Title: [164368] trunk
Revision
164368
Author
[email protected]
Date
2014-02-19 09:58:49 -0800 (Wed, 19 Feb 2014)

Log Message

REGRESSION (r163560): Always treat SVG <tspan> and <textPath> as display inline
https://bugs.webkit.org/show_bug.cgi?id=128552
<rdar://problem/16029658>

Reviewed by Andreas Kling.

Source/WebCore:

Following <http://trac.webkit.org/changeset/163560>, SVG <tspan> and <textPath> may be treated as block-
level elements depending on their CSS styles (e.g. display: block). But such elements should always be
treated as inline-level elements.

Tests: svg/text/textpath-display-block.html
       svg/text/textpath-display-none.html
       svg/text/tspan-display-block.html

* css/StyleResolver.cpp:
(WebCore::StyleResolver::adjustRenderStyle):

LayoutTests:

Added tests to ensure that SVG <tspan> and <textPath> are always treated as inline-level
elements when explicitly or implicitly specified as a non-none, non-inline display type.

Additionally, added a test to ensure that we don't render a <textPath> when it has CSS
display none. Note, the test LayoutTests/svg/batik/text/textProperties2.svg ensures a
similar behavior for <tspan>.

* svg/text/textpath-display-block-expected.txt: Added.
* svg/text/textpath-display-block.html: Added.
* svg/text/textpath-display-none-expected.html: Added.
* svg/text/textpath-display-none.html: Added.
* svg/text/tspan-display-block-expected.txt: Added.
* svg/text/tspan-display-block.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (164367 => 164368)


--- trunk/LayoutTests/ChangeLog	2014-02-19 17:54:31 UTC (rev 164367)
+++ trunk/LayoutTests/ChangeLog	2014-02-19 17:58:49 UTC (rev 164368)
@@ -1,5 +1,27 @@
 2014-02-19  Daniel Bates  <[email protected]>
 
+        REGRESSION (r163560): Always treat SVG <tspan> and <textPath> as display inline
+        https://bugs.webkit.org/show_bug.cgi?id=128552
+        <rdar://problem/16029658>
+
+        Reviewed by Andreas Kling.
+
+        Added tests to ensure that SVG <tspan> and <textPath> are always treated as inline-level
+        elements when explicitly or implicitly specified as a non-none, non-inline display type.
+
+        Additionally, added a test to ensure that we don't render a <textPath> when it has CSS
+        display none. Note, the test LayoutTests/svg/batik/text/textProperties2.svg ensures a
+        similar behavior for <tspan>.
+
+        * svg/text/textpath-display-block-expected.txt: Added.
+        * svg/text/textpath-display-block.html: Added.
+        * svg/text/textpath-display-none-expected.html: Added.
+        * svg/text/textpath-display-none.html: Added.
+        * svg/text/tspan-display-block-expected.txt: Added.
+        * svg/text/tspan-display-block.html: Added.
+
+2014-02-19  Daniel Bates  <[email protected]>
+
         Do not dispatch change event twice in single step action
         https://bugs.webkit.org/show_bug.cgi?id=116936
         <rdar://problem/16086828>

Added: trunk/LayoutTests/svg/text/textpath-display-block-expected.txt (0 => 164368)


--- trunk/LayoutTests/svg/text/textpath-display-block-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/svg/text/textpath-display-block-expected.txt	2014-02-19 17:58:49 UTC (rev 164368)
@@ -0,0 +1,4 @@
+Tests that a <textPath> with display block doesn't cause an assertion failure.
+
+PASS
+

Added: trunk/LayoutTests/svg/text/textpath-display-block.html (0 => 164368)


--- trunk/LayoutTests/svg/text/textpath-display-block.html	                        (rev 0)
+++ trunk/LayoutTests/svg/text/textpath-display-block.html	2014-02-19 17:58:49 UTC (rev 164368)
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<head>
+<style>
+#textpath { display: block; }
+</style>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+</script>
+</head>
+<body>
+<p>Tests that a &lt;textPath&gt; with display block doesn't cause an assertion failure.</p>
+<svg>
+    <path id="result-path" d="M 0 20 L 100 20" />
+    <text>
+        <textPath id="textpath" xlink:href=""
+    </text>
+</svg>
+</body>
+</html>

Added: trunk/LayoutTests/svg/text/textpath-display-none-expected.html (0 => 164368)


