WK2: VoiceOver cannot move focus into a web area programmatically
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 May 2011 00:10:38 +0000 (00:10 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 May 2011 00:10:38 +0000 (00:10 +0000)
https://bugs.webkit.org/show_bug.cgi?id=60661

Reviewed by Maciej Stachowiak.

Source/WebCore:

Accessibility code relies on the ability to bring focus to the containing widget view.
In WK2, that message needs to be propagated to the UI process.

* page/ChromeClient.h:
(WebCore::ChromeClient::makeFirstResponder):
* page/mac/ChromeMac.mm:
(WebCore::Chrome::focusNSView):
* platform/mac/WidgetMac.mm:
(WebCore::Widget::setFocus):

Source/WebKit2:

Add a makeFirstResponder method that will bring focus to the widget view within the UI
process.

* UIProcess/API/mac/PageClientImpl.h:
* UIProcess/API/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::makeFirstResponder):
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::makeFirstResponder):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::makeFirstResponder):
* WebProcess/WebCoreSupport/WebChromeClient.h:

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

13 files changed:
Source/WebCore/ChangeLog
Source/WebCore/page/ChromeClient.h
Source/WebCore/page/mac/ChromeMac.mm
Source/WebCore/platform/mac/WidgetMac.mm
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/mac/PageClientImpl.h
Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
Source/WebKit2/UIProcess/PageClient.h
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/WebPageProxy.messages.in
Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h

index 62ed333..700be13 100644 (file)
@@ -1,3 +1,20 @@
+2011-05-18  Chris Fleizach  <cfleizach@apple.com>
+
+        Reviewed by Maciej Stachowiak.
+
+        WK2: VoiceOver cannot move focus into a web area programmatically
+        https://bugs.webkit.org/show_bug.cgi?id=60661
+
+        Accessibility code relies on the ability to bring focus to the containing widget view.
+        In WK2, that message needs to be propagated to the UI process.
+
+        * page/ChromeClient.h:
+        (WebCore::ChromeClient::makeFirstResponder):
+        * page/mac/ChromeMac.mm:
+        (WebCore::Chrome::focusNSView):
+        * platform/mac/WidgetMac.mm:
+        (WebCore::Widget::setFocus):
+
 2011-05-18  Alok Priyadarshi  <alokp@chromium.org> and Adrienne Walker  <enne@google.com>
 
         Reviewed by James Robinson.
index 9a0fdeb..a9a05a3 100644 (file)
@@ -286,7 +286,8 @@ namespace WebCore {
 #if PLATFORM(MAC)
         virtual NSResponder *firstResponder() { return 0; }
         virtual void makeFirstResponder(NSResponder *) { }
-
+        // Focuses on the containing view associated with this page.
+        virtual void makeFirstResponder() { }
         virtual void willPopUpMenu(NSMenu *) { }
 #endif
 
index d2ae39d..b09ecf1 100644 (file)
@@ -30,6 +30,12 @@ void Chrome::focusNSView(NSView* view)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
 
+    // Handle the WK2 case where there is no view passed in.
+    if (!view) {
+        client()->makeFirstResponder();
+        return;
+    }
+    
     NSResponder *firstResponder = client()->firstResponder();
     if (firstResponder == view)
         return;
index 6fa63af..0aef655 100644 (file)
@@ -103,9 +103,6 @@ Widget::~Widget()
 // FIXME: Should move this to Chrome; bad layering that this knows about Frame.
 void Widget::setFocus(bool focused)
 {
-    if (!platformWidget())
-        return;
-
     if (!focused)
         return;
 
@@ -115,6 +112,7 @@ void Widget::setFocus(bool focused)
 
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
  
+    // Call this even when there is no platformWidget(). WK2 will focus on the widget in the UIProcess.
     NSView *view = [platformWidget() _webcore_effectiveFirstResponder];
     if (Page* page = frame->page())
         page->chrome()->focusNSView(view);
index e0c9688..92be3d7 100644 (file)
@@ -1,3 +1,25 @@
+2011-05-18  Chris Fleizach  <cfleizach@apple.com>
+
+        Reviewed by Maciej Stachowiak.
+
+        WK2: VoiceOver cannot move focus into a web area programmatically
+        https://bugs.webkit.org/show_bug.cgi?id=60661
+
+        Add a makeFirstResponder method that will bring focus to the widget view within the UI
+        process.
+
+        * UIProcess/API/mac/PageClientImpl.h:
+        * UIProcess/API/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::makeFirstResponder):
+        * UIProcess/PageClient.h:
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * UIProcess/mac/WebPageProxyMac.mm:
+        (WebKit::WebPageProxy::makeFirstResponder):
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::makeFirstResponder):
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+
 2011-05-18  Brady Eidson  <beidson@apple.com>
 
         Reviewed by Anders Carlsson.
