[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:11:34 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 758c91bd820de8d1666b3a5be3f5af996e6ee8cc
Author: kocienda <kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Nov 14 00:34:57 2003 +0000

    WebCore:
    
            Reviewed by John
    
    	Fix for this bug:
    
    	<rdar://problem/3483284>: Tabbing to links needs to honor new
    	WebKit tab-to-links preference
    
    	In addition to fixing the bug, I also did a bit of cleanup
    	in the code which helps to determine tab order.
    
    	Biggest change is to modify the keyboard UI mode function so
    	that it is a set of flags, rather than a straight-up value.
    
    	I also tweaked the names on the keyboard UI mode constants
    	to make them read better.
    
            * kwq/KWQButton.mm:
            (QButton::focusPolicy): Tweaks to make more readable and use
    	new model for keyboard UI mode.
            * kwq/KWQComboBox.mm:
            (QComboBox::focusPolicy): Ditto. Plus, this function was not
    	blocking exceptions.
            * kwq/KWQFileButton.mm:
            (KWQFileButton::focusPolicy): Tweaks to make more readable and use
            new model for keyboard UI mode.
            * kwq/KWQKHTMLPart.h:
            * kwq/KWQKHTMLPart.mm:
            (KWQKHTMLPart::nextKeyViewInFrame): Now checks new tabsToLinks
    	function to determine if links can be tabbed to.
            (KWQKHTMLPart::currentEventIsKeyboardOptionTab): New function
    	checks for option-tab keyboard event.
            (KWQKHTMLPart::tabsToLinks): New helper to take keyboard UI mode
    	and option-tab into account.
            (KWQKHTMLPart::keyboardUIMode): Name tweak.
            * kwq/KWQListBox.mm: Tweaks to make more readable and use
            new model for keyboard UI mode.
            (QListBox::focusPolicy):
            * kwq/WebCoreKeyboardAccess.h: Tweaked names. Added WebCoreKeyboardAccessTabsToLinks.
    
    WebKit:
    
            Reviewed by John
    
    	Fix for this bug:
    
    	<rdar://problem/3483284>: Tabbing to links needs to honor new
    	WebKit tab-to-links preference
    
            * WebCoreSupport.subproj/WebBridge.m:
            (-[WebBridge dealloc]): Remove self from notification center.
            (-[WebBridge _retrieveKeyboardUIModeFromPreferences:]): Now
    	checks for WebCoreKeyboardAccessTabsToLinks preference.
            (-[WebBridge keyboardUIMode]): Adds self to notification center
    	to pick up changes to WebPreferences.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5483 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 8dd4dc5..10cbe76 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,44 @@
+2003-11-13  Ken Kocienda  <kocienda at apple.com>
+
+        Reviewed by John
+	
+	Fix for this bug:
+
+	<rdar://problem/3483284>: Tabbing to links needs to honor new 
+	WebKit tab-to-links preference
+
+	In addition to fixing the bug, I also did a bit of cleanup
+	in the code which helps to determine tab order.
+
+	Biggest change is to modify the keyboard UI mode function so
+	that it is a set of flags, rather than a straight-up value.
+
+	I also tweaked the names on the keyboard UI mode constants
+	to make them read better.
+
+        * kwq/KWQButton.mm:
+        (QButton::focusPolicy): Tweaks to make more readable and use 
+	new model for keyboard UI mode.
+        * kwq/KWQComboBox.mm:
+        (QComboBox::focusPolicy): Ditto. Plus, this function was not
+	blocking exceptions.
+        * kwq/KWQFileButton.mm:
+        (KWQFileButton::focusPolicy): Tweaks to make more readable and use 
+        new model for keyboard UI mode.
+        * kwq/KWQKHTMLPart.h:
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::nextKeyViewInFrame): Now checks new tabsToLinks
+	function to determine if links can be tabbed to.
+        (KWQKHTMLPart::currentEventIsKeyboardOptionTab): New function
+	checks for option-tab keyboard event.
+        (KWQKHTMLPart::tabsToLinks): New helper to take keyboard UI mode
+	and option-tab into account.
+        (KWQKHTMLPart::keyboardUIMode): Name tweak.
+        * kwq/KWQListBox.mm: Tweaks to make more readable and use 
+        new model for keyboard UI mode.
+        (QListBox::focusPolicy):
+        * kwq/WebCoreKeyboardAccess.h: Tweaked names. Added WebCoreKeyboardAccessTabsToLinks.
+
 2003-11-13  David Hyatt  <hyatt at apple.com>
 
 	Implement a custom unfurl marquee style.
