Title: [274457] trunk
Revision
274457
Author
[email protected]
Date
2021-03-15 18:25:41 -0700 (Mon, 15 Mar 2021)

Log Message

[iOS] WebPageProxy's EditorState may be stale until the next remote layer tree commit
https://bugs.webkit.org/show_bug.cgi?id=223207
<rdar://problem/75410700>

Reviewed by Tim Horton.

Source/WebKit:

Fixes a race condition wherein it's possible for the cached `EditorState` in the UI process (on `WebPageProxy`)
to be set to a stale (older) value after being set to a newer value. This can happen in the case where:

1.  An editor state update is computed and set on a remote layer tree transaction in the web process, inside
    `WebPage::willCommitLayerTree`. A pending `BackingStoreFlusher` is created, and we dispatch a task onto a
    background queue to flush the layer tree commit.

2.  IPC that updates the selection arrives in the web process (e.g. WebPage::selectTextWithGranularityAtPoint),
    and causes us to send an `EditorStateChanged` message to the UI process with this new selection.

3.  The pending `BackingStoreFlusher` created in step (1) dispatches on the background queue, and sends its
    editor state over to the UI process.

As a result, the UI process receives the `EditorStateChanged` message in step (2) before it receives the remote
layer tree transaction sent in step (3), which contains the editor state computed prior to step (2); we then set
`WebPageProxy::m_editorState` from its value computed in step (2) to the value computed in step (1).

To fix this (and any similar issues involving out-of-band editor state updates), we introduce a monotonically
increasing transaction ID on editor state that's similar to the one used for remote layer tree commits; we then
avoid updating the editor state in `WebPageProxy` if we receive an `EditorState` whose transaction ID is less
than our current ID.

Test: fast/images/image-extraction/ios/reselect-word-in-image-overlay.html

* Shared/EditorState.cpp:
(WebKit::EditorState::encode const):
(WebKit::EditorState::decode):
* Shared/EditorState.h:

Add the TransactionID, and add encoding/decoding support for the new member.

* UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::editorStateChanged):
(WebKit::WebPageProxy::updateEditorState):

Refactor this to return a `bool`, indicating whether the editor state was modified (this only returns `false` in
the case where the incoming editor state was older than the one we currently have). We also make this method
platform-agnostic, and move the platform-dependent logic previously implemented by individual `updateEditorState`
implementations into `WebPageProxy::didUpdateEditorState` instead.

* UIProcess/WebPageProxy.h:
* UIProcess/gtk/WebPageProxyGtk.cpp:
(WebKit::WebPageProxy::didUpdateEditorState):
(WebKit::WebPageProxy::updateEditorState): Deleted.
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::didUpdateEditorState):

Add a new platform method hook that is called when `m_editorState` is updated due to an incoming `EditorState`
from the web process. The old and new cached `EditorState` values are passed into this method; note that even
though only the previous value is necessary as an argument (since `m_editorState` is already equal to the new
value here), I chose to pass in both to make it clear that both old and new values can be consulted here.

(WebKit::WebPageProxy::updateEditorState): Deleted.
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::didUpdateEditorState):
(WebKit::WebPageProxy::updateEditorState): Deleted.
* UIProcess/playstation/WebPageProxyPlayStation.cpp:
(WebKit::WebPageProxy::didUpdateEditorState):
(WebKit::WebPageProxy::updateEditorState): Deleted.
* UIProcess/win/WebPageProxyWin.cpp:
(WebKit::WebPageProxy::didUpdateEditorState):
(WebKit::WebPageProxy::updateEditorState): Deleted.
* UIProcess/wpe/WebPageProxyWPE.cpp:
(WebKit::WebPageProxy::didUpdateEditorState):
(WebKit::WebPageProxy::updateEditorState): Deleted.

Rename these method implementations, and adjust them to use `oldEditorState` and `newEditorState`.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::editorState const):
* WebProcess/WebPage/WebPage.h:

LayoutTests:

* fast/images/image-extraction/ios/reselect-word-in-image-overlay-expected.txt: Added.
* fast/images/image-extraction/ios/reselect-word-in-image-overlay.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (274456 => 274457)


