Reviewed by Darin Adler.
authorap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Mar 2011 21:34:20 +0000 (21:34 +0000)
committerap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Mar 2011 21:34:20 +0000 (21:34 +0000)
        REGRESSION (WebKit2): Tab keys no longer observe Full Keyboard Access
        https://bugs.webkit.org/show_bug.cgi?id=55633
        <rdar://problem/8963023>

        * WebKit2.xcodeproj/project.pbxproj:
        * WebProcess/mac/FullKeyboardAccessWatcher.h: Added.
        * WebProcess/mac/FullKeyboardAccessWatcher.mm: Added.
        (-[FullKeyboardAccessWatcher retrieveKeyboardUIModeFromPreferences:]):
        (-[FullKeyboardAccessWatcher init]):
        (+[FullKeyboardAccessWatcher fullKeyboardAccessEnabled]):
        Get the current state of full keyboard access, listening for change notifications.

        * WebProcess/WebProcess.h:  Added fullKeyboardAccessEnabled().

        * WebProcess/WebProcess.cpp: (WebKit::WebProcess::fullKeyboardAccessEnabled):
        WebKit1 also doesn't implement this on platforms other than Mac.

        * WebProcess/mac/WebProcessMac.mm: (WebKit::WebProcess::fullKeyboardAccessEnabled):
        Just ask FullKeyboardAccessWatcher.

        * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::keyboardUIMode):
        * WebProcess/WebCoreSupport/WebChromeClient.h:
        Added keyboardUIMode(), removed tabsToLinks().

        * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::keyboardUIMode):
        * WebProcess/WebPage/WebPage.h:
        Generate keyboard UI mode from tabToLinks preference and current state of FKA.

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

43 files changed:
Source/WebCore/ChangeLog
Source/WebCore/loader/EmptyClients.h
Source/WebCore/page/ChromeClient.h
Source/WebCore/page/EventHandler.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/ChromeClientImpl.cpp
Source/WebKit/chromium/src/ChromeClientImpl.h
Source/WebKit/efl/ChangeLog
Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp
Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.h
Source/WebKit/gtk/ChangeLog
Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h
Source/WebKit/haiku/ChangeLog
Source/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.cpp
Source/WebKit/haiku/WebCoreSupport/ChromeClientHaiku.h
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebChromeClient.h
Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit/qt/ChangeLog
Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
Source/WebKit/qt/WebCoreSupport/ChromeClientQt.h
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebCoreSupport/WebChromeClient.cpp
Source/WebKit/win/WebCoreSupport/WebChromeClient.h
Source/WebKit/wince/ChangeLog
Source/WebKit/wince/WebCoreSupport/ChromeClientWinCE.cpp
Source/WebKit/wince/WebCoreSupport/ChromeClientWinCE.h
Source/WebKit/wx/ChangeLog
Source/WebKit/wx/WebKitSupport/ChromeClientWx.cpp
Source/WebKit/wx/WebKitSupport/ChromeClientWx.h
Source/WebKit2/ChangeLog
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebProcess.cpp
Source/WebKit2/WebProcess/WebProcess.h
Source/WebKit2/WebProcess/mac/FullKeyboardAccessWatcher.h [new file with mode: 0644]
Source/WebKit2/WebProcess/mac/FullKeyboardAccessWatcher.mm [new file with mode: 0644]
Source/WebKit2/WebProcess/mac/WebProcessMac.mm

index d603ed7..66e40b3 100644 (file)
@@ -1,3 +1,17 @@
+2011-03-02  Alexey Proskuryakov  <ap@apple.com>
+
+        Reviewed by Darin Adler.
+
+        REGRESSION (WebKit2): Tab keys no longer observe Full Keyboard Access
+        https://bugs.webkit.org/show_bug.cgi?id=55633
+        <rdar://problem/8963023>
+
+        * loader/EmptyClients.h: (WebCore::EmptyChromeClient::keyboardUIMode):
+        * page/ChromeClient.h:
+        * page/EventHandler.cpp: (WebCore::EventHandler::tabsToLinks):
+        Merged tabsToLinks() and keyboardUIMode(). The latter returned a superset of information
+        returned by former.
+
 2011-03-03  Dimitri Glazkov  <dglazkov@chromium.org>
 
         Fix Win compile break, caused by r80276.
index f8bbabb..ce95c9c 100644 (file)
@@ -152,7 +152,7 @@ public:
 
     virtual void setStatusbarText(const String&) { }
 
-    virtual bool tabsToLinks() const { return false; }
+    virtual KeyboardUIMode keyboardUIMode() { return KeyboardAccessDefault; }
 
     virtual IntRect windowResizerRect() const { return IntRect(); }
 
