Title: [233537] trunk
Revision
233537
Author
[email protected]
Date
2018-07-05 13:28:54 -0700 (Thu, 05 Jul 2018)

Log Message

Do not assume that hypen's width can be computed using the simplified text measure codepath.
https://bugs.webkit.org/show_bug.cgi?id=187352
<rdar://problem/40821283>

Reviewed by Simon Fraser.

Source/WebCore:

Just because the text content is qualified for simplified text measure, it does not necessarily mean the hyphen is simple enough as well.

Test: fast/text/hyphen-is-complex-crash.html

* rendering/SimpleLineLayoutTextFragmentIterator.cpp:
(WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style):
(WebCore::SimpleLineLayout::TextFragmentIterator::TextFragmentIterator):
* rendering/SimpleLineLayoutTextFragmentIterator.h:

LayoutTests:

* fast/text/hyphen-is-complex-crash-expected.txt: Added.
* fast/text/hyphen-is-complex-crash.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (233536 => 233537)


--- trunk/LayoutTests/ChangeLog	2018-07-05 19:45:27 UTC (rev 233536)
+++ trunk/LayoutTests/ChangeLog	2018-07-05 20:28:54 UTC (rev 233537)
@@ -1,3 +1,14 @@
+2018-07-05  Zalan Bujtas  <[email protected]>
+
+        Do not assume that hypen's width can be computed using the simplified text measure codepath.
+        https://bugs.webkit.org/show_bug.cgi?id=187352
+        <rdar://problem/40821283>
+
+        Reviewed by Simon Fraser.
+
+        * fast/text/hyphen-is-complex-crash-expected.txt: Added.
+        * fast/text/hyphen-is-complex-crash.html: Added.
+
 2018-07-05  Wenson Hsieh  <[email protected]>
 
         [WK1] editing/spelling/markers.html times out on High Sierra after r233439

Added: trunk/LayoutTests/fast/text/hyphen-is-complex-crash-expected.txt (0 => 233537)


--- trunk/LayoutTests/fast/text/hyphen-is-complex-crash-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/text/hyphen-is-complex-crash-expected.txt	2018-07-05 20:28:54 UTC (rev 233537)
@@ -0,0 +1,2 @@
+
+Pass if no crash.

Added: trunk/LayoutTests/fast/text/hyphen-is-complex-crash.html (0 => 233537)


--- trunk/LayoutTests/fast/text/hyphen-is-complex-crash.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/hyphen-is-complex-crash.html	2018-07-05 20:28:54 UTC (rev 233537)
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests simple text with complex hyphen.</title>
+<style>
+body {
+    font-variant-caps: unicase;
+    -webkit-hyphens: auto;
+}
+</style>
+</head>
+<body>
+<br>
+<div>Pass if no crash.</div>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+document.execCommand("selectAll", false);
+</script>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (233536 => 233537)


--- trunk/Source/WebCore/ChangeLog	2018-07-05 19:45:27 UTC (rev 233536)
+++ trunk/Source/WebCore/ChangeLog	2018-07-05 20:28:54 UTC (rev 233537)
@@ -1,3 +1,20 @@
+2018-07-05  Zalan Bujtas  <[email protected]>
+
+        Do not assume that hypen's width can be computed using the simplified text measure codepath.
+        https://bugs.webkit.org/show_bug.cgi?id=187352
+        <rdar://problem/40821283>
+
+        Reviewed by Simon Fraser.
+
+        Just because the text content is qualified for simplified text measure, it does not necessarily mean the hyphen is simple enough as well.
+
+        Test: fast/text/hyphen-is-complex-crash.html
+
+        * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
+        (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style):
+        (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragmentIterator):
+        * rendering/SimpleLineLayoutTextFragmentIterator.h:
+
 2018-07-05  Eric Carlson  <[email protected]>
 
         Video sometimes flickers when playing to AppleTV

Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp (233536 => 233537)


--- trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp	2018-07-05 19:45:27 UTC (rev 233536)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp	2018-07-05 20:28:54 UTC (rev 233537)
@@ -35,7 +35,7 @@
 namespace WebCore {
 namespace SimpleLineLayout {
 
-TextFragmentIterator::Style::Style(const RenderStyle& style, bool useSimplifiedTextMeasuring)
+TextFragmentIterator::Style::Style(const RenderStyle& style)
     : font(style.fontCascade())
     , textAlign(style.textAlign())
     , hasKerningOrLigatures(font.enableKerning() || font.requiresShaping())
@@ -49,7 +49,7 @@
     , wordSpacing(font.wordSpacing())
     , tabWidth(collapseWhitespace ? 0 : style.tabSize())
     , shouldHyphenate(style.hyphens() == Hyphens::Auto && canHyphenate(style.locale()))
-    , hyphenStringWidth(shouldHyphenate ? (useSimplifiedTextMeasuring ? font.widthForSimpleText(style.hyphenString()) : font.width(TextRun(String(style.hyphenString())))) : 0)
+    , hyphenStringWidth(shouldHyphenate ? font.width(TextRun(String(style.hyphenString()))) : 0)
     , hyphenLimitBefore(style.hyphenationLimitBefore() < 0 ? 2 : style.hyphenationLimitBefore())
     , hyphenLimitAfter(style.hyphenationLimitAfter() < 0 ? 2 : style.hyphenationLimitAfter())
     , locale(style.locale())
@@ -62,7 +62,7 @@
     : m_flowContents(flow)
     , m_currentSegment(m_flowContents.begin())
     , m_lineBreakIterator(m_currentSegment->text, flow.style().locale())
-    , m_style(flow.style(), m_currentSegment->canUseSimplifiedTextMeasuring)
+    , m_style(flow.style())
 {
 }
 

Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.h (233536 => 233537)


--- trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.h	2018-07-05 19:45:27 UTC (rev 233536)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.h	2018-07-05 20:28:54 UTC (rev 233537)
@@ -103,7 +103,7 @@
     std::optional<unsigned> lastHyphenPosition(const TextFragmentIterator::TextFragment& run, unsigned beforeIndex) const;
 
     struct Style {
-        explicit Style(const RenderStyle&, bool useSimplifiedTextMeasuring);
+        explicit Style(const RenderStyle&);
 
         const FontCascade& font;
         TextAlignMode textAlign;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to