diff --git a/WebCore/kwq/KWQButton.mm b/WebCore/kwq/KWQButton.mm
index 52da923..e1621d5 100644
--- a/WebCore/kwq/KWQButton.mm
+++ b/WebCore/kwq/KWQButton.mm
@@ -320,9 +320,10 @@ QWidget::FocusPolicy QButton::focusPolicy() const
     // Add an additional check here.
     // For now, buttons are only focused when full
     // keyboard access is turned on.
-    if (![KWQKHTMLPart::bridgeForWidget(this) keyboardUIMode] == WebCoreFullKeyboardAccess)
+    unsigned keyboardUIMode = [KWQKHTMLPart::bridgeForWidget(this) keyboardUIMode];
+    if ((keyboardUIMode & WebCoreKeyboardAccessFull) == 0)
         return NoFocus;
-
+    
     KWQ_UNBLOCK_EXCEPTIONS;
 
     return QWidget::focusPolicy();
diff --git a/WebCore/kwq/KWQComboBox.mm b/WebCore/kwq/KWQComboBox.mm
index 2cf9101..f8c1bfd 100644
--- a/WebCore/kwq/KWQComboBox.mm
+++ b/WebCore/kwq/KWQComboBox.mm
@@ -279,12 +279,17 @@ const int *QComboBox::dimensions() const
 
 QWidget::FocusPolicy QComboBox::focusPolicy() const
 {
+    KWQ_BLOCK_EXCEPTIONS;
+    
     // Add an additional check here.
     // For now, selects are only focused when full
     // keyboard access is turned on.
-    if ([KWQKHTMLPart::bridgeForWidget(this) keyboardUIMode] != WebCoreFullKeyboardAccess)
+    unsigned keyboardUIMode = [KWQKHTMLPart::bridgeForWidget(this) keyboardUIMode];
+    if ((keyboardUIMode & WebCoreKeyboardAccessFull) == 0)
         return NoFocus;
-
+    
+    KWQ_UNBLOCK_EXCEPTIONS;
+    
     return QWidget::focusPolicy();
 }
 
diff --git a/WebCore/kwq/KWQFileButton.mm b/WebCore/kwq/KWQFileButton.mm
index dc1f906..d814231 100644
--- a/WebCore/kwq/KWQFileButton.mm
+++ b/WebCore/kwq/KWQFileButton.mm
@@ -122,15 +122,16 @@ int KWQFileButton::baselinePosition(int height) const
 QWidget::FocusPolicy KWQFileButton::focusPolicy() const
 {
     KWQ_BLOCK_EXCEPTIONS;
-
+    
     // Add an additional check here.
-    // For now, buttons are only focused when full
+    // For now, file buttons are only focused when full
     // keyboard access is turned on.
-    if (![KWQKHTMLPart::bridgeForWidget(this) keyboardUIMode] == WebCoreFullKeyboardAccess)
+    unsigned keyboardUIMode = [KWQKHTMLPart::bridgeForWidget(this) keyboardUIMode];
+    if ((keyboardUIMode & WebCoreKeyboardAccessFull) == 0)
         return NoFocus;
-
+    
     KWQ_UNBLOCK_EXCEPTIONS;
-
+    
     return QWidget::focusPolicy();
 }
 
diff --git a/WebCore/kwq/KWQKHTMLPart.h b/WebCore/kwq/KWQKHTMLPart.h
index 0a631a1..019b744 100644
--- a/WebCore/kwq/KWQKHTMLPart.h
+++ b/WebCore/kwq/KWQKHTMLPart.h
@@ -147,6 +147,8 @@ public:
     NSView *nextKeyView(DOM::NodeImpl *startingPoint, KWQSelectionDirection);
     NSView *nextKeyViewInFrameHierarchy(DOM::NodeImpl *startingPoint, KWQSelectionDirection);
     static NSView *nextKeyViewForWidget(QWidget *startingPoint, KWQSelectionDirection);