index 01bbd78..35aaa59 100644 (file)
@@ -132,7 +132,7 @@ namespace WebCore {
         virtual bool runJavaScriptPrompt(Frame*, const String& message, const String& defaultValue, String& result) = 0;
         virtual void setStatusbarText(const String&) = 0;
         virtual bool shouldInterruptJavaScript() = 0;
-        virtual bool tabsToLinks() const = 0;
+        virtual KeyboardUIMode keyboardUIMode() = 0;
 
 #if ENABLE(REGISTER_PROTOCOL_HANDLER)
         virtual void registerProtocolHandler(const String& scheme, const String& baseURL, const String& url, const String& title) = 0;
@@ -277,8 +277,6 @@ namespace WebCore {
 #endif
 
 #if PLATFORM(MAC)
-        virtual KeyboardUIMode keyboardUIMode() { return KeyboardAccessDefault; }
-
         virtual NSResponder *firstResponder() { return 0; }
         virtual void makeFirstResponder(NSResponder *) { }
 
index 1a4eabb..727426e 100644 (file)
@@ -2753,7 +2753,7 @@ bool EventHandler::tabsToLinks(KeyboardEvent* event) const
     if (!page)
         return false;
 
-    bool tabsToLinksClientCallResult = page->chrome()->client()->tabsToLinks();
+    bool tabsToLinksClientCallResult = page->chrome()->client()->keyboardUIMode() & KeyboardAccessTabsToLinks;
     return eventInvertsTabsToLinksClientCallResult(event) ? !tabsToLinksClientCallResult : tabsToLinksClientCallResult;
 }
 
index 9194076..efbced1 100644 (file)
@@ -1,3 +1,16 @@
+2011-03-02  Alexey Proskuryakov  <ap@apple.com>
+
+        Reviewed by Darin Adler.
+
+        REGRESSION (WebKit2): Tab keys no longer observe Full Keyboard Access
+        https://bugs.webkit.org/show_bug.cgi?id=55633
+        <rdar://problem/8963023>
+
+        * src/ChromeClientImpl.cpp: (WebKit::ChromeClientImpl::keyboardUIMode):
+        * src/ChromeClientImpl.h:
+        Implement keyboardUIMode() instead of tabsToLinks(). No change in functionality, since
+        this platform doesn't observe or have full keyboard access state.
+
 2011-03-03  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r80219.
index 992e26c..1e639ec 100644 (file)
@@ -485,14 +485,9 @@ bool ChromeClientImpl::shouldInterruptJavaScript()
     return false;
 }
 
-bool ChromeClientImpl::tabsToLinks() const
-{
-    // Returns true if anchors should accept keyboard focus with the tab key.
-    // This method is used in a convoluted fashion by EventHandler::tabsToLinks.
-    // It's a twisted path (self-evident, but more complicated than seems
-    // necessary), but the net result is that returning true from here, on a
-    // platform other than MAC or QT, lets anchors get keyboard focus.
-    return m_webView->tabsToLinks();
+KeyboardUIMode ChromeClientImpl::keyboardUIMode()
+{
+    return m_webView->tabsToLinks() ? KeyboardAccessTabsToLinks : KeyboardAccessDefault;
 }
 
 IntRect ChromeClientImpl::windowResizerRect() const
index 7d43775..671767a 100644 (file)
@@ -35,6 +35,7 @@
 #include "ChromeClientChromium.h"
 #include "PopupMenu.h"
 #include "SearchPopupMenu.h"
+#include "WebCoreKeyboardUIMode.h"
 
 namespace WebCore {
 class AccessibilityObject;
@@ -101,7 +102,7 @@ public:
         const WTF::String& defaultValue, WTF::String& result);
     virtual void setStatusbarText(const WTF::String& message);
     virtual bool shouldInterruptJavaScript();
-    virtual bool tabsToLinks() const;
+    virtual WebCore::KeyboardUIMode keyboardUIMode();
     virtual WebCore::IntRect windowResizerRect() const;
 #if ENABLE(REGISTER_PROTOCOL_HANDLER)
     virtual void registerProtocolHandler(const String& scheme, const String& baseURL, const String& url, const String& title);
index 1accad8..9c8c5a7 100644 (file)
@@ -1,3 +1,16 @@
+2011-03-02  Alexey Proskuryakov  <ap@apple.com>
+
+        Reviewed by Darin Adler.
+
+        REGRESSION (WebKit2): Tab keys no longer observe Full Keyboard Access
+        https://bugs.webkit.org/show_bug.cgi?id=55633
+        <rdar://problem/8963023>
+
+        * WebCoreSupport/ChromeClientEfl.cpp: (WebCore::ChromeClientEfl::keyboardUIMode):
+        * WebCoreSupport/ChromeClientEfl.h:
+        Implement keyboardUIMode() instead of tabsToLinks(). No change in functionality, since
+        this platform doesn't observe or have full keyboard access state.
+
 2011-03-01  Joseph Pecoraro  <joepeck@webkit.org>
 
         Unreviewed. Roll out r80068 and r80073 due to breaking WebKit2 Qt port.
index 6425c39..a1851c5 100644 (file)
@@ -305,9 +305,9 @@ bool ChromeClientEfl::shouldInterruptJavaScript()
     return ewk_view_should_interrupt_javascript(m_view);
 }
 