--- trunk/LayoutTests/ChangeLog	2021-03-16 00:52:06 UTC (rev 274456)
+++ trunk/LayoutTests/ChangeLog	2021-03-16 01:25:41 UTC (rev 274457)
@@ -1,3 +1,14 @@
+2021-03-15  Wenson Hsieh  <[email protected]>
+
+        [iOS] WebPageProxy's EditorState may be stale until the next remote layer tree commit
+        https://bugs.webkit.org/show_bug.cgi?id=223207
+        <rdar://problem/75410700>
+
+        Reviewed by Tim Horton.
+
+        * fast/images/image-extraction/ios/reselect-word-in-image-overlay-expected.txt: Added.
+        * fast/images/image-extraction/ios/reselect-word-in-image-overlay.html: Added.
+
 2021-03-15  Zalan Bujtas  <[email protected]>
 
         [Multi-column] Ignore line grid offset when the grid line is shorter than 0.5px

Added: trunk/LayoutTests/fast/images/image-extraction/ios/reselect-word-in-image-overlay-expected.txt (0 => 274457)


--- trunk/LayoutTests/fast/images/image-extraction/ios/reselect-word-in-image-overlay-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/images/image-extraction/ios/reselect-word-in-image-overlay-expected.txt	2021-03-16 01:25:41 UTC (rev 274457)
@@ -0,0 +1,7 @@
+PASS selectionRects.length is 1
+PASS Dismissed selection
+PASS selectionRects.length is 1
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/images/image-extraction/ios/reselect-word-in-image-overlay.html (0 => 274457)


--- trunk/LayoutTests/fast/images/image-extraction/ios/reselect-word-in-image-overlay.html	                        (rev 0)
+++ trunk/LayoutTests/fast/images/image-extraction/ios/reselect-word-in-image-overlay.html	2021-03-16 01:25:41 UTC (rev 274457)
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script src=""
+<style>
+img {
+    position: absolute;
+    top: 0;
+    left: 0;
+}
+</style>
+</head>
+<body>
+<img src=""
+<script>
+jsTestIsAsync = true;
+addEventListener("load", async () => {
+    let image = document.querySelector("img");
+    internals.installImageOverlay(image, [
+        {
+            text : "foo",
+            topLeft : new DOMPointReadOnly(0, 0),
+            topRight : new DOMPointReadOnly(1, 0),
+            bottomRight : new DOMPointReadOnly(1, 0.5),
+            bottomLeft : new DOMPointReadOnly(0, 0.5),
+        }
+    ]);
+    await UIHelper.longPressAtPoint(200, 100);
+    selectionRects = await UIHelper.waitForSelectionToAppear();
+    shouldBe("selectionRects.length", "1");
+
+    await UIHelper.activateAt(200, 300);
+    await UIHelper.waitForSelectionToDisappear();
+    testPassed("Dismissed selection");
+
+    await UIHelper.longPressAtPoint(200, 100);
+    selectionRects = await UIHelper.waitForSelectionToAppear();
+    shouldBe("selectionRects.length", "1");
+
+    finishJSTest();
+});
+</script>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebKit/ChangeLog (274456 => 274457)