+    static bool currentEventIsKeyboardOptionTab();
+    bool tabsToLinks();
     
     static bool currentEventIsMouseDownInWidget(QWidget *candidate);
     
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 62f4cac..32e6aae 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -950,7 +950,7 @@ NSView *KWQKHTMLPart::nextKeyViewInFrame(NodeImpl *node, KWQSelectionDirection d
                 }
             }
         }
-        else if ([_bridge keyboardUIMode] == WebCoreFullKeyboardAccess) {
+        else if (tabsToLinks()) {
             doc->setFocusNode(node);
             if (view()) {
                 QRect rect = node->getRect();
@@ -1034,12 +1034,45 @@ bool KWQKHTMLPart::currentEventIsMouseDownInWidget(QWidget *candidate)
             return NO;
     }
     KWQ_UNBLOCK_EXCEPTIONS;
-
+    
     NodeImpl *node = nodeForWidget(candidate);
     ASSERT(node);
     return partForNode(node)->nodeUnderMouse() == node;
 }
 
+bool KWQKHTMLPart::currentEventIsKeyboardOptionTab()
+{
+    KWQ_BLOCK_EXCEPTIONS;
+    NSEvent *evt = [NSApp currentEvent];
+    if ([evt type] != NSKeyDown) {
+        return NO;
+    }
+
+    if (([evt modifierFlags] & NSAlternateKeyMask) == 0) {
+        return NO;
+    }
+    
+    NSString *chars = [evt charactersIgnoringModifiers];
+    if ([chars length] != 1)
+        return NO;
+    
+    const unichar tabKey = 0x0009;
+    const unichar shiftTabKey = 0x0019;
+    unichar c = [chars characterAtIndex:0];
+    if (c != tabKey && c != shiftTabKey)
+        return NO;
+    
+    KWQ_UNBLOCK_EXCEPTIONS;
+    return YES;
+}
+
+bool KWQKHTMLPart::tabsToLinks()
+{
+    if ([_bridge keyboardUIMode] & WebCoreKeyboardAccessTabsToLinks)
+        return !KWQKHTMLPart::currentEventIsKeyboardOptionTab();
+    else
+        return KWQKHTMLPart::currentEventIsKeyboardOptionTab();
+}
 
 QMap<int, ScheduledAction*> *KWQKHTMLPart::pauseActions(const void *key)
 {
@@ -2684,7 +2717,7 @@ WebCoreKeyboardUIMode KWQKHTMLPart::keyboardUIMode() const
     return [_bridge keyboardUIMode];
     KWQ_UNBLOCK_EXCEPTIONS;
 
-    return WebCoreDefaultKeyboardAccess;
+    return WebCoreKeyboardAccessDefault;
 }
 
 void KWQKHTMLPart::setName(const QString &name)
diff --git a/WebCore/kwq/KWQListBox.mm b/WebCore/kwq/KWQListBox.mm
index 5c9a277..196377a 100644
--- a/WebCore/kwq/KWQListBox.mm
+++ b/WebCore/kwq/KWQListBox.mm
@@ -319,15 +319,17 @@ QSize QListBox::sizeForNumberOfLines(int lines) const
 
 QWidget::FocusPolicy QListBox::focusPolicy() const
 {
+    KWQ_BLOCK_EXCEPTIONS;
+    
     // Add an additional check here.
     // For now, selects are only focused when full
     // keyboard access is turned on.
-
-    KWQ_BLOCK_EXCEPTIONS;
-    if (![KWQKHTMLPart::bridgeForWidget(this) keyboardUIMode] == WebCoreFullKeyboardAccess)
-	return NoFocus;
+    unsigned keyboardUIMode = [KWQKHTMLPart::bridgeForWidget(this) keyboardUIMode];
+    if ((keyboardUIMode & WebCoreKeyboardAccessFull) == 0)
+        return NoFocus;
+    
     KWQ_UNBLOCK_EXCEPTIONS;
-
+    
     return QScrollView::focusPolicy();
 }
 
diff --git a/WebCore/kwq/WebCoreKeyboardAccess.h b/WebCore/kwq/WebCoreKeyboardAccess.h
index bf4d824..19bd74f 100644
--- a/WebCore/kwq/WebCoreKeyboardAccess.h
+++ b/WebCore/kwq/WebCoreKeyboardAccess.h
@@ -24,6 +24,8 @@
  */
 
 typedef enum {
-    WebCoreDefaultKeyboardAccess,
-    WebCoreFullKeyboardAccess
+    WebCoreKeyboardAccessDefault     = 0x00000000,
+    WebCoreKeyboardAccessFull        = 0x00000001,
+    // this flag may be or'ed with either of the two above
+    WebCoreKeyboardAccessTabsToLinks = 0x10000000, 
 } WebCoreKeyboardUIMode;
\ No newline at end of file
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index a796f70..b1cb265 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -4,6 +4,22 @@
 
 	Fix for this bug:
 
+	<rdar://problem/3483284>: Tabbing to links needs to honor new 
+	WebKit tab-to-links preference
+
+        * WebCoreSupport.subproj/WebBridge.m:
+        (-[WebBridge dealloc]): Remove self from notification center.
+        (-[WebBridge _retrieveKeyboardUIModeFromPreferences:]): Now
+	checks for WebCoreKeyboardAccessTabsToLinks preference.
+        (-[WebBridge keyboardUIMode]): Adds self to notification center
+	to pick up changes to WebPreferences.
+
+2003-11-13  Ken Kocienda  <kocienda at apple.com>
+
+        Reviewed by John
+
+	Fix for this bug:
+
 	<rdar://problem/3481719>: WebKit needs preference for tabbing to links
 
         * WebView.subproj/WebPreferences.m:
diff --git a/WebKit/WebCoreSupport.subproj/WebBridge.m b/WebKit/WebCoreSupport.subproj/WebBridge.m
index e35173e..e59ac05 100644
--- a/WebKit/WebCoreSupport.subproj/WebBridge.m
+++ b/WebKit/WebCoreSupport.subproj/WebBridge.m
@@ -91,6 +91,8 @@
     if (_keyboardUIModeAccessed) {
         [[NSDistributedNotificationCenter defaultCenter] 
             removeObserver:self name:KeyboardUIModeDidChangeNotification object:nil];
+        [[NSNotificationCenter defaultCenter] 
+            removeObserver:self name:WebPreferencesChangedNotification object:nil];
     }
     
     --WebBridgeCount;
@@ -998,7 +1000,12 @@ static id <WebFormDelegate> formDelegate(WebBridge *self)
     // I do not know that we would ever get one bit on and the other off since
     // checking the checkbox in system preferences which is marked as "Turn on full keyboard access"
     // turns on both bits.
-    _keyboardUIMode = (mode & 0x2) ? WebCoreFullKeyboardAccess : WebCoreDefaultKeyboardAccess;
+    _keyboardUIMode = (mode & 0x2) ? WebCoreKeyboardAccessFull : WebCoreKeyboardAccessDefault;
+    
+    // check for tabbing to links
+    if ([[WebPreferences standardPreferences] tabsToLinks]) {
+        _keyboardUIMode |= WebCoreKeyboardAccessTabsToLinks;
+    }
 }
 
 - (WebCoreKeyboardUIMode)keyboardUIMode
@@ -1010,6 +1017,10 @@ static id <WebFormDelegate> formDelegate(WebBridge *self)
         [[NSDistributedNotificationCenter defaultCenter] 
             addObserver:self selector:@selector(_retrieveKeyboardUIModeFromPreferences:) 
             name:KeyboardUIModeDidChangeNotification object:nil];
+
+        [[NSNotificationCenter defaultCenter] 
+            addObserver:self selector:@selector(_retrieveKeyboardUIModeFromPreferences:) 
+                   name:WebPreferencesChangedNotification object:nil];
     }
     return _keyboardUIMode;
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list