[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
darin
darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:36:19 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 73d5781165f6e2ae07142819e281ca17c04aee96
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Sep 5 06:24:43 2002 +0000
One more pass of refinement on that last change.
* History.subproj/WebBackForwardList.m: (-[WebBackForwardList addEntry:]):
Replace the last entry instead of just ignoring if this one matches.
* History.subproj/WebHistoryList.h: Add replaceEntryAtIndex. Remove addURL: and removeURL:.
* History.subproj/WebHistoryList.m:
(-[WebHistoryList addEntry:]): Call removeEntry: rather than using an entire pasted copy here.
(-[WebHistoryList removeEntry:]): Use a hash of the URL and the URL rather than relying on the
fact that WebHistoryItem hashes and does isEqual based on the URL only.
(-[WebHistoryList replaceEntryAtIndex:withEntry:]): Added. Used by the code above.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1966 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 10aab16..df531a1 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,5 +1,20 @@
2002-09-04 Darin Adler <darin at apple.com>
+ One more pass of refinement on that last change.
+
+ * History.subproj/WebBackForwardList.m: (-[WebBackForwardList addEntry:]):
+ Replace the last entry instead of just ignoring if this one matches.
+
+ * History.subproj/WebHistoryList.h: Add replaceEntryAtIndex. Remove addURL: and removeURL:.
+
+ * History.subproj/WebHistoryList.m:
+ (-[WebHistoryList addEntry:]): Call removeEntry: rather than using an entire pasted copy here.
+ (-[WebHistoryList removeEntry:]): Use a hash of the URL and the URL rather than relying on the
+ fact that WebHistoryItem hashes and does isEqual based on the URL only.
+ (-[WebHistoryList replaceEntryAtIndex:withEntry:]): Added. Used by the code above.
+
+2002-09-04 Darin Adler <darin at apple.com>
+
Fix bug where doing a reload adds an entry to the back/forward list.
* History.subproj/WebBackForwardList.m: (-[WebBackForwardList addEntry:]):
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 10aab16..df531a1 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,5 +1,20 @@
2002-09-04 Darin Adler <darin at apple.com>
+ One more pass of refinement on that last change.
+
+ * History.subproj/WebBackForwardList.m: (-[WebBackForwardList addEntry:]):
+ Replace the last entry instead of just ignoring if this one matches.
+
+ * History.subproj/WebHistoryList.h: Add replaceEntryAtIndex. Remove addURL: and removeURL:.
+
+ * History.subproj/WebHistoryList.m:
+ (-[WebHistoryList addEntry:]): Call removeEntry: rather than using an entire pasted copy here.
+ (-[WebHistoryList removeEntry:]): Use a hash of the URL and the URL rather than relying on the
+ fact that WebHistoryItem hashes and does isEqual based on the URL only.
+ (-[WebHistoryList replaceEntryAtIndex:withEntry:]): Added. Used by the code above.
+
+2002-09-04 Darin Adler <darin at apple.com>
+
Fix bug where doing a reload adds an entry to the back/forward list.
* History.subproj/WebBackForwardList.m: (-[WebBackForwardList addEntry:]):
diff --git a/WebKit/History.subproj/WebBackForwardList.m b/WebKit/History.subproj/WebBackForwardList.m
index d5414d1..189f311 100644
--- a/WebKit/History.subproj/WebBackForwardList.m
+++ b/WebKit/History.subproj/WebBackForwardList.m
@@ -35,13 +35,14 @@
-(void)addEntry:(WebHistoryItem *)entry
{
- // If the last entry matches this new entry, don't add a new one, since we are
- // presumably just doing a reload.
+ // If the last entry matches this new entry, then replace it rather than adding
+ // a new one, since we are doing a reload.
if ([uriList count] > index) {
WebHistoryItem *lastEntry = [uriList entryAtIndex:index];
if ([[lastEntry URL] isEqual:[entry URL]]
&& ([lastEntry target] == [entry target] || [[lastEntry target] isEqual:[entry target]])
&& ([lastEntry parent] == [entry parent] || [[lastEntry parent] isEqual:[entry parent]])) {
+ [uriList replaceEntryAtIndex:index withEntry:entry];
return;
}
}
diff --git a/WebKit/History.subproj/WebHistoryList.h b/WebKit/History.subproj/WebHistoryList.h
index 0ac5ebb..95c6f22 100644
--- a/WebKit/History.subproj/WebHistoryList.h
+++ b/WebKit/History.subproj/WebHistoryList.h
@@ -27,14 +27,15 @@ typedef struct WebHistoryListNode WebHistoryListNode;
-(int)maximumSize;
-(void)setMaximumSize:(int)size;
--(WebHistoryItem *)addURL:(NSURL *)URL withTitle:(NSString *)title;
+-(WebHistoryItem *)entryAtIndex:(int)index;
+-(WebHistoryItem *)entryForURL:(NSURL *)URL;
+
-(void)addEntry:(WebHistoryItem *)entry;
--(WebHistoryItem *)removeURL:(NSURL *)URL;
--(BOOL)removeEntry:(WebHistoryItem *)entry;
--(WebHistoryItem *)entryForURL:(NSURL *)URL;
--(WebHistoryItem *)entryAtIndex:(int)index;
+-(void)removeEntry:(WebHistoryItem *)entry;
-(WebHistoryItem *)removeEntryAtIndex:(int)index;
-(void)removeEntriesToIndex:(int)index;
+-(void)replaceEntryAtIndex:(int)index withEntry:(WebHistoryItem *)entry;
+
@end
diff --git a/WebKit/History.subproj/WebHistoryList.m b/WebKit/History.subproj/WebHistoryList.m
index 83d4a28..a0a41d0 100644
--- a/WebKit/History.subproj/WebHistoryList.m
+++ b/WebKit/History.subproj/WebHistoryList.m
@@ -32,10 +32,10 @@ static WebHistoryListNode *newURIListNode(WebHistoryItem *entry)
static void freeNode(WebHistoryListNode *node)
{
- // it is important to autorelase here rather than using
+ // It is important to autorelase here rather than using
// a straight release since we often return an entry
// as a result of an operation that causes a node
- // to be freed
+ // to be freed.
[node->entry autorelease];
free(node);
}
@@ -100,55 +100,16 @@ static void freeNode(WebHistoryListNode *node)
_maximumSize = size;
}
-
-
--(WebHistoryItem *)addURL:(NSURL *)URL withTitle:(NSString *)title;
-{
- WebHistoryItem *result;
-
- result = [[WebHistoryItem alloc] initWithURL:URL title:title];
- [self addEntry:result];
-
- return result;
-}
-
-(void)addEntry:(WebHistoryItem *)entry
{
- WebHistoryListNode *node;
- unsigned hash;
-
if (!_allowsDuplicates) {
// search the list first and remove any entry with the same URL
// having the same title does not count
- // use the hash codes of the URLs to speed up the linear search
- hash = [entry hash];
- for (node = _head; node != nil; node = node->next) {
- if (hash == node->hash && [entry isEqual:node->entry]) {
- _count--;
- if (node == _head) {
- _head = node->next;
- if (_head) {
- _head->prev = nil;
- }
- }
- else if (node == _tail) {
- _tail = node->prev;
- if (_tail) {
- _tail->next = nil;
- }
- }
- else {
- node->prev->next = node->next;
- node->next->prev = node->prev;
- }
- freeNode(node);
- break;
- }
- }
+ [self removeEntry:entry];
}
// make new entry and put it at the head of the list
- node = newURIListNode(entry);
+ WebHistoryListNode *node = newURIListNode(entry);
node->next = _head;
_head = node;
_count++;
@@ -166,15 +127,13 @@ static void freeNode(WebHistoryListNode *node)
}
}
--(WebHistoryItem *)removeURL:(NSURL *)URL
+-(void)removeEntry:(WebHistoryItem *)entry
{
- WebHistoryItem *removedEntry;
- WebHistoryListNode *node;
- unsigned hash;
-
- removedEntry = nil;
- hash = [URL hash];
+ WebHistoryItem *removedEntry = nil;
+ NSURL *URL = [entry URL];
+ unsigned hash = [URL hash];
+ WebHistoryListNode *node;
for (node = _head; node != nil; node = node->next) {
if (hash == node->hash && [URL isEqual:[node->entry URL]]) {
_count--;
@@ -199,56 +158,14 @@ static void freeNode(WebHistoryListNode *node)
break;
}
}
-
- return removedEntry;
-}
-
--(BOOL)removeEntry:(WebHistoryItem *)entry
-{
- BOOL removed;
- WebHistoryListNode *node;
- unsigned hash;
-
- removed = NO;
- hash = [entry hash];
-
- for (node = _head; node != nil; node = node->next) {
- if (hash == node->hash && [entry isEqual:node->entry]) {
- _count--;
- removed = YES;
- if (node == _head) {
- _head = node->next;
- if (_head) {
- _head->prev = nil;
- }
- }
- else if (node == _tail) {
- _tail = node->prev;
- if (_tail) {
- _tail->next = nil;
- }
- }
- else {
- node->prev->next = node->next;
- node->next->prev = node->prev;
- }
- freeNode(node);
- break;
- }
- }
-
- return removed;
}
-(WebHistoryItem *)entryForURL:(NSURL *)URL
{
- WebHistoryItem *foundEntry;
- WebHistoryListNode *node;
- unsigned hash;
-
- foundEntry = nil;
- hash = [URL hash];
+ WebHistoryItem *foundEntry = nil;
+ unsigned hash = [URL hash];
+ WebHistoryListNode *node;
for (node = _head; node != nil; node = node->next) {
if (hash == node->hash && [URL isEqual:[node->entry URL]]) {
foundEntry = node->entry;
@@ -261,13 +178,10 @@ static void freeNode(WebHistoryListNode *node)
-(WebHistoryItem *)entryAtIndex:(int)index
{
- int i;
- WebHistoryListNode *node;
-
WEBKIT_ASSERT(index >= 0 && index < _count);
- node = _head;
-
+ WebHistoryListNode *node = _head;
+ int i;
for (i = 0; i < index; i++) {
node = node->next;
}
@@ -275,22 +189,32 @@ static void freeNode(WebHistoryListNode *node)
return node->entry;
}
--(WebHistoryItem *)removeEntryAtIndex:(int)index
+-(void)replaceEntryAtIndex:(int)index withEntry:(WebHistoryItem *)entry
{
- WebHistoryItem *removedEntry;
- WebHistoryListNode *node;
+ WEBKIT_ASSERT(index >= 0 && index < _count);
+
+ WebHistoryListNode *node = _head;
int i;
+ for (i = 0; i < index; i++) {
+ node = node->next;
+ }
- WEBKIT_ASSERT(index > 0 && index < _count);
+ [node->entry autorelease];
+ node->entry = [entry retain];
+}
- node = _head;
+-(WebHistoryItem *)removeEntryAtIndex:(int)index
+{
+ WEBKIT_ASSERT(index > 0 && index < _count);
+ WebHistoryListNode *node = _head;
+ int i;
for (i = 0; i < index; i++) {
node = node->next;
}
_count--;
- removedEntry = node->entry;
+ WebHistoryItem *removedEntry = node->entry;
if (node == _head) {
_head = node->next;
if (_head) {
@@ -314,19 +238,15 @@ static void freeNode(WebHistoryListNode *node)
-(void)removeEntriesToIndex:(int)index
{
- WebHistoryListNode *node;
- WebHistoryListNode *delNode;
- int i;
-
WEBKIT_ASSERT(index > 0 && index < _count);
- node = _head;
-
+ WebHistoryListNode *node = _head;
+ int i;
for (i = 0; i < index; i++) {
- delNode = node;
- node = node->next;
- freeNode(delNode);
+ WebHistoryListNode *next = node->next;
+ freeNode(node);
_count--;
+ node = next;
}
_head = node;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list