[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

trey trey at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:54:30 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 3629d5a8919587394a7d4083e7b38ea886a2fcf4
Author: trey <trey at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Oct 25 22:51:57 2002 +0000

    WebKit:
    
    	2919039 - Implement limit on back/forward history list
    	2998200 - access to most-recent in submenu of back & forward buttons
    	3022566 - need WebKit API for accessing and visiting back/forward list items
    	3084051 - forward button incorrectly enabled after going forward all the way
    
    	Remaining issues at this point are getting the title of the pages
    	into the menu items (instead of the URL), and saving document
    	state properly when you jump around in the list.  Solutions are
    	known and coming soon.
    
            * History.subproj/WebBackForwardList.h:
    	Added doc comments to API.  Made ivars private.  Replaced index-
    	based API with item-based API.  Added a sizelimit to the overall
    	list.  Tweaked API to get back and forward lists.
            * History.subproj/WebBackForwardList.m:
    	Straightforward impl of the above, with the note that I dumped
    	WebHistoryList from the API and impl in favor of an NSArray,
    	which is efficient for this sort of use (queue, stack).
            (-[WebBackForwardList init]):
            (-[WebBackForwardList dealloc]):
            (-[WebBackForwardList goBack]):
            (-[WebBackForwardList goForward]):
            (-[WebBackForwardList goToEntry:]):
            (-[WebBackForwardList backEntry]):
            (-[WebBackForwardList forwardEntry]):
            (-[WebBackForwardList maximumSize]):
            (-[WebBackForwardList setMaximumSize:]):
            (-[WebBackForwardList description]):
            * History.subproj/WebHistoryList.h: Removed.
    	Nuked from API, per above.
            * History.subproj/WebHistoryList.m: Removed.
            * Misc.subproj/WebKit.h:
    	WebHistoryList gone from API.
            * WebCoreSupport.subproj/WebBridge.m:
            (-[WebBridge loadURL:]):
    	Use if/else instead of buried "return;", so next person doesn;t
    	make the same mis-read I did.
            (-[WebBridge saveDocumentState:]):
    	Site of future work.
            * WebKit.pbproj/project.pbxproj:
    	Nuked WebHistoryList.
            * WebView.subproj/WebController.h:
            * WebView.subproj/WebController.m:
            (-[WebController goBackOrForwardToItem:]):
    	New method to support random access nav in backforward list.
            * WebView.subproj/WebDataSourcePrivate.m:
            (-[WebDataSource _setTitle:]):
    	Site of future work (fixing title in items)
            * WebView.subproj/WebFramePrivate.h:
    	WebFrameLoadTypeIndexedBack/WebFrameLoadTypeIndexedForward are
    	collapsed into WebFrameLoadTypeIndexedBackForward.  Vestigial
    	WebFrameLoadTypeIntermediateBack is nuked.
            * WebView.subproj/WebFramePrivate.m:
            (-[WebFramePrivate setBackForwardItem:]):
            (-[WebFrame _setBackForwardItem:]):
            (-[WebFrame _backForwardItem]):
    	Must remember the BF item we're going to so we can update the
    	BF list on commit.
            (-[WebFrame _transitionToCommitted]):
    	Update the BF list on commit.
            (-[WebFrame _isLoadComplete]):
            (-[WebFrame _goToItem:withFrameLoadType:]):
    	Update BF list on within-page nav.
    	Remember BF item we are going to for later update on commit.
    
    WebBrowser:
    
    	2919039 - Implement limit on back/forward history list
    	2998200 - access to most-recent in submenu of back & forward buttons
    	3084051 - forward button incorrectly enabled after going forward all the way
    
    	Remaining issues at this point are getting the title of the pages
    	into the menu items (instead of the URL), and saving document
    	state properly when you jump around in the list.  Solutions are
    	known and coming soon.
    
            * BrowserDocument.h:
    	Add BrowserDocumentClientNavigatedWithinPageNotification.
            * BrowserDocument.m:
            (-[BrowserDocument init]):
    	Set up BackForwardListSizeLimit preference.
            (-[BrowserDocument canGoBack]):
            (-[BrowserDocument canGoForward]):
            (-[BrowserDocument goBack:]):
            (-[BrowserDocument goForward:]):
    	Nits adopting new API.
            (-[BrowserDocument goToItem:]):
            (-[BrowserDocument _addItem:toMenu:]):
            (-[BrowserDocument backListMenuForButton:]):
            (-[BrowserDocument forwardListMenuForButton:]):
    	Code to build BF menus, and respond to clicks.
            * BrowserWindowController.m:
            (-[BrowserWindowController windowDidLoad]):
            (-[BrowserWindowController frameLoadWithinPage:]):
    	Register for and handle BrowserDocumentClientNavigatedWithinPageNotification.
    	Must update title bar widgets at this point.
            * Defaults.plist:
    	New defaults: BackForwardListSizeLimit, BackForwardMenuSizeLimit
            * LocationChangeHandler.m:
            (-[LocationChangeHandler locationChangedWithinPageForDataSource:]):
    	Post BrowserDocumentClientNavigatedWithinPageNotification.
            * PreferenceKeys.h:
    	New default keys.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2468 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index b77ce70..c6b2894 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,70 @@
+2002-10-25  Trey Matteson  <trey at apple.com>
+	
+	2919039 - Implement limit on back/forward history list
+	2998200 - access to most-recent in submenu of back & forward buttons
+	3022566 - need WebKit API for accessing and visiting back/forward list items
+	3084051 - forward button incorrectly enabled after going forward all the way
+
+	Remaining issues at this point are getting the title of the pages
+	into the menu items (instead of the URL), and saving document
+	state properly when you jump around in the list.  Solutions are
+	known and coming soon.
+
+        * History.subproj/WebBackForwardList.h:
+	Added doc comments to API.  Made ivars private.  Replaced index-
+	based API with item-based API.  Added a sizelimit to the overall
+	list.  Tweaked API to get back and forward lists.
+        * History.subproj/WebBackForwardList.m:
+	Straightforward impl of the above, with the note that I dumped
+	WebHistoryList from the API and impl in favor of an NSArray,
+	which is efficient for this sort of use (queue, stack).
+        (-[WebBackForwardList init]):
+        (-[WebBackForwardList dealloc]):
+        (-[WebBackForwardList goBack]):
+        (-[WebBackForwardList goForward]):
+        (-[WebBackForwardList goToEntry:]):
+        (-[WebBackForwardList backEntry]):
+        (-[WebBackForwardList forwardEntry]):
+        (-[WebBackForwardList maximumSize]):
+        (-[WebBackForwardList setMaximumSize:]):
+        (-[WebBackForwardList description]):
+        * History.subproj/WebHistoryList.h: Removed.
+	Nuked from API, per above.
+        * History.subproj/WebHistoryList.m: Removed.
+        * Misc.subproj/WebKit.h:
+	WebHistoryList gone from API.
+        * WebCoreSupport.subproj/WebBridge.m:
+        (-[WebBridge loadURL:]):
+	Use if/else instead of buried "return;", so next person doesn;t
+	make the same mis-read I did.
+        (-[WebBridge saveDocumentState:]):
+	Site of future work.
+        * WebKit.pbproj/project.pbxproj:
+	Nuked WebHistoryList.
+        * WebView.subproj/WebController.h:
+        * WebView.subproj/WebController.m:
+        (-[WebController goBackOrForwardToItem:]):
+	New method to support random access nav in backforward list.
+        * WebView.subproj/WebDataSourcePrivate.m:
+        (-[WebDataSource _setTitle:]):
+	Site of future work (fixing title in items)
+        * WebView.subproj/WebFramePrivate.h:
+	WebFrameLoadTypeIndexedBack/WebFrameLoadTypeIndexedForward are
+	collapsed into WebFrameLoadTypeIndexedBackForward.  Vestigial
+	WebFrameLoadTypeIntermediateBack is nuked.
+        * WebView.subproj/WebFramePrivate.m:
+        (-[WebFramePrivate setBackForwardItem:]):
+        (-[WebFrame _setBackForwardItem:]):
+        (-[WebFrame _backForwardItem]):
+	Must remember the BF item we're going to so we can update the
+	BF list on commit.
+        (-[WebFrame _transitionToCommitted]):
+	Update the BF list on commit.
+        (-[WebFrame _isLoadComplete]):
+        (-[WebFrame _goToItem:withFrameLoadType:]):
+	Update BF list on within-page nav.
+	Remember BF item we are going to for later update on commit.
+
 2002-10-25  Chris Blumenberg  <cblu at apple.com>
 
 	Minor non-mentionable clean-up.
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index b77ce70..c6b2894 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,70 @@
+2002-10-25  Trey Matteson  <trey at apple.com>
+	
+	2919039 - Implement limit on back/forward history list
+	2998200 - access to most-recent in submenu of back & forward buttons
+	3022566 - need WebKit API for accessing and visiting back/forward list items
+	3084051 - forward button incorrectly enabled after going forward all the way
+
+	Remaining issues at this point are getting the title of the pages
+	into the menu items (instead of the URL), and saving document
+	state properly when you jump around in the list.  Solutions are
+	known and coming soon.
+
+        * History.subproj/WebBackForwardList.h:
+	Added doc comments to API.  Made ivars private.  Replaced index-
+	based API with item-based API.  Added a sizelimit to the overall
+	list.  Tweaked API to get back and forward lists.
+        * History.subproj/WebBackForwardList.m:
+	Straightforward impl of the above, with the note that I dumped
+	WebHistoryList from the API and impl in favor of an NSArray,
+	which is efficient for this sort of use (queue, stack).
+        (-[WebBackForwardList init]):
+        (-[WebBackForwardList dealloc]):
+        (-[WebBackForwardList goBack]):
+        (-[WebBackForwardList goForward]):
+        (-[WebBackForwardList goToEntry:]):
+        (-[WebBackForwardList backEntry]):
+        (-[WebBackForwardList forwardEntry]):
+        (-[WebBackForwardList maximumSize]):
+        (-[WebBackForwardList setMaximumSize:]):
+        (-[WebBackForwardList description]):
+        * History.subproj/WebHistoryList.h: Removed.
+	Nuked from API, per above.
+        * History.subproj/WebHistoryList.m: Removed.
+        * Misc.subproj/WebKit.h:
+	WebHistoryList gone from API.
+        * WebCoreSupport.subproj/WebBridge.m:
+        (-[WebBridge loadURL:]):
+	Use if/else instead of buried "return;", so next person doesn;t
+	make the same mis-read I did.
+        (-[WebBridge saveDocumentState:]):
+	Site of future work.
+        * WebKit.pbproj/project.pbxproj:
+	Nuked WebHistoryList.
+        * WebView.subproj/WebController.h:
+        * WebView.subproj/WebController.m:
+        (-[WebController goBackOrForwardToItem:]):
+	New method to support random access nav in backforward list.
+        * WebView.subproj/WebDataSourcePrivate.m:
+        (-[WebDataSource _setTitle:]):
+	Site of future work (fixing title in items)
+        * WebView.subproj/WebFramePrivate.h:
+	WebFrameLoadTypeIndexedBack/WebFrameLoadTypeIndexedForward are
+	collapsed into WebFrameLoadTypeIndexedBackForward.  Vestigial
+	WebFrameLoadTypeIntermediateBack is nuked.
+        * WebView.subproj/WebFramePrivate.m:
+        (-[WebFramePrivate setBackForwardItem:]):
+        (-[WebFrame _setBackForwardItem:]):
+        (-[WebFrame _backForwardItem]):
+	Must remember the BF item we're going to so we can update the
+	BF list on commit.
+        (-[WebFrame _transitionToCommitted]):
+	Update the BF list on commit.
+        (-[WebFrame _isLoadComplete]):
+        (-[WebFrame _goToItem:withFrameLoadType:]):
+	Update BF list on within-page nav.
+	Remember BF item we are going to for later update on commit.
+
 2002-10-25  Chris Blumenberg  <cblu at apple.com>
 
 	Minor non-mentionable clean-up.
diff --git a/WebKit/History.subproj/WebBackForwardList.h b/WebKit/History.subproj/WebBackForwardList.h
index 10ccc4b..c3ddc86 100644
--- a/WebKit/History.subproj/WebBackForwardList.h
+++ b/WebKit/History.subproj/WebBackForwardList.h
@@ -4,36 +4,95 @@
 
 #import <Foundation/Foundation.h>
 
- at class WebHistoryList;
 @class WebHistoryItem;
 
+/*!
+    @class WebBackForwardList
+    WebBackForwardList holds an ordered list of WebHistoryItems that comprises the back and
+    forward lists.
+    
+    Note that the methods which modify instances of this class do not cause
+    navigation to happen in other layers of the stack;  they are only for maintaining this data
+    structure.
+*/
 @interface WebBackForwardList : NSObject {
-    WebHistoryList *uriList;
-    int index;
-    int state;
+    @private
+    NSMutableArray *_entries;
+    int _current;
+    int _maximumSize;
 }
 
-// add to the list
--(void)addEntry:(WebHistoryItem *)entry;
+/*!
+    @method addEntry:
+    @abstract Adds an entry to the list.
+    @discussion Add an entry to the back-forward list, immediately after the current entry.
+    If the current position in the list is not at the end of the list, elements in the
+    forward list will be dropped at this point.  In addition, entries may be dropped to keep
+    the size of the list within the maximum size.
+    @param entry The entry to add.
+*/    
+- (void)addEntry:(WebHistoryItem *)entry;
 
-// change position in the list
--(void)goBack;
--(void)goBackToIndex: (int)pos;
--(void)goForward;
--(void)goForwardToIndex: (int)pos;
+/*!
+    @method goBack
+    @abstract Move the current pointer back to the entry before the current entry.
+*/
+- (void)goBack;
 
-// examine entries without changing position
-- (WebHistoryItem *)backEntryAtIndex: (int)pos;
--(WebHistoryItem *)backEntry;
--(WebHistoryItem *)currentEntry;
--(WebHistoryItem *)forwardEntry;
+/*!
+    @method goForward
+    @abstract Move the current pointer ahead to the entry after the current entry.
+*/
+- (void)goForward;
 
-// examine entire list
--(NSArray *)backList;
--(NSArray *)forwardList;
+/*!
+    @method goToEntry:
+    @abstract Move the current pointer to the given entry.
+*/
+- (void)goToEntry:(WebHistoryItem *)entry;
 
-// check whether entries exist
--(BOOL)canGoBack;
--(BOOL)canGoForward;
+/*!
+    @method backEntry
+    @result Returns the entry right before the current entry, or nil if there isn't one.
+*/
+- (WebHistoryItem *)backEntry;
+
+/*!
+    @method currentEntry
+    @result Returns the current entry.
+*/
+- (WebHistoryItem *)currentEntry;
+
+/*!
+    @method forwardEntry
+    @result Returns the entry right after the current entry, or nil if there isn't one.
+*/
+- (WebHistoryItem *)forwardEntry;
+
+/*!
+    @method backListWithSizeLimit:
+    @param limit A cap on the size of the array returned.
+    @result Returns a portion of the list before current entry, or nil if there are none.  The entries are in the order that they were originally visited.
+*/
+- (NSArray *)backListWithSizeLimit:(int)limit;
+
+/*!
+    @method forwardListWithSizeLimit:
+    @param limit A cap on the size of the array returned.
+    @result Returns a portion of the list after current entry, or nil if there are none.  The entries are in the order that they were originally visited.
+*/
+- (NSArray *)forwardListWithSizeLimit:(int)limit;
+
+/*!
+    @method maximumSize
+    @result Returns this list's maximum size.
+*/
+- (int)maximumSize;
+
+/*!
+    @method maximumSize
+    @abstract Sets this list's maximum size.
+*/
+- (void)setMaximumSize:(int)size;
 
- at end
\ No newline at end of file
+ at end
diff --git a/WebKit/History.subproj/WebBackForwardList.m b/WebKit/History.subproj/WebBackForwardList.m
index 189f311..a5bee3c 100644
--- a/WebKit/History.subproj/WebBackForwardList.m
+++ b/WebKit/History.subproj/WebBackForwardList.m
@@ -7,157 +7,146 @@
 //
 
 #import "WebBackForwardList.h"
-
 #import "WebHistoryItem.h"
-#import "WebHistoryList.h"
+#import <WebFoundation/WebAssertions.h>
 
 @implementation WebBackForwardList
 
--(id)init
+- (id)init
 {
     self = [super init];
     if (!self) {
         return nil;
     }
     
-    uriList = [[WebHistoryList alloc] init];
-    [uriList setAllowsDuplicates:YES];
-    index = 0;
+    _entries = [[NSMutableArray alloc] init];
+    _current = -1;
+    _maximumSize = 100;		// typically set by browser app
 
     return self;
 }
 
--(void)dealloc
+- (void)dealloc
 {
-    [uriList release];
+    [_entries release];
     [super dealloc];
 }
 
--(void)addEntry:(WebHistoryItem *)entry
+- (void)addEntry:(WebHistoryItem *)entry;
 {
     // 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;
+    if (_current >= 0) {
+        WebHistoryItem *curr = [_entries objectAtIndex:_current];
+        if ([[curr URL] isEqual:[entry URL]]
+            && [[curr target] isEqual:[entry target]]
+            && [[curr parent] isEqual:[entry parent]])
+        {
+            [_entries replaceObjectAtIndex:_current withObject:entry];
+            return;	// skip clearing the forward list
         }
     }
 
-    if (index > 0) {
-        [uriList removeEntriesToIndex:index];
-        index = 0;
+    // Toss anything in the forward list
+    int currSize = [_entries count];
+    if (_current != currSize-1 && _current != -1) {
+        NSRange forwardRange = NSMakeRange(_current+1, currSize-(_current+1));
+        [_entries removeObjectsInRange: forwardRange];
+        currSize -= forwardRange.length;
+    }
+
+    // Toss the first item if the list is getting too big, as long as we're not using it
+    if (currSize == _maximumSize && _current != 0) {
+       [_entries removeObjectAtIndex:0];
+       currSize--;
+       _current--;
     }
-    [uriList addEntry:entry];
+
+    [_entries addObject:entry];
+    _current++;
 }
 
--(void)goBack
+- (void)goBack
 {
-    index++;
+    ASSERT(_current > 0);
+    _current--;
 }
 
--(void)goBackToIndex: (int)pos
+- (void)goForward
 {
+    ASSERT(_current < (int)[_entries count]-1);
+    _current++;
 }
 
-- (WebHistoryItem *)backEntryAtIndex: (int)pos
+- (void)goToEntry:(WebHistoryItem *)entry
 {
-    WebHistoryItem *result;
-    int count;
-    
-    count = [uriList count];
-    if (count > 1 && index+pos < (count - 1)) {
-        result = [uriList entryAtIndex:index+1+pos];
-    } else {
-        result = nil;
-    }
-
-    return result;
+    int index = [_entries indexOfObjectIdenticalTo:entry];
+    ASSERT(index != NSNotFound);
+    _current = index;
 }
 
--(WebHistoryItem *)backEntry
+- (WebHistoryItem *)backEntry
 {
-    WebHistoryItem *result;
-    int count;
-    
-    count = [uriList count];
-    if (count > 1 && index < (count - 1)) {
-        result = [uriList entryAtIndex:index+1];
+    if (_current > 0) {
+        return [_entries objectAtIndex:_current-1];
     } else {
-        result = nil;
+        return nil;
     }
-
-    return result;
-}
-
--(WebHistoryItem *)currentEntry
-{
-    WebHistoryItem *result;
-    
-    if (index < 0 || index >= [uriList count])
-        return  nil;
-        
-    result = [uriList entryAtIndex:index];
-
-    return result;
 }
 
--(WebHistoryItem *)forwardEntry
+- (WebHistoryItem *)currentEntry;
 {
-    WebHistoryItem *result;
-
-    if (index > 0) {
-        result = [uriList entryAtIndex:index-1];
+    if (_current >= 0) {
+        return [_entries objectAtIndex:_current];
     } else {
-        result = nil;
+        return nil;
     }
-
-    return result;
 }
 
--(void)goForward
+- (WebHistoryItem *)forwardEntry
 {
-    index--;
+    if (_current < (int)[_entries count]-1) {
+        return [_entries objectAtIndex:_current+1];
+    } else {
+        return nil;
+    }
 }
 
--(void)goForwardToIndex: (int)pos
+- (NSArray *)backListWithSizeLimit:(int)limit;
 {
+    if (_current > 0) {
+        NSRange r;
+        r.location = MAX(_current-limit, 0);
+        r.length = _current - r.location;
+        return [_entries subarrayWithRange:r];
+    } else {
+        return nil;
+    }
 }
 
--(BOOL)canGoBack
+- (NSArray *)forwardListWithSizeLimit:(int)limit;
 {
-    BOOL result;
-    int count;
-    
-    count = [uriList count];
-    result = (count > 1 && index < (count - 1));
-    
-    return result;
+    int lastEntry = (int)[_entries count]-1;
+    if (_current < lastEntry) {
+        NSRange r;
+        r.location = _current+1;
+        r.length =  MIN(_current+limit, lastEntry) - _current;
+        return [_entries subarrayWithRange:r];
+    } else {
+        return nil;
+    }
 }
 
--(BOOL)canGoForward
+- (int)maximumSize
 {
-    BOOL result;
-
-    result = (index > 0);
-    
-    return result;
+    return _maximumSize;
 }
 
--(NSArray *)backList
+- (void)setMaximumSize:(int)size
 {
-    // FIXME: implement this some day
-    return nil;
+    _maximumSize = size;
 }
 
--(NSArray *)forwardList
-{
-    // FIXME: implement this some day
-    return nil;
-}
 
 -(NSString *)description
 {
@@ -169,15 +158,15 @@
     [result appendString:@"\n--------------------------------------------\n"];    
     [result appendString:@"WebBackForwardList:\n"];
     
-    for (i = 0; i < [uriList count]; i++) {
-        if (i == index) {
+    for (i = 0; i < (int)[_entries count]; i++) {
+        if (i == _current) {
             [result appendString:@" >>>"]; 
         }
         else {
             [result appendString:@"    "]; 
         }   
         [result appendFormat:@" %d) ", i]; 
-        [result appendString:[[uriList entryAtIndex:i] description]]; 
+        [result appendString:[[_entries objectAtIndex:i] description]]; 
         [result appendString:@"\n"]; 
     }
 
diff --git a/WebKit/History.subproj/WebHistoryList.h b/WebKit/History.subproj/WebHistoryList.h
deleted file mode 100644
index 95c6f22..0000000
--- a/WebKit/History.subproj/WebHistoryList.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*	WebHistoryList.h
-	Copyright 2001, Apple, Inc. All rights reserved.
-*/
-
-#import <Foundation/Foundation.h>
-
- at class WebHistoryItem;
-
-typedef struct WebHistoryListNode WebHistoryListNode;
-
- at interface WebHistoryList : NSObject 
-{
-    WebHistoryListNode *_head;
-    WebHistoryListNode *_tail;
-    int _count;
-    BOOL _allowsDuplicates;
-    int _maximumSize;
-}
-
--(id)init;
-
--(BOOL)allowsDuplicates;
--(void)setAllowsDuplicates:(BOOL)allowsDuplicates;
-
--(int)count;
-
--(int)maximumSize;
--(void)setMaximumSize:(int)size;
-
--(WebHistoryItem *)entryAtIndex:(int)index;
--(WebHistoryItem *)entryForURL:(NSURL *)URL;
-
--(void)addEntry:(WebHistoryItem *)entry;
-
--(void)removeEntry:(WebHistoryItem *)entry;
--(WebHistoryItem *)removeEntryAtIndex:(int)index;
--(void)removeEntriesToIndex:(int)index;
-
--(void)replaceEntryAtIndex:(int)index withEntry:(WebHistoryItem *)entry;
-
- at end
diff --git a/WebKit/History.subproj/WebHistoryList.m b/WebKit/History.subproj/WebHistoryList.m
deleted file mode 100644
index d730eb9..0000000
--- a/WebKit/History.subproj/WebHistoryList.m
+++ /dev/null
@@ -1,255 +0,0 @@
-/*	
-    WebHistoryList.m
-    Copyright 2001, Apple, Inc. All rights reserved.
-*/
-
-#import "WebHistoryList.h"
-#import "WebHistoryItem.h"
-#import <WebFoundation/WebAssertions.h>
-
-struct WebHistoryListNode
-{
-    unsigned hash;
-    WebHistoryItem *entry;
-    WebHistoryListNode *prev;
-    WebHistoryListNode *next;
-};
-
-static WebHistoryListNode *newURIListNode(WebHistoryItem *entry)
-{
-    WebHistoryListNode *node;
-
-    [entry retain];
-    
-    node = malloc(sizeof(WebHistoryListNode));
-    node->hash = [entry hash];
-    node->entry = entry;
-    node->prev = nil;
-    node->next = nil;
-    
-    return node;    
-}
-
-static void freeNode(WebHistoryListNode *node)
-{
-    // 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.
-    [node->entry autorelease];
-    free(node);    
-}
-
-
- at implementation WebHistoryList
-
--(id)init
-{
-    if (self != [super init])
-    {
-        return nil;
-    }
-    
-    _head = _tail = nil;
-    _count = 0;
-    _maximumSize = -1;
-    _allowsDuplicates = NO;
-    
-    return self;
-}
-
--(void)dealloc
-{
-    WebHistoryListNode *curNode;
-    WebHistoryListNode *delNode;
-
-    curNode = _head;
-
-    while (curNode) {
-        delNode = curNode;
-        curNode = curNode->next;
-        freeNode(delNode);
-    }
-
-    [super dealloc];
-}
-
--(BOOL)allowsDuplicates
-{
-    return _allowsDuplicates;
-}
-
--(void)setAllowsDuplicates:(BOOL)allowsDuplicates
-{
-    _allowsDuplicates = allowsDuplicates;
-}
-
--(int)count
-{
-    return _count;
-}
-
--(int)maximumSize
-{
-    return _maximumSize;
-}
-
--(void)setMaximumSize:(int)size
-{
-    ASSERT(size > 0 || size == -1);
-    _maximumSize = size;
-}
-
--(void)addEntry:(WebHistoryItem *)entry
-{
-    if (!_allowsDuplicates) {
-        // search the list first and remove any entry with the same URL
-        // having the same title does not count
-        [self removeEntry:entry];
-    }
-
-    // make new entry and put it at the head of the list
-    WebHistoryListNode *node = newURIListNode(entry);
-    node->next = _head;
-    _head = node;
-    _count++;
-    if (_count == 1) {
-        _tail = _head;
-    }
-    
-    if (_maximumSize != -1 && _count > _maximumSize) {
-        // drop off the tail
-        node = _tail;
-        _tail = _tail->prev;
-        _tail->next = nil;
-        freeNode(node);
-        _count--;
-    }
-}
-
--(void)removeEntry:(WebHistoryItem *)entry
-{
-    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--;
-            removedEntry = node->entry;
-            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;
-        }
-    }
-}
-
--(WebHistoryItem *)entryForURL:(NSURL *)URL
-{
-    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;
-            break;
-        }
-    }
-    
-    return foundEntry;
-}
-
--(WebHistoryItem *)entryAtIndex:(int)index
-{
-    ASSERT(index >= 0 && index < _count);
-
-    WebHistoryListNode *node = _head;
-    int i;
-    for (i = 0; i < index; i++) {
-        node = node->next;
-    }
-
-    return node->entry;    
-}
-
--(void)replaceEntryAtIndex:(int)index withEntry:(WebHistoryItem *)entry
-{
-    ASSERT(index >= 0 && index < _count);
-
-    WebHistoryListNode *node = _head;
-    int i;
-    for (i = 0; i < index; i++) {
-        node = node->next;
-    }
-
-    [node->entry autorelease];
-    node->entry = [entry retain];
-}
-
--(WebHistoryItem *)removeEntryAtIndex:(int)index
-{
-    ASSERT(index > 0 && index < _count);
-
-    WebHistoryListNode *node = _head;
-    int i;
-    for (i = 0; i < index; i++) {
-        node = node->next;
-    }
-
-    _count--;
-    WebHistoryItem *removedEntry = node->entry;
-    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);
-
-    return removedEntry;
-}
-
--(void)removeEntriesToIndex:(int)index
-{
-    ASSERT(index > 0 && index < _count);
-
-    WebHistoryListNode *node = _head;
-    int i;
-    for (i = 0; i < index; i++) {
-        WebHistoryListNode *next = node->next;
-        freeNode(node);
-        _count--;
-        node = next;
-    }
-    
-    _head = node;
-}
-
- at end
diff --git a/WebKit/Misc.subproj/WebKit.h b/WebKit/Misc.subproj/WebKit.h
index 6015e96..dcd21a6 100644
--- a/WebKit/Misc.subproj/WebKit.h
+++ b/WebKit/Misc.subproj/WebKit.h
@@ -15,7 +15,6 @@
 #import <WebKit/WebHTMLView.h>
 #import <WebKit/WebHistory.h>
 #import <WebKit/WebHistoryItem.h>
-#import <WebKit/WebHistoryList.h>
 #import <WebKit/WebKitErrors.h>
 #import <WebKit/WebLocationChangeDelegate.h>
 #import <WebKit/WebPreferences.h>
diff --git a/WebKit/WebCoreSupport.subproj/WebBridge.m b/WebKit/WebCoreSupport.subproj/WebBridge.m
index 2f28c69..86168c3 100644
--- a/WebKit/WebCoreSupport.subproj/WebBridge.m
+++ b/WebKit/WebCoreSupport.subproj/WebBridge.m
@@ -296,13 +296,12 @@
         WebDataSource *dataSource = [frame dataSource];
         [dataSource _setURL:URL];        
         [[[frame controller] locationChangeDelegate] locationChangedWithinPageForDataSource:dataSource];
-        return;
+    } else {
+        WebResourceRequest *request = [[WebResourceRequest alloc] initWithURL:URL];
+        [request setReferrer:[self referrer]];
+        [self loadRequest:request];
+        [request release];
     }
-    
-    WebResourceRequest *request = [[WebResourceRequest alloc] initWithURL:URL];
-    [request setReferrer:[self referrer]];
-    [self loadRequest:request];
-    [request release];
 }
 
 - (void)postWithURL:(NSURL *)URL data:(NSData *)data contentType:(NSString *)contentType
