Title: [175638] trunk
Revision
175638
Author
a...@apple.com
Date
2014-11-05 13:21:45 -0800 (Wed, 05 Nov 2014)

Log Message

fast/dom/remove-body-during-body-replacement2.html fails on WK2
https://bugs.webkit.org/show_bug.cgi?id=138334

Reviewed by Anders Carlsson.

Source/WebKit2:

Added an SPI to focus a frame.

* WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
(WKBundleFrameFocus):
* WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setViewState):

Tools:

Reset focus to main frame between tests. DumpRenderTree does this via -makeFirstResponder
calls, which works because each frame is an NSView in WK1. WK2 makes equivalent
-makeFirstResponder calls, which may or may not be needed for other reasons, but
it also needs to reset internal focus explicitly.

It's not clear if this is the right long-term fix or a workaround for a WebKit bug.
WebKit behavior appears wrong, but it matches Firefox.

* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::resetAfterTest):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (175637 => 175638)


--- trunk/Source/WebKit2/ChangeLog	2014-11-05 21:13:29 UTC (rev 175637)
+++ trunk/Source/WebKit2/ChangeLog	2014-11-05 21:21:45 UTC (rev 175638)
@@ -1,3 +1,18 @@
+2014-11-05  Alexey Proskuryakov  <a...@apple.com>
+
+        fast/dom/remove-body-during-body-replacement2.html fails on WK2
+        https://bugs.webkit.org/show_bug.cgi?id=138334
+
+        Reviewed by Anders Carlsson.
+
+        Added an SPI to focus a frame.
+
+        * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
+        (WKBundleFrameFocus):
+        * WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::setViewState):
+
 2014-11-05  Tim Horton  <timothy_hor...@apple.com>
 
         Select Data Detectors results instead of just highlighting them

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp (175637 => 175638)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp	2014-11-05 21:13:29 UTC (rev 175637)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp	2014-11-05 21:21:45 UTC (rev 175638)
@@ -35,9 +35,11 @@
 #include "WebFrame.h"
 #include "WebSecurityOrigin.h"
 #include <WebCore/Document.h>
+#include <WebCore/FocusController.h>
 #include <WebCore/Frame.h>
 #include <WebCore/FrameLoader.h>
 #include <WebCore/FrameView.h>
+#include <WebCore/Page.h>
 
 using namespace WebCore;
 using namespace WebKit;
@@ -270,3 +272,12 @@
 
     return toCopiedAPI(coreFrame->document()->securityOrigin());
 }
+
+void WKBundleFrameFocus(WKBundleFrameRef frameRef)
+{
+    Frame* coreFrame = toImpl(frameRef)->coreFrame();
+    if (!coreFrame)
+        return;
+
+    coreFrame->page()->focusController().setFocusedFrame(coreFrame);
+}

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h (175637 => 175638)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h	2014-11-05 21:13:29 UTC (rev 175637)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h	2014-11-05 21:21:45 UTC (rev 175638)
@@ -54,6 +54,8 @@
 
 WK_EXPORT bool WKBundleFrameHandlesPageScaleGesture(WKBundleFrameRef frame);
 
+WK_EXPORT void WKBundleFrameFocus(WKBundleFrameRef frame);
+
 #ifdef __cplusplus
 }
 #endif

Modified: trunk/Tools/ChangeLog (175637 => 175638)


--- trunk/Tools/ChangeLog	2014-11-05 21:13:29 UTC (rev 175637)
+++ trunk/Tools/ChangeLog	2014-11-05 21:21:45 UTC (rev 175638)
@@ -1,3 +1,21 @@
+2014-11-05  Alexey Proskuryakov  <a...@apple.com>
+
+        fast/dom/remove-body-during-body-replacement2.html fails on WK2
+        https://bugs.webkit.org/show_bug.cgi?id=138334
+
+        Reviewed by Anders Carlsson.
+
+        Reset focus to main frame between tests. DumpRenderTree does this via -makeFirstResponder
+        calls, which works because each frame is an NSView in WK1. WK2 makes equivalent
+        -makeFirstResponder calls, which may or may not be needed for other reasons, but
+        it also needs to reset internal focus explicitly.
+
+        It's not clear if this is the right long-term fix or a workaround for a WebKit bug.
+        WebKit behavior appears wrong, but it matches Firefox.
+
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+        (WTR::InjectedBundlePage::resetAfterTest):
+
 2014-11-05  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [GTK] Add WebKitWebResource::failed-with-tls-errors signal

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp (175637 => 175638)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp	2014-11-05 21:13:29 UTC (rev 175637)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp	2014-11-05 21:21:45 UTC (rev 175638)
@@ -418,6 +418,11 @@
 void InjectedBundlePage::resetAfterTest()
 {
     WKBundleFrameRef frame = WKBundlePageGetMainFrame(m_page);
+
+    // WebKit currently doesn't reset focus even when navigating to a new page. This may or may not be a bug
+    // (see <https://bugs.webkit.org/show_bug.cgi?id=138334>), however for tests, we want to start each one with a clean state.
+    WKBundleFrameFocus(frame);
+
     JSGlobalContextRef context = WKBundleFrameGetJavaScriptContext(frame);
     WebCoreTestSupport::resetInternalsObject(context);
     assignedUrlsCache.clear();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to