[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 07:36:59 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 1af8f6631896efffae1b572f879288d82cb8ca84
Author: trey <trey at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Apr 14 20:46:44 2003 +0000

    WebKit:
    
    	3150693 - open new window on "same page" doesn't give me the same frame content
    
    	The core is a new support method that loads a WebView given a HistoryItem, which
    	thus restores all frames of that item, and optionally the form and scroll state.
    
            Reviewed by NOBODY (OOPS!).
    
            * History.subproj/WebHistoryItem.m:
            (-[WebHistoryItem copyWithZone:]):  Copy the docState, scrollPosition, isTargetItem.
    	No good	reason to have left these out when I wrote this method.
            * WebView.subproj/WebFramePrivate.h:
            * WebView.subproj/WebFramePrivate.m:
            (-[WebFrame _saveDocumentAndScrollState]):  New method to run the frame tree and
    	save all form/scroll state to the current item.
            * WebView.subproj/WebView.m:
    	_goToItem:withLoadType: moved to WebViewPrivate.m
            * WebView.subproj/WebViewPrivate.h:
            * WebView.subproj/WebViewPrivate.m:
            (-[WebView _goToItem:withLoadType:]):  Moved from WebView.m, no change.
            (-[WebView _loadItem:showingInView:]):  New method to load the view with the item.
    
    WebBrowser:
    
    	3150693 - open new window on "same page" doesn't give me the same frame content
    
    	The basic idea is that we try to call the new _loadItem:showingInView:
    	method with a history item instead of just loading a URL.
    
            Reviewed by NOBODY (OOPS!).
    
            * BrowserDocument.h:
            * BrowserDocument.m:
            (-[BrowserDocument goToHistoryItem:inView:]):  Just pass through args to
    	our current controller.
            * BrowserWindowController.m:
            (-[BrowserWindowController windowDidLoad]):  If we can get a history item
    	use that to do the load.  Else use a URL like before.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4101 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 77587dc..bb0660d 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,26 @@
+2003-04-13  Trey Matteson  <trey at apple.com>
+
+	3150693 - open new window on "same page" doesn't give me the same frame content
+
+	The core is a new support method that loads a WebView given a HistoryItem, which
+	thus restores all frames of that item, and optionally the form and scroll state.
+
+        Reviewed by NOBODY (OOPS!).
+
+        * History.subproj/WebHistoryItem.m:
+        (-[WebHistoryItem copyWithZone:]):  Copy the docState, scrollPosition, isTargetItem.
+	No good	reason to have left these out when I wrote this method.
+        * WebView.subproj/WebFramePrivate.h:
+        * WebView.subproj/WebFramePrivate.m:
+        (-[WebFrame _saveDocumentAndScrollState]):  New method to run the frame tree and
+	save all form/scroll state to the current item.
+        * WebView.subproj/WebView.m:
+	_goToItem:withLoadType: moved to WebViewPrivate.m
+        * WebView.subproj/WebViewPrivate.h:
+        * WebView.subproj/WebViewPrivate.m:
+        (-[WebView _goToItem:withLoadType:]):  Moved from WebView.m, no change.
+        (-[WebView _loadItem:showingInView:]):  New method to load the view with the item.
+
 2003-04-12  Chris Blumenberg  <cblu at apple.com>
 
 	Fixed: 3162338 - Embedding SVG with <object type="image/svg+xml"> doesn't work
diff --git a/WebKit/History.subproj/WebHistoryItem.m b/WebKit/History.subproj/WebHistoryItem.m
index 8d9e3df..9390cb1 100644
--- a/WebKit/History.subproj/WebHistoryItem.m
+++ b/WebKit/History.subproj/WebHistoryItem.m
@@ -93,10 +93,13 @@
     copy->_private->title = [_private->title copy];
     copy->_private->displayTitle = [_private->displayTitle copy];
     copy->_private->lastVisitedDate = [_private->lastVisitedDate copy];
+    copy->_private->scrollPoint = _private->scrollPoint;
     copy->_private->anchor = [_private->anchor copy];
+    copy->_private->documentState = [_private->documentState copy];
     if (_private->subItems) {
         copy->_private->subItems = [[NSMutableArray alloc] initWithArray:_private->subItems copyItems:YES];
     }
+    copy->_private->isTargetItem = _private->isTargetItem;
     copy->_private->formData = [_private->formData copy];
     copy->_private->formContentType = [_private->formContentType copy];
     copy->_private->formReferrer = [_private->formReferrer copy];
diff --git a/WebKit/WebView.subproj/WebFramePrivate.h b/WebKit/WebView.subproj/WebFramePrivate.h
index fbffc5d..e136055 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.h
+++ b/WebKit/WebView.subproj/WebFramePrivate.h
@@ -127,7 +127,6 @@ typedef enum {
 
 - (void)_addExtraFieldsToRequest:(NSMutableURLRequest *)request alwaysFromRequest: (BOOL)f;
 
-
 - (void)_checkNewWindowPolicyForRequest:(NSURLRequest *)request action:(NSDictionary *)action frameName:(NSString *)frameName formState:(WebFormState *)formState andCall:(id)target withSelector:(SEL)selector;
 
 - (void)_checkNavigationPolicyForRequest:(NSURLRequest *)request dataSource:(WebDataSource *)dataSource formState:(WebFormState *)formState andCall:(id)target withSelector:(SEL)selector;
@@ -161,6 +160,9 @@ typedef enum {
 
 - (WebHistoryItem *)_itemForSavingDocState;
 - (WebHistoryItem *)_itemForRestoringDocState;
+
+- (void)_saveDocumentAndScrollState;
+
 - (void)_handleUnimplementablePolicyWithErrorCode:(int)code forURL:(NSURL *)URL;
 
 - (void)_loadDataSource:(WebDataSource *)dataSource withLoadType:(WebFrameLoadType)type formState:(WebFormState *)formState;
diff --git a/WebKit/WebView.subproj/WebFramePrivate.m b/WebKit/WebView.subproj/WebFramePrivate.m
index f439905..8798fd5 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.m
+++ b/WebKit/WebView.subproj/WebFramePrivate.m
@@ -1931,6 +1931,21 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
     return nil;
 }
 
+// Walk the frame tree, telling all frames to save their form state into their current
+// history item.
+- (void)_saveDocumentAndScrollState
+{
+    [_private->bridge saveDocumentState];
+    [self _saveScrollPositionToItem:[_private currentItem]];
+
+    NSArray *frames = [self children];
+    int count = [frames count];
+    int i;
+    for (i = 0; i < count; i++) {
+        [[frames objectAtIndex:i] _saveDocumentAndScrollState];
+    }
+}
+
 // Called after the FormsDelegate is done processing willSubmitForm:
 -(void)_continueAfterWillSubmitForm:(WebPolicyAction)policy
 {
diff --git a/WebKit/WebView.subproj/WebView.m b/WebKit/WebView.subproj/WebView.m
index fd52b6a..3bf62f4 100644
--- a/WebKit/WebView.subproj/WebView.m
+++ b/WebKit/WebView.subproj/WebView.m
@@ -241,16 +241,6 @@ NSString *WebElementLinkTitleKey = 		@"WebElementLinkTitle";
     _private->useBackForwardList = flag;
 }
 
-- (void)_goToItem: (WebHistoryItem *)item withLoadType: (WebFrameLoadType)type
-{
-    // We never go back/forward on a per-frame basis, so the target must be the main frame
-    ASSERT([item target] == nil || [self _findFrameNamed:[item target]] == [self mainFrame]);
-
-    // abort any current load if we're going back/forward
-    [[self mainFrame] stopLoading];
-    [[self mainFrame] _goToItem: item withLoadType: type];
-}
-
 - (BOOL)goBack
 {
     WebHistoryItem *item = [[self backForwardList] backItem];
diff --git a/WebKit/WebView.subproj/WebViewPrivate.h b/WebKit/WebView.subproj/WebViewPrivate.h
index ced862c..f849f7c 100644
--- a/WebKit/WebView.subproj/WebViewPrivate.h
+++ b/WebKit/WebView.subproj/WebViewPrivate.h
@@ -4,6 +4,7 @@
 */
 #import <WebKit/WebPolicyDelegate.h>
 #import <WebKit/WebView.h>
+#import <WebKit/WebFramePrivate.h>
 
 @class WebBackForwardList;
 @class WebError;
@@ -129,6 +130,21 @@ typedef struct _WebResourceDelegateImplementationCache {
 
 - (void)_mouseDidMoveOverElement:(NSDictionary *)dictionary modifierFlags:(unsigned)modifierFlags;
 
+/*!
+Could be worth adding to the API.
+    @method loadItem:showingInView:
+    @abstract Loads the view with the contents described by the item, including frame content
+        described by child items.
+    @param item   The item to load.  It is not retained, but a copy will appear in the
+        BackForwardList on this WebView.
+    @param otherView   An optional WebView where the item is currently showing.  If this is
+        specified, the resulting load will have the same scroll position and form state
+        as present in otherView.
+*/
+- (void)_loadItem:(WebHistoryItem *)item showingInView:(WebView *)otherView;
+
+- (void)_goToItem: (WebHistoryItem *)item withLoadType: (WebFrameLoadType)type;
+
 // May well become public
 - (void)_setFormDelegate: (id<WebFormDelegate>)delegate;
 - (id<WebFormDelegate>)_formDelegate;
diff --git a/WebKit/WebView.subproj/WebViewPrivate.m b/WebKit/WebView.subproj/WebViewPrivate.m
index 8f3b9af..393644c 100644
--- a/WebKit/WebView.subproj/WebViewPrivate.m
+++ b/WebKit/WebView.subproj/WebViewPrivate.m
@@ -16,6 +16,7 @@
 #import <WebKit/WebFormDelegatePrivate.h>
 #import <WebKit/WebFramePrivate.h>
 #import <WebKit/WebFrameViewPrivate.h>
+#import <WebKit/WebHistoryItemPrivate.h>
 #import <WebKit/WebLocationChangeDelegate.h>
 #import <WebKit/WebPreferencesPrivate.h>
 #import <WebKit/WebResourceLoadDelegate.h>
@@ -344,6 +345,39 @@
     _private->lastElementWasNonNil = dictionary != nil;
 }
 
+- (void)_goToItem:(WebHistoryItem *)item withLoadType:(WebFrameLoadType)type
+{
+    // We never go back/forward on a per-frame basis, so the target must be the main frame
+    ASSERT([item target] == nil || [self _findFrameNamed:[item target]] == [self mainFrame]);
+
+    // abort any current load if we're going back/forward
+    [[self mainFrame] stopLoading];
+    [[self mainFrame] _goToItem:item withLoadType:type];
+}
+
+- (void)_loadItem:(WebHistoryItem *)item showingInView:(WebView *)otherView
+{
+    // It turns out the right combination of behavior is done with the back/forward load
+    // type.  (See behavior matrix at the top of WebFramePrivate.)  So we put this item in
+    // the back forward list, and go there.
+
+    if (otherView && [[otherView backForwardList] currentItem] == item) {
+        // If this item is showing somewhere, save away its current scroll and form state
+        [[otherView mainFrame] _saveDocumentAndScrollState];
+    }
+
+    WebHistoryItem *newItem = [item copy];	// Makes a deep copy, happily
+    // Make the top item the target.  This ensures we reload all frames if we go forward and
+    // back to this item later, which seems good for the first page of a window, where this
+    // feature is typically used.
+    [[item targetItem] setIsTargetItem:NO];
+    [item setIsTargetItem:YES];
+    
+    [[self backForwardList] addItem:newItem];
+
+    [self _goToItem:newItem withLoadType:WebFrameLoadTypeIndexedBackForward];
+}
+
 - (void)_setFormDelegate: (id<WebFormDelegate>)delegate
 {
     _private->formDelegate = delegate;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list