Title: [192169] trunk
Revision
192169
Author
mmaxfi...@apple.com
Date
2015-11-09 11:40:39 -0800 (Mon, 09 Nov 2015)

Log Message

Some style changes cause tatechuyoko to be drawn off center
https://bugs.webkit.org/show_bug.cgi?id=150986
<rdar://problem/20748013>

Reviewed by Darin Adler.

Source/WebCore:

Layouts should be idempotent. In particular, during layout, an element should not
rely on a previous call to styleDidChange() with a sufficiently high StyleDifference.
RenderCombineText was assuming that, if a layout occurs, a previous call to
styleDidChange() would have reset the renderedText. However, an ancestor element might
cause the RenderCombineText to re-combine when it is already combined. Therefore, the
recombination should fully uncombine before recombining.

Test: fast/text/text-combine-style-change-extra-layout.html

* rendering/RenderCombineText.cpp:
(WebCore::RenderCombineText::combineText): Fully uncombine before recombining.

LayoutTests:

* fast/text/text-combine-style-change-extra-layout-expected.html: Added.
* fast/text/text-combine-style-change-extra-layout.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (192168 => 192169)


--- trunk/LayoutTests/ChangeLog	2015-11-09 19:39:27 UTC (rev 192168)
+++ trunk/LayoutTests/ChangeLog	2015-11-09 19:40:39 UTC (rev 192169)
@@ -1,3 +1,14 @@
+2015-11-09  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Some style changes cause tatechuyoko to be drawn off center
+        https://bugs.webkit.org/show_bug.cgi?id=150986
+        <rdar://problem/20748013>
+
+        Reviewed by Darin Adler.
+
+        * fast/text/text-combine-style-change-extra-layout-expected.html: Added.
+        * fast/text/text-combine-style-change-extra-layout.html: Added.
+
 2015-11-09  Said Abou-Hallawa  <sabouhall...@apple.com>
 
         REGRESSION (r190883): Error calculating the tile size for an SVG with no intrinsic size but with large floating intrinsic ratio

Added: trunk/LayoutTests/fast/text/text-combine-style-change-extra-layout-expected.html (0 => 192169)


--- trunk/LayoutTests/fast/text/text-combine-style-change-extra-layout-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/text-combine-style-change-extra-layout-expected.html	2015-11-09 19:40:39 UTC (rev 192169)
@@ -0,0 +1,12 @@
+<html>
+    <head>
+        <style>
+        #w {
+            background-color: green;
+        }
+        </style>
+    </head>
+    <body style="-webkit-writing-mode: vertical-rl; font-size: 320px;">
+        <span id="w" style="-webkit-text-combine: horizontal;">39</span>
+    </body>
+</html>

Added: trunk/LayoutTests/fast/text/text-combine-style-change-extra-layout.html (0 => 192169)


--- trunk/LayoutTests/fast/text/text-combine-style-change-extra-layout.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/text-combine-style-change-extra-layout.html	2015-11-09 19:40:39 UTC (rev 192169)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <style>
+            .asdf {
+                background-color: green;
+            }
+        </style>
+    </head>
+    <body style="-webkit-writing-mode: vertical-rl; font-size: 320px;">
+        <span id="w" style="-webkit-text-combine: horizontal;">39</span>
+		<script>
+            if (window.testRunner)
+                testRunner.waitUntilDone();
+            window.setTimeout(function() {
+                document.getElementById("w").className = "asdf";
+                if (window.testRunner)
+                    testRunner.notifyDone();
+            }, 0);
+        </script>
+    </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (192168 => 192169)


--- trunk/Source/WebCore/ChangeLog	2015-11-09 19:39:27 UTC (rev 192168)
+++ trunk/Source/WebCore/ChangeLog	2015-11-09 19:40:39 UTC (rev 192169)
@@ -1,3 +1,23 @@
+2015-11-09  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Some style changes cause tatechuyoko to be drawn off center
+        https://bugs.webkit.org/show_bug.cgi?id=150986
+        <rdar://problem/20748013>
+
+        Reviewed by Darin Adler.
+
+        Layouts should be idempotent. In particular, during layout, an element should not
+        rely on a previous call to styleDidChange() with a sufficiently high StyleDifference.
+        RenderCombineText was assuming that, if a layout occurs, a previous call to
+        styleDidChange() would have reset the renderedText. However, an ancestor element might
+        cause the RenderCombineText to re-combine when it is already combined. Therefore, the
+        recombination should fully uncombine before recombining.
+
+        Test: fast/text/text-combine-style-change-extra-layout.html
+
+        * rendering/RenderCombineText.cpp:
+        (WebCore::RenderCombineText::combineText): Fully uncombine before recombining.
+
 2015-11-09  Brent Fulgham  <bfulg...@apple.com>
 
         [Win] Recognize context flush as an event that requires an update

Modified: trunk/Source/WebCore/rendering/RenderCombineText.cpp (192168 => 192169)


--- trunk/Source/WebCore/rendering/RenderCombineText.cpp	2015-11-09 19:39:27 UTC (rev 192168)
+++ trunk/Source/WebCore/rendering/RenderCombineText.cpp	2015-11-09 19:40:39 UTC (rev 192169)
@@ -90,6 +90,10 @@
     if (!m_needsFontUpdate)
         return;
 
+    // An ancestor element may trigger us to lay out again, even when we're already combined.
+    if (m_isCombined)
+        RenderText::setRenderedText(originalText());
+
     m_isCombined = false;
     m_needsFontUpdate = false;
 
@@ -141,8 +145,8 @@
         m_combineFontStyle->fontCascade().update(fontSelector);
 
     if (m_isCombined) {
-        DEPRECATED_DEFINE_STATIC_LOCAL(String, objectReplacementCharacterString, (&objectReplacementCharacter, 1));
-        RenderText::setRenderedText(objectReplacementCharacterString.impl());
+        static NeverDestroyed<String> objectReplacementCharacterString(&objectReplacementCharacter, 1);
+        RenderText::setRenderedText(objectReplacementCharacterString.get());
         m_combinedTextSize = FloatSize(combinedTextWidth, glyphOverflow.bottom + glyphOverflow.top);
     }
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to