Changeset 244897 in webkit


Ignore:
Timestamp:
May 2, 2019 6:05:32 PM (5 years ago)
Author:
Wenson Hsieh
Message:

REGRESSION: Layout test editing/selection/ios/selection-after-changing-text-with-callout-menu.html is failing
https://bugs.webkit.org/show_bug.cgi?id=197532
<rdar://problem/50177144>

Reviewed by Ryosuke Niwa.

Fixes layout tests that began failing after r244546. See below for details.

  • UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:

(WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):

Partially reverts a change in r244546, after which we commit the layer tree and scroll before updating the
page's editor state. The purpose of this change was to ensure that UI process-side element focus scrolling logic
would not conflict with web-process-driven scrolling logic.

Instead, we split the existing logic in WebPageProxy::editorStateChanged into two pieces: one that updates the
editor state (by setting m_editorState), and a second that dispatches updates to PageClient when the first
editor state is received after focusing an element. During a layer tree commit in the UI process, we first
update the editor state, then commit the layer tree and apply scroll position changes, and finally scroll to
reveal the focused element if necessary.

When an editor state is delivered to the UI process in an out-of-band update (i.e. not in a layer tree commit),
simply dispatch the initial editor state for a focused element immediately.

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::scheduleFullEditorStateUpdate):

Add an IPC message to schedule an editor state update in the next remote layer tree commit. See below for more
details.

(WebKit::WebPageProxy::editorStateChanged):
(WebKit::WebPageProxy::dispatchDidReceiveEditorStateAfterFocus):

  • UIProcess/WebPageProxy.h:
  • UIProcess/gtk/WebPageProxyGtk.cpp:

(WebKit::WebPageProxy::updateEditorState):
(WebKit::WebPageProxy::editorStateChanged): Deleted.

  • UIProcess/ios/WKContentViewInteraction.mm:

(-[WKContentView willFinishIgnoringCalloutBarFadeAfterPerformingAction]):

Additionally ensure that an editor state update is scheduled. This addresses a potential source of flakiness in
the layout test editing/selection/ios/selection-after-changing-text-with-callout-menu.html, where an editor
state update may only be scheduled after the next layout timer fires (this is the case in custom callout menu
actions that change the DOM but do not otherwise trigger any editing commands).

In the problematic scenario, the client could make a change that triggers layout soon; but before the layout
timer fires, the timer for the next remote layer tree commit could fire, such that the next layer tree commit
would not contain the relevant editor state.

This extra step ensures that we always *schedule* an editor state update when performing a callout menu action
that does not automatically dismiss, so that we can prevent the callout bar from dismissing during the correct
scope.

  • UIProcess/ios/WebPageProxyIOS.mm:

(WebKit::WebPageProxy::layerTreeCommitComplete):
(WebKit::WebPageProxy::updateEditorState):

Rename editorStateChanged to updateEditorState, and make the editorStateChanged codepath only executed when an
out-of-band editor state update is delivered to the UI process.

(WebKit::WebPageProxy::dispatchDidReceiveEditorStateAfterFocus):

Notify the UI process that the initial editor state has been received; this prompts us to scroll to reveal the
focused element, if needed.

(WebKit::WebPageProxy::editorStateChanged): Deleted.

  • UIProcess/mac/WebPageProxyMac.mm:

(WebKit::WebPageProxy::updateEditorState):
(WebKit::WebPageProxy::editorStateChanged): Deleted.

  • UIProcess/win/WebPageProxyWin.cpp:

(WebKit::WebPageProxy::updateEditorState):
(WebKit::WebPageProxy::editorStateChanged): Deleted.

  • UIProcess/wpe/WebPageProxyWPE.cpp:

(WebKit::WebPageProxy::updateEditorState):
(WebKit::WebPageProxy::editorStateChanged): Deleted.

  • WebProcess/WebPage/WebPage.h:
  • WebProcess/WebPage/WebPage.messages.in:
