Title: [222548] branches/safari-604-branch

Diff

Modified: branches/safari-604-branch/LayoutTests/ChangeLog (222547 => 222548)


--- branches/safari-604-branch/LayoutTests/ChangeLog	2017-09-27 02:54:36 UTC (rev 222547)
+++ branches/safari-604-branch/LayoutTests/ChangeLog	2017-09-27 03:17:31 UTC (rev 222548)
@@ -1,3 +1,18 @@
+2017-09-26  Jason Marcell  <[email protected]>
+
+        Cherry-pick r222539. rdar://problem/34205774
+
+    2017-09-26  Zalan Bujtas  <[email protected]>
+
+            Fall back to normal line layout position, when simple line layout fails to find one.
+            https://bugs.webkit.org/show_bug.cgi?id=176220
+            <rdar://problem/34205774>
+
+            Reviewed by Brent Fulgham.
+
+            * fast/text/invalid-positionForPoint-offset-expected.txt: Added.
+            * fast/text/invalid-positionForPoint-offset.html: Added.
+
 2017-09-25  Ryan Haddad  <[email protected]>
 
         Cherry-pick r222399.

Added: branches/safari-604-branch/LayoutTests/fast/text/invalid-positionForPoint-offset-expected.txt (0 => 222548)


--- branches/safari-604-branch/LayoutTests/fast/text/invalid-positionForPoint-offset-expected.txt	                        (rev 0)
+++ branches/safari-604-branch/LayoutTests/fast/text/invalid-positionForPoint-offset-expected.txt	2017-09-27 03:17:31 UTC (rev 222548)
@@ -0,0 +1 @@
+

Added: branches/safari-604-branch/LayoutTests/fast/text/invalid-positionForPoint-offset.html (0 => 222548)


--- branches/safari-604-branch/LayoutTests/fast/text/invalid-positionForPoint-offset.html	                        (rev 0)
+++ branches/safari-604-branch/LayoutTests/fast/text/invalid-positionForPoint-offset.html	2017-09-27 03:17:31 UTC (rev 222548)
@@ -0,0 +1,25 @@
+<style>
+* { 
+    border-bottom: green solid; 
+    margin: 0px; 
+}
+</style>
+<script>
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+function eventhandler() {
+    dd.before(a);
+    document.caretRangeFromPoint(0,0);
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+</script>
+<h6>
+<a id="a"></a>
+</h6>
+<dd id="dd"></dd>
+<svg>
+PASS if no crash.
+<set attributeName="dominant-baseline" _onbegin_="eventhandler()" />

Modified: branches/safari-604-branch/Source/WebCore/ChangeLog (222547 => 222548)


--- branches/safari-604-branch/Source/WebCore/ChangeLog	2017-09-27 02:54:36 UTC (rev 222547)
+++ branches/safari-604-branch/Source/WebCore/ChangeLog	2017-09-27 03:17:31 UTC (rev 222548)
@@ -1,5 +1,27 @@
 2017-09-26  Jason Marcell  <[email protected]>
 
+        Cherry-pick r222539. rdar://problem/34205774
+
+    2017-09-26  Zalan Bujtas  <[email protected]>
+
+            Fall back to normal line layout position, when simple line layout fails to find one.
+            https://bugs.webkit.org/show_bug.cgi?id=176220
+            <rdar://problem/34205774>
+
+            Reviewed by Brent Fulgham.
+
+            In case of empty content, let's just fall back to normal line layout and try to
+            find the visually correct one.
+
+            Test: fast/text/invalid-positionForPoint-offset.html
+
+            * rendering/RenderText.cpp:
+            (WebCore::RenderText::positionForPoint):
+            * rendering/SimpleLineLayoutResolver.cpp:
+            (WebCore::SimpleLineLayout::RunResolver::runForPoint const):
+
+2017-09-26  Jason Marcell  <[email protected]>
+
         Cherry-pick r222474. rdar://problem/34646376
 
     2017-09-25  Per Arne Vollan  <[email protected]>

Modified: branches/safari-604-branch/Source/WebCore/rendering/RenderText.cpp (222547 => 222548)


--- branches/safari-604-branch/Source/WebCore/rendering/RenderText.cpp	2017-09-27 02:54:36 UTC (rev 222547)
+++ branches/safari-604-branch/Source/WebCore/rendering/RenderText.cpp	2017-09-27 03:17:31 UTC (rev 222548)
@@ -447,7 +447,11 @@
 Position RenderText::positionForPoint(const LayoutPoint& point)
 {
     if (simpleLineLayout() && parent()->firstChild() == parent()->lastChild()) {
-        auto position = Position(textNode(), SimpleLineLayout::textOffsetForPoint(point, *this, *simpleLineLayout()));
+        auto offset = SimpleLineLayout::textOffsetForPoint(point, *this, *simpleLineLayout());
+        // Did not find a valid offset. Fall back to the normal line layout based Position.
+        if (offset == textLength())
+            return positionForPoint(point, nullptr).deepEquivalent();
+        auto position = Position(textNode(), offset);
         ASSERT(position == positionForPoint(point, nullptr).deepEquivalent());
         return position;
     }

Modified: branches/safari-604-branch/Source/WebCore/rendering/SimpleLineLayoutResolver.cpp (222547 => 222548)


--- branches/safari-604-branch/Source/WebCore/rendering/SimpleLineLayoutResolver.cpp	2017-09-27 02:54:36 UTC (rev 222547)
+++ branches/safari-604-branch/Source/WebCore/rendering/SimpleLineLayoutResolver.cpp	2017-09-27 03:17:31 UTC (rev 222548)
@@ -239,6 +239,8 @@
 {
     if (!m_lineHeight)
         return end();
+    if (begin() == end())
+        return end();
     unsigned lineIndex = lineIndexForHeight(point.y(), IndexType::Last);
     auto x = point.x() - m_borderAndPaddingBefore;
     auto it = begin();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to