@@ -359,6 +358,7 @@
 
 - (void)saveDocumentState: (NSArray *)documentState
 {
+//??? does this need a case for WebFrameLoadTypeIndexedBackForward?
     WebHistoryItem *item;
     
     if ([frame _loadType] == WebFrameLoadTypeBack)
diff --git a/WebKit/WebKit.pbproj/project.pbxproj b/WebKit/WebKit.pbproj/project.pbxproj
index b0a203c..d342934 100644
--- a/WebKit/WebKit.pbproj/project.pbxproj
+++ b/WebKit/WebKit.pbproj/project.pbxproj
@@ -205,7 +205,6 @@
 				39446096020F50ED0ECA1767,
 				F520FB1B0221DEFD01C1A525,
 				39446097020F50ED0ECA1767,
-				39446098020F50ED0ECA1767,
 				F5B92B840223191D01C1A525,
 				F5E0A77002B8FEE401C1A525,
 				F59EAE400253C7EE018635CA,
@@ -326,7 +325,6 @@
 				394460A7020F50ED0ECA1767,
 				394460A8020F50ED0ECA1767,
 				394460A9020F50ED0ECA1767,
-				394460AA020F50ED0ECA1767,
 				F5EBC45A02134BC301CA1520,
 				9CF0E24C021361B10ECA16EA,
 				F5143A380221DCCE01A80181,
@@ -534,8 +532,6 @@
 				3944607E020F50ED0ECA1767,
 				3944607F020F50ED0ECA1767,
 				39446080020F50ED0ECA1767,
-				39446081020F50ED0ECA1767,
-				39446082020F50ED0ECA1767,
 				F5E0A76E02B8FEE401C1A525,
 				F5E0A76F02B8FEE401C1A525,
 				F520FB190221DEFD01C1A525,
@@ -916,18 +912,6 @@
 			path = WebHistoryItem.m;
 			refType = 4;
 		};
