Title: [212271] trunk/Source/WebCore
Revision
212271
Author
[email protected]
Date
2017-02-13 18:20:50 -0800 (Mon, 13 Feb 2017)

Log Message

Simple line layout: Do not measure runs with trailing whitespace when kerning and ligatures are off.
https://bugs.webkit.org/show_bug.cgi?id=168247
<rdar://problem/30497288>

Reviewed by Antti Koivisto.

The width of the run is supposed to be the same with or without the trailing whitespace.

Covered by performance test.

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (212270 => 212271)


--- trunk/Source/WebCore/ChangeLog	2017-02-14 02:11:09 UTC (rev 212270)
+++ trunk/Source/WebCore/ChangeLog	2017-02-14 02:20:50 UTC (rev 212271)
@@ -1,3 +1,20 @@
+2017-02-13  Zalan Bujtas  <[email protected]>
+
+        Simple line layout: Do not measure runs with trailing whitespace when kerning and ligatures are off.
+        https://bugs.webkit.org/show_bug.cgi?id=168247
+        <rdar://problem/30497288>
+
+        Reviewed by Antti Koivisto.
+
+        The width of the run is supposed to be the same with or without the trailing whitespace.
+
+        Covered by performance test.
+
+        * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
+        (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style):
+        (WebCore::SimpleLineLayout::TextFragmentIterator::textWidth):
+        * rendering/SimpleLineLayoutTextFragmentIterator.h:
+
 2017-02-13  Karim H  <[email protected]>
 
         Added the other missing BSTR roles tag names.

Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp (212270 => 212271)


--- trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp	2017-02-14 02:11:09 UTC (rev 212270)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp	2017-02-14 02:20:50 UTC (rev 212271)
@@ -37,6 +37,7 @@
 TextFragmentIterator::Style::Style(const RenderStyle& style, bool useSimplifiedTextMeasuring)
     : font(style.fontCascade())
     , textAlign(style.textAlign())
+    , hasKerningOrLigatures(font.enableKerning() || font.requiresShaping())
     , collapseWhitespace(style.collapseWhiteSpace())
     , preserveNewline(style.preserveNewline())
     , wrapLines(style.autoWrap())
@@ -244,7 +245,8 @@
     if (m_style.font.isFixedPitch())
         return downcast<RenderText>(segment.renderer).width(segmentFrom, segmentTo - segmentFrom, m_style.font, xPosition, nullptr, nullptr);
 
-    bool measureWithEndSpace = m_style.collapseWhitespace && segmentTo < segment.text.length() && segment.text[segmentTo] == ' ';
+    bool measureWithEndSpace = m_style.hasKerningOrLigatures && m_style.collapseWhitespace
+        && segmentTo < segment.text.length() && segment.text[segmentTo] == ' ';
     if (measureWithEndSpace)
         ++segmentTo;
     float width = 0;

Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.h (212270 => 212271)


--- trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.h	2017-02-14 02:11:09 UTC (rev 212270)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.h	2017-02-14 02:20:50 UTC (rev 212271)
@@ -109,6 +109,7 @@
 
         const FontCascade& font;
         ETextAlign textAlign;
+        bool hasKerningOrLigatures;
         bool collapseWhitespace;
         bool preserveNewline;
         bool wrapLines;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to