Title: [256935] trunk/Source/WebKit
Revision
256935
Author
[email protected]
Date
2020-02-19 12:39:39 -0800 (Wed, 19 Feb 2020)

Log Message

[iOS] fast/dom/focus-shift-crash.html and editing/selection/selection-change-in-disconnected-frame-crash.html crash after r256864
https://bugs.webkit.org/show_bug.cgi?id=207939

Reviewed by Tim Horton.

Fix two layout tests that began to crash after r256864 due to a missing null check for EditorClient.
To make this conditional a bit easier to read, pull out each case where we should avoid calling
didChangeSelection() into a separate early return. The EditorClient may be null on iOS in the case where the
Frame has been detached from its Page.

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::updateSelectionAppearance):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (256934 => 256935)


--- trunk/Source/WebKit/ChangeLog	2020-02-19 20:22:00 UTC (rev 256934)
+++ trunk/Source/WebKit/ChangeLog	2020-02-19 20:39:39 UTC (rev 256935)
@@ -1,3 +1,18 @@
+2020-02-19  Wenson Hsieh  <[email protected]>
+
+        [iOS] fast/dom/focus-shift-crash.html and editing/selection/selection-change-in-disconnected-frame-crash.html crash after r256864
+        https://bugs.webkit.org/show_bug.cgi?id=207939
+
+        Reviewed by Tim Horton.
+
+        Fix two layout tests that began to crash after r256864 due to a missing null check for EditorClient.
+        To make this conditional a bit easier to read, pull out each case where we should avoid calling
+        didChangeSelection() into a separate early return. The EditorClient may be null on iOS in the case where the
+        Frame has been detached from its Page.
+
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::updateSelectionAppearance):
+
 2020-02-19  Kate Cheney  <[email protected]>
 
         WebPageProxy::PolicyDecisionSender should send a struct instead of many parameters

Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (256934 => 256935)


--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2020-02-19 20:22:00 UTC (rev 256934)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2020-02-19 20:39:39 UTC (rev 256935)
@@ -593,8 +593,16 @@
 {
     auto& frame = m_page->focusController().focusedOrMainFrame();
     auto& editor = frame.editor();
-    if (!editor.ignoreSelectionChanges() && editor.client()->shouldRevealCurrentSelectionAfterInsertion() && (editor.hasComposition() || !frame.selection().selection().isNone()))
-        didChangeSelection();
+    if (editor.ignoreSelectionChanges())
+        return;
+
+    if (editor.client() && !editor.client()->shouldRevealCurrentSelectionAfterInsertion())
+        return;
+
+    if (!editor.hasComposition() && frame.selection().selection().isNone())
+        return;
+
+    didChangeSelection();
 }
 
 static void dispatchSyntheticMouseMove(Frame& mainFrame, const WebCore::FloatPoint& location, OptionSet<WebEvent::Modifier> modifiers, WebCore::PointerID pointerId = WebCore::mousePointerID)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to