-bool ChromeClientEfl::tabsToLinks() const
+KeyboardUIMode ChromeClientEfl::keyboardUIMode()
 {
-    return true;
+    return KeyboardAccessTabsToLinks;
 }
 
 IntRect ChromeClientEfl::windowResizerRect() const
index c17fe10..2dc3922 100644 (file)
@@ -27,6 +27,7 @@
 #include "ChromeClient.h"
 #include "KURL.h"
 #include "PopupMenu.h"
+#include "WebCoreKeyboardUIMode.h"
 
 typedef struct _Evas_Object Evas_Object;
 
@@ -91,7 +92,7 @@ public:
     virtual bool runJavaScriptPrompt(Frame*, const String& message, const String& defaultValue, String& result);
     virtual void setStatusbarText(const String&);
     virtual bool shouldInterruptJavaScript();
-    virtual bool tabsToLinks() const;
+    virtual WebCore::KeyboardUIMode keyboardUIMode();
 
     virtual IntRect windowResizerRect() const;
 
index 4d3ec95..0e5c978 100644 (file)
@@ -1,3 +1,16 @@
+2011-03-02  Alexey Proskuryakov  <ap@apple.com>
+
+        Reviewed by Darin Adler.
+
+        REGRESSION (WebKit2): Tab keys no longer observe Full Keyboard Access
+        https://bugs.webkit.org/show_bug.cgi?id=55633
+        <rdar://problem/8963023>
+
+        * WebCoreSupport/ChromeClientGtk.cpp: (WebKit::ChromeClient::keyboardUIMode):
+        * WebCoreSupport/ChromeClientGtk.h:
+        Implement keyboardUIMode() instead of tabsToLinks(). No change in functionality, since
+        this platform doesn't observe or have full keyboard access state.
+
 2011-03-03  Lukasz Slachciak  <l.slachciak@samsung.com>
 
         Reviewed by Xan Lopez.
index d17dec0..206b504 100644 (file)
@@ -355,12 +355,13 @@ bool ChromeClient::shouldInterruptJavaScript()
     return false;
 }
 
-bool ChromeClient::tabsToLinks() const
+KeyboardUIMode ChromeClient::keyboardUIMode()
 {
+    bool tabsToLinks = true;
     if (DumpRenderTreeSupportGtk::dumpRenderTreeModeEnabled())
-        return DumpRenderTreeSupportGtk::linksIncludedInFocusChain();
+        tabsToLinks = DumpRenderTreeSupportGtk::linksIncludedInFocusChain();
 
-    return true;
+    return tabsToLinks ? KeyboardAccessTabsToLinks : KeyboardAccessDefault;
 }
 
 IntRect ChromeClient::windowResizerRect() const
index 4017f74..cfccfc2 100644 (file)
@@ -25,6 +25,7 @@
 #include "KURL.h"
 #include "PopupMenu.h"
 #include "SearchPopupMenu.h"
+#include "WebCoreKeyboardUIMode.h"
 
 typedef struct _WebKitWebView WebKitWebView;
 
@@ -91,7 +92,7 @@ namespace WebKit {
         virtual bool runJavaScriptPrompt(WebCore::Frame*, const WTF::String& message, const WTF::String& defaultValue, WTF::String& result);
         virtual void setStatusbarText(const WTF::String&);
         virtual bool shouldInterruptJavaScript();
-        virtual bool tabsToLinks() const;
+        virtual WebCore::KeyboardUIMode keyboardUIMode();
 
         virtual WebCore::IntRect windowResizerRect() const;
 
index ce84a1f..f4ddcad 100644 (file)
@@ -1,3 +1,16 @@
+2011-03-02  Alexey Proskuryakov  <ap@apple.com>
+
+        Reviewed by Darin Adler.
+
+        REGRESSION (WebKit2): Tab keys no longer observe Full Keyboard Access
+        https://bugs.webkit.org/show_bug.cgi?id=55633
+        <rdar://problem/8963023>
+
+        * WebCoreSupport/ChromeClientHaiku.cpp: (WebCore::ChromeClientHaiku::keyboardUIMode):
+        * WebCoreSupport/ChromeClientHaiku.h:
+        Implement keyboardUIMode() instead of tabsToLinks(). No change in functionality, since
+        this platform doesn't observe or have full keyboard access state.
+
 2011-02-28  Chang Shu  <cshu@webkit.org>
 
         Reviewed by Ryosuke Niwa.
index 6ed11ea..b16e08c 100644 (file)
@@ -253,9 +253,9 @@ bool ChromeClientHaiku::shouldInterruptJavaScript()
     return false;
 }
 
-bool ChromeClientHaiku::tabsToLinks() const
+KeyboardUIMode ChromeClientHaiku::keyboardUIMode()
 {
-    return false;
+    return KeyboardAccessDefault;
 }
 
 IntRect ChromeClientHaiku::windowResizerRect() const
index 3298c37..b865793 100644 (file)
@@ -32,6 +32,7 @@
 #include "ChromeClient.h"
 #include "FloatRect.h"
 #include "RefCounted.h"
+#include "WebCoreKeyboardUIMode.h"
 
 namespace WebCore {
 
@@ -101,7 +102,7 @@ namespace WebCore {
         virtual bool shouldInterruptJavaScript();
 
         virtual void setStatusbarText(const WTF::String&);
-        virtual bool tabsToLinks() const;
+        virtual WebCore::KeyboardUIMode keyboardUIMode();
         virtual IntRect windowResizerRect() const;
 
         virtual void invalidateWindow(const IntRect&, bool);
index 2770ab8..f1bffdf 100644 (file)
@@ -1,3 +1,20 @@
+2011-03-02  Alexey Proskuryakov  <ap@apple.com>
+
+        Reviewed by Darin Adler.
+
+        REGRESSION (WebKit2): Tab keys no longer observe Full Keyboard Access
+        https://bugs.webkit.org/show_bug.cgi?id=55633
+        <rdar://problem/8963023>
+
+        * WebCoreSupport/WebChromeClient.h:
+        * WebCoreSupport/WebChromeClient.mm:
+        Removed tabsToLinks(). Mac WebKit already implements keyboardUIMode().
+
+        * WebView/WebView.mm: (-[WebView _retrieveKeyboardUIModeFromPreferences:]):
+        Removed an incorrect comment. We actually get a value of 2 on Snow Leopard, and we don't
+        require both bits to be set. The rest of the comment might be wrong too, but I'm not sure,
+        so I've preserved it.
+
 2011-03-02  Jessie Berlin  <jberlin@apple.com>
 
         Rubber-stamped by Dan Bernstein.
index dda0bb1..3129fae 100644 (file)
@@ -88,8 +88,6 @@ public:
     virtual bool runJavaScriptPrompt(WebCore::Frame*, const WTF::String& message, const WTF::String& defaultValue, WTF::String& result);
     virtual bool shouldInterruptJavaScript();
 
-    virtual bool tabsToLinks() const;
-    
     virtual WebCore::IntRect windowResizerRect() const;
 
     virtual void invalidateWindow(const WebCore::IntRect&, bool);
index 0df1e78..99b817b 100644 (file)
@@ -546,11 +546,6 @@ void WebChromeClient::setStatusbarText(const String& status)
     [localPool drain];
 }
 
-bool WebChromeClient::tabsToLinks() const
-{
-    return [[m_webView preferences] tabsToLinks];
-}
-
 IntRect WebChromeClient::windowResizerRect() const
 {
     NSRect rect = [[m_webView window] _growBoxRect];
index 8fb06d6..c7605a0 100644 (file)
@@ -5895,10 +5895,6 @@ static inline uint64_t roundUpToPowerOf2(uint64_t num)
     // The keyboard access mode is reported by two bits:
     // Bit 0 is set if feature is on
     // Bit 1 is set if full keyboard access works for any control, not just text boxes and lists
-    // We require both bits to be on.
-    // 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.
     _private->_keyboardUIMode = (mode & 0x2) ? KeyboardAccessFull : KeyboardAccessDefault;
     
     // check for tabbing to links
index c69e3fa..723251a 100644 (file)
@@ -1,3 +1,16 @@
+2011-03-02  Alexey Proskuryakov  <ap@apple.com>
+
+        Reviewed by Darin Adler.
+
+        REGRESSION (WebKit2): Tab keys no longer observe Full Keyboard Access
+        https://bugs.webkit.org/show_bug.cgi?id=55633
+        <rdar://problem/8963023>
+
+        * WebCoreSupport/ChromeClientQt.cpp (WebCore::ChromeClientQt::keyboardUIMode):
+        * WebCoreSupport/ChromeClientQt.h:
+        Implement keyboardUIMode() instead of tabsToLinks(). No change in functionality, since
+        this platform doesn't observe or have full keyboard access state.
+
 2011-03-03  Alexis Menard  <alexis.menard@openbossa.org>
 
         Reviewed by Andreas Kling.
index fb9b96c..c784375 100644 (file)
@@ -354,9 +354,10 @@ bool ChromeClientQt::shouldInterruptJavaScript()
     return shouldInterrupt;
 }
 
-bool ChromeClientQt::tabsToLinks() const
+KeyboardUIMode ChromeClientQt::keyboardUIMode()
 {
-    return m_webPage->settings()->testAttribute(QWebSettings::LinksIncludedInFocusChain);
+    return m_webPage->settings()->testAttribute(QWebSettings::LinksIncludedInFocusChain)
+        ? KeyboardAccessTabsToLinks : KeyboardAccessDefault;
 }
 
 IntRect ChromeClientQt::windowResizerRect() const
index f1b377c..3c6bd43 100644 (file)
@@ -35,6 +35,7 @@
 #include "KURL.h"
 #include "PlatformString.h"
 #include "QtPlatformPlugin.h"
+#include "WebCoreKeyboardUIMode.h"
 
 QT_BEGIN_NAMESPACE
 class QEventLoop;
@@ -112,7 +113,7 @@ namespace WebCore {
 
         virtual void setStatusbarText(const String&);
 
-        virtual bool tabsToLinks() const;
+        virtual WebCore::KeyboardUIMode keyboardUIMode();
         virtual IntRect windowResizerRect() const;
 
         virtual void invalidateWindow(const IntRect&, bool);
index fce7c7d..220b748 100644 (file)
@@ -1,3 +1,16 @@
+2011-03-02  Alexey Proskuryakov  <ap@apple.com>
+
+        Reviewed by Darin Adler.
+
+        REGRESSION (WebKit2): Tab keys no longer observe Full Keyboard Access
+        https://bugs.webkit.org/show_bug.cgi?id=55633
+        <rdar://problem/8963023>
+
+        * WebCoreSupport/WebChromeClient.cpp: (WebChromeClient::keyboardUIMode):
+        * WebCoreSupport/WebChromeClient.h:
+        Implement keyboardUIMode() instead of tabsToLinks(). No change in functionality, since
+        this platform doesn't observe or have full keyboard access state.
+
 2011-03-03  Peter Kasting  <pkasting@google.com>
 
         Reviewed by James Robinson.
index 47ca713..65537f4 100644 (file)
@@ -448,14 +448,14 @@ bool WebChromeClient::shouldInterruptJavaScript()
     return false;
 }
 
-bool WebChromeClient::tabsToLinks() const
+KeyboardUIMode WebChromeClient::keyboardUIMode()
 {
     BOOL enabled = FALSE;
     IWebPreferences* preferences;
     if (SUCCEEDED(m_webView->preferences(&preferences)))
         preferences->tabsToLinks(&enabled);
 
-    return !!enabled;
+    return enabled ? KeyboardAccessTabsToLinks : KeyboardAccessDefault;
 }
 
 IntRect WebChromeClient::windowResizerRect() const
index 9298f1c..f672c89 100644 (file)
@@ -29,6 +29,7 @@
 #include <WebCore/GraphicsContext.h>
 #include <WebCore/FocusDirection.h>
 #include <WebCore/ScrollTypes.h>
+#include <WebCore/WebCoreKeyboardUIMode.h>
 #include <wtf/Forward.h>
 #include <wtf/PassRefPtr.h>
 
@@ -92,7 +93,7 @@ public:
     virtual void setStatusbarText(const WTF::String&);
     virtual bool shouldInterruptJavaScript();
 
-    virtual bool tabsToLinks() const;
+    virtual WebCore::KeyboardUIMode keyboardUIMode();
     virtual WebCore::IntRect windowResizerRect() const;
 
     virtual void invalidateWindow(const WebCore::IntRect&, bool);
index 7b8a97a..142518b 100644 (file)
@@ -1,3 +1,16 @@
+2011-03-02  Alexey Proskuryakov  <ap@apple.com>
+
+        Reviewed by Darin Adler.
+
+        REGRESSION (WebKit2): Tab keys no longer observe Full Keyboard Access
+        https://bugs.webkit.org/show_bug.cgi?id=55633
+        <rdar://problem/8963023>
+
+        * WebCoreSupport/ChromeClientWinCE.cpp: (WebKit::ChromeClientWinCE::keyboardUIMode):
+        * WebCoreSupport/ChromeClientWinCE.h:
+        Implement keyboardUIMode() instead of tabsToLinks(). No change in functionality, since
+        this platform doesn't observe or have full keyboard access state.
+
 2011-03-02  Brian Weinstein  <bweinstein@apple.com>
 
         WinCE build fix.
index 3430c66..4424c01 100644 (file)
@@ -219,9 +219,9 @@ bool ChromeClientWinCE::shouldInterruptJavaScript()
     return false;
 }
 
-bool ChromeClientWinCE::tabsToLinks() const
+KeyboardUIMode ChromeClientWinCE::keyboardUIMode()
 {
-    return true;
+    return KeyboardAccessTabsToLinks;
 }
 
 IntRect ChromeClientWinCE::windowResizerRect() const
index 781989d..50ce2c2 100644 (file)
@@ -26,6 +26,7 @@
 #define ChromeClientWinCE_h
 
 #include "ChromeClient.h"
+#include "WebCoreKeyboardUIMode.h"
 
 class WebView;
 
@@ -89,7 +90,7 @@ public:
     virtual bool runJavaScriptPrompt(WebCore::Frame*, const WTF::String& message, const WTF::String& defaultValue, WTF::String& result);
     virtual void setStatusbarText(const WTF::String&);
     virtual bool shouldInterruptJavaScript();
-    virtual bool tabsToLinks() const;
+    virtual WebCore::KeyboardUIMode keyboardUIMode();
 
     virtual WebCore::IntRect windowResizerRect() const;
 
index c67d385..a0801c9 100644 (file)
@@ -1,3 +1,16 @@
+2011-03-02  Alexey Proskuryakov  <ap@apple.com>
+
+        Reviewed by Darin Adler.
+
+        REGRESSION (WebKit2): Tab keys no longer observe Full Keyboard Access
+        https://bugs.webkit.org/show_bug.cgi?id=55633
+        <rdar://problem/8963023>
+
+        * WebKitSupport/ChromeClientWx.cpp: (WebCore::ChromeClientWx::keyboardUIMode):
+        * WebKitSupport/ChromeClientWx.h:
+        Implement keyboardUIMode() instead of tabsToLinks(). No change in functionality, since
+        this platform doesn't observe or have full keyboard access state.
+
 2011-03-01  Kevin Ollivier  <kevino@theolliviers.com>
 
         [wx] Build fix after removal of Frame::isContentEditable.
