Title: [223553] trunk
Revision
223553
Author
[email protected]
Date
2017-10-17 10:13:56 -0700 (Tue, 17 Oct 2017)

Log Message

ASSERTION FAILED: m_truncation != cFullTruncation in InlineTextBox::clampedOffset()
https://bugs.webkit.org/show_bug.cgi?id=178322

Reviewed by Darin Adler.

Source/WebCore:

It is acceptable for InlineTextBox::clampedOffset() to be called for a fully truncated box,
say a person clicks on the ellipsis in a truncated text run. Restore the behavior prior to
r223259 and return the clamped offset.

Test: fast/text/click-ellipsis-assertion-failure.html

* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::clampedOffset const):

LayoutTests:

Add a test to ensure that clicking on the ellipsis in a truncated text run does not
cause an assertion failure in a debug build.

* fast/text/click-ellipsis-assertion-failure-expected.txt: Added.
* fast/text/click-ellipsis-assertion-failure.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (223552 => 223553)


--- trunk/LayoutTests/ChangeLog	2017-10-17 17:04:51 UTC (rev 223552)
+++ trunk/LayoutTests/ChangeLog	2017-10-17 17:13:56 UTC (rev 223553)
@@ -1,5 +1,18 @@
 2017-10-17  Daniel Bates  <[email protected]>
 
+        ASSERTION FAILED: m_truncation != cFullTruncation in InlineTextBox::clampedOffset()
+        https://bugs.webkit.org/show_bug.cgi?id=178322
+
+        Reviewed by Darin Adler.
+
+        Add a test to ensure that clicking on the ellipsis in a truncated text run does not
+        cause an assertion failure in a debug build.
+
+        * fast/text/click-ellipsis-assertion-failure-expected.txt: Added.
+        * fast/text/click-ellipsis-assertion-failure.html: Added.
+
+2017-10-17  Daniel Bates  <[email protected]>
+
         REGRESSION (r222670 and r222732): RTL truncated text may not be drawn
         https://bugs.webkit.org/show_bug.cgi?id=178278
         <rdar://problem/34982818>

Added: trunk/LayoutTests/fast/text/click-ellipsis-assertion-failure-expected.txt (0 => 223553)


--- trunk/LayoutTests/fast/text/click-ellipsis-assertion-failure-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/text/click-ellipsis-assertion-failure-expected.txt	2017-10-17 17:13:56 UTC (rev 223553)
@@ -0,0 +1,4 @@
+Tests that computing the caret rectangle with respect to a fully truncated inline text box does not cause an assertion failure in a debug build. To run by hand, click the '...' (below). The test PASSED if we do not crash.
+
+abc
+PASS did not crash.

Added: trunk/LayoutTests/fast/text/click-ellipsis-assertion-failure.html (0 => 223553)


--- trunk/LayoutTests/fast/text/click-ellipsis-assertion-failure.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/click-ellipsis-assertion-failure.html	2017-10-17 17:13:56 UTC (rev 223553)
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<style>
+#ellipsizedText {
+    font-size: 300%;
+    display: inline-block;
+    text-overflow: ellipsis;
+    overflow: hidden;
+    white-space: nowrap;
+    width: 50px;
+}
+</style>
+</head>
+<body>
+<p>Tests that computing the caret rectangle with respect to a fully truncated inline text box does not cause an assertion failure in a debug build. To run by hand, click the '...' (below). The test PASSED if we do not crash.</p>
+<div id="ellipsizedText">abc</div>
+<pre id="result">PASS did not crash.</pre>
+<script>
+if (window.testRunner) {
+    testRunner.dumpAsText();
+
+    var ellipsizedText = document.getElementById("ellipsizedText");
+    UIHelper.activateAt(ellipsizedText.offsetLeft, ellipsizedText.offsetTop);
+}
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (223552 => 223553)


--- trunk/Source/WebCore/ChangeLog	2017-10-17 17:04:51 UTC (rev 223552)
+++ trunk/Source/WebCore/ChangeLog	2017-10-17 17:13:56 UTC (rev 223553)
@@ -1,5 +1,21 @@
 2017-10-17  Daniel Bates  <[email protected]>
 
+        ASSERTION FAILED: m_truncation != cFullTruncation in InlineTextBox::clampedOffset()
+        https://bugs.webkit.org/show_bug.cgi?id=178322
+
+        Reviewed by Darin Adler.
+
+        It is acceptable for InlineTextBox::clampedOffset() to be called for a fully truncated box,
+        say a person clicks on the ellipsis in a truncated text run. Restore the behavior prior to
+        r223259 and return the clamped offset.
+
+        Test: fast/text/click-ellipsis-assertion-failure.html
+
+        * rendering/InlineTextBox.cpp:
+        (WebCore::InlineTextBox::clampedOffset const):
+
+2017-10-17  Daniel Bates  <[email protected]>
+
         REGRESSION (r222670 and r222732): RTL truncated text may not be drawn
         https://bugs.webkit.org/show_bug.cgi?id=178278
         <rdar://problem/34982818>

Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (223552 => 223553)


--- trunk/Source/WebCore/rendering/InlineTextBox.cpp	2017-10-17 17:04:51 UTC (rev 223552)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp	2017-10-17 17:13:56 UTC (rev 223553)
@@ -591,8 +591,9 @@
 
 unsigned InlineTextBox::clampedOffset(unsigned x) const
 {
-    ASSERT(m_truncation != cFullTruncation);
     unsigned offset = std::max(std::min(x, m_start + m_len), m_start) - m_start;
+    if (m_truncation == cFullTruncation)
+        return offset;
     if (m_truncation != cNoTruncation)
         offset = std::min<unsigned>(offset, m_truncation);
     else if (offset == m_len) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to