Reviewed by Eric.
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Dec 2005 08:19:32 +0000 (08:19 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Dec 2005 08:19:32 +0000 (08:19 +0000)
- move a few more methods from WebView to WebFrame.

        * WebView.subproj/WebFrame.m:
        (-[WebFrame _hasSelection]): Renamed from _frameIsSelected: and moved from
WebView.
        (-[WebFrame _clearSelection]): Renamed from _deselectFrame: and moved from
WebView.
        * WebView.subproj/WebFrameInternal.h:
        * WebView.subproj/WebView.m:
        (-[WebView searchFor:direction:caseSensitive:wrap:]): Update for renames.
        (-[WebView _findSelectedFrameStartingFromFrame:skippingFrame:]): Ditto.
        (-[WebView _debugCollectSelectedFramesIntoArray:startingFromFrame:]): Ditto.
        (-[WebView _selectedFrameDidChange]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@11745 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/ChangeLog
WebKit/WebView.subproj/WebFrame.m
WebKit/WebView.subproj/WebFrameInternal.h
WebKit/WebView.subproj/WebView.m

index 5e048237f0fd47d3690b3cd8eccee7ed10dbe5c6..f3d3d9eb8e7eced3d442f1ff6a9198e2b75b6b2f 100644 (file)
@@ -1,3 +1,21 @@
+2005-12-22  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Eric.
+
+       - move a few more methods from WebView to WebFrame.     
+
+        * WebView.subproj/WebFrame.m:
+        (-[WebFrame _hasSelection]): Renamed from _frameIsSelected: and moved from
+       WebView.
+        (-[WebFrame _clearSelection]): Renamed from _deselectFrame: and moved from 
+       WebView.
+        * WebView.subproj/WebFrameInternal.h:
+        * WebView.subproj/WebView.m:
+        (-[WebView searchFor:direction:caseSensitive:wrap:]): Update for renames.
+        (-[WebView _findSelectedFrameStartingFromFrame:skippingFrame:]): Ditto.
+        (-[WebView _debugCollectSelectedFramesIntoArray:startingFromFrame:]): Ditto.
+        (-[WebView _selectedFrameDidChange]):
+
 2005-12-21  Timothy Hatcher  <timothy@apple.com>
 
         * WebKit.xcodeproj/project.pbxproj:
index 34d93a3ba601ce4d7cd8f24bf6c1accbc3877d0d..fe778676f01de7d2078e3937c3dd697d94079c92 100644 (file)
@@ -2809,6 +2809,31 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
     return _private->frameNamespace;
 }
 
+- (BOOL)_hasSelection
+{
+    id documentView = [[self frameView] documentView];    
+    
+    // optimization for common case to avoid creating potentially large selection string
+    if ([documentView isKindOfClass:[WebHTMLView class]]) {
+        DOMRange *selectedDOMRange = [[self _bridge] selectedDOMRange];
+        return selectedDOMRange && ![selectedDOMRange collapsed];
+    }
+    
+    if ([documentView conformsToProtocol:@protocol(WebDocumentText)]) {
+        return [[documentView selectedString] length] > 0;
+    }
+    
+    return NO;
+}
+
+- (void)_clearSelection
+{
+    id documentView = [[self frameView] documentView];    
+    if ([documentView conformsToProtocol:@protocol(WebDocumentText)]) {
+        [documentView deselectAll];
+    }
+}
+
 @end
 
 @implementation WebFormState : NSObject
index a912812ed8956437f777d390d21b061b34b5bb71..fb223c764e1d372a3c523ec1e0217015848b62f1 100644 (file)
@@ -53,6 +53,9 @@
 - (void)_setFrameNamespace:(NSString *)namespace;
 - (NSString *)_frameNamespace;
 
+- (BOOL)_hasSelection;
+- (void)_clearSelection;
+
 @end
 
 @interface NSObject (WebInternalFrameLoadDelegate)
index 98358940ead7f0766f10977969beb016d0109132..ab992d34308655c2afa3d4a13bb46adcb3aea726 100644 (file)
@@ -298,9 +298,7 @@ macro(yankAndSelect) \
 - (BOOL)_isLoading;
 - (WebFrameView *)_frameViewAtWindowPoint:(NSPoint)point;
 - (WebBridge *)_bridgeAtPoint:(NSPoint)point;
-- (void)_deselectFrame:(WebFrame *)frame;
 - (WebFrame *)_focusedFrame;
-- (BOOL)_frameIsSelected:(WebFrame *)frame;
 - (void)_preflightSpellChecker;
 - (BOOL)_continuousCheckingAllowed;
 - (NSResponder *)_responderForResponderOperations;
@@ -2247,9 +2245,8 @@ static WebFrame *incrementFrame(WebFrame *curr, BOOL forward, BOOL wrapFlag)
             
             if ([searchView searchFor:string direction:forward caseSensitive:caseFlag wrap:NO]) {
                 WebFrame *newSelectedFrame = [(WebFrameView *)[searchView _web_superviewOfClass:[WebFrameView class]] webFrame];
-                if (newSelectedFrame != startFrame) {
-                    [self _deselectFrame:startFrame];
-                }
+                if (newSelectedFrame != startFrame)
+                    [startFrame _clearSelection];
                 [[self window] makeFirstResponder:searchView];
                 return YES;
             }
@@ -3022,34 +3019,9 @@ FOR_EACH_RESPONDER_SELECTOR(FORWARD)
     return nil;
 }
 