--- trunk/Source/WebKit/ChangeLog	2021-03-16 00:52:06 UTC (rev 274456)
+++ trunk/Source/WebKit/ChangeLog	2021-03-16 01:25:41 UTC (rev 274457)
@@ -1,3 +1,85 @@
+2021-03-15  Wenson Hsieh  <[email protected]>
+
+        [iOS] WebPageProxy's EditorState may be stale until the next remote layer tree commit
+        https://bugs.webkit.org/show_bug.cgi?id=223207
+        <rdar://problem/75410700>
+
+        Reviewed by Tim Horton.
+
+        Fixes a race condition wherein it's possible for the cached `EditorState` in the UI process (on `WebPageProxy`)
+        to be set to a stale (older) value after being set to a newer value. This can happen in the case where:
+
+        1.  An editor state update is computed and set on a remote layer tree transaction in the web process, inside
+            `WebPage::willCommitLayerTree`. A pending `BackingStoreFlusher` is created, and we dispatch a task onto a
+            background queue to flush the layer tree commit.
+
+        2.  IPC that updates the selection arrives in the web process (e.g. WebPage::selectTextWithGranularityAtPoint),
+            and causes us to send an `EditorStateChanged` message to the UI process with this new selection.
+
+        3.  The pending `BackingStoreFlusher` created in step (1) dispatches on the background queue, and sends its
+            editor state over to the UI process.
+
+        As a result, the UI process receives the `EditorStateChanged` message in step (2) before it receives the remote
+        layer tree transaction sent in step (3), which contains the editor state computed prior to step (2); we then set
+        `WebPageProxy::m_editorState` from its value computed in step (2) to the value computed in step (1).
+
+        To fix this (and any similar issues involving out-of-band editor state updates), we introduce a monotonically
+        increasing transaction ID on editor state that's similar to the one used for remote layer tree commits; we then
+        avoid updating the editor state in `WebPageProxy` if we receive an `EditorState` whose transaction ID is less
+        than our current ID.
+
+        Test: fast/images/image-extraction/ios/reselect-word-in-image-overlay.html
+
+        * Shared/EditorState.cpp:
+        (WebKit::EditorState::encode const):
+        (WebKit::EditorState::decode):
+        * Shared/EditorState.h:
+
+        Add the TransactionID, and add encoding/decoding support for the new member.
+
+        * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
+        (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::editorStateChanged):
+        (WebKit::WebPageProxy::updateEditorState):
+
+        Refactor this to return a `bool`, indicating whether the editor state was modified (this only returns `false` in
+        the case where the incoming editor state was older than the one we currently have). We also make this method
+        platform-agnostic, and move the platform-dependent logic previously implemented by individual `updateEditorState`
+        implementations into `WebPageProxy::didUpdateEditorState` instead.
+
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/gtk/WebPageProxyGtk.cpp:
+        (WebKit::WebPageProxy::didUpdateEditorState):
+        (WebKit::WebPageProxy::updateEditorState): Deleted.
+        * UIProcess/ios/WebPageProxyIOS.mm:
+        (WebKit::WebPageProxy::didUpdateEditorState):
+
+        Add a new platform method hook that is called when `m_editorState` is updated due to an incoming `EditorState`
+        from the web process. The old and new cached `EditorState` values are passed into this method; note that even
+        though only the previous value is necessary as an argument (since `m_editorState` is already equal to the new
+        value here), I chose to pass in both to make it clear that both old and new values can be consulted here.
+
+        (WebKit::WebPageProxy::updateEditorState): Deleted.
+        * UIProcess/mac/WebPageProxyMac.mm:
+        (WebKit::WebPageProxy::didUpdateEditorState):
+        (WebKit::WebPageProxy::updateEditorState): Deleted.
+        * UIProcess/playstation/WebPageProxyPlayStation.cpp:
+        (WebKit::WebPageProxy::didUpdateEditorState):
+        (WebKit::WebPageProxy::updateEditorState): Deleted.
+        * UIProcess/win/WebPageProxyWin.cpp:
+        (WebKit::WebPageProxy::didUpdateEditorState):
+        (WebKit::WebPageProxy::updateEditorState): Deleted.
+        * UIProcess/wpe/WebPageProxyWPE.cpp:
+        (WebKit::WebPageProxy::didUpdateEditorState):
+        (WebKit::WebPageProxy::updateEditorState): Deleted.
+
+        Rename these method implementations, and adjust them to use `oldEditorState` and `newEditorState`.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::editorState const):
+        * WebProcess/WebPage/WebPage.h:
+
 2021-03-15  Alex Christensen  <[email protected]>
 
         REGRESSION(r271642) Another app was relying on DOMWindow reuse

Modified: trunk/Source/WebKit/Shared/EditorState.cpp (274456 => 274457)