--- trunk/LayoutTests/svg/text/textpath-display-none-expected.html	                        (rev 0)
+++ trunk/LayoutTests/svg/text/textpath-display-none-expected.html	2014-02-19 17:58:49 UTC (rev 164368)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<head>
+<style>
+#reference-square {
+    position: relative;
+    top: 20px;
+    width: 100px;
+    height: 100px;
+    background-color: blue;
+}
+</style>
+</head>
+<body>
+<p>Tests that a &lt;textPath&gt; with display none isn't rendered. This test FAILED if you see the word FAIL below. Otherwise, it PASSED.</p>
+<div id="reference-square"></div>
+</body>
+</html>

Added: trunk/LayoutTests/svg/text/textpath-display-none.html (0 => 164368)


--- trunk/LayoutTests/svg/text/textpath-display-none.html	                        (rev 0)
+++ trunk/LayoutTests/svg/text/textpath-display-none.html	2014-02-19 17:58:49 UTC (rev 164368)
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<head>
+<style>
+#textpath {
+    display: none;
+}
+svg {
+    height: 200px;
+    width: 200px;
+}
+</style>
+</head>
+<body>
+<p>Tests that a &lt;textPath&gt; with display none isn't rendered. This test FAILED if you see the word FAIL below. Otherwise, it PASSED.</p>
+<svg style="width: 200px; height: 200px">
+    <path id="reference-square" d="M 0 20 L 100 20 L 100 120 L 0 120" fill="blue" />
+    <text>
+        <textPath id="textpath" xlink:href="" FAIL FAIL FAIL FAIL FAIL FAIL FAIL</textPath>
+    </text>
+</svg>
+</body>
+</html>

Added: trunk/LayoutTests/svg/text/tspan-display-block-expected.txt (0 => 164368)


--- trunk/LayoutTests/svg/text/tspan-display-block-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/svg/text/tspan-display-block-expected.txt	2014-02-19 17:58:49 UTC (rev 164368)
@@ -0,0 +1,4 @@
+Tests that a <tspan> with display block doesn't cause an assertion failure.
+
+PASS
+

Added: trunk/LayoutTests/svg/text/tspan-display-block.html (0 => 164368)


--- trunk/LayoutTests/svg/text/tspan-display-block.html	                        (rev 0)
+++ trunk/LayoutTests/svg/text/tspan-display-block.html	2014-02-19 17:58:49 UTC (rev 164368)
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<head>
+<style>
+tspan { display: block; }
+</style>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+</script>
+</head>
+<body>
+<p>Tests that a &lt;tspan&gt; with display block doesn't cause an assertion failure.</p>
+<svg><text x="0" y="20">PA<tspan>S</tspan>S</text></svg>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (164367 => 164368)


--- trunk/Source/WebCore/ChangeLog	2014-02-19 17:54:31 UTC (rev 164367)
+++ trunk/Source/WebCore/ChangeLog	2014-02-19 17:58:49 UTC (rev 164368)
@@ -1,5 +1,24 @@
 2014-02-19  Daniel Bates  <[email protected]>
 
+        REGRESSION (r163560): Always treat SVG <tspan> and <textPath> as display inline
+        https://bugs.webkit.org/show_bug.cgi?id=128552
+        <rdar://problem/16029658>
+
+        Reviewed by Andreas Kling.
+
+        Following <http://trac.webkit.org/changeset/163560>, SVG <tspan> and <textPath> may be treated as block-
+        level elements depending on their CSS styles (e.g. display: block). But such elements should always be
+        treated as inline-level elements.
+
+        Tests: svg/text/textpath-display-block.html
+               svg/text/textpath-display-none.html
+               svg/text/tspan-display-block.html
+
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::adjustRenderStyle):
+
+2014-02-19  Daniel Bates  <[email protected]>
+
         Do not dispatch change event twice in single step action
         https://bugs.webkit.org/show_bug.cgi?id=116936
         <rdar://problem/16086828>

Modified: trunk/Source/WebCore/css/StyleResolver.cpp (164367 => 164368)


--- trunk/Source/WebCore/css/StyleResolver.cpp	2014-02-19 17:54:31 UTC (rev 164367)
+++ trunk/Source/WebCore/css/StyleResolver.cpp	2014-02-19 17:58:49 UTC (rev 164368)
@@ -1353,6 +1353,10 @@
         // SVG text layout code expects us to be a block-level style element.
         if ((e->hasTagName(SVGNames::foreignObjectTag) || e->hasTagName(SVGNames::textTag)) && style.isDisplayInlineType())
             style.setDisplay(BLOCK);
+
+        // SVG text layout code expects us to be an inline-level style element.
+        if ((e->hasTagName(SVGNames::tspanTag) || e->hasTagName(SVGNames::textPathTag)) && style.display() != NONE && !style.isDisplayInlineType())
+            style.setDisplay(INLINE);
     }
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to