index 026d8a6..d525c09 100644 (file)
@@ -333,10 +333,10 @@ bool ChromeClientWx::shouldInterruptJavaScript()
     return false;
 }
 
-bool ChromeClientWx::tabsToLinks() const
+KeyboardUIMode ChromeClientWx::keyboardUIMode()
 {
     notImplemented();
-    return false;
+    return KeyboardAccessDefault;
 }
 
 IntRect ChromeClientWx::windowResizerRect() const
index 94e6504..079a0c9 100644 (file)
@@ -32,6 +32,7 @@
 #include "ChromeClient.h"
 #include "FocusDirection.h"
 #include "IntRect.h"
+#include "WebCoreKeyboardUIMode.h"
 #include "WebView.h"
 
 namespace WebCore {
@@ -98,7 +99,7 @@ public:
     virtual void setStatusbarText(const String&);
     virtual bool shouldInterruptJavaScript();
     
-    virtual bool tabsToLinks() const;
+    virtual WebCore::KeyboardUIMode keyboardUIMode();
 
     virtual IntRect windowResizerRect() const;
     virtual void scrollBackingStore(int dx, int dy, const IntRect& scrollViewRect, const IntRect& clipRect);
index 109d786..3b506cd 100644 (file)
@@ -1,3 +1,35 @@
+2011-03-03  Alexey Proskuryakov  <ap@apple.com>
+
+        Reviewed by Darin Adler.
+
+        REGRESSION (WebKit2): Tab keys no longer observe Full Keyboard Access
+        https://bugs.webkit.org/show_bug.cgi?id=55633
+        <rdar://problem/8963023>
+
+        * WebKit2.xcodeproj/project.pbxproj:
+        * WebProcess/mac/FullKeyboardAccessWatcher.h: Added.
+        * WebProcess/mac/FullKeyboardAccessWatcher.mm: Added.
+        (-[FullKeyboardAccessWatcher retrieveKeyboardUIModeFromPreferences:]):
+        (-[FullKeyboardAccessWatcher init]):
+        (+[FullKeyboardAccessWatcher fullKeyboardAccessEnabled]):
+        Get the current state of full keyboard access, listening for change notifications.
+
+        * WebProcess/WebProcess.h:  Added fullKeyboardAccessEnabled().
+
+        * WebProcess/WebProcess.cpp: (WebKit::WebProcess::fullKeyboardAccessEnabled):
+        WebKit1 also doesn't implement this on platforms other than Mac.
+
+        * WebProcess/mac/WebProcessMac.mm: (WebKit::WebProcess::fullKeyboardAccessEnabled):
+        Just ask FullKeyboardAccessWatcher.
+
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp: (WebKit::WebChromeClient::keyboardUIMode):
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+        Added keyboardUIMode(), removed tabsToLinks().
+
+        * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::keyboardUIMode):
+        * WebProcess/WebPage/WebPage.h:
+        Generate keyboard UI mode from tabToLinks preference and current state of FKA.
+
 2011-03-03  Sam Weinig  <sam@webkit.org>
 
         Reviewed by Anders Carlsson.
index f26cb3d..76679b7 100644 (file)
                E18C92F412DB9E7100CF2AEB /* PrintInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E18C92F312DB9E7100CF2AEB /* PrintInfo.cpp */; };
                E18C92F512DB9E7A00CF2AEB /* PrintInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E18C92F312DB9E7100CF2AEB /* PrintInfo.cpp */; };
                E18C92F612DB9E9400CF2AEB /* PrintInfoMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1CC1B8F12D7EADF00625838 /* PrintInfoMac.mm */; };
