Title: [251346] branches/safari-608-branch
Revision
251346
Author
bshaf...@apple.com
Date
2019-10-20 10:33:25 -0700 (Sun, 20 Oct 2019)

Log Message

Cherry-pick r250929. rdar://problem/56280990

    RunResolver::rangeForRendererWithOffsets should check for range end
    https://bugs.webkit.org/show_bug.cgi?id=202761
    <rdar://problem/55917924>

    Reviewed by Antti Koivisto.

    Source/WebCore:

    This patch ensures that when rangeForRenderer comes back with a collapsed run (empty range), rangeForRendererWithOffsets returns an empty range as well.

    Test: fast/text/simple-line-layout-range-check-end.html

    * rendering/SimpleLineLayoutResolver.cpp:
    (WebCore::SimpleLineLayout::RunResolver::rangeForRendererWithOffsets const):

    LayoutTests:

    * fast/text/simple-line-layout-range-check-end-expected.txt: Added.
    * fast/text/simple-line-layout-range-check-end.html: Added.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250929 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: branches/safari-608-branch/LayoutTests/ChangeLog (251345 => 251346)


--- branches/safari-608-branch/LayoutTests/ChangeLog	2019-10-20 17:33:22 UTC (rev 251345)
+++ branches/safari-608-branch/LayoutTests/ChangeLog	2019-10-20 17:33:25 UTC (rev 251346)
@@ -1,5 +1,42 @@
 2019-10-15  Kocsen Chung  <kocsen_ch...@apple.com>
 
+        Cherry-pick r250929. rdar://problem/56280990
+
+    RunResolver::rangeForRendererWithOffsets should check for range end
+    https://bugs.webkit.org/show_bug.cgi?id=202761
+    <rdar://problem/55917924>
+    
+    Reviewed by Antti Koivisto.
+    
+    Source/WebCore:
+    
+    This patch ensures that when rangeForRenderer comes back with a collapsed run (empty range), rangeForRendererWithOffsets returns an empty range as well.
+    
+    Test: fast/text/simple-line-layout-range-check-end.html
+    
+    * rendering/SimpleLineLayoutResolver.cpp:
+    (WebCore::SimpleLineLayout::RunResolver::rangeForRendererWithOffsets const):
+    
+    LayoutTests:
+    
+    * fast/text/simple-line-layout-range-check-end-expected.txt: Added.
+    * fast/text/simple-line-layout-range-check-end.html: Added.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250929 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-10-09  Zalan Bujtas  <za...@apple.com>
+
+            RunResolver::rangeForRendererWithOffsets should check for range end
+            https://bugs.webkit.org/show_bug.cgi?id=202761
+            <rdar://problem/55917924>
+
+            Reviewed by Antti Koivisto.
+
+            * fast/text/simple-line-layout-range-check-end-expected.txt: Added.
+            * fast/text/simple-line-layout-range-check-end.html: Added.
+
+2019-10-15  Kocsen Chung  <kocsen_ch...@apple.com>
+
         Cherry-pick r250811. rdar://problem/56061121
 
     Only wrapping CryptoKeys for IDB during serialization

Added: branches/safari-608-branch/LayoutTests/fast/text/simple-line-layout-range-check-end-expected.txt (0 => 251346)


--- branches/safari-608-branch/LayoutTests/fast/text/simple-line-layout-range-check-end-expected.txt	                        (rev 0)
+++ branches/safari-608-branch/LayoutTests/fast/text/simple-line-layout-range-check-end-expected.txt	2019-10-20 17:33:25 UTC (rev 251346)
@@ -0,0 +1,3 @@
+Pass if no crash or assert.
+text
+

Added: branches/safari-608-branch/LayoutTests/fast/text/simple-line-layout-range-check-end.html (0 => 251346)


--- branches/safari-608-branch/LayoutTests/fast/text/simple-line-layout-range-check-end.html	                        (rev 0)
+++ branches/safari-608-branch/LayoutTests/fast/text/simple-line-layout-range-check-end.html	2019-10-20 17:33:25 UTC (rev 251346)
@@ -0,0 +1,14 @@
+Pass if no crash or assert.
+<div id=first></div>
+<div id=middle></div>
+<div id=last></div>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+middle.after("text");
+
+var foo = document.createRange();
+foo.selectNodeContents(last);
+foo.setStartAfter(first);
+foo.getBoundingClientRect();
+</script>

Modified: branches/safari-608-branch/Source/WebCore/ChangeLog (251345 => 251346)


--- branches/safari-608-branch/Source/WebCore/ChangeLog	2019-10-20 17:33:22 UTC (rev 251345)
+++ branches/safari-608-branch/Source/WebCore/ChangeLog	2019-10-20 17:33:25 UTC (rev 251346)
@@ -1,5 +1,46 @@
 2019-10-15  Kocsen Chung  <kocsen_ch...@apple.com>
 
+        Cherry-pick r250929. rdar://problem/56280990
+
+    RunResolver::rangeForRendererWithOffsets should check for range end
+    https://bugs.webkit.org/show_bug.cgi?id=202761
+    <rdar://problem/55917924>
+    
+    Reviewed by Antti Koivisto.
+    
+    Source/WebCore:
+    
+    This patch ensures that when rangeForRenderer comes back with a collapsed run (empty range), rangeForRendererWithOffsets returns an empty range as well.
+    
+    Test: fast/text/simple-line-layout-range-check-end.html
+    
+    * rendering/SimpleLineLayoutResolver.cpp:
+    (WebCore::SimpleLineLayout::RunResolver::rangeForRendererWithOffsets const):
+    
+    LayoutTests:
+    
+    * fast/text/simple-line-layout-range-check-end-expected.txt: Added.
+    * fast/text/simple-line-layout-range-check-end.html: Added.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250929 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-10-09  Zalan Bujtas  <za...@apple.com>
+
+            RunResolver::rangeForRendererWithOffsets should check for range end
+            https://bugs.webkit.org/show_bug.cgi?id=202761
+            <rdar://problem/55917924>
+
+            Reviewed by Antti Koivisto.
+
+            This patch ensures that when rangeForRenderer comes back with a collapsed run (empty range), rangeForRendererWithOffsets returns an empty range as well.
+
+            Test: fast/text/simple-line-layout-range-check-end.html
+
+            * rendering/SimpleLineLayoutResolver.cpp:
+            (WebCore::SimpleLineLayout::RunResolver::rangeForRendererWithOffsets const):
+
+2019-10-15  Kocsen Chung  <kocsen_ch...@apple.com>
+
         Cherry-pick r250811. rdar://problem/56061121
 
     Only wrapping CryptoKeys for IDB during serialization

Modified: branches/safari-608-branch/Source/WebCore/rendering/SimpleLineLayoutResolver.cpp (251345 => 251346)


--- branches/safari-608-branch/Source/WebCore/rendering/SimpleLineLayoutResolver.cpp	2019-10-20 17:33:22 UTC (rev 251345)
+++ branches/safari-608-branch/Source/WebCore/rendering/SimpleLineLayoutResolver.cpp	2019-10-20 17:33:25 UTC (rev 251346)
@@ -299,6 +299,8 @@
 {
     ASSERT(startOffset <= endOffset);
     auto range = rangeForRenderer(renderer);
+    if (range.begin() == range.end())
+        return { end(), end() };
     auto it = range.begin();
     auto localEnd = (*it).start() + endOffset;
     // Advance to the first run with the start offset inside. Only the first node in a range can have a startOffset.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to