Location:
trunk/Source/WebKit
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r244893 r244897  
     12019-05-02  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        REGRESSION: Layout test editing/selection/ios/selection-after-changing-text-with-callout-menu.html is failing
     4        https://bugs.webkit.org/show_bug.cgi?id=197532
     5        <rdar://problem/50177144>
     6
     7        Reviewed by Ryosuke Niwa.
     8
     9        Fixes layout tests that began failing after r244546. See below for details.
     10
     11        * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
     12        (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
     13
     14        Partially reverts a change in r244546, after which we commit the layer tree and scroll before updating the
     15        page's editor state. The purpose of this change was to ensure that UI process-side element focus scrolling logic
     16        would not conflict with web-process-driven scrolling logic.
     17
     18        Instead, we split the existing logic in WebPageProxy::editorStateChanged into two pieces: one that updates the
     19        editor state (by setting m_editorState), and a second that dispatches updates to PageClient when the first
     20        editor state is received after focusing an element. During a layer tree commit in the UI process, we first
     21        update the editor state, then commit the layer tree and apply scroll position changes, and finally scroll to
     22        reveal the focused element if necessary.
     23
     24        When an editor state is delivered to the UI process in an out-of-band update (i.e. not in a layer tree commit),
     25        simply dispatch the initial editor state for a focused element immediately.
     26
     27        * UIProcess/WebPageProxy.cpp:
     28        (WebKit::WebPageProxy::scheduleFullEditorStateUpdate):
     29
     30        Add an IPC message to schedule an editor state update in the next remote layer tree commit. See below for more
     31        details.
     32
     33        (WebKit::WebPageProxy::editorStateChanged):
     34        (WebKit::WebPageProxy::dispatchDidReceiveEditorStateAfterFocus):
     35        * UIProcess/WebPageProxy.h:
     36        * UIProcess/gtk/WebPageProxyGtk.cpp:
     37        (WebKit::WebPageProxy::updateEditorState):
     38        (WebKit::WebPageProxy::editorStateChanged): Deleted.
     39        * UIProcess/ios/WKContentViewInteraction.mm:
     40        (-[WKContentView willFinishIgnoringCalloutBarFadeAfterPerformingAction]):
     41
     42        Additionally ensure that an editor state update is scheduled. This addresses a potential source of flakiness in
     43        the layout test editing/selection/ios/selection-after-changing-text-with-callout-menu.html, where an editor
     44        state update may only be scheduled after the next layout timer fires (this is the case in custom callout menu
     45        actions that change the DOM but do not otherwise trigger any editing commands).
     46
     47        In the problematic scenario, the client could make a change that triggers layout soon; but before the layout
     48        timer fires, the timer for the next remote layer tree commit could fire, such that the next layer tree commit
     49        would not contain the relevant editor state.
     50
     51        This extra step ensures that we always *schedule* an editor state update when performing a callout menu action
     52        that does not automatically dismiss, so that we can prevent the callout bar from dismissing during the correct
     53        scope.
     54
     55        * UIProcess/ios/WebPageProxyIOS.mm:
     56        (WebKit::WebPageProxy::layerTreeCommitComplete):
     57        (WebKit::WebPageProxy::updateEditorState):
     58
     59        Rename editorStateChanged to updateEditorState, and make the editorStateChanged codepath only executed when an
     60        out-of-band editor state update is delivered to the UI process.
     61
     62        (WebKit::WebPageProxy::dispatchDidReceiveEditorStateAfterFocus):
     63
     64        Notify the UI process that the initial editor state has been received; this prompts us to scroll to reveal the
     65        focused element, if needed.
     66
     67        (WebKit::WebPageProxy::editorStateChanged): Deleted.
     68        * UIProcess/mac/WebPageProxyMac.mm:
     69        (WebKit::WebPageProxy::updateEditorState):
     70        (WebKit::WebPageProxy::editorStateChanged): Deleted.
     71        * UIProcess/win/WebPageProxyWin.cpp:
     72        (WebKit::WebPageProxy::updateEditorState):
     73        (WebKit::WebPageProxy::editorStateChanged): Deleted.
     74        * UIProcess/wpe/WebPageProxyWPE.cpp:
     75        (WebKit::WebPageProxy::updateEditorState):
     76        (WebKit::WebPageProxy::editorStateChanged): Deleted.
     77        * WebProcess/WebPage/WebPage.h:
     78        * WebProcess/WebPage/WebPage.messages.in:
     79
    1802019-05-02  Timothy Hatcher  <timothy@apple.com>
    281
  • trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm

    r244546 r244897  
    200200    m_activityStateChangeID = layerTreeTransaction.activityStateChangeID();
    201201
     202    if (layerTreeTransaction.hasEditorState())
     203        m_webPageProxy.updateEditorState(layerTreeTransaction.editorState());
     204
    202205    if (m_remoteLayerTreeHost->updateLayerTree(layerTreeTransaction)) {
    203206        if (layerTreeTransaction.transactionID() >= m_transactionIDForUnhidingContent)
     
    254257
    255258    if (layerTreeTransaction.hasEditorState())
    256         m_webPageProxy.editorStateChanged(layerTreeTransaction.editorState());
     259        m_webPageProxy.dispatchDidReceiveEditorStateAfterFocus();
    257260
    258261    if (auto milestones = layerTreeTransaction.newlyReachedPaintingMilestones())
  • trunk/Source/WebKit/UIProcess/WebPageProxy.cpp

    r244819 r244897  
    20072007}
    20082008
     2009void WebPageProxy::scheduleFullEditorStateUpdate()
     2010{
     2011    if (!hasRunningProcess())
     2012        return;
     2013
     2014    m_process->send(Messages::WebPage::ScheduleFullEditorStateUpdate(), m_pageID);
     2015}
     2016
    20092017void WebPageProxy::executeEditCommand(const String& commandName, const String& argument, WTF::Function<void(CallbackBase::Error)>&& callbackFunction)
    20102018{
     
    65036511    callback->performCallbackWithReturnValue(range);
    65046512}
     6513
     6514void WebPageProxy::editorStateChanged(const EditorState& editorState)
     6515{
     6516    updateEditorState(editorState);
     6517    dispatchDidReceiveEditorStateAfterFocus();
     6518}
     6519
     6520#if !PLATFORM(IOS_FAMILY)
     6521
     6522void WebPageProxy::dispatchDidReceiveEditorStateAfterFocus()
     6523{
     6524}
     6525
     6526#endif
    65056527
    65066528#if ENABLE(APPLICATION_MANIFEST)
  • trunk/Source/WebKit/UIProcess/WebPageProxy.h

    r244819 r244897  
    14241424#endif
    14251425    void editorStateChanged(const EditorState&);
     1426    void updateEditorState(const EditorState&);
     1427    void scheduleFullEditorStateUpdate();
     1428    void dispatchDidReceiveEditorStateAfterFocus();
    14261429
    14271430#if PLATFORM(COCOA)
  • trunk/Source/WebKit/UIProcess/gtk/WebPageProxyGtk.cpp

    r243862 r244897  
    8080}
    8181
    82 void WebPageProxy::editorStateChanged(const EditorState& editorState)
     82void WebPageProxy::updateEditorState(const EditorState& editorState)
    8383{
    8484    m_editorState = editorState;
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r244775 r244897  
    39213921{
    39223922    _ignoreSelectionCommandFadeCount++;
     3923    _page->scheduleFullEditorStateUpdate();
    39233924    _page->callAfterNextPresentationUpdate([weakSelf = WeakObjCPtr<WKContentView>(self)] (auto) {
    39243925        if (auto strongSelf = weakSelf.get())
  • trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm

    r244775 r244897  
    431431{
    432432    pageClient().layerTreeCommitComplete();
     433
     434    if (m_waitingForPostLayoutEditorStateUpdateAfterFocusingElement && !m_editorState.isMissingPostLayoutData) {
     435        pageClient().didReceiveEditorStateUpdateAfterFocus();
     436        m_waitingForPostLayoutEditorStateUpdateAfterFocusingElement = false;
     437    }
    433438}
    434439
     
    11031108}
    11041109
    1105 void WebPageProxy::editorStateChanged(const EditorState& editorState)
     1110void WebPageProxy::updateEditorState(const EditorState& editorState)
    11061111{
    11071112    bool couldChangeSecureInputState = m_editorState.isInPasswordField != editorState.isInPasswordField || m_editorState.selectionIsNone;
     
    11201125    pageClient().selectionDidChange();
    11211126    updateFontAttributesAfterEditorStateChange();
    1122 
    1123     if (m_waitingForPostLayoutEditorStateUpdateAfterFocusingElement && !m_editorState.isMissingPostLayoutData) {
    1124         pageClient().didReceiveEditorStateUpdateAfterFocus();
    1125         m_waitingForPostLayoutEditorStateUpdateAfterFocusingElement = false;
    1126     }
     1127}
     1128
     1129void WebPageProxy::dispatchDidReceiveEditorStateAfterFocus()
     1130{
     1131    if (!m_waitingForPostLayoutEditorStateUpdateAfterFocusingElement || m_editorState.isMissingPostLayoutData)
     1132        return;
     1133
     1134    pageClient().didReceiveEditorStateUpdateAfterFocus();
     1135    m_waitingForPostLayoutEditorStateUpdateAfterFocusingElement = false;
    11271136}
    11281137
  • trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm

    r244633 r244897  
    608608}
    609609
    610 void WebPageProxy::editorStateChanged(const EditorState& editorState)
     610void WebPageProxy::updateEditorState(const EditorState& editorState)
    611611{
    612612    bool couldChangeSecureInputState = m_editorState.isInPasswordField != editorState.isInPasswordField || m_editorState.selectionIsNone;
  • trunk/Source/WebKit/UIProcess/win/WebPageProxyWin.cpp

    r243327 r244897  
    6161}
    6262
    63 void WebPageProxy::editorStateChanged(const EditorState& editorState)
     63void WebPageProxy::updateEditorState(const EditorState& editorState)
    6464{
    6565    m_editorState = editorState;
  • trunk/Source/WebKit/UIProcess/wpe/WebPageProxyWPE.cpp

    r243327 r244897  
    6565}
    6666
    67 void WebPageProxy::editorStateChanged(const EditorState&)
     67void WebPageProxy::updateEditorState(const EditorState&)
    6868{
    6969    notImplemented();
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.h

    r244849 r244897  
    11841184
    11851185    void updateIntrinsicContentSizeIfNeeded(const WebCore::IntSize&);
     1186    void scheduleFullEditorStateUpdate();
    11861187
    11871188private:
     
    12001201    void platformEditorState(WebCore::Frame&, EditorState& result, IncludePostLayoutDataHint) const;
    12011202    void sendEditorStateUpdate();
    1202     void scheduleFullEditorStateUpdate();
    12031203
    12041204#if PLATFORM(COCOA)
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in

    r244775 r244897  
    203203    ForceRepaint(WebKit::CallbackID callbackID)
    204204
     205    ScheduleFullEditorStateUpdate()
     206
    205207#if PLATFORM(COCOA)
    206208    # Dictionary support.
Note: See TracChangeset for help on using the changeset viewer.