-- (BOOL)_frameIsSelected:(WebFrame *)frame
-{
-    id documentView = [[frame frameView] documentView];    
-    
-    // optimization for common case to avoid creating potentially large selection string
-    if ([documentView isKindOfClass:[WebHTMLView class]]) {
-        DOMRange *selectedDOMRange = [[frame _bridge] selectedDOMRange];
-        return selectedDOMRange && ![selectedDOMRange collapsed];
-    }
-    
-    if ([documentView conformsToProtocol:@protocol(WebDocumentText)]) {
-        return [[documentView selectedString] length] > 0;
-    }
-    
-    return NO;
-}
-
-- (void)_deselectFrame:(WebFrame *)frame
-{
-    id documentView = [[frame frameView] documentView];    
-    if ([documentView conformsToProtocol:@protocol(WebDocumentText)]) {
-        [documentView deselectAll];
-    }
-}
-
 - (WebFrame *)_findSelectedFrameStartingFromFrame:(WebFrame *)frame skippingFrame:(WebFrame *)frameToSkip
 {
-    if (frame != frameToSkip && [self _frameIsSelected:frame]) {
+    if (frame != frameToSkip && [frame _hasSelection]) {
         return frame;
     }
     
@@ -3079,9 +3051,8 @@ FOR_EACH_RESPONDER_SELECTOR(FORWARD)
 #ifndef DEBUG
 - (void)_debugCollectSelectedFramesIntoArray:(NSMutableArray *)selectedFrames startingFromFrame:(WebFrame *)frame
 {
-    if ([self _frameIsSelected:frame]) {
+    if ([frame _hasSelection])
         [selectedFrames addObject:frame];
-    }
     
     NSArray *frames = [frame _internalChildFrames];
     int i;
@@ -3269,7 +3240,7 @@ FOR_EACH_RESPONDER_SELECTOR(FORWARD)
     // We rely on WebDocumentSelection protocol implementors to call this method when they become first 
     // responder. It would be nicer to just notice first responder changes here instead, but there's no 
     // notification sent when the first responder changes in general (Radar 2573089).
-    [self _deselectFrame:[self _findSelectedFrameSkippingFrame:[self _focusedFrame]]];
+    [[self _findSelectedFrameSkippingFrame:[self _focusedFrame]] _clearSelection];
 
 #ifndef NDEBUG
     // While we're in the general area of selection and frames, check that there is only one now.