<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[165836] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/165836">165836</a></dd>
<dt>Author</dt> <dd>dbates@webkit.org</dd>
<dt>Date</dt> <dd>2014-03-18 12:59:05 -0700 (Tue, 18 Mar 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>REGRESSION (<a href="http://trac.webkit.org/projects/webkit/changeset/163560">r163560</a>): ASSERTION FAILED: childrenInline() in WebCore::RenderSVGText::layout
https://bugs.webkit.org/show_bug.cgi?id=130346

Reviewed by Andreas Kling.

Source/WebCore:

Following &lt;http://trac.webkit.org/changeset/163560&gt;, SVG inline elements 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.

Partially revert &lt;http://trac.webkit.org/changeset/164368&gt; as it addressed a similar issue for
&lt;tspan&gt; and &lt;tref&gt;. Instead we should implement RenderSVGInline::updateFromStyle() to ensure that
RenderSVGInline and any derived classes (e.g. RenderSVGTSpan) are always treated as inline elements
regardless of their CSS style because the SVG text layout code depends on this assumption as part
of a performance optimization. We may want to revaluate the benefits of this optimization with respect
to code clarity and ensuring the code is less error prone.

Test: svg/text/a-display-block.html
      svg/text/tref-display-inherit.html

* css/StyleResolver.cpp:
(WebCore::StyleResolver::adjustRenderStyle): Revert changes from &lt;http://trac.webkit.org/changeset/164368&gt;.
* rendering/RenderInline.h:
* rendering/svg/RenderSVGInline.cpp:
(WebCore::RenderSVGInline::updateFromStyle): Added; ensure that RenderSVGInline and any derived
classes are treated as inline elements because the SVG text layout code depends on this assumption.
* rendering/svg/RenderSVGInline.h:

LayoutTests:

Added tests to ensure that SVG &lt;a&gt; and &lt;tref&gt; are always treated as inline-level elements.

* svg/text/a-display-block-expected.txt: Added.
* svg/text/a-display-block.html: Added.
* svg/text/tref-display-inherit-expected.txt: Added.
* svg/text/tref-display-inherit.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssStyleResolvercpp">trunk/Source/WebCore/css/StyleResolver.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderInlineh">trunk/Source/WebCore/rendering/RenderInline.h</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgRenderSVGInlinecpp">trunk/Source/WebCore/rendering/svg/RenderSVGInline.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgRenderSVGInlineh">trunk/Source/WebCore/rendering/svg/RenderSVGInline.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestssvgtextadisplayblockexpectedtxt">trunk/LayoutTests/svg/text/a-display-block-expected.txt</a></li>
<li><a href="#trunkLayoutTestssvgtextadisplayblockhtml">trunk/LayoutTests/svg/text/a-display-block.html</a></li>
<li><a href="#trunkLayoutTestssvgtexttrefdisplayinheritexpectedtxt">trunk/LayoutTests/svg/text/tref-display-inherit-expected.txt</a></li>
<li><a href="#trunkLayoutTestssvgtexttrefdisplayinherithtml">trunk/LayoutTests/svg/text/tref-display-inherit.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (165835 => 165836)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-03-18 19:50:57 UTC (rev 165835)
+++ trunk/LayoutTests/ChangeLog        2014-03-18 19:59:05 UTC (rev 165836)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2014-03-18  Daniel Bates  &lt;dabates@apple.com&gt;
+
+        REGRESSION (r163560): ASSERTION FAILED: childrenInline() in WebCore::RenderSVGText::layout
+        https://bugs.webkit.org/show_bug.cgi?id=130346
+
+        Reviewed by Andreas Kling.
+
+        Added tests to ensure that SVG &lt;a&gt; and &lt;tref&gt; are always treated as inline-level elements.
+
+        * svg/text/a-display-block-expected.txt: Added.
+        * svg/text/a-display-block.html: Added.
+        * svg/text/tref-display-inherit-expected.txt: Added.
+        * svg/text/tref-display-inherit.html: Added.
+
</ins><span class="cx"> 2014-03-18  Hans Muller  &lt;hmuller@adobe.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [CSS Shapes] shape-outside: ellipse(50% 50% at) causes crash
</span></span></pre></div>
<a id="trunkLayoutTestssvgtextadisplayblockexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/svg/text/a-display-block-expected.txt (0 => 165836)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/text/a-display-block-expected.txt                                (rev 0)
+++ trunk/LayoutTests/svg/text/a-display-block-expected.txt        2014-03-18 19:59:05 UTC (rev 165836)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+Tests that an &lt;a&gt; with display block doesn't cause an assertion failure.
+
+PASS
+
</ins></span></pre></div>
<a id="trunkLayoutTestssvgtextadisplayblockhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/svg/text/a-display-block.html (0 => 165836)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/text/a-display-block.html                                (rev 0)
+++ trunk/LayoutTests/svg/text/a-display-block.html        2014-03-18 19:59:05 UTC (rev 165836)
</span><span class="lines">@@ -0,0 +1,21 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;head&gt;
+&lt;style&gt;
+a {
+    display: block;
+}
+&lt;/style&gt;
+&lt;script&gt;
+if (window.testRunner)
+    testRunner.dumpAsText();
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;p&gt;Tests that an &amp;lt;a&amp;gt; with display block doesn't cause an assertion failure.&lt;/p&gt;
+&lt;svg&gt;
+    &lt;text x=&quot;0&quot; y=&quot;20&quot;&gt;
+        &lt;a xlink:href=&quot;https://bugs.webkit.org/show_bug.cgi?id=130346&quot;&gt;PASS&lt;/a&gt;
+    &lt;/text&gt;
+&lt;/svg&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestssvgtexttrefdisplayinheritexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/svg/text/tref-display-inherit-expected.txt (0 => 165836)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/text/tref-display-inherit-expected.txt                                (rev 0)
+++ trunk/LayoutTests/svg/text/tref-display-inherit-expected.txt        2014-03-18 19:59:05 UTC (rev 165836)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+Tests that a &lt;tref&gt; with display inherit doesn't cause an assertion failure.
+
+PASS
+
</ins></span></pre></div>
<a id="trunkLayoutTestssvgtexttrefdisplayinherithtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/svg/text/tref-display-inherit.html (0 => 165836)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/svg/text/tref-display-inherit.html                                (rev 0)
+++ trunk/LayoutTests/svg/text/tref-display-inherit.html        2014-03-18 19:59:05 UTC (rev 165836)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;head&gt;
+&lt;script&gt;
+if (window.testRunner)
+    testRunner.dumpAsText();
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;p&gt;Tests that a &amp;lt;tref&amp;gt; with display inherit doesn't cause an assertion failure.&lt;/p&gt;
+&lt;svg&gt;
+    &lt;text x=&quot;0&quot; y=&quot;20&quot;&gt;
+        &lt;tref display=&quot;inherit&quot;&gt;&lt;/tref&gt;PASS
+    &lt;/text&gt;
+&lt;/svg&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (165835 => 165836)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-03-18 19:50:57 UTC (rev 165835)
+++ trunk/Source/WebCore/ChangeLog        2014-03-18 19:59:05 UTC (rev 165836)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2014-03-18  Daniel Bates  &lt;dabates@apple.com&gt;
+
+        REGRESSION (r163560): ASSERTION FAILED: childrenInline() in WebCore::RenderSVGText::layout
+        https://bugs.webkit.org/show_bug.cgi?id=130346
+
+        Reviewed by Andreas Kling.
+
+        Following &lt;http://trac.webkit.org/changeset/163560&gt;, SVG inline elements 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.
+
+        Partially revert &lt;http://trac.webkit.org/changeset/164368&gt; as it addressed a similar issue for
+        &lt;tspan&gt; and &lt;tref&gt;. Instead we should implement RenderSVGInline::updateFromStyle() to ensure that
+        RenderSVGInline and any derived classes (e.g. RenderSVGTSpan) are always treated as inline elements
+        regardless of their CSS style because the SVG text layout code depends on this assumption as part
+        of a performance optimization. We may want to revaluate the benefits of this optimization with respect
+        to code clarity and ensuring the code is less error prone.
+
+        Test: svg/text/a-display-block.html
+              svg/text/tref-display-inherit.html
+
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::adjustRenderStyle): Revert changes from &lt;http://trac.webkit.org/changeset/164368&gt;.
+        * rendering/RenderInline.h:
+        * rendering/svg/RenderSVGInline.cpp:
+        (WebCore::RenderSVGInline::updateFromStyle): Added; ensure that RenderSVGInline and any derived
+        classes are treated as inline elements because the SVG text layout code depends on this assumption.
+        * rendering/svg/RenderSVGInline.h:
+
</ins><span class="cx"> 2014-03-18  Hans Muller  &lt;hmuller@adobe.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [CSS Shapes] shape-outside: ellipse(50% 50% at) causes crash
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleResolvercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleResolver.cpp (165835 => 165836)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleResolver.cpp        2014-03-18 19:50:57 UTC (rev 165835)
+++ trunk/Source/WebCore/css/StyleResolver.cpp        2014-03-18 19:59:05 UTC (rev 165836)
</span><span class="lines">@@ -1363,10 +1363,6 @@
</span><span class="cx">         // SVG text layout code expects us to be a block-level style element.
</span><span class="cx">         if ((e-&gt;hasTagName(SVGNames::foreignObjectTag) || e-&gt;hasTagName(SVGNames::textTag)) &amp;&amp; style.isDisplayInlineType())
</span><span class="cx">             style.setDisplay(BLOCK);
</span><del>-
-        // SVG text layout code expects us to be an inline-level style element.
-        if ((e-&gt;hasTagName(SVGNames::tspanTag) || e-&gt;hasTagName(SVGNames::textPathTag)) &amp;&amp; style.display() != NONE &amp;&amp; !style.isDisplayInlineType())
-            style.setDisplay(INLINE);
</del><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderInlineh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderInline.h (165835 => 165836)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderInline.h        2014-03-18 19:50:57 UTC (rev 165835)
+++ trunk/Source/WebCore/rendering/RenderInline.h        2014-03-18 19:59:05 UTC (rev 165836)
</span><span class="lines">@@ -100,6 +100,8 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
</span><span class="cx"> 
</span><ins>+    virtual void updateFromStyle() override;
+
</ins><span class="cx"> private:
</span><span class="cx">     virtual const char* renderName() const override;
</span><span class="cx"> 
</span><span class="lines">@@ -169,8 +171,6 @@
</span><span class="cx">     virtual void addAnnotatedRegions(Vector&lt;AnnotatedRegionValue&gt;&amp;) override final;
</span><span class="cx"> #endif
</span><span class="cx">     
</span><del>-    virtual void updateFromStyle() override final;
-    
</del><span class="cx">     RenderPtr&lt;RenderInline&gt; clone() const;
</span><span class="cx"> 
</span><span class="cx">     void paintOutlineForLine(GraphicsContext*, const LayoutPoint&amp;, const LayoutRect&amp; prevLine, const LayoutRect&amp; thisLine,
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgRenderSVGInlinecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/RenderSVGInline.cpp (165835 => 165836)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/RenderSVGInline.cpp        2014-03-18 19:50:57 UTC (rev 165835)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGInline.cpp        2014-03-18 19:59:05 UTC (rev 165836)
</span><span class="lines">@@ -112,6 +112,14 @@
</span><span class="cx">     SVGResourcesCache::clientStyleChanged(*this, diff, style());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void RenderSVGInline::updateFromStyle()
+{
+    RenderInline::updateFromStyle();
+
+    // SVG text layout code expects us to be an inline-level element.
+    setInline(true);
+}
+
</ins><span class="cx"> void RenderSVGInline::addChild(RenderObject* child, RenderObject* beforeChild)
</span><span class="cx"> {
</span><span class="cx">     RenderInline::addChild(child, beforeChild);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgRenderSVGInlineh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/RenderSVGInline.h (165835 => 165836)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/RenderSVGInline.h        2014-03-18 19:50:57 UTC (rev 165835)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGInline.h        2014-03-18 19:59:05 UTC (rev 165836)
</span><span class="lines">@@ -39,6 +39,8 @@
</span><span class="cx">     virtual bool requiresLayer() const override final { return false; }
</span><span class="cx">     virtual bool isSVGInline() const override final { return true; }
</span><span class="cx"> 
</span><ins>+    virtual void updateFromStyle() override final;
+
</ins><span class="cx">     // Chapter 10.4 of the SVG Specification say that we should use the
</span><span class="cx">     // object bounding box of the parent text element.
</span><span class="cx">     // We search for the root text element and take its bounding box.
</span></span></pre>
</div>
</div>

</body>
</html>