Commit d4ca2268 authored by darin's avatar darin

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.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2861 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 66f55f6a
2002-11-25 Darin Adler <darin@apple.com>
* 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.
2002-11-24 Darin Adler <darin@apple.com>
- changed ScopeChain to not ref each item in the chain, and use
......
2002-11-25 Darin Adler <darin@apple.com>
* 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.
2002-11-24 Darin Adler <darin@apple.com>
- changed ScopeChain to not ref each item in the chain, and use
......
2002-11-25 Darin Adler <darin@apple.com>
* 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.
2002-11-24 Darin Adler <darin@apple.com>
- changed ScopeChain to not ref each item in the chain, and use
......
// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 2002 Apple Computer, Inc.
......@@ -77,40 +76,44 @@ PropertyMap::PropertyMap() : _table(0)
PropertyMap::~PropertyMap()
{
if (!_table) {
#if USE_SINGLE_ENTRY
UString::Rep *key = _singleEntry.key;
if (key)
key->deref();
UString::Rep *key = _singleEntry.key;
if (key)
key->deref();
#endif
if (_table) {
for (int i = 0; i < _table->size; i++) {
return;
}
for (int i = 0; i < _table->size; i++) {
UString::Rep *key = _table->entries[i].key;
if (key)
key->deref();
}
free(_table);
}
free(_table);
}
void PropertyMap::clear()
{
if (!_table) {
#if USE_SINGLE_ENTRY
UString::Rep *key = _singleEntry.key;
if (key) {
key->deref();
_singleEntry.key = 0;
}
UString::Rep *key = _singleEntry.key;
if (key) {
key->deref();
_singleEntry.key = 0;
}
#endif
if (_table) {
for (int i = 0; i < _table->size; i++) {
return;
}
for (int i = 0; i < _table->size; i++) {
UString::Rep *key = _table->entries[i].key;
if (key) {
key->deref();
_table->entries[i].key = 0;
key->deref();
_table->entries[i].key = 0;
}
}
_table->keyCount = 0;
}
_table->keyCount = 0;
}
inline int PropertyMap::hash(const UString::Rep *s) const
......@@ -123,7 +126,7 @@ ValueImp *PropertyMap::get(const Identifier &name, int &attributes) const
UString::Rep *rep = name._ustring.rep;
if (!_table) {
#if USE_SINGLE_ENTRY
#if USE_SINGLE_ENTRY
UString::Rep *key = _singleEntry.key;
if (rep == key) {
attributes = _singleEntry.attributes;
......@@ -330,16 +333,15 @@ void PropertyMap::remove(const Identifier &name)
void PropertyMap::mark() const
{
if (!_table) {
#if USE_SINGLE_ENTRY
if (_singleEntry.key) {
ValueImp *v = _singleEntry.value;
if (!v->marked())
v->mark();
}
if (_singleEntry.key) {
ValueImp *v = _singleEntry.value;
if (!v->marked())
v->mark();
}
#endif
if (!_table) {
return;
return;
}
for (int i = 0; i != _table->size; ++i) {
......@@ -353,13 +355,13 @@ void PropertyMap::mark() const
void PropertyMap::addEnumerablesToReferenceList(ReferenceList &list, const Object &base) const
{
if (!_table) {
#if USE_SINGLE_ENTRY
UString::Rep *key = _singleEntry.key;
if (key && !(_singleEntry.attributes & DontEnum))
list.append(Reference(base, Identifier(key)));
UString::Rep *key = _singleEntry.key;
if (key && !(_singleEntry.attributes & DontEnum))
list.append(Reference(base, Identifier(key)));
#endif
if (!_table) {
return;
return;
}
for (int i = 0; i != _table->size; ++i) {
......@@ -371,31 +373,29 @@ void PropertyMap::addEnumerablesToReferenceList(ReferenceList &list, const Objec
void PropertyMap::addSparseArrayPropertiesToReferenceList(ReferenceList &list, const Object &base) const
{
if (!_table) {
#if USE_SINGLE_ENTRY
UString::Rep *key = _singleEntry.key;
if (key) {
UString k(key);
bool fitsInUInt32;
k.toUInt32(&fitsInUInt32);
if (fitsInUInt32) {
list.append(Reference(base, Identifier(key)));
}
}
UString::Rep *key = _singleEntry.key;
if (key) {
UString k(key);
bool fitsInUInt32;
k.toUInt32(&fitsInUInt32);
if (fitsInUInt32)
list.append(Reference(base, Identifier(key)));
}
#endif
if (!_table) {
return;
return;
}
for (int i = 0; i != _table->size; ++i) {
UString::Rep *key = _table->entries[i].key;
if (key) {
UString k(key);
bool fitsInUInt32;
k.toUInt32(&fitsInUInt32);
if (fitsInUInt32) {
list.append(Reference(base, Identifier(key)));
}
}
UString::Rep *key = _table->entries[i].key;
if (key) {
UString k(key);
bool fitsInUInt32;
k.toUInt32(&fitsInUInt32);
if (fitsInUInt32)
list.append(Reference(base, Identifier(key)));
}
}
}
......@@ -403,14 +403,15 @@ void PropertyMap::save(SavedProperties &p) const
{
int count = 0;
if (!_table) {
#if USE_SINGLE_ENTRY
if (_singleEntry.key)
++count;
if (_singleEntry.key)
++count;
#endif
if (_table) {
for (int i = 0; i != _table->size; ++i)
if (_table->entries[i].key && _table->entries[i].attributes == 0)
++count;
} else {
for (int i = 0; i != _table->size; ++i)
if (_table->entries[i].key && _table->entries[i].attributes == 0)
++count;
}
delete [] p._properties;
......@@ -422,20 +423,21 @@ void PropertyMap::save(SavedProperties &p) const
SavedProperty *prop = p._properties;
if (!_table) {
#if USE_SINGLE_ENTRY
if (_singleEntry.key) {
prop->key = Identifier(_singleEntry.key);
prop->value = Value(_singleEntry.value);
++prop;
}
if (_singleEntry.key) {
prop->key = Identifier(_singleEntry.key);
prop->value = Value(_singleEntry.value);
++prop;
}
#endif
if (_table) {
for (int i = 0; i != _table->size; ++i) {
if (_table->entries[i].key && _table->entries[i].attributes == 0) {
prop->key = Identifier(_table->entries[i].key);
prop->value = Value(_table->entries[i].value);
} else {
for (int i = 0; i != _table->size; ++i) {
if (_table->entries[i].key && _table->entries[i].attributes == 0) {
prop->key = Identifier(_table->entries[i].key);
prop->value = Value(_table->entries[i].value);
}
}
}
}
}
......@@ -449,33 +451,27 @@ void PropertyMap::restore(const SavedProperties &p)
void PropertyMap::checkConsistency()
{
if (!_table)
return;
int count = 0;
if (_table) {
for (int j = 0; j != _table->size; ++j) {
for (int j = 0; j != _table->size; ++j) {
UString::Rep *rep = _table->entries[j].key;
if (!rep)
continue;
continue;
int i = hash(rep);
while (UString::Rep *key = _table->entries[i].key) {
if (rep == key)
break;
i = (i + 1) & _tableSizeMask;
if (rep == key)
break;
i = (i + 1) & _tableSizeMask;
}
assert(i == j);
count++;
}
}
#if USE_SINGLE_ENTRY
if (_singleEntry.key)
count++;
#endif
if (_table) {
assert(count == _table->keyCount);
assert(_table->size >= 16);
assert(_table->sizeMask);
assert(_table->size == _table->sizeMask + 1);
}
assert(count == _table->keyCount);
assert(_table->size >= 16);
assert(_table->sizeMask);
assert(_table->size == _table->sizeMask + 1);
}
#endif // DO_CONSISTENCY_CHECK
......
......@@ -195,10 +195,10 @@ - (unsigned)_numberOfDescendants
- (void)removeChild:(WebBookmark *)bookmark
{
ASSERT_ARG(bookmark, [bookmark parent] == self);
ASSERT_ARG(bookmark, [_list containsObject:bookmark]);
ASSERT_ARG(bookmark, [_list indexOfObjectIdenticalTo:bookmark] != NSNotFound);
[bookmark retain];
[_list removeObject:bookmark];
[_list removeObjectIdenticalTo:bookmark];
[bookmark _setParent:nil];
[bookmark release];
......@@ -209,7 +209,7 @@ - (void)removeChild:(WebBookmark *)bookmark
- (void)insertChild:(WebBookmark *)bookmark atIndex:(unsigned)index
{
ASSERT_ARG(bookmark, [bookmark parent] == nil);
ASSERT_ARG(bookmark, ![_list containsObject:bookmark]);
ASSERT_ARG(bookmark, [_list indexOfObjectIdenticalTo:bookmark] == NSNotFound);
[_list insertObject:bookmark atIndex:index];
[bookmark _setParent:self];
......
2002-11-25 Darin Adler <darin@apple.com>
- 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.
2002-11-25 Chris Blumenberg <cblu@apple.com>
Fixed: 3084350 - No URL flavors provided for images
......
2002-11-25 Darin Adler <darin@apple.com>
- 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.
2002-11-25 Chris Blumenberg <cblu@apple.com>
Fixed: 3084350 - No URL flavors provided for images
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment