Changeset 2861 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Nov 25, 2002, 1:34:05 PM (23 years ago)
Author:
darin
Message:

JavaScriptCore:

  • kjs/property_map.cpp: Rearrange code a little bit and tweak indentation. This might provide a tiny speedup because we don't look at the single entry any more in cases where the _table pointer is non-0.

WebKit:

  • fixed a problem I discovered in testing where multiple identical bookmarks confuse us
  • Bookmarks.subproj/WebBookmarkList.m: (-[WebBookmarkList removeChild:]): Use indexOfObjectIdenticalTo: and removeObjectIdenticalTo: instead of containsObject: and removeObject:. (-[WebBookmarkList insertChild:atIndex:]): Use indexOfObjectIdenticalTo: instead of containsObject: in the assertion.

WebBrowser:

  • fixed 3042781 -- slidey animation sometimes draws partial item behind overflow indicator
  • fixed 3090845 -- would be nice to be able to drop bookmarks into folders using the bookmark toolbar
  • fixed 3107422 -- bookmark in toolbar gets stuck highlighted if window is moved by the stacking code
  • fixed problem where you would get an overflow indicator even if there was room for the last bookmark
  • fixed problem where the cursor could change to an I-beam during a constrained drag
  • FavoriteButton.h: Add canAcceptDroppedBookmark, setHighlighted, and acceptDroppedBookmark methods for use when doing a constrained drag that drop items into folders. Also add a category on NSView to be used to pause animation when over a button that will accept a drop.
  • FavoriteButton.m: (-[FavoriteButton registerForDraggedTypes]): Accept DraggedFavoriteButtonPboardType. (-[FavoriteButton initTrackingRect]): Add an observer so we update the tracking rect when the window moves too. This fixes bug 3107422. (-[FavoriteButton bookmarksFromPasteboard:]): Added. Helper method that accepts drag from DraggedFavoriteButtonPboardType as well as the other bookmark pasteboard types, but only within the same superview. (-[FavoriteButton determineDragOperation:]): Call [self bookmarksFromPasteboard:] instead of [WebBookmark bookmarksFromPasteboard]. (-[FavoriteButton draggingEntered:]): Pause animation when we enter a button that can accept a dropped bookmark. This makes sure that the button doesn't slide out from under the mouse. (-[FavoriteButton draggingUpdated:]): Don't do any highlighting here because it's not necessary. (-[FavoriteButton draggingExited:]): Resume the animation in case we paused it. (-[FavoriteButton performDragOperation:]): Call [self bookmarksFromPasteboard:] instead of [WebBookmark bookmarksFromPasteboard]. Also resume the animation in case we paused it. (-[FavoriteButton canAcceptDroppedBookmark]): Added. Returns YES if the bookmark's type is WebBookmarkTypeList. (-[FavoriteButton setHighlighted:]): Added. Calls setHighlighted: on the button's cell. (-[FavoriteButton acceptDroppedBookmark:]): Added. Does the same work that performDragOperation does for the case of moving a button within the same bar. (-[FavoriteButton _hitTest:dragTypes:]): Don't accept drags at the edges of the button. This makes space between buttons so there's room to put new buttons between two old ones, even if the old ones are both for folders. (-[NSView pauseAnimation]): Added. Passes the call up the superview chain. (-[NSView resumeAnimation]): Added. Passes the call up the superview chain.
  • FavoritesBar.m: (-[FavoritesBar maxButtonXWithoutClipIndicator]): Added. Leaves a margin, currently 3 pixels. (-[FavoritesBar maxButtonXWithClipIndicator]): Added. Leaves a margin, currently 3 pixels. (-[FavoritesBar maxButtonX]): Modified to call either maxButtonXWithoutClipIndicator or maxButtonXWithClipIndicator depending on whether the clip indicator is showing. (-[FavoritesBar slideButtonsIntoPlace]): Slide buttons off the right side of the bar if they are going to be clipped out. Allow the last button to go all the way to the right, using the space that would otherwise be used by the clip indicator. Make the clip indicator disappear if buttons are going to slide past it to the left or the right. (-[FavoritesBar _layOutButtons]): Include the smarts about leaving space for the item to be dropped and about leaving out the currently dragged item that was formerly only in slideButtonsIntoPlace. Also include the smarts about positioning mentioned above, and do positioning here, rather than in _refreshButtons. To allow calling this during constrained dragging, add the dragged item after adding all the other items. (-[FavoritesBar finishedSlidingAnimation:]): Added. Calls _layOutButtons. This is used to make the clip indicator reappear in case slideButtonsIntoPlace made it disappear. (-[FavoritesBar addButtonForBookmark:]): Removed left edge parameter. This no method longer tries to position bookmarks at all. (-[FavoritesBar _refreshButtons]): Get rid of code that attempts to position the buttons. We now do that in _layOutButtons. (-[FavoritesBar initWithView:]): Initialize _dragSourceIndexIfMoving to NSNotFound. Make us the animation's delegate so we get a finishedSlidingAnimation:. (-[FavoritesBar performDragOperation:]): Check for drags within the favorites bar by checking _dragSourceIndexIfMoving rather than looking for DraggedFavoriteButtonPboardType. Also reset _dropIndex since _layOutButtons now looks at it. (-[FavoritesBar draggingEnded:]): Reset _dragSourceIndexIfMoving since _layOutButtons now looks at it. (-[FavoritesBar reorderFavoriteButton:fromMouseDownEvent:]): Disable cursor rectangles and set the cursor to the arrow cursor during the reorder process. Add hit testing so that the constrained dragging can drop items in FavoriteButtons that are folders. Pause animation when over such a FavoriteButton, and resume it when not over it. (-[FavoritesBar pauseAnimation]): Added. (-[FavoritesBar resumeAnimation]): Added.
  • FavoritesBarView.h: Add pauseAnimation and resumeAnimation methods to the delegate.
  • FavoritesBarView.m: (-[FavoritesBarView pauseAnimation]): Pass call on to the delegate. (-[FavoritesBarView resumeAnimation]): Ditto.
  • SlidingAnimation.h: Add delegate, setDelegate method, pause and resume methods, and finishedSlidingAnimation: method for the delegate.
  • SlidingAnimation.m: (-[SlidingAnimation updateTimer]): Take the paused state into account, and also call the finishedSlidingAnimation: method when the animation completes. (-[SlidingAnimation showNextFrame]): Simplify by using a call to updateTimer to do most of the work. (-[SlidingAnimation setDelegate:]): Added. Just sets the delegate field. (-[SlidingAnimation pause]): Added. Just sets the paused state and calls updateTimer. (-[SlidingAnimation resume]): Added. Just sets the paused state and calls updateTimer.
  • fixed a problem I discovered in testing where multiple identical bookmarks confuse us
  • BookmarksViewController.m: ([BookmarksViewController anyAncestorOfBookmark:inArray:]): Use indexOfObjectIdenticalTo: instead of containsObject:, because we want to use identity on bookmarks, not equality comparison. ([BookmarksViewController bookmarkOrAnyAncestor:inArray:]): Ditto. ([BookmarksViewController newContentItemWithTitle:URLString:type:positionIgnoresSelection:]): Ditto. ([BookmarksViewController sourceRowForBookmark:]): Ditto. ([BookmarksViewController outlineView:validateDrop:proposedItem:proposedChildIndex:]): Ditto. ([BookmarksViewController paste:]): Ditto. ([UndoRemoveInfo initWithBookmark:]): Ditto.
