Title: [283087] trunk
Revision
283087
Author
an...@apple.com
Date
2021-09-26 06:47:42 -0700 (Sun, 26 Sep 2021)

Log Message

Line iterator firstRun/lastRun may return runs from wrong lines
https://bugs.webkit.org/show_bug.cgi?id=230770
<rdar://problem/83509753>

Reviewed by Alan Bujtas.

Source/WebCore:

In some situation line iterator firstRun/lastRun could return runs from different lines.
This could lead to inconsistencies like firstRun being non-null while lastRun is null.

Test: editing/iterator-line-start-end.html

* layout/integration/LayoutIntegrationLineIteratorModernPath.h:
(WebCore::LayoutIntegration::LineIteratorModernPath::firstRun const):
(WebCore::LayoutIntegration::LineIteratorModernPath::lastRun const):

Take care to only return runs from this line.

LayoutTests:

* editing/iterator-line-start-end-expected.txt: Added.
* editing/iterator-line-start-end.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (283086 => 283087)


--- trunk/LayoutTests/ChangeLog	2021-09-26 06:21:43 UTC (rev 283086)
+++ trunk/LayoutTests/ChangeLog	2021-09-26 13:47:42 UTC (rev 283087)
@@ -1,3 +1,14 @@
+2021-09-26  Antti Koivisto  <an...@apple.com>
+
+        Line iterator firstRun/lastRun may return runs from wrong lines
+        https://bugs.webkit.org/show_bug.cgi?id=230770
+        <rdar://problem/83509753>
+
+        Reviewed by Alan Bujtas.
+
+        * editing/iterator-line-start-end-expected.txt: Added.
+        * editing/iterator-line-start-end.html: Added.
+
 2021-09-23  Tim Nguyen  <n...@apple.com>
 
         Make inert nodes invisible to hit testing

Added: trunk/LayoutTests/editing/iterator-line-start-end-expected.txt (0 => 283087)


--- trunk/LayoutTests/editing/iterator-line-start-end-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/iterator-line-start-end-expected.txt	2021-09-26 13:47:42 UTC (rev 283087)
@@ -0,0 +1,3 @@
+
+This test passes if it doesn't crash
+xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx x

Added: trunk/LayoutTests/editing/iterator-line-start-end.html (0 => 283087)


--- trunk/LayoutTests/editing/iterator-line-start-end.html	                        (rev 0)
+++ trunk/LayoutTests/editing/iterator-line-start-end.html	2021-09-26 13:47:42 UTC (rev 283087)
@@ -0,0 +1,9 @@
+<img align="right" height="100">
+<div>This test passes if it doesn't crash</div>
+<div>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx x</div>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+
+document.execCommand("selectAll");
+</script>

Modified: trunk/Source/WebCore/ChangeLog (283086 => 283087)


--- trunk/Source/WebCore/ChangeLog	2021-09-26 06:21:43 UTC (rev 283086)
+++ trunk/Source/WebCore/ChangeLog	2021-09-26 13:47:42 UTC (rev 283087)
@@ -1,3 +1,22 @@
+2021-09-26  Antti Koivisto  <an...@apple.com>
+
+        Line iterator firstRun/lastRun may return runs from wrong lines
+        https://bugs.webkit.org/show_bug.cgi?id=230770
+        <rdar://problem/83509753>
+
+        Reviewed by Alan Bujtas.
+
+        In some situation line iterator firstRun/lastRun could return runs from different lines.
+        This could lead to inconsistencies like firstRun being non-null while lastRun is null.
+
+        Test: editing/iterator-line-start-end.html
+
+        * layout/integration/LayoutIntegrationLineIteratorModernPath.h:
+        (WebCore::LayoutIntegration::LineIteratorModernPath::firstRun const):
+        (WebCore::LayoutIntegration::LineIteratorModernPath::lastRun const):
+
+        Take care to only return runs from this line.
+
 2021-09-25  Alan Bujtas  <za...@apple.com>
 
         Fix win build.

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineIteratorModernPath.h (283086 => 283087)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineIteratorModernPath.h	2021-09-26 06:21:43 UTC (rev 283086)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineIteratorModernPath.h	2021-09-26 13:47:42 UTC (rev 283087)
@@ -102,7 +102,7 @@
             return { *m_inlineContent };
         auto runIterator = RunIteratorModernPath { *m_inlineContent, line().firstBoxIndex() };
         if (runIterator.box().isInlineBox())
-            runIterator.traverseNextLeaf();
+            runIterator.traverseNextOnLine();
         return runIterator;
     }
 
@@ -113,7 +113,7 @@
             return { *m_inlineContent };
         auto runIterator = RunIteratorModernPath { *m_inlineContent, line().firstBoxIndex() + boxCount - 1 };
         if (runIterator.box().isInlineBox())
-            runIterator.traversePreviousLeaf();
+            runIterator.traversePreviousOnLine();
         return runIterator;
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to