Title: [288288] releases/WebKitGTK/webkit-2.34/Source/WebCore
Revision
288288
Author
[email protected]
Date
2022-01-20 07:46:28 -0800 (Thu, 20 Jan 2022)

Log Message

Merge r287428 - Simplify test for startOfLastParagraph in InsertListCommand::doApply
https://bugs.webkit.org/show_bug.cgi?id=234600

Patch by Frederic Wang <[email protected]> on 2021-12-24
Reviewed by Darin Adler.

Current test is !startOfLastParagraph.deepEquivalent().anchorNode()->isConnected(). It could
be replaced with the less verbose startOfLastParagraph.isOrphan() which is equivalent to
startOfLastParagraph.deepEquivalent().isOrphan() and so to the condition
startOfLastParagraph.deepEquivalent().anchorNode() &&
!startOfLastParagraph.deepEquivalent().anchorNode()->isConnected(). A difference can only
happen for a page where anchorNode() is a null pointer. In such a test case exists, then it
is already crashing with a null ptr deref anyway.

No new tests, behavior essentially unchanged.

* editing/InsertListCommand.cpp:
(WebCore::InsertListCommand::doApply): Use startOfLastParagraph.isOrphan().

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.34/Source/WebCore/ChangeLog (288287 => 288288)


--- releases/WebKitGTK/webkit-2.34/Source/WebCore/ChangeLog	2022-01-20 15:41:36 UTC (rev 288287)
+++ releases/WebKitGTK/webkit-2.34/Source/WebCore/ChangeLog	2022-01-20 15:46:28 UTC (rev 288288)
@@ -1,3 +1,23 @@
+2021-12-24  Frederic Wang  <[email protected]>
+
+        Simplify test for startOfLastParagraph in InsertListCommand::doApply
+        https://bugs.webkit.org/show_bug.cgi?id=234600
+
+        Reviewed by Darin Adler.
+
+        Current test is !startOfLastParagraph.deepEquivalent().anchorNode()->isConnected(). It could
+        be replaced with the less verbose startOfLastParagraph.isOrphan() which is equivalent to
+        startOfLastParagraph.deepEquivalent().isOrphan() and so to the condition
+        startOfLastParagraph.deepEquivalent().anchorNode() &&
+        !startOfLastParagraph.deepEquivalent().anchorNode()->isConnected(). A difference can only
+        happen for a page where anchorNode() is a null pointer. In such a test case exists, then it
+        is already crashing with a null ptr deref anyway.
+
+        No new tests, behavior essentially unchanged.
+
+        * editing/InsertListCommand.cpp:
+        (WebCore::InsertListCommand::doApply): Use startOfLastParagraph.isOrphan().
+
 2021-12-23  Philippe Normand  <[email protected]>
 
         [GStreamer] MediaPlayerPrivateGStreamer mishandles failure to create WebKitTextCombiner

Modified: releases/WebKitGTK/webkit-2.34/Source/WebCore/editing/InsertListCommand.cpp (288287 => 288288)


--- releases/WebKitGTK/webkit-2.34/Source/WebCore/editing/InsertListCommand.cpp	2022-01-20 15:41:36 UTC (rev 288287)
+++ releases/WebKitGTK/webkit-2.34/Source/WebCore/editing/InsertListCommand.cpp	2022-01-20 15:46:28 UTC (rev 288288)
@@ -155,7 +155,7 @@
                     // infinite loop and because there is no more work to be done.
                     // FIXME(<rdar://problem/5983974>): The endingSelection() may be incorrect here. Compute
                     // the new location of endOfSelection and use it as the end of the new selection.
-                    if (!startOfLastParagraph.deepEquivalent().anchorNode()->isConnected())
+                    if (startOfLastParagraph.isOrphan())
                         return;
                     setEndingSelection(startOfCurrentParagraph);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to