Title: [287428] trunk/Source/WebCore
- Revision
- 287428
- Author
- [email protected]
- Date
- 2021-12-24 09:06:59 -0800 (Fri, 24 Dec 2021)
Log Message
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: trunk/Source/WebCore/ChangeLog (287427 => 287428)
--- trunk/Source/WebCore/ChangeLog 2021-12-24 16:57:47 UTC (rev 287427)
+++ trunk/Source/WebCore/ChangeLog 2021-12-24 17:06:59 UTC (rev 287428)
@@ -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-24 Sam Weinig <[email protected]>
On systems without CG support for alpha premultiplied gradients, the CGGradientRef path should still be used for the subset of gradients that can transformed
Modified: trunk/Source/WebCore/editing/InsertListCommand.cpp (287427 => 287428)
--- trunk/Source/WebCore/editing/InsertListCommand.cpp 2021-12-24 16:57:47 UTC (rev 287427)
+++ trunk/Source/WebCore/editing/InsertListCommand.cpp 2021-12-24 17:06:59 UTC (rev 287428)
@@ -156,7 +156,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