--- trunk/Source/WebKit/Shared/EditorState.cpp	2021-03-16 00:52:06 UTC (rev 274456)
+++ trunk/Source/WebKit/Shared/EditorState.cpp	2021-03-16 01:25:41 UTC (rev 274457)
@@ -34,6 +34,7 @@
 
 void EditorState::encode(IPC::Encoder& encoder) const
 {
+    encoder << transactionID;
     encoder << originIdentifierForPasteboard;
     encoder << shouldIgnoreSelectionChanges;
     encoder << selectionIsNone;
@@ -50,6 +51,9 @@
 
 bool EditorState::decode(IPC::Decoder& decoder, EditorState& result)
 {
+    if (!decoder.decode(result.transactionID))
+        return false;
+
     if (!decoder.decode(result.originIdentifierForPasteboard))
         return false;
 

Modified: trunk/Source/WebKit/Shared/EditorState.h (274456 => 274457)


--- trunk/Source/WebKit/Shared/EditorState.h	2021-03-16 00:52:06 UTC (rev 274456)
+++ trunk/Source/WebKit/Shared/EditorState.h	2021-03-16 01:25:41 UTC (rev 274457)
@@ -26,6 +26,7 @@
 #pragma once
 
 #include "ArgumentCoders.h"
+#include "TransactionID.h"
 #include <WebCore/Color.h>
 #include <WebCore/FontAttributes.h>
 #include <WebCore/IntRect.h>
@@ -69,6 +70,7 @@
 };
 
 struct EditorState {
+    TransactionID transactionID;
     String originIdentifierForPasteboard;
     bool shouldIgnoreSelectionChanges { false };
     bool selectionIsNone { true }; // This will be false when there is a caret selection.

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm (274456 => 274457)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm	2021-03-16 00:52:06 UTC (rev 274456)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm	2021-03-16 01:25:41 UTC (rev 274457)
@@ -212,8 +212,7 @@
     m_transactionIDForPendingCACommit = layerTreeTransaction.transactionID();
     m_activityStateChangeID = layerTreeTransaction.activityStateChangeID();
 
-    if (layerTreeTransaction.hasEditorState())
-        m_webPageProxy.updateEditorState(layerTreeTransaction.editorState());
+    bool didUpdateEditorState = layerTreeTransaction.hasEditorState() && m_webPageProxy.updateEditorState(layerTreeTransaction.editorState());
 
     if (m_remoteLayerTreeHost->updateLayerTree(layerTreeTransaction)) {
         if (layerTreeTransaction.transactionID() >= m_transactionIDForUnhidingContent)
@@ -263,7 +262,7 @@
     didRefreshDisplay();
 #endif
 
-    if (layerTreeTransaction.hasEditorState())
+    if (didUpdateEditorState)
         m_webPageProxy.dispatchDidUpdateEditorState();
 
     if (auto milestones = layerTreeTransaction.newlyReachedPaintingMilestones())

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (274456 => 274457)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2021-03-16 00:52:06 UTC (rev 274456)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2021-03-16 01:25:41 UTC (rev 274457)
@@ -7167,10 +7167,20 @@
 
 void WebPageProxy::editorStateChanged(const EditorState& editorState)
 {
-    updateEditorState(editorState);
-    dispatchDidUpdateEditorState();
+    if (updateEditorState(editorState))
+        dispatchDidUpdateEditorState();
 }
 
+bool WebPageProxy::updateEditorState(const EditorState& newEditorState)
+{
+    if (newEditorState.transactionID < m_editorState.transactionID)
+        return false;
+
+    auto oldEditorState = std::exchange(m_editorState, newEditorState);
+    didUpdateEditorState(oldEditorState, newEditorState);
+    return true;
+}
+
 #if !PLATFORM(IOS_FAMILY)
 
 void WebPageProxy::dispatchDidUpdateEditorState()

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (274456 => 274457)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2021-03-16 00:52:06 UTC (rev 274456)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2021-03-16 01:25:41 UTC (rev 274457)
@@ -1600,7 +1600,7 @@
     void createSandboxExtensionsIfNeeded(const Vector<String>& files, SandboxExtension::Handle& fileReadHandle, SandboxExtension::HandleArray& fileUploadHandles);
 #endif
     void editorStateChanged(const EditorState&);
-    void updateEditorState(const EditorState&);
+    bool updateEditorState(const EditorState& newEditorState);
     void scheduleFullEditorStateUpdate();
     void dispatchDidUpdateEditorState();
 
@@ -2252,7 +2252,6 @@
     void updateInputContextAfterBlurringAndRefocusingElement();
     void focusedElementDidChangeInputMode(WebCore::InputMode);
     void didReleaseAllTouchPoints();
-    void didUpdateEditorState();
 
     void showInspectorHighlight(const WebCore::InspectorOverlay::Highlight&);
     void hideInspectorHighlight();
@@ -2417,6 +2416,8 @@
 
     static SandboxExtension::Handle fontdMachExtensionHandle();
 
+    void didUpdateEditorState(const EditorState& oldEditorState, const EditorState& newEditorState);
+
     const Identifier m_identifier;
     WebCore::PageIdentifier m_webPageID;
     WeakPtr<PageClient> m_pageClient;

Modified: trunk/Source/WebKit/UIProcess/gtk/WebPageProxyGtk.cpp (274456 => 274457)


--- trunk/Source/WebKit/UIProcess/gtk/WebPageProxyGtk.cpp	2021-03-16 00:52:06 UTC (rev 274456)
+++ trunk/Source/WebKit/UIProcess/gtk/WebPageProxyGtk.cpp	2021-03-16 01:25:41 UTC (rev 274457)
@@ -58,13 +58,11 @@
 #endif
 }
 
-void WebPageProxy::updateEditorState(const EditorState& editorState)
+void WebPageProxy::didUpdateEditorState(const EditorState&, const EditorState& newEditorState)
 {
-    m_editorState = editorState;
-    
-    if (editorState.shouldIgnoreSelectionChanges)
+    if (newEditorState.shouldIgnoreSelectionChanges)
         return;
-    if (m_editorState.selectionIsRange)
+    if (newEditorState.selectionIsRange)
         WebPasteboardProxy::singleton().setPrimarySelectionOwner(focusedFrame());
     pageClient().selectionDidChange();
 }

Modified: trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm (274456 => 274457)


--- trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm	2021-03-16 00:52:06 UTC (rev 274456)
+++ trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm	2021-03-16 01:25:41 UTC (rev 274457)
@@ -1052,17 +1052,15 @@
     send(Messages::WebPage::GenerateSyntheticEditingCommand(command));
 }
 
-void WebPageProxy::updateEditorState(const EditorState& editorState)
+void WebPageProxy::didUpdateEditorState(const EditorState& oldEditorState, const EditorState& newEditorState)
 {
-    bool couldChangeSecureInputState = m_editorState.isInPasswordField != editorState.isInPasswordField || m_editorState.selectionIsNone;
+    bool couldChangeSecureInputState = newEditorState.isInPasswordField != oldEditorState.isInPasswordField || oldEditorState.selectionIsNone;
     
-    m_editorState = editorState;
-    
     // Selection being none is a temporary state when editing. Flipping secure input state too quickly was causing trouble (not fully understood).
-    if (couldChangeSecureInputState && !editorState.selectionIsNone)
+    if (couldChangeSecureInputState && !newEditorState.selectionIsNone)
         pageClient().updateSecureInputState();
     
-    if (editorState.shouldIgnoreSelectionChanges)
+    if (newEditorState.shouldIgnoreSelectionChanges)
         return;
     
     // We always need to notify the client on iOS to make sure the selection is redrawn,

Modified: trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm (274456 => 274457)


--- trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm	2021-03-16 00:52:06 UTC (rev 274456)
+++ trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm	2021-03-16 01:25:41 UTC (rev 274457)
@@ -574,17 +574,14 @@
     return pageClient().boundsOfLayerInLayerBackedWindowCoordinates(layer);
 }
 
-void WebPageProxy::updateEditorState(const EditorState& editorState)
+void WebPageProxy::didUpdateEditorState(const EditorState& oldEditorState, const EditorState& newEditorState)
 {
-    bool couldChangeSecureInputState = m_editorState.isInPasswordField != editorState.isInPasswordField || m_editorState.selectionIsNone;
-    
-    m_editorState = editorState;
-    
+    bool couldChangeSecureInputState = newEditorState.isInPasswordField != oldEditorState.isInPasswordField || oldEditorState.selectionIsNone;
     // Selection being none is a temporary state when editing. Flipping secure input state too quickly was causing trouble (not fully understood).
-    if (couldChangeSecureInputState && !editorState.selectionIsNone)
+    if (couldChangeSecureInputState && !newEditorState.selectionIsNone)
         pageClient().updateSecureInputState();
     
-    if (editorState.shouldIgnoreSelectionChanges)
+    if (newEditorState.shouldIgnoreSelectionChanges)
         return;
     
     pageClient().selectionDidChange();

Modified: trunk/Source/WebKit/UIProcess/playstation/WebPageProxyPlayStation.cpp (274456 => 274457)


--- trunk/Source/WebKit/UIProcess/playstation/WebPageProxyPlayStation.cpp	2021-03-16 00:52:06 UTC (rev 274456)
+++ trunk/Source/WebKit/UIProcess/playstation/WebPageProxyPlayStation.cpp	2021-03-16 01:25:41 UTC (rev 274457)
@@ -64,9 +64,8 @@
     completionHandler({ });
 }
 
-void WebPageProxy::updateEditorState(const EditorState& editorState)
+void WebPageProxy::didUpdateEditorState(const EditorState&, const EditorState&)
 {
-    m_editorState = editorState;
 }
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/UIProcess/win/WebPageProxyWin.cpp (274456 => 274457)


--- trunk/Source/WebKit/UIProcess/win/WebPageProxyWin.cpp	2021-03-16 00:52:06 UTC (rev 274456)
+++ trunk/Source/WebKit/UIProcess/win/WebPageProxyWin.cpp	2021-03-16 01:25:41 UTC (rev 274457)
@@ -70,9 +70,8 @@
     completionHandler(WTFMove(searchItems));
 }
 