index 6986e55..5f30cbc 100644 (file)
@@ -94,6 +94,8 @@ private:
     virtual void accessibilityWebProcessTokenReceived(const CoreIPC::DataReference&);    
     virtual void setComplexTextInputEnabled(uint64_t pluginComplexTextInputIdentifier, bool complexTextInputEnabled);
 
+    virtual void makeFirstResponder();
+    
     virtual CGContextRef containingWindowGraphicsContext();
 
     virtual void didChangeScrollbarsForMainFrame() const;
index efae190..db97807 100644 (file)
@@ -164,6 +164,11 @@ bool PageClientImpl::isViewFocused()
     return [m_wkView _isFocused];
 }
 
+void PageClientImpl::makeFirstResponder()
+{
+     [[m_wkView window] makeFirstResponder:m_wkView];
+}
+    
 bool PageClientImpl::isViewVisible()
 {
     if (![m_wkView window])
index 2c7f127..920f9e6 100644 (file)
@@ -117,6 +117,7 @@ public:
     virtual void setDragImage(const WebCore::IntPoint& clientPosition, PassRefPtr<ShareableBitmap> dragImage, bool isLinkDrag) = 0;
     virtual void updateTextInputState(bool updateSecureInputState) = 0;
     virtual void resetTextInputState() = 0;
+    virtual void makeFirstResponder() = 0;
 #endif
 #if PLATFORM(WIN)
     virtual void compositionSelectionChanged(bool) = 0;
index c17b9e5..064f0ec 100644 (file)
@@ -379,6 +379,7 @@ public:
     void registerUIProcessAccessibilityTokens(const CoreIPC::DataReference& elemenToken, const CoreIPC::DataReference& windowToken);
     bool writeSelectionToPasteboard(const String& pasteboardName, const Vector<String>& pasteboardTypes);
     bool readSelectionFromPasteboard(const String& pasteboardName);
+    void makeFirstResponder();
 #endif
 
     void viewScaleFactorDidChange(double);
index 1cedbe7..9e52e4b 100644 (file)
@@ -227,6 +227,8 @@ messages -> WebPageProxy {
     Speak(WTF::String string)
     StopSpeaking()
 
+    MakeFirstResponder()
+
     # Spotlight
     SearchWithSpotlight(WTF::String string)
 #endif
index a2acc73..00522e1 100644 (file)
@@ -326,6 +326,11 @@ void WebPageProxy::registerWebProcessAccessibilityToken(const CoreIPC::DataRefer
     m_pageClient->accessibilityWebProcessTokenReceived(data);
 }    
     
+void WebPageProxy::makeFirstResponder()
+{
+    m_pageClient->makeFirstResponder();
+}
+    
 void WebPageProxy::registerUIProcessAccessibilityTokens(const CoreIPC::DataReference& elementToken, const CoreIPC::DataReference& windowToken)
 {
     if (!isValid())
index 4b4eb61..9a54956 100644 (file)
@@ -129,6 +129,13 @@ void WebChromeClient::unfocus()
     m_page->send(Messages::WebPageProxy::SetFocus(false));
 }
 
+#if PLATFORM(MAC)
+void WebChromeClient::makeFirstResponder()
+{
+    m_page->send(Messages::WebPageProxy::MakeFirstResponder());
+}    
+#endif    
+
 bool WebChromeClient::canTakeFocus(FocusDirection)
 {
     notImplemented();
index d0017bf..98c2a25 100644 (file)
@@ -214,6 +214,10 @@ private:
     virtual void setRootFullScreenLayer(WebCore::GraphicsLayer*);
 #endif
 
+#if PLATFORM(MAC)
+    virtual void makeFirstResponder();
+#endif
+    
     virtual void dispatchViewportDataDidChange(const WebCore::ViewportArguments&) const;
 
     virtual void didCompleteRubberBandForMainFrame(const WebCore::IntSize&) const;