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

kocienda kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:41:40 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 037d6176f4879ad26ade5925c2ec51cc623b6a58
Author: kocienda <kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue May 25 18:27:23 2004 +0000

            Reviewed by John
    
            Improve _bridgeForCurrentSelection so that it is frame-savvy.
            Fixup setSelectedDOMRange:affinity: so that it uses the right bridge.
    
            * WebView.subproj/WebView.m:
            (-[WebView _bridgeForCurrentSelection]): Use _currentFrame not mainFrame.
            (-[WebView _currentFrame]): Moved to WebView (WebInternal) category so _bridgeForCurrentSelection can use it.
            (-[WebView setSelectedDOMRange:affinity:]): Derive the bridge to use from the range passed in; _bridgeForCurrentSelection
            is not the right way to get at the document for the range.
            * WebView.subproj/WebViewInternal.h: Add _currentFrame declaration.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6681 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index ee99ccf..f437f77 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,17 @@
+2004-05-25  Ken Kocienda  <kocienda at apple.com>
+
+        Reviewed by John
+        
+        Improve _bridgeForCurrentSelection so that it is frame-savvy.
+        Fixup setSelectedDOMRange:affinity: so that it uses the right bridge.
+
+        * WebView.subproj/WebView.m:
+        (-[WebView _bridgeForCurrentSelection]): Use _currentFrame not mainFrame. 
+        (-[WebView _currentFrame]): Moved to WebView (WebInternal) category so _bridgeForCurrentSelection can use it.
+        (-[WebView setSelectedDOMRange:affinity:]): Derive the bridge to use from the range passed in; _bridgeForCurrentSelection
+        is not the right way to get at the document for the range.
+        * WebView.subproj/WebViewInternal.h: Add _currentFrame declaration.
+
 2004-05-24  Darin Adler  <darin at apple.com>
 
         Reviewed by Ken.
diff --git a/WebKit/WebView.subproj/WebView.m b/WebKit/WebView.subproj/WebView.m
index ddd04b7..0e07f0a 100644
--- a/WebKit/WebView.subproj/WebView.m
+++ b/WebKit/WebView.subproj/WebView.m
@@ -19,6 +19,7 @@
 #import <WebKit/WebDefaultPolicyDelegate.h>
 #import <WebKit/WebDefaultResourceLoadDelegate.h>
 #import <WebKit/WebDefaultUIDelegate.h>
+#import <WebKit/WebDOMOperationsPrivate.h>
 #import <WebKit/WebDocument.h>
 #import <WebKit/WebDocumentInternal.h>
 #import <WebKit/WebDynamicScrollBarsView.h>
@@ -1836,19 +1837,6 @@ NS_ENDHANDLER
     }
 }
 
-// Return the frame holding first responder
-- (WebFrame *)_currentFrame
-{
-    // Find the frame holding the first responder, or holding the first form in the doc
-    NSResponder *resp = [[self window] firstResponder];
-    if (!resp || ![resp isKindOfClass:[NSView class]] || ![(NSView *)resp isDescendantOf:self]) {
-        return nil;	// first responder outside our view tree
-    } else {
-        WebFrameView *frameView = (WebFrameView *)[(NSView *)resp _web_superviewOfClass:[WebFrameView class]];
-        return [frameView webFrame];
-    }
-}
-
 static WebFrame *incrementFrame(WebFrame *curr, BOOL forward, BOOL wrapFlag)
 {
     return forward ? [curr _nextFrameWithWrap:wrapFlag]
@@ -2267,10 +2255,11 @@ static WebFrame *incrementFrame(WebFrame *curr, BOOL forward, BOOL wrapFlag)
     }
 }
 
+// Note: This method should only be used by callers that wish to do nothing if there is no selection or if
+// the selection is outside of the WebView hierarchy.
 - (WebBridge *)_bridgeForCurrentSelection
 {
-    // FIXME: This needs to be changed to deal properly with subframes.
-    return [[self mainFrame] _bridge];
+    return [[self _currentFrame] _bridge];
 }
 
 - (BOOL)_currentSelectionIsEditable
@@ -2295,6 +2284,19 @@ static WebFrame *incrementFrame(WebFrame *curr, BOOL forward, BOOL wrapFlag)
 
 @implementation WebView (WebInternal)
 
+// Return the frame holding first responder
+- (WebFrame *)_currentFrame
+{
+    // Find the frame holding the first responder, or holding the first form in the doc
+    NSResponder *resp = [[self window] firstResponder];
+    if (!resp || ![resp isKindOfClass:[NSView class]] || ![(NSView *)resp isDescendantOf:self]) {
+        return nil;	// first responder outside our view tree
+    } else {
+        WebFrameView *frameView = (WebFrameView *)[(NSView *)resp _web_superviewOfClass:[WebFrameView class]];
+        return [frameView webFrame];
+    }
+}
+
 - (BOOL)_isLoading
 {
     WebFrame *mainFrame = [self mainFrame];
@@ -2439,7 +2441,10 @@ static NSFont *_fontFromStyle(DOMCSSStyleDeclaration *style)
 
 - (void)setSelectedDOMRange:(DOMRange *)range affinity:(NSSelectionAffinity)selectionAffinity
 {
-    [[self _bridgeForCurrentSelection] setSelectedDOMRange:range affinity:selectionAffinity];
+    // Derive the bridge to use from the range passed in.
+    // Using _bridgeForCurrentSelection could give us a different document than
+    // the one the range uses.
+    [[[range startContainer] _bridge] setSelectedDOMRange:range affinity:selectionAffinity];
 }
 
 - (DOMRange *)selectedDOMRange
diff --git a/WebKit/WebView.subproj/WebViewInternal.h b/WebKit/WebView.subproj/WebViewInternal.h
index b4abaa2..40a18c3 100644
--- a/WebKit/WebView.subproj/WebViewInternal.h
+++ b/WebKit/WebView.subproj/WebViewInternal.h
@@ -3,6 +3,7 @@
 #import <WebKit/WebViewPrivate.h>
 
 @interface WebView (WebInternal)
+- (WebFrame *)_currentFrame;
 - (BOOL)_isLoading;
 - (void)_updateFontPanel;
 @end;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list