<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[244897] trunk/Source/WebKit</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/244897">244897</a></dd>
<dt>Author</dt> <dd>wenson_hsieh@apple.com</dd>
<dt>Date</dt> <dd>2019-05-02 18:05:32 -0700 (Thu, 02 May 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>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 <a href="http://trac.webkit.org/projects/webkit/changeset/244546">r244546</a>. See below for details.

* UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):

Partially reverts a change in <a href="http://trac.webkit.org/projects/webkit/changeset/244546">r244546</a>, 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:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitUIProcessRemoteLayerTreeRemoteLayerTreeDrawingAreaProxymm">trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebPageProxycpp">trunk/Source/WebKit/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebPageProxyh">trunk/Source/WebKit/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessgtkWebPageProxyGtkcpp">trunk/Source/WebKit/UIProcess/gtk/WebPageProxyGtk.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcessiosWKContentViewInteractionmm">trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm</a></li>
<li><a href="#trunkSourceWebKitUIProcessiosWebPageProxyIOSmm">trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm</a></li>
<li><a href="#trunkSourceWebKitUIProcessmacWebPageProxyMacmm">trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm</a></li>
<li><a href="#trunkSourceWebKitUIProcesswinWebPageProxyWincpp">trunk/Source/WebKit/UIProcess/win/WebPageProxyWin.cpp</a></li>
<li><a href="#trunkSourceWebKitUIProcesswpeWebPageProxyWPEcpp">trunk/Source/WebKit/UIProcess/wpe/WebPageProxyWPE.cpp</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebPageWebPageh">trunk/Source/WebKit/WebProcess/WebPage/WebPage.h</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebPageWebPagemessagesin">trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (244896 => 244897)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2019-05-03 00:12:51 UTC (rev 244896)
+++ trunk/Source/WebKit/ChangeLog       2019-05-03 01:05:32 UTC (rev 244897)
</span><span class="lines">@@ -1,3 +1,82 @@
</span><ins>+2019-05-02  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        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:
+
</ins><span class="cx"> 2019-05-02  Timothy Hatcher  <timothy@apple.com>
</span><span class="cx"> 
</span><span class="cx">         NSAttributedString conversion in a loop returns nil and WKUnknownError every other time.
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessRemoteLayerTreeRemoteLayerTreeDrawingAreaProxymm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm (244896 => 244897)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm 2019-05-03 00:12:51 UTC (rev 244896)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm    2019-05-03 01:05:32 UTC (rev 244897)
</span><span class="lines">@@ -199,6 +199,9 @@
</span><span class="cx">     m_transactionIDForPendingCACommit = layerTreeTransaction.transactionID();
</span><span class="cx">     m_activityStateChangeID = layerTreeTransaction.activityStateChangeID();
</span><span class="cx"> 
</span><ins>+    if (layerTreeTransaction.hasEditorState())
+        m_webPageProxy.updateEditorState(layerTreeTransaction.editorState());
+
</ins><span class="cx">     if (m_remoteLayerTreeHost->updateLayerTree(layerTreeTransaction)) {
</span><span class="cx">         if (layerTreeTransaction.transactionID() >= m_transactionIDForUnhidingContent)
</span><span class="cx">             m_webPageProxy.setRemoteLayerTreeRootNode(m_remoteLayerTreeHost->rootNode());
</span><span class="lines">@@ -253,7 +256,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     if (layerTreeTransaction.hasEditorState())
</span><del>-        m_webPageProxy.editorStateChanged(layerTreeTransaction.editorState());
</del><ins>+        m_webPageProxy.dispatchDidReceiveEditorStateAfterFocus();
</ins><span class="cx"> 
</span><span class="cx">     if (auto milestones = layerTreeTransaction.newlyReachedPaintingMilestones())
</span><span class="cx">         m_webPageProxy.didReachLayoutMilestone(milestones);
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (244896 => 244897)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp   2019-05-03 00:12:51 UTC (rev 244896)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp      2019-05-03 01:05:32 UTC (rev 244897)
</span><span class="lines">@@ -2006,6 +2006,14 @@
</span><span class="cx">     m_maintainsInactiveSelection = newValue;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebPageProxy::scheduleFullEditorStateUpdate()
+{
+    if (!hasRunningProcess())
+        return;
+
+    m_process->send(Messages::WebPage::ScheduleFullEditorStateUpdate(), m_pageID);
+}
+
</ins><span class="cx"> void WebPageProxy::executeEditCommand(const String& commandName, const String& argument, WTF::Function<void(CallbackBase::Error)>&& callbackFunction)
</span><span class="cx"> {
</span><span class="cx">     if (!hasRunningProcess()) {
</span><span class="lines">@@ -6503,6 +6511,20 @@
</span><span class="cx">     callback->performCallbackWithReturnValue(range);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebPageProxy::editorStateChanged(const EditorState& editorState)
+{
+    updateEditorState(editorState);
+    dispatchDidReceiveEditorStateAfterFocus();
+}
+
+#if !PLATFORM(IOS_FAMILY)
+
+void WebPageProxy::dispatchDidReceiveEditorStateAfterFocus()
+{
+}
+
+#endif
+
</ins><span class="cx"> #if ENABLE(APPLICATION_MANIFEST)
</span><span class="cx"> void WebPageProxy::applicationManifestCallback(const Optional<WebCore::ApplicationManifest>& manifestOrNull, CallbackID callbackID)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (244896 => 244897)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebPageProxy.h     2019-05-03 00:12:51 UTC (rev 244896)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h        2019-05-03 01:05:32 UTC (rev 244897)
</span><span class="lines">@@ -1423,6 +1423,9 @@
</span><span class="cx">     void createSandboxExtensionsIfNeeded(const Vector<String>& files, SandboxExtension::Handle& fileReadHandle, SandboxExtension::HandleArray& fileUploadHandles);
</span><span class="cx"> #endif
</span><span class="cx">     void editorStateChanged(const EditorState&);
</span><ins>+    void updateEditorState(const EditorState&);
+    void scheduleFullEditorStateUpdate();
+    void dispatchDidReceiveEditorStateAfterFocus();
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx">     void touchBarMenuDataRemoved();
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessgtkWebPageProxyGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/gtk/WebPageProxyGtk.cpp (244896 => 244897)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/gtk/WebPageProxyGtk.cpp    2019-05-03 00:12:51 UTC (rev 244896)
+++ trunk/Source/WebKit/UIProcess/gtk/WebPageProxyGtk.cpp       2019-05-03 01:05:32 UTC (rev 244897)
</span><span class="lines">@@ -79,7 +79,7 @@
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPageProxy::editorStateChanged(const EditorState& editorState)
</del><ins>+void WebPageProxy::updateEditorState(const EditorState& editorState)
</ins><span class="cx"> {
</span><span class="cx">     m_editorState = editorState;
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessiosWKContentViewInteractionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (244896 => 244897)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm    2019-05-03 00:12:51 UTC (rev 244896)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm       2019-05-03 01:05:32 UTC (rev 244897)
</span><span class="lines">@@ -3920,6 +3920,7 @@
</span><span class="cx"> - (void)willFinishIgnoringCalloutBarFadeAfterPerformingAction
</span><span class="cx"> {
</span><span class="cx">     _ignoreSelectionCommandFadeCount++;
</span><ins>+    _page->scheduleFullEditorStateUpdate();
</ins><span class="cx">     _page->callAfterNextPresentationUpdate([weakSelf = WeakObjCPtr<WKContentView>(self)] (auto) {
</span><span class="cx">         if (auto strongSelf = weakSelf.get())
</span><span class="cx">             strongSelf->_ignoreSelectionCommandFadeCount--;
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessiosWebPageProxyIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm (244896 => 244897)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm     2019-05-03 00:12:51 UTC (rev 244896)
+++ trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm        2019-05-03 01:05:32 UTC (rev 244897)
</span><span class="lines">@@ -430,6 +430,11 @@
</span><span class="cx"> void WebPageProxy::layerTreeCommitComplete()
</span><span class="cx"> {
</span><span class="cx">     pageClient().layerTreeCommitComplete();
</span><ins>+
+    if (m_waitingForPostLayoutEditorStateUpdateAfterFocusingElement && !m_editorState.isMissingPostLayoutData) {
+        pageClient().didReceiveEditorStateUpdateAfterFocus();
+        m_waitingForPostLayoutEditorStateUpdateAfterFocusingElement = false;
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPageProxy::selectWithGesture(const WebCore::IntPoint point, WebCore::TextGranularity granularity, uint32_t gestureType, uint32_t gestureState, bool isInteractingWithFocusedElement, WTF::Function<void(const WebCore::IntPoint&, uint32_t, uint32_t, uint32_t, CallbackBase::Error)>&& callbackFunction)
</span><span class="lines">@@ -1102,7 +1107,7 @@
</span><span class="cx">     process().send(Messages::WebPage::ContentSizeCategoryDidChange(contentSizeCategory), m_pageID);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPageProxy::editorStateChanged(const EditorState& editorState)
</del><ins>+void WebPageProxy::updateEditorState(const EditorState& editorState)
</ins><span class="cx"> {
</span><span class="cx">     bool couldChangeSecureInputState = m_editorState.isInPasswordField != editorState.isInPasswordField || m_editorState.selectionIsNone;
</span><span class="cx">     
</span><span class="lines">@@ -1119,11 +1124,15 @@
</span><span class="cx">     // even during composition to support phrase boundary gesture.
</span><span class="cx">     pageClient().selectionDidChange();
</span><span class="cx">     updateFontAttributesAfterEditorStateChange();
</span><ins>+}
</ins><span class="cx"> 
</span><del>-    if (m_waitingForPostLayoutEditorStateUpdateAfterFocusingElement && !m_editorState.isMissingPostLayoutData) {
-        pageClient().didReceiveEditorStateUpdateAfterFocus();
-        m_waitingForPostLayoutEditorStateUpdateAfterFocusingElement = false;
-    }
</del><ins>+void WebPageProxy::dispatchDidReceiveEditorStateAfterFocus()
+{
+    if (!m_waitingForPostLayoutEditorStateUpdateAfterFocusingElement || m_editorState.isMissingPostLayoutData)
+        return;
+
+    pageClient().didReceiveEditorStateUpdateAfterFocus();
+    m_waitingForPostLayoutEditorStateUpdateAfterFocusingElement = false;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPageProxy::showValidationMessage(const IntRect& anchorClientRect, const String& message)
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessmacWebPageProxyMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm (244896 => 244897)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm     2019-05-03 00:12:51 UTC (rev 244896)
+++ trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm        2019-05-03 01:05:32 UTC (rev 244897)
</span><span class="lines">@@ -607,7 +607,7 @@
</span><span class="cx">     return MacApplication::isAppleMail();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPageProxy::editorStateChanged(const EditorState& editorState)
</del><ins>+void WebPageProxy::updateEditorState(const EditorState& editorState)
</ins><span class="cx"> {
</span><span class="cx">     bool couldChangeSecureInputState = m_editorState.isInPasswordField != editorState.isInPasswordField || m_editorState.selectionIsNone;
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcesswinWebPageProxyWincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/win/WebPageProxyWin.cpp (244896 => 244897)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/win/WebPageProxyWin.cpp    2019-05-03 00:12:51 UTC (rev 244896)
+++ trunk/Source/WebKit/UIProcess/win/WebPageProxyWin.cpp       2019-05-03 01:05:32 UTC (rev 244897)
</span><span class="lines">@@ -60,7 +60,7 @@
</span><span class="cx">     completionHandler(WTFMove(searchItems));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPageProxy::editorStateChanged(const EditorState& editorState)
</del><ins>+void WebPageProxy::updateEditorState(const EditorState& editorState)
</ins><span class="cx"> {
</span><span class="cx">     m_editorState = editorState;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcesswpeWebPageProxyWPEcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/wpe/WebPageProxyWPE.cpp (244896 => 244897)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/wpe/WebPageProxyWPE.cpp    2019-05-03 00:12:51 UTC (rev 244896)
+++ trunk/Source/WebKit/UIProcess/wpe/WebPageProxyWPE.cpp       2019-05-03 01:05:32 UTC (rev 244897)
</span><span class="lines">@@ -64,7 +64,7 @@
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPageProxy::editorStateChanged(const EditorState&)
</del><ins>+void WebPageProxy::updateEditorState(const EditorState&)
</ins><span class="cx"> {
</span><span class="cx">     notImplemented();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (244896 => 244897)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2019-05-03 00:12:51 UTC (rev 244896)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h    2019-05-03 01:05:32 UTC (rev 244897)
</span><span class="lines">@@ -1183,6 +1183,7 @@
</span><span class="cx">     void setRemoteObjectRegistry(RemoteObjectRegistry&);
</span><span class="cx"> 
</span><span class="cx">     void updateIntrinsicContentSizeIfNeeded(const WebCore::IntSize&);
</span><ins>+    void scheduleFullEditorStateUpdate();
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     WebPage(uint64_t pageID, WebPageCreationParameters&&);
</span><span class="lines">@@ -1199,7 +1200,6 @@
</span><span class="cx">     void platformDetach();
</span><span class="cx">     void platformEditorState(WebCore::Frame&, EditorState& result, IncludePostLayoutDataHint) const;
</span><span class="cx">     void sendEditorStateUpdate();
</span><del>-    void scheduleFullEditorStateUpdate();
</del><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx">     void sendTouchBarMenuDataAddedUpdate(WebCore::HTMLMenuElement&);
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebPageWebPagemessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (244896 => 244897)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in       2019-05-03 00:12:51 UTC (rev 244896)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in  2019-05-03 01:05:32 UTC (rev 244897)
</span><span class="lines">@@ -202,6 +202,8 @@
</span><span class="cx">     RunJavaScriptInFrame(uint64_t frameID, String script, bool forceUserGesture, WebKit::CallbackID callbackID)
</span><span class="cx">     ForceRepaint(WebKit::CallbackID callbackID)
</span><span class="cx"> 
</span><ins>+    ScheduleFullEditorStateUpdate()
+
</ins><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx">     # Dictionary support.
</span><span class="cx">     PerformDictionaryLookupOfCurrentSelection()
</span></span></pre>
</div>
</div>

</body>
</html>