+               E1BB16A413201B9B00F49431 /* FullKeyboardAccessWatcher.h in Headers */ = {isa = PBXBuildFile; fileRef = E1BB1688132018BA00F49431 /* FullKeyboardAccessWatcher.h */; };
+               E1BB16A513201B9B00F49431 /* FullKeyboardAccessWatcher.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1BB1689132018BA00F49431 /* FullKeyboardAccessWatcher.mm */; };
                E1CC1B9012D7EADF00625838 /* PrintInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = E1CC1B8E12D7EADF00625838 /* PrintInfo.h */; };
                E1CC1B9112D7EADF00625838 /* PrintInfoMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1CC1B8F12D7EADF00625838 /* PrintInfoMac.mm */; };
                E1EE53E311F8CFC000CCBEE4 /* InjectedBundlePageEditorClient.h in Headers */ = {isa = PBXBuildFile; fileRef = E1EE53DC11F8CF9F00CCBEE4 /* InjectedBundlePageEditorClient.h */; };
                E134F01512EA5D11004EC58D /* WKPrintingView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPrintingView.h; sourceTree = "<group>"; };
                E134F01912EA5D99004EC58D /* WKPrintingView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKPrintingView.mm; sourceTree = "<group>"; };
                E18C92F312DB9E7100CF2AEB /* PrintInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PrintInfo.cpp; sourceTree = "<group>"; };
+               E1BB1688132018BA00F49431 /* FullKeyboardAccessWatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FullKeyboardAccessWatcher.h; sourceTree = "<group>"; };
+               E1BB1689132018BA00F49431 /* FullKeyboardAccessWatcher.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = FullKeyboardAccessWatcher.mm; sourceTree = "<group>"; };
                E1CC1B8E12D7EADF00625838 /* PrintInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrintInfo.h; sourceTree = "<group>"; };
                E1CC1B8F12D7EADF00625838 /* PrintInfoMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PrintInfoMac.mm; sourceTree = "<group>"; };
                E1EE53DC11F8CF9F00CCBEE4 /* InjectedBundlePageEditorClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundlePageEditorClient.h; sourceTree = "<group>"; };
                        children = (
                                1A6FA01D11E1526300DB1371 /* WebProcessMainMac.mm */,
                                BC3065C312592F8900E71278 /* WebProcessMac.mm */,
+                               E1BB1688132018BA00F49431 /* FullKeyboardAccessWatcher.h */,
+                               E1BB1689132018BA00F49431 /* FullKeyboardAccessWatcher.mm */,
                        );
                        path = mac;
                        sourceTree = "<group>";
                                BCE81D8D1319F7EF00241910 /* FontInfo.h in Headers */,
                                BCE81D99131AE02100241910 /* DictionaryPopupInfo.h in Headers */,
                                37C4E9F6131C6E7E0029BD5A /* config.h in Headers */,
+                               E1BB16A413201B9B00F49431 /* FullKeyboardAccessWatcher.h in Headers */,
                                33AA1067131F060000D4A575 /* WebCookieManagerProxyClient.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                                3309345A1315B9980097A7BC /* WKCookieManager.cpp in Sources */,
                                BCE81D8C1319F7EF00241910 /* FontInfo.cpp in Sources */,
                                BCE81D98131AE02100241910 /* DictionaryPopupInfo.cpp in Sources */,