-		39446081020F50ED0ECA1767 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			path = WebHistoryList.h;
-			refType = 4;
-		};
-		39446082020F50ED0ECA1767 = {
-			fileEncoding = 30;
-			isa = PBXFileReference;
-			path = WebHistoryList.m;
-			refType = 4;
-		};
 		39446088020F50ED0ECA1767 = {
 			fileRef = 39446065020F50ED0ECA1767;
 			isa = PBXBuildFile;
@@ -1024,15 +1008,6 @@
 				);
 			};
 		};
-		39446098020F50ED0ECA1767 = {
-			fileRef = 39446081020F50ED0ECA1767;
-			isa = PBXBuildFile;
-			settings = {
-				ATTRIBUTES = (
-					Public,
-				);
-			};
-		};
 		3944609D020F50ED0ECA1767 = {
 			fileRef = 39446064020F50ED0ECA1767;
 			isa = PBXBuildFile;
@@ -1093,12 +1068,6 @@
 			settings = {
 			};
 		};
-		394460AA020F50ED0ECA1767 = {
-			fileRef = 39446082020F50ED0ECA1767;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
 //390
 //391
 //392
diff --git a/WebKit/WebView.subproj/WebController.h b/WebKit/WebView.subproj/WebController.h
index 9455378..6ebab17 100644
--- a/WebKit/WebView.subproj/WebController.h
+++ b/WebKit/WebView.subproj/WebController.h
@@ -8,6 +8,7 @@
 #import <Cocoa/Cocoa.h>
 
 @class WebBackForwardList;
+ at class WebHistoryItem;
 @class WebController;
 @class WebControllerPrivate;
 @class WebDataSource;
@@ -247,7 +248,7 @@ extern NSString *WebElementFrameKey;
 
 /*!
     @method goBack
-    @abstract Go back to the last URL in the backforward list.
+    @abstract Go back to the previous URL in the backforward list.
     @result Returns YES if able to go back in the backforward list, NO otherwise.
 */    
 - (BOOL)goBack;
@@ -260,6 +261,13 @@ extern NSString *WebElementFrameKey;
 - (BOOL)goForward;
 
 /*!
+    @method goBackOrForwardToItem:
+    @abstract Go back or forward to an item in the backforward list.
+    @result Returns YES if able to go to the item, NO otherwise.
+*/    
+- (BOOL)goBackOrForwardToItem:(WebHistoryItem *)item;
+
+/*!
     @method setTextSizeMultiplier:
     @abstract Change the size of the text rendering in views managed by this controller.
     @param multiplier A fractional percentage value, 1.0 is 100%.
diff --git a/WebKit/WebView.subproj/WebController.m b/WebKit/WebView.subproj/WebController.m
index 6ea71f9..599d807 100644
--- a/WebKit/WebView.subproj/WebController.m
+++ b/WebKit/WebView.subproj/WebController.m
@@ -315,6 +315,12 @@ NSString *WebElementFrameKey = @"WebElementFrame";
     return NO;
 }
 
+- (BOOL)goBackOrForwardToItem:(WebHistoryItem *)item
+{
+    [self _goToItem: item withFrameLoadType: WebFrameLoadTypeIndexedBackForward];
+    return YES;
+}
+
 - (void)setTextSizeMultiplier:(float)m
 {
     if (_private->textSizeMultiplier == m) {
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.m b/WebKit/WebView.subproj/WebDataSourcePrivate.m
index 5761a86..7ea3909 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.m
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.m
@@ -251,8 +251,15 @@
     // The title doesn't get communicated to the controller until we are committed.
     if (_private->committed) {
         WebHistoryItem *entry;
-        entry = [[WebHistory sharedHistory] entryForURL: [[[self _originalRequest] URL] _web_canonicalize]];
+        NSURL *canonURL = [[[self _originalRequest] URL] _web_canonicalize];
+        entry = [[WebHistory sharedHistory] entryForURL: canonURL];
         [entry setTitle: _private->pageTitle];
+
+        // Must update the entry in the back-forward list too.
+        //WebBackForwardList *bfList = [_private->controller backForwardList];
+        //entry = [bfList entryForURL: canonURL];
+        //[entry setTitle: _private->pageTitle];
+
         [[_private->controller locationChangeDelegate] receivedPageTitle:_private->pageTitle forDataSource:self];
     }
 }
diff --git a/WebKit/WebView.subproj/WebFramePrivate.h b/WebKit/WebView.subproj/WebFramePrivate.h
index c8ac1b5..60dd2fa 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.h
+++ b/WebKit/WebView.subproj/WebFramePrivate.h
@@ -31,12 +31,10 @@ typedef enum {
     WebFrameLoadTypeStandard,
     WebFrameLoadTypeBack,
     WebFrameLoadTypeForward,
-    WebFrameLoadTypeIndexedBack,
-    WebFrameLoadTypeIndexedForward,
+    WebFrameLoadTypeIndexedBackForward,		// a multi-item hop in the backforward list
     WebFrameLoadTypeReload,
     WebFrameLoadTypeReloadAllowingStaleData,
-    WebFrameLoadTypeInternal,
-    WebFrameLoadTypeIntermediateBack
+    WebFrameLoadTypeInternal
 } WebFrameLoadType;
 
 #define WebFrameStateChangedNotification @"WebFrameStateChangedNotification"
@@ -56,6 +54,7 @@ typedef enum {
     WebFrameState state;
     NSTimer *scheduledLayoutTimer;
     WebFrameLoadType loadType;
+    WebHistoryItem *backForwardItem;
     WebFrame *parent;
     NSMutableArray *children;
     WebPluginController *pluginController;
@@ -73,6 +72,8 @@ typedef enum {
 - (WebDataSource *)provisionalDataSource;
 - (WebFrameLoadType)loadType;
 - (void)setLoadType:(WebFrameLoadType)loadType;
+- (void)setBackForwardItem: (WebHistoryItem *)item;
+- (WebHistoryItem *)backForwardItem;
 
 @end
 
@@ -96,6 +97,8 @@ typedef enum {
 - (void)_setProvisionalDataSource:(WebDataSource *)d;
 - (void)_setLoadType: (WebFrameLoadType)loadType;
 - (WebFrameLoadType)_loadType;
+- (void)_setBackForwardItem: (WebHistoryItem *)item;
+- (WebHistoryItem *)_backForwardItem;
 - (void)_goToItem: (WebHistoryItem *)item withFrameLoadType: (WebFrameLoadType)type;
 - (void)_restoreScrollPosition;
 - (void)_scrollToTop;
diff --git a/WebKit/WebView.subproj/WebFramePrivate.m b/WebKit/WebView.subproj/WebFramePrivate.m
index 6278329..44c60ab 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.m
+++ b/WebKit/WebView.subproj/WebFramePrivate.m
@@ -118,6 +118,15 @@ static const char * const stateNames[] = {
     loadType = t;
 }
 
+- (WebHistoryItem *)backForwardItem { return backForwardItem; }
+- (void)setBackForwardItem: (WebHistoryItem *)item
+{
+    if (backForwardItem != item) {
+        [backForwardItem release];
+        backForwardItem = [item retain];
+    }
+}
+
 
 @end
 
@@ -178,6 +187,16 @@ static const char * const stateNames[] = {
     return [_private loadType];
 }
 
+- (void)_setBackForwardItem: (WebHistoryItem *)item
+{
+    [_private setBackForwardItem: item];
+}
+
+- (WebHistoryItem *)_backForwardItem
+{
+    return [_private backForwardItem];
+}
+
 - (void)_scheduleLayout:(NSTimeInterval)inSeconds
 {
     // FIXME: Maybe this should have the code to move up the deadline if the new interval brings the time even closer.
@@ -312,15 +331,18 @@ static const char * const stateNames[] = {
                     [backForwardList goForward];
                     [self _restoreScrollPosition];
                     break;
-    
-                case WebFrameLoadTypeIntermediateBack:
-                    break;
-                    
+
                 case WebFrameLoadTypeBack:
                     [backForwardList goBack];
                     [self _restoreScrollPosition];
                     break;
                     
+                case WebFrameLoadTypeIndexedBackForward:
+                    [backForwardList goToEntry: [self _backForwardItem]];
+                    [self _setBackForwardItem: nil];
+                    [self _restoreScrollPosition];
+                    break;
+                    
                 case WebFrameLoadTypeReload:
                     [self _scrollToTop];
                     break;
@@ -498,14 +520,8 @@ static const char * const stateNames[] = {
                 if ([[self controller] usesBackForwardList]){
                     switch ([self _loadType]) {
                     case WebFrameLoadTypeForward:
-                        [self _restoreScrollPosition];
-                        break;
-        
-                    case WebFrameLoadTypeIntermediateBack:
-                        [[self controller] goBack];
-                        break;
-                        
                     case WebFrameLoadTypeBack:
+                    case WebFrameLoadTypeIndexedBackForward:
                         [self _restoreScrollPosition];
                         break;
                         
@@ -686,14 +702,14 @@ static const char * const stateNames[] = {
     [_private setProvisionalDataSource:d];
 }
 
-
+// main funnel for navigating via back/forward
 - (void)_goToItem: (WebHistoryItem *)item withFrameLoadType: (WebFrameLoadType)type
 {
     NSURL *itemURL = [item URL];
     WebResourceRequest *request;
-    WebDataSource *dataSource;
     NSURL *originalURL = [[[self dataSource] request] URL];
-    
+
+    // Are we navigating to an anchor within the page?
     if ([item anchor] && [[itemURL _web_URLByRemovingFragment] isEqual: [originalURL _web_URLByRemovingFragment]]) {
         WebBackForwardList *backForwardList = [[self controller] backForwardList];
 
@@ -701,9 +717,12 @@ static const char * const stateNames[] = {
             [backForwardList goForward];
         else if (type == WebFrameLoadTypeBack)
             [backForwardList goBack];
+        else if (type == WebFrameLoadTypeIndexedBackForward)
+            [backForwardList goToEntry:item];
         else 
             [NSException raise:NSInvalidArgumentException format:@"WebFrameLoadType incorrect"];
         [[_private->dataSource _bridge] scrollToAnchor: [item anchor]];
+        [[[self controller] locationChangeDelegate] locationChangedWithinPageForDataSource:_private->dataSource];
     }
     else {
         request = [[WebResourceRequest alloc] initWithURL:itemURL];
@@ -725,9 +744,7 @@ static const char * const stateNames[] = {
                     break;
                 case WebFrameLoadTypeBack:
                 case WebFrameLoadTypeForward:
-                case WebFrameLoadTypeIndexedBack:
-                case WebFrameLoadTypeIndexedForward:
-                case WebFrameLoadTypeIntermediateBack:
+                case WebFrameLoadTypeIndexedBackForward:
                     [request setRequestCachePolicy:WebRequestCachePolicyReturnCacheObjectLoadFromOriginIfNoCacheObject];
                     break;
                 case WebFrameLoadTypeInternal:
@@ -736,13 +753,19 @@ static const char * const stateNames[] = {
                     break;
             }
         }
-        
-        dataSource = [[WebDataSource alloc] initWithRequest:request];
+
+        WebDataSource *newDataSource = [[WebDataSource alloc] initWithRequest:request];
         [request release];
-        [self setProvisionalDataSource: dataSource];
+        [self setProvisionalDataSource: newDataSource];
         [self _setLoadType: type];
+        // we need to remember this item in order to set the position in the BFList later
+        if (type == WebFrameLoadTypeIndexedBackForward) {
+            [self _setBackForwardItem: item];
+        } else {
+            [self _setBackForwardItem: nil];
+        }
         [self startLoading];
-        [dataSource release];
+        [newDataSource release];
     }
 }
 
diff --git a/WebKit/WebView.subproj/WebView.h b/WebKit/WebView.subproj/WebView.h
index 9455378..6ebab17 100644
--- a/WebKit/WebView.subproj/WebView.h
+++ b/WebKit/WebView.subproj/WebView.h
@@ -8,6 +8,7 @@
 #import <Cocoa/Cocoa.h>
 
 @class WebBackForwardList;
+ at class WebHistoryItem;
 @class WebController;
 @class WebControllerPrivate;
 @class WebDataSource;
@@ -247,7 +248,7 @@ extern NSString *WebElementFrameKey;
 
 /*!
     @method goBack
-    @abstract Go back to the last URL in the backforward list.
+    @abstract Go back to the previous URL in the backforward list.
     @result Returns YES if able to go back in the backforward list, NO otherwise.
 */    
 - (BOOL)goBack;
@@ -260,6 +261,13 @@ extern NSString *WebElementFrameKey;
 - (BOOL)goForward;
 
 /*!
+    @method goBackOrForwardToItem:
+    @abstract Go back or forward to an item in the backforward list.
+    @result Returns YES if able to go to the item, NO otherwise.
+*/    
+- (BOOL)goBackOrForwardToItem:(WebHistoryItem *)item;
+
+/*!
     @method setTextSizeMultiplier:
     @abstract Change the size of the text rendering in views managed by this controller.
     @param multiplier A fractional percentage value, 1.0 is 100%.
diff --git a/WebKit/WebView.subproj/WebView.m b/WebKit/WebView.subproj/WebView.m
index 6ea71f9..599d807 100644
--- a/WebKit/WebView.subproj/WebView.m
+++ b/WebKit/WebView.subproj/WebView.m
@@ -315,6 +315,12 @@ NSString *WebElementFrameKey = @"WebElementFrame";
     return NO;
 }
 
+- (BOOL)goBackOrForwardToItem:(WebHistoryItem *)item
+{
+    [self _goToItem: item withFrameLoadType: WebFrameLoadTypeIndexedBackForward];
+    return YES;
+}
+
 - (void)setTextSizeMultiplier:(float)m
 {
     if (_private->textSizeMultiplier == m) {

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list