Title: [229867] trunk
Revision
229867
Author
[email protected]
Date
2018-03-22 14:59:41 -0700 (Thu, 22 Mar 2018)

Log Message

[Simple line layout] Text with letter spacing is not positioned properly.
https://bugs.webkit.org/show_bug.cgi?id=183079
<rdar://problem/38762569>

Reviewed by Antti Koivisto.

Source/WebCore:

We need to recompute RenderText::m_canUseSimplifiedTextMeasuring when the font cascade changes
since we might not be able to use the fast path anymore.

Test: fast/text/simple-line-layout-dynamic-letter-word-spacing.html

* rendering/RenderText.cpp:
(WebCore::RenderText::styleDidChange):

LayoutTests:

* fast/text/simple-line-layout-dynamic-letter-word-spacing-expected.html: Added.
* fast/text/simple-line-layout-dynamic-letter-word-spacing.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (229866 => 229867)


--- trunk/LayoutTests/ChangeLog	2018-03-22 21:56:18 UTC (rev 229866)
+++ trunk/LayoutTests/ChangeLog	2018-03-22 21:59:41 UTC (rev 229867)
@@ -1,3 +1,14 @@
+2018-03-22  Zalan Bujtas  <[email protected]>
+
+        [Simple line layout] Text with letter spacing is not positioned properly.
+        https://bugs.webkit.org/show_bug.cgi?id=183079
+        <rdar://problem/38762569>
+
+        Reviewed by Antti Koivisto.
+
+        * fast/text/simple-line-layout-dynamic-letter-word-spacing-expected.html: Added.
+        * fast/text/simple-line-layout-dynamic-letter-word-spacing.html: Added.
+
 2018-03-22  Adrian Perez de Castro  <[email protected]>
 
         [WPE] Enable WOFF2 support

Added: trunk/LayoutTests/fast/text/simple-line-layout-dynamic-letter-word-spacing-expected.html (0 => 229867)


--- trunk/LayoutTests/fast/text/simple-line-layout-dynamic-letter-word-spacing-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/simple-line-layout-dynamic-letter-word-spacing-expected.html	2018-03-22 21:59:41 UTC (rev 229867)
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+div {
+    width: 200px;
+}
+</style>
+</head>
+<body>
+<div id=letterSpacing>foobar foobar foobar foobar</div>
+<div id=wordSpacing>foobar foobar foobar foobar</div>
+<script>
+if (window.internals)
+    internals.settings.setSimpleLineLayoutEnabled(false);
+document.body.offsetHeight;
+letterSpacing.style.letterSpacing = "10px";
+wordSpacing.style.wordSpacing = "20px";
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/fast/text/simple-line-layout-dynamic-letter-word-spacing.html (0 => 229867)


--- trunk/LayoutTests/fast/text/simple-line-layout-dynamic-letter-word-spacing.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/simple-line-layout-dynamic-letter-word-spacing.html	2018-03-22 21:59:41 UTC (rev 229867)
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+div {
+    width: 200px;
+}
+</style>
+</head>
+<body>
+<div id=letterSpacing>foobar foobar foobar foobar</div>
+<div id=wordSpacing>foobar foobar foobar foobar</div>
+<script>
+document.body.offsetHeight;
+letterSpacing.style.letterSpacing = "10px";
+wordSpacing.style.wordSpacing = "20px";
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (229866 => 229867)


--- trunk/Source/WebCore/ChangeLog	2018-03-22 21:56:18 UTC (rev 229866)
+++ trunk/Source/WebCore/ChangeLog	2018-03-22 21:59:41 UTC (rev 229867)
@@ -1,3 +1,19 @@
+2018-03-22  Zalan Bujtas  <[email protected]>
+
+        [Simple line layout] Text with letter spacing is not positioned properly.
+        https://bugs.webkit.org/show_bug.cgi?id=183079
+        <rdar://problem/38762569>
+
+        Reviewed by Antti Koivisto.
+
+        We need to recompute RenderText::m_canUseSimplifiedTextMeasuring when the font cascade changes
+        since we might not be able to use the fast path anymore.
+
+        Test: fast/text/simple-line-layout-dynamic-letter-word-spacing.html
+
+        * rendering/RenderText.cpp:
+        (WebCore::RenderText::styleDidChange):
+
 2018-03-21  Antoine Quint  <[email protected]>
 
         [Web Animations] Make imported/mozilla/css-animations/test_event-dispatch.html pass reliably

Modified: trunk/Source/WebCore/rendering/RenderText.cpp (229866 => 229867)


--- trunk/Source/WebCore/rendering/RenderText.cpp	2018-03-22 21:56:18 UTC (rev 229866)
+++ trunk/Source/WebCore/rendering/RenderText.cpp	2018-03-22 21:59:41 UTC (rev 229867)
@@ -263,13 +263,14 @@
     if (!oldStyle) {
         m_useBackslashAsYenSymbol = computeUseBackslashAsYenSymbol();
         needsResetText = m_useBackslashAsYenSymbol;
-        // It should really be computed in the c'tor, but during construction we don't have parent yet -and RenderText style == parent()->style()
-        m_canUseSimplifiedTextMeasuring = computeCanUseSimplifiedTextMeasuring();
     } else if (oldStyle->fontCascade().useBackslashAsYenSymbol() != newStyle.fontCascade().useBackslashAsYenSymbol()) {
         m_useBackslashAsYenSymbol = computeUseBackslashAsYenSymbol();
         needsResetText = true;
     }
 
+    if (!oldStyle || oldStyle->fontCascade() != newStyle.fontCascade())
+        m_canUseSimplifiedTextMeasuring = computeCanUseSimplifiedTextMeasuring();
+
     ETextTransform oldTransform = oldStyle ? oldStyle->textTransform() : TTNONE;
     ETextSecurity oldSecurity = oldStyle ? oldStyle->textSecurity() : TSNONE;
     if (needsResetText || oldTransform != newStyle.textTransform() || oldSecurity != newStyle.textSecurity())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to