+                               E1BB16A513201B9B00F49431 /* FullKeyboardAccessWatcher.mm in Sources */,
                                33AA1066131F060000D4A575 /* WebCookieManagerProxyClient.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
index 18ba26b..c320bc2 100644 (file)
@@ -336,9 +336,9 @@ bool WebChromeClient::shouldInterruptJavaScript()
     return false;
 }
 
-bool WebChromeClient::tabsToLinks() const
+KeyboardUIMode WebChromeClient::keyboardUIMode()
 {
-    return m_page->tabsToLinks();
+    return m_page->keyboardUIMode();
 }
 
 IntRect WebChromeClient::windowResizerRect() const
index 82ba36e..96da752 100644 (file)
@@ -102,8 +102,9 @@ private:
     virtual bool runJavaScriptPrompt(WebCore::Frame*, const String& message, const String& defaultValue, String& result);
     virtual void setStatusbarText(const String&);
     virtual bool shouldInterruptJavaScript();
-    virtual bool tabsToLinks() const;
-    
+
+    virtual WebCore::KeyboardUIMode keyboardUIMode();
+
     virtual WebCore::IntRect windowResizerRect() const;
     
     // Methods used by HostWindow.
index 24371e3..bfb4e96 100644 (file)
@@ -1192,6 +1192,12 @@ IntRect WebPage::windowResizerRect() const
                    m_windowResizerSize.width(), m_windowResizerSize.height());
 }
 
+KeyboardUIMode WebPage::keyboardUIMode()
+{
+    bool fullKeyboardAccessEnabled = WebProcess::shared().fullKeyboardAccessEnabled();
+    return static_cast<KeyboardUIMode>((fullKeyboardAccessEnabled ? KeyboardAccessFull : KeyboardAccessDefault) | (m_tabToLinks ? KeyboardAccessTabsToLinks : 0));
+}
+
 void WebPage::runJavaScriptInMainFrame(const String& script, uint64_t callbackID)
 {
     // NOTE: We need to be careful when running scripts that the objects we depend on don't
index 5fa230a..2ef15d8 100644 (file)
@@ -46,6 +46,7 @@
 #include <WebCore/Editor.h>
 #include <WebCore/FrameLoaderTypes.h>
 #include <WebCore/IntRect.h>
+#include <WebCore/WebCoreKeyboardUIMode.h>
 #include <wtf/HashMap.h>
 #include <wtf/OwnPtr.h>
 #include <wtf/PassRefPtr.h>
@@ -153,7 +154,7 @@ public:
     void show();
     String userAgent() const { return m_userAgent; }
     WebCore::IntRect windowResizerRect() const;
-    bool tabsToLinks() const { return m_tabToLinks; }
+    WebCore::KeyboardUIMode keyboardUIMode();
 
     WebEditCommand* webEditCommand(uint64_t);
     void addWebEditCommand(uint64_t, WebEditCommand*);
index 4cfa8b4..6de748f 100644 (file)
@@ -291,6 +291,13 @@ void WebProcess::addVisitedLink(WebCore::LinkHash linkHash)
     m_connection->send(Messages::WebContext::AddVisitedLinkHash(linkHash), 0);
 }
 
+#if !PLATFORM(MAC)
+bool WebProcess::fullKeyboardAccessEnabled()
+{
+    return false;
+}
+#endif
+
 void WebProcess::setCacheModel(uint32_t cm)
 {
     CacheModel cacheModel = static_cast<CacheModel>(cm);
index 772d77f..946bb69 100644 (file)
@@ -88,6 +88,8 @@ public:
     void addVisitedLink(WebCore::LinkHash);
     bool isLinkVisited(WebCore::LinkHash) const;
 
+    bool fullKeyboardAccessEnabled();
+
     WebFrame* webFrame(uint64_t) const;
     void addWebFrame(uint64_t, WebFrame*);
     void removeWebFrame(uint64_t);
diff --git a/Source/WebKit2/WebProcess/mac/FullKeyboardAccessWatcher.h b/Source/WebKit2/WebProcess/mac/FullKeyboardAccessWatcher.h
new file mode 100644 (file)
index 0000000..d6212b2
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef FullKeyboardAccessWatcher_h
+#define FullKeyboardAccessWatcher_h
+
+#import <Cocoa/Cocoa.h>
+
+@interface FullKeyboardAccessWatcher : NSObject {
+@private
+    BOOL fullKeyboardAccessEnabled;
+}
+
++ (BOOL)fullKeyboardAccessEnabled;
+
+@end;
+
+#endif // FullKeyboardAccessWatcher_h
diff --git a/Source/WebKit2/WebProcess/mac/FullKeyboardAccessWatcher.mm b/Source/WebKit2/WebProcess/mac/FullKeyboardAccessWatcher.mm
new file mode 100644 (file)
index 0000000..5fbcf9d
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "FullKeyboardAccessWatcher.h"
+
+const NSString *KeyboardUIModeDidChangeNotification = @"com.apple.KeyboardUIModeDidChange";
+const CFStringRef AppleKeyboardUIMode = CFSTR("AppleKeyboardUIMode");
+const CFStringRef UniversalAccessDomain = CFSTR("com.apple.universalaccess");
+
+@implementation FullKeyboardAccessWatcher
+
+- (void)retrieveKeyboardUIModeFromPreferences:(NSNotification *)notification
+{
+    CFPreferencesAppSynchronize(UniversalAccessDomain);
+
+    Boolean keyExistsAndHasValidFormat;
+    int mode = CFPreferencesGetAppIntegerValue(AppleKeyboardUIMode, UniversalAccessDomain, &keyExistsAndHasValidFormat);
+    if (keyExistsAndHasValidFormat) {
+        // The keyboard access mode is reported by two bits:
+        // Bit 0 is set if feature is on
+        // Bit 1 is set if full keyboard access works for any control, not just text boxes and lists.
+        fullKeyboardAccessEnabled = (mode & 0x2);
+    }
+}
+
+- (id)init
+{
+    self = [super init];
+    if (!self)
+        return nil;
+
+    [self retrieveKeyboardUIModeFromPreferences:nil];
+
+    [[NSDistributedNotificationCenter defaultCenter] 
+        addObserver:self selector:@selector(retrieveKeyboardUIModeFromPreferences:) 
+        name:KeyboardUIModeDidChangeNotification object:nil];
+
+    return self;
+}
+
++ (BOOL)fullKeyboardAccessEnabled
+{
+    static FullKeyboardAccessWatcher *watcher = [[FullKeyboardAccessWatcher alloc] init];
+    return watcher->fullKeyboardAccessEnabled;
+}
+
+@end
index 2665a71..92b36b8 100644 (file)
@@ -26,6 +26,7 @@
 #import "config.h"
 #import "WebProcess.h"
 
+#import "FullKeyboardAccessWatcher.h"
 #import "SandboxExtension.h"
 #import "WebProcessCreationParameters.h"
 #import <WebCore/MemoryCache.h>
@@ -110,6 +111,11 @@ void WebProcess::platformClearResourceCaches()
     [[NSURLCache sharedURLCache] removeAllCachedResponses];
 }
 
+bool WebProcess::fullKeyboardAccessEnabled()
+{
+    return [FullKeyboardAccessWatcher fullKeyboardAccessEnabled];
+}
+
 #if ENABLE(WEB_PROCESS_SANDBOX)
 static void appendSandboxParameterPath(Vector<const char*>& vector, const char* name, const char* path)
 {