-void WebPageProxy::updateEditorState(const EditorState& editorState)
+void WebPageProxy::didUpdateEditorState(const EditorState&, const EditorState&)
 {
-    m_editorState = editorState;
 }
 
 PlatformViewWidget WebPageProxy::viewWidget()

Modified: trunk/Source/WebKit/UIProcess/wpe/WebPageProxyWPE.cpp (274456 => 274457)


--- trunk/Source/WebKit/UIProcess/wpe/WebPageProxyWPE.cpp	2021-03-16 00:52:06 UTC (rev 274456)
+++ trunk/Source/WebKit/UIProcess/wpe/WebPageProxyWPE.cpp	2021-03-16 01:25:41 UTC (rev 274457)
@@ -54,10 +54,9 @@
 }
 #endif
 
-void WebPageProxy::updateEditorState(const EditorState& editorState)
+void WebPageProxy::didUpdateEditorState(const EditorState&, const EditorState& newEditorState)
 {
-    m_editorState = editorState;
-    if (!editorState.shouldIgnoreSelectionChanges)
+    if (!newEditorState.shouldIgnoreSelectionChanges)
         pageClient().selectionDidChange();
 }
 

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (274456 => 274457)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2021-03-16 00:52:06 UTC (rev 274456)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2021-03-16 01:25:41 UTC (rev 274457)
@@ -1183,6 +1183,7 @@
     const VisibleSelection& selection = frame->selection().selection();
     const Editor& editor = frame->editor();
 
+    result.transactionID = m_lastEditorStateTransactionID.increment();
     result.selectionIsNone = selection.isNone();
     result.selectionIsRange = selection.isRange();
     result.isContentEditable = selection.isContentEditable();

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (274456 => 274457)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2021-03-16 00:52:06 UTC (rev 274456)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2021-03-16 01:25:41 UTC (rev 274457)
@@ -2176,6 +2176,7 @@
 
     enum class EditorStateIsContentEditable { No, Yes, Unset };
     mutable EditorStateIsContentEditable m_lastEditorStateWasContentEditable { EditorStateIsContentEditable::Unset };
+    mutable TransactionID m_lastEditorStateTransactionID;
 
 #if PLATFORM(GTK) || PLATFORM(WPE)
     Optional<InputMethodState> m_inputMethodState;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to