Reviewed by Trey.
authorsullivan <sullivan@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Jul 2004 17:41:26 +0000 (17:41 +0000)
committersullivan <sullivan@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Jul 2004 17:41:26 +0000 (17:41 +0000)
        - fixed these bugs:
        <rdar://problem/3709110> REGRESSION (Tiger): Pressing Tab key to move focus
        onto links skips every other link
        <rdar://problem/3692576> focus ring is in odd place after clicking RSS button
        with "Tab to links" enabled

        WebHTMLView has some trickery by which we advance the focused link when nextKeyView
        or previousKeyView is called within nextValidKeyView or previousValidKeyView. This
        broke in Tiger because AppKit now (sometimes at least) calls nextKeyView more than
        once within nextValidKeyView. Fixed 3709110 by making sure we only advance the focus
        once within a call to nextValidKeyView or previousValidKeyView.

        Also, this same trickery didn't work right with hidden views. Fixed 3692576 by checking
        whether the view is hidden and bypassing the focus-moving trickery in that case.

        * WebView.subproj/WebHTMLViewInternal.h:
        renamed inNextValidKeyView -> nextKeyViewAccessShouldMoveFocus

        * WebView.subproj/WebHTMLView.m:
        (-[WebHTMLView nextKeyView]):
        now clears nextKeyViewAccessShouldMoveFocus
        (-[WebHTMLView previousKeyView]):
        ditto
        (-[WebHTMLView nextValidKeyView]):
        now doesn't set focus-moving trigger ivar if view is hidden or has hidden ancestor
        (-[WebHTMLView previousValidKeyView]):
        ditto

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

WebKit/ChangeLog
WebKit/WebView.subproj/WebHTMLView.m
WebKit/WebView.subproj/WebHTMLViewInternal.h

index 5ff93bda181c2dec452f26f2241092ad2a510b68..a0c362dbe2d55673af6c144d2135ed82011e1946 100644 (file)
@@ -1,3 +1,35 @@
+2004-07-01  John Sullivan  <sullivan@apple.com>
+
+        Reviewed by Trey.
+        
+        - fixed these bugs:
+        <rdar://problem/3709110> REGRESSION (Tiger): Pressing Tab key to move focus 
+        onto links skips every other link
+        <rdar://problem/3692576> focus ring is in odd place after clicking RSS button 
+        with "Tab to links" enabled
+        
+        WebHTMLView has some trickery by which we advance the focused link when nextKeyView
+        or previousKeyView is called within nextValidKeyView or previousValidKeyView. This
+        broke in Tiger because AppKit now (sometimes at least) calls nextKeyView more than
+        once within nextValidKeyView. Fixed 3709110 by making sure we only advance the focus 
+        once within a call to nextValidKeyView or previousValidKeyView.
+        
+        Also, this same trickery didn't work right with hidden views. Fixed 3692576 by checking
+        whether the view is hidden and bypassing the focus-moving trickery in that case.
+
+        * WebView.subproj/WebHTMLViewInternal.h:
+        renamed inNextValidKeyView -> nextKeyViewAccessShouldMoveFocus
+        
+        * WebView.subproj/WebHTMLView.m:
+        (-[WebHTMLView nextKeyView]):
+        now clears nextKeyViewAccessShouldMoveFocus
+        (-[WebHTMLView previousKeyView]):
+        ditto
+        (-[WebHTMLView nextValidKeyView]):
+        now doesn't set focus-moving trigger ivar if view is hidden or has hidden ancestor
+        (-[WebHTMLView previousValidKeyView]):
+        ditto
+
 2004-06-30  Trey Matteson  <trey@apple.com>
 
        Dragging within a web view should be allowed to start when the window isn't key.
index 20ef8f35093246783c2ff4920003632577dfa9be..b50e6278f7cc037d3bfb2a3e57d12e0560a2f2fb 100644 (file)
@@ -1999,31 +1999,41 @@ static WebHTMLView *lastHitView = nil;
 
 - (NSView *)nextKeyView
 {
-    return (_private && _private->inNextValidKeyView && ![[self _bridge] inNextKeyViewOutsideWebFrameViews])
-        ? [[self _bridge] nextKeyView]
-        : [super nextKeyView];
+    if (_private && _private->nextKeyViewAccessShouldMoveFocus && ![[self _bridge] inNextKeyViewOutsideWebFrameViews]) {
+        _private->nextKeyViewAccessShouldMoveFocus = NO;
+        return [[self _bridge] nextKeyView];
+    }
+    
+    return [super nextKeyView];
 }
 
 - (NSView *)previousKeyView
 {
-    return (_private && _private->inNextValidKeyView)
-        ? [[self _bridge] previousKeyView]
-        : [super previousKeyView];
+    if (_private && _private->nextKeyViewAccessShouldMoveFocus) {
+        _private->nextKeyViewAccessShouldMoveFocus = NO;
+        return [[self _bridge] previousKeyView];
+    }
+        
+    return [super previousKeyView];
 }
 
 - (NSView *)nextValidKeyView
 {
-    _private->inNextValidKeyView = YES;
+    if (![self isHiddenOrHasHiddenAncestor]) {
+        _private->nextKeyViewAccessShouldMoveFocus = YES;
+    }
     NSView *view = [super nextValidKeyView];
-    _private->inNextValidKeyView = NO;
+    _private->nextKeyViewAccessShouldMoveFocus = NO;
     return view;
 }
 
 - (NSView *)previousValidKeyView
 {
-    _private->inNextValidKeyView = YES;
+    if (![self isHiddenOrHasHiddenAncestor]) {
+        _private->nextKeyViewAccessShouldMoveFocus = YES;
+    }
     NSView *view = [super previousValidKeyView];
-    _private->inNextValidKeyView = NO;
+    _private->nextKeyViewAccessShouldMoveFocus = NO;
     return view;
 }
 
index 1aed5dc7992b04a507d425a3f5eff21483737082..4dd24054dfa08c31e607497b533d142d86b32927 100644 (file)
@@ -8,7 +8,7 @@
     BOOL needsLayout;
     BOOL needsToApplyStyles;
     BOOL inWindow;
-    BOOL inNextValidKeyView;
+    BOOL nextKeyViewAccessShouldMoveFocus;
     BOOL ignoringMouseDraggedEvents;
     BOOL printing;
     BOOL initiatedDrag;