Title: [208170] trunk
Revision
208170
Author
[email protected]
Date
2016-10-31 13:16:37 -0700 (Mon, 31 Oct 2016)

Log Message

ASSERTION FAILED: !m_trailingWhitespaceWidth in WebCore::SimpleLineLayout::LineState::removeTrailingWhitespace
https://bugs.webkit.org/show_bug.cgi?id=164076

Reviewed by Antti Koivisto.

Source/WebCore:

FontCascade's text measure methods return NaN for zero sized fonts. We could actually early return and not
measure text with zero font size at all.

Test: fast/text/simple-line-layout-with-zero-sized-font.html

* rendering/SimpleLineLayoutTextFragmentIterator.cpp:
(WebCore::SimpleLineLayout::TextFragmentIterator::textWidth):
(WebCore::SimpleLineLayout::TextFragmentIterator::runWidth):

LayoutTests:

* fast/text/simple-line-layout-with-zero-sized-font-expected.txt: Added.
* fast/text/simple-line-layout-with-zero-sized-font.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (208169 => 208170)


--- trunk/LayoutTests/ChangeLog	2016-10-31 19:38:58 UTC (rev 208169)
+++ trunk/LayoutTests/ChangeLog	2016-10-31 20:16:37 UTC (rev 208170)
@@ -1,3 +1,13 @@
+2016-10-31  Zalan Bujtas  <[email protected]>
+
+        ASSERTION FAILED: !m_trailingWhitespaceWidth in WebCore::SimpleLineLayout::LineState::removeTrailingWhitespace
+        https://bugs.webkit.org/show_bug.cgi?id=164076
+
+        Reviewed by Antti Koivisto.
+
+        * fast/text/simple-line-layout-with-zero-sized-font-expected.txt: Added.
+        * fast/text/simple-line-layout-with-zero-sized-font.html: Added.
+
 2016-10-31  Nan Wang  <[email protected]>
 
         AX: iOS Voiceover does not announce previously selected value from input type="date" form field

Added: trunk/LayoutTests/fast/text/simple-line-layout-with-zero-sized-font-expected.txt (0 => 208170)


--- trunk/LayoutTests/fast/text/simple-line-layout-with-zero-sized-font-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/text/simple-line-layout-with-zero-sized-font-expected.txt	2016-10-31 20:16:37 UTC (rev 208170)
@@ -0,0 +1,2 @@
+PASS if no assert in debug.
+	

Added: trunk/LayoutTests/fast/text/simple-line-layout-with-zero-sized-font.html (0 => 208170)


--- trunk/LayoutTests/fast/text/simple-line-layout-with-zero-sized-font.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/simple-line-layout-with-zero-sized-font.html	2016-10-31 20:16:37 UTC (rev 208170)
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that we don't measure text with font-size 0.</title>
+<style>
+a {
+  white-space: pre-wrap;
+  font-size: 0;
+  display: grid;
+}
+</style>
+<script>
+if (window.testRunner)
+  testRunner.dumpAsText();
+</script>
+</head>
+<body>
+PASS if no assert in debug.
+<a>&#9</a>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (208169 => 208170)


--- trunk/Source/WebCore/ChangeLog	2016-10-31 19:38:58 UTC (rev 208169)
+++ trunk/Source/WebCore/ChangeLog	2016-10-31 20:16:37 UTC (rev 208170)
@@ -1,3 +1,19 @@
+2016-10-31  Zalan Bujtas  <[email protected]>
+
+        ASSERTION FAILED: !m_trailingWhitespaceWidth in WebCore::SimpleLineLayout::LineState::removeTrailingWhitespace
+        https://bugs.webkit.org/show_bug.cgi?id=164076
+
+        Reviewed by Antti Koivisto.
+
+        FontCascade's text measure methods return NaN for zero sized fonts. We could actually early return and not
+        measure text with zero font size at all.
+
+        Test: fast/text/simple-line-layout-with-zero-sized-font.html
+
+        * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
+        (WebCore::SimpleLineLayout::TextFragmentIterator::textWidth):
+        (WebCore::SimpleLineLayout::TextFragmentIterator::runWidth):
+
 2016-10-31  Dave Hyatt  <[email protected]>
 
         [CSS Parser] Support -webkit-named-image

Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp (208169 => 208170)


--- trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp	2016-10-31 19:38:58 UTC (rev 208169)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp	2016-10-31 20:16:37 UTC (rev 208170)
@@ -149,6 +149,8 @@
     auto& segment = *m_currentSegment;
     ASSERT(segment.start <= from && from <= segment.end && segment.start <= to && to <= segment.end);
     ASSERT(is<RenderText>(segment.renderer));
+    if (!m_style.font.size())
+        return 0;
     if (m_style.font.isFixedPitch() || (from == segment.start && to == segment.end))
         return downcast<RenderText>(segment.renderer).width(from - segment.start, to - from, m_style.font, xPosition, nullptr, nullptr);
     return segment.text.is8Bit() ? runWidth<LChar>(segment, from, to, xPosition) : runWidth<UChar>(segment, from, to, xPosition);
@@ -196,6 +198,7 @@
 template <typename CharacterType>
 float TextFragmentIterator::runWidth(const FlowContents::Segment& segment, unsigned startPosition, unsigned endPosition, float xPosition) const
 {
+    ASSERT(m_style.font.size());
     ASSERT(startPosition <= endPosition);
     if (startPosition == endPosition)
         return 0;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to