Changeset 175638 in webkit


Ignore:
Timestamp:
Nov 5, 2014 1:21:45 PM (10 years ago)
Author:
ap@apple.com
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):

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r175637 r175638  
     12014-11-05  Alexey Proskuryakov  <ap@apple.com>
     2
     3        fast/dom/remove-body-during-body-replacement2.html fails on WK2
     4        https://bugs.webkit.org/show_bug.cgi?id=138334
     5
     6        Reviewed by Anders Carlsson.
     7
     8        Added an SPI to focus a frame.
     9
     10        * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp:
     11        (WKBundleFrameFocus):
     12        * WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h:
     13        * WebProcess/WebPage/WebPage.cpp:
     14        (WebKit::WebPage::setViewState):
     15
    1162014-11-05  Tim Horton  <timothy_horton@apple.com>
    217
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp

    r164192 r175638  
    3636#include "WebSecurityOrigin.h"
    3737#include <WebCore/Document.h>
     38#include <WebCore/FocusController.h>
    3839#include <WebCore/Frame.h>
    3940#include <WebCore/FrameLoader.h>
    4041#include <WebCore/FrameView.h>
     42#include <WebCore/Page.h>
    4143
    4244using namespace WebCore;
     
    271273    return toCopiedAPI(coreFrame->document()->securityOrigin());
    272274}
     275
     276void WKBundleFrameFocus(WKBundleFrameRef frameRef)
     277{
     278    Frame* coreFrame = toImpl(frameRef)->coreFrame();
     279    if (!coreFrame)
     280        return;
     281
     282    coreFrame->page()->focusController().setFocusedFrame(coreFrame);
     283}
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFramePrivate.h

    r168541 r175638  
    5555WK_EXPORT bool WKBundleFrameHandlesPageScaleGesture(WKBundleFrameRef frame);
    5656
     57WK_EXPORT void WKBundleFrameFocus(WKBundleFrameRef frame);
     58
    5759#ifdef __cplusplus
    5860}
  • trunk/Tools/ChangeLog

    r175618 r175638  
     12014-11-05  Alexey Proskuryakov  <ap@apple.com>
     2
     3        fast/dom/remove-body-during-body-replacement2.html fails on WK2
     4        https://bugs.webkit.org/show_bug.cgi?id=138334
     5
     6        Reviewed by Anders Carlsson.
     7
     8        Reset focus to main frame between tests. DumpRenderTree does this via -makeFirstResponder
     9        calls, which works because each frame is an NSView in WK1. WK2 makes equivalent
     10        -makeFirstResponder calls, which may or may not be needed for other reasons, but
     11        it also needs to reset internal focus explicitly.
     12
     13        It's not clear if this is the right long-term fix or a workaround for a WebKit bug.
     14        WebKit behavior appears wrong, but it matches Firefox.
     15
     16        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
     17        (WTR::InjectedBundlePage::resetAfterTest):
     18
    1192014-11-05  Carlos Garcia Campos  <cgarcia@igalia.com>
    220
  • trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp

    r174866 r175638  
    419419{
    420420    WKBundleFrameRef frame = WKBundlePageGetMainFrame(m_page);
     421
     422    // WebKit currently doesn't reset focus even when navigating to a new page. This may or may not be a bug
     423    // (see <https://bugs.webkit.org/show_bug.cgi?id=138334>), however for tests, we want to start each one with a clean state.
     424    WKBundleFrameFocus(frame);
     425
    421426    JSGlobalContextRef context = WKBundleFrameGetJavaScriptContext(frame);
    422427    WebCoreTestSupport::resetInternalsObject(context);
Note: See TracChangeset for help on using the changeset viewer.