Location:
trunk/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r2851 r2861  
     12002-11-25  Darin Adler  <[email protected]>
     2
     3        * kjs/property_map.cpp: Rearrange code a little bit and tweak indentation.
     4        This might provide a tiny speedup because we don't look at the single entry
     5        any more in cases where the _table pointer is non-0.
     6
    172002-11-24  Darin Adler  <[email protected]>
    28
  • trunk/JavaScriptCore/ChangeLog-2002-12-03

    r2851 r2861  
     12002-11-25  Darin Adler  <[email protected]>
     2
     3        * kjs/property_map.cpp: Rearrange code a little bit and tweak indentation.
     4        This might provide a tiny speedup because we don't look at the single entry
     5        any more in cases where the _table pointer is non-0.
     6
    172002-11-24  Darin Adler  <[email protected]>
    28
  • trunk/JavaScriptCore/ChangeLog-2003-10-25

    r2851 r2861  
     12002-11-25  Darin Adler  <[email protected]>
     2
     3        * kjs/property_map.cpp: Rearrange code a little bit and tweak indentation.
     4        This might provide a tiny speedup because we don't look at the single entry
     5        any more in cases where the _table pointer is non-0.
     6
    172002-11-24  Darin Adler  <[email protected]>
    28
  • trunk/JavaScriptCore/kjs/property_map.cpp

    r2846 r2861  
    1 // -*- c-basic-offset: 2 -*-
    21/*
    32 *  This file is part of the KDE libraries
     
    7877PropertyMap::~PropertyMap()
    7978{
    80 #if USE_SINGLE_ENTRY
    81     UString::Rep *key = _singleEntry.key;
    82     if (key)
    83         key->deref();
    84 #endif
    85     if (_table) {
    86       for (int i = 0; i < _table->size; i++) {
     79    if (!_table) {
     80#if USE_SINGLE_ENTRY
     81        UString::Rep *key = _singleEntry.key;
     82        if (key)
     83            key->deref();
     84#endif
     85        return;
     86    }
     87   
     88    for (int i = 0; i < _table->size; i++) {
    8789        UString::Rep *key = _table->entries[i].key;
    8890        if (key)
    8991          key->deref();
    90       }
    91       free(_table);
    92     }
     92    }
     93    free(_table);
    9394}
    9495
    9596void PropertyMap::clear()
    9697{
    97 #if USE_SINGLE_ENTRY
    98     UString::Rep *key = _singleEntry.key;
    99     if (key) {
    100         key->deref();
    101         _singleEntry.key = 0;
    102     }
    103 #endif
    104     if (_table) {
    105       for (int i = 0; i < _table->size; i++) {
     98    if (!_table) {
     99#if USE_SINGLE_ENTRY
     100        UString::Rep *key = _singleEntry.key;
     101        if (key) {
     102            key->deref();
     103            _singleEntry.key = 0;
     104        }
     105#endif
     106        return;
     107    }
     108
     109    for (int i = 0; i < _table->size; i++) {
    106110        UString::Rep *key = _table->entries[i].key;
    107111        if (key) {
    108           key->deref();
    109           _table->entries[i].key = 0;
    110         }
    111       }
    112       _table->keyCount = 0;
    113     }
     112            key->deref();
     113            _table->entries[i].key = 0;
     114        }
     115    }
     116    _table->keyCount = 0;
    114117}
    115118
     
    124127   
    125128    if (!_table) {
    126  #if USE_SINGLE_ENTRY
     129#if USE_SINGLE_ENTRY
    127130        UString::Rep *key = _singleEntry.key;
    128131        if (rep == key) {
     
    331334void PropertyMap::mark() const
    332335{
    333 #if USE_SINGLE_ENTRY
    334     if (_singleEntry.key) {
    335         ValueImp *v = _singleEntry.value;
    336         if (!v->marked())
    337             v->mark();
    338     }
    339 #endif
    340 
    341     if (!_table) {
    342       return;
     336    if (!_table) {
     337#if USE_SINGLE_ENTRY
     338        if (_singleEntry.key) {
     339            ValueImp *v = _singleEntry.value;
     340            if (!v->marked())
     341                v->mark();
     342        }
     343#endif
     344        return;
    343345    }
    344346
     
    354356void PropertyMap::addEnumerablesToReferenceList(ReferenceList &list, const Object &base) const
    355357{
    356 #if USE_SINGLE_ENTRY
    357     UString::Rep *key = _singleEntry.key;
    358     if (key && !(_singleEntry.attributes & DontEnum))
    359         list.append(Reference(base, Identifier(key)));
    360 #endif
    361     if (!_table) {
    362       return;
     358    if (!_table) {
     359#if USE_SINGLE_ENTRY
     360        UString::Rep *key = _singleEntry.key;
     361        if (key && !(_singleEntry.attributes & DontEnum))
     362            list.append(Reference(base, Identifier(key)));
     363#endif
     364        return;
    363365    }
    364366
     
    372374void PropertyMap::addSparseArrayPropertiesToReferenceList(ReferenceList &list, const Object &base) const
    373375{
    374 #if USE_SINGLE_ENTRY
    375     UString::Rep *key = _singleEntry.key;
    376     if (key) {
    377       UString k(key);
    378       bool fitsInUInt32;
    379       k.toUInt32(&fitsInUInt32);
    380       if (fitsInUInt32) {
    381         list.append(Reference(base, Identifier(key)));
    382       }
    383     }
    384 #endif
    385     if (!_table) {
    386       return;
     376    if (!_table) {
     377#if USE_SINGLE_ENTRY
     378        UString::Rep *key = _singleEntry.key;
     379        if (key) {
     380            UString k(key);
     381            bool fitsInUInt32;
     382            k.toUInt32(&fitsInUInt32);
     383            if (fitsInUInt32)
     384                list.append(Reference(base, Identifier(key)));
     385        }
     386#endif
     387        return;
    387388    }
    388389
    389390    for (int i = 0; i != _table->size; ++i) {
    390       UString::Rep *key = _table->entries[i].key;
    391       if (key) {
    392         UString k(key);
    393         bool fitsInUInt32;
    394         k.toUInt32(&fitsInUInt32);
    395         if (fitsInUInt32) {
    396           list.append(Reference(base, Identifier(key)));
    397         }
    398       }
     391        UString::Rep *key = _table->entries[i].key;
     392        if (key) {
     393            UString k(key);
     394            bool fitsInUInt32;
     395            k.toUInt32(&fitsInUInt32);
     396            if (fitsInUInt32)
     397                list.append(Reference(base, Identifier(key)));
     398        }
    399399    }
    400400}
     
    404404    int count = 0;
    405405
    406 #if USE_SINGLE_ENTRY
    407     if (_singleEntry.key)
    408         ++count;
    409 #endif
    410     if (_table) {
    411       for (int i = 0; i != _table->size; ++i)
    412         if (_table->entries[i].key && _table->entries[i].attributes == 0)
    413           ++count;
     406    if (!_table) {
     407#if USE_SINGLE_ENTRY
     408        if (_singleEntry.key)
     409            ++count;
     410#endif
     411    } else {
     412        for (int i = 0; i != _table->size; ++i)
     413            if (_table->entries[i].key && _table->entries[i].attributes == 0)
     414                ++count;
    414415    }
    415416
     
    423424    SavedProperty *prop = p._properties;
    424425   
    425 #if USE_SINGLE_ENTRY
    426     if (_singleEntry.key) {
    427         prop->key = Identifier(_singleEntry.key);
    428         prop->value = Value(_singleEntry.value);
    429         ++prop;
    430     }
    431 #endif
    432     if (_table) {
    433       for (int i = 0; i != _table->size; ++i) {
    434         if (_table->entries[i].key && _table->entries[i].attributes == 0) {
    435           prop->key = Identifier(_table->entries[i].key);
    436           prop->value = Value(_table->entries[i].value);
    437         }
    438       }
     426    if (!_table) {
     427#if USE_SINGLE_ENTRY
     428        if (_singleEntry.key) {
     429            prop->key = Identifier(_singleEntry.key);
     430            prop->value = Value(_singleEntry.value);
     431            ++prop;
     432        }
     433#endif
     434    } else {
     435        for (int i = 0; i != _table->size; ++i) {
     436            if (_table->entries[i].key && _table->entries[i].attributes == 0) {
     437                prop->key = Identifier(_table->entries[i].key);
     438                prop->value = Value(_table->entries[i].value);
     439            }
     440        }
    439441    }
    440442}
     
    450452void PropertyMap::checkConsistency()
    451453{
     454    if (!_table)
     455        return;
     456
    452457    int count = 0;
    453     if (_table) {
    454       for (int j = 0; j != _table->size; ++j) {
     458    for (int j = 0; j != _table->size; ++j) {
    455459        UString::Rep *rep = _table->entries[j].key;
    456460        if (!rep)
    457           continue;
     461            continue;
    458462        int i = hash(rep);
    459463        while (UString::Rep *key = _table->entries[i].key) {
    460           if (rep == key)
    461             break;
    462           i = (i + 1) & _tableSizeMask;
     464            if (rep == key)
     465                break;
     466            i = (i + 1) & _tableSizeMask;
    463467        }
    464468        assert(i == j);
    465469        count++;
    466       }
    467     }
    468 
    469 #if USE_SINGLE_ENTRY
    470     if (_singleEntry.key)
    471       count++;
    472 #endif
    473     if (_table) {
    474       assert(count == _table->keyCount);
    475       assert(_table->size >= 16);
    476       assert(_table->sizeMask);
    477       assert(_table->size == _table->sizeMask + 1);
    478     }
     470    }
     471    assert(count == _table->keyCount);
     472    assert(_table->size >= 16);
     473    assert(_table->sizeMask);
     474    assert(_table->size == _table->sizeMask + 1);
    479475}
    480476
Note: See TracChangeset for help on using the changeset viewer.