<!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>[193614] trunk/Source/WebCore</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/193614">193614</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2015-12-06 22:27:48 -0800 (Sun, 06 Dec 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Show more information about SVG renderers in showLayerTree() output
https://bugs.webkit.org/show_bug.cgi?id=151930

Reviewed by Zalan Bujtas.

In showLayerTree() output, for SVG renderers show:
- visual and layout overflow, for boxes
- frame rect, for boxes
- layout state
- class and id

* rendering/RenderLayer.cpp:
(WebCore::showLayerTree):
* rendering/RenderTreeAsText.cpp:
(WebCore::RenderTreeAsText::writeRenderObject):
(WebCore::writeDebugInfo): New function to share dumping with svg output.
(WebCore::write):
* rendering/RenderTreeAsText.h:
* rendering/svg/SVGRenderTreeAsText.cpp:
(WebCore::writePositionAndStyle): Show the frameRect for boxes (e.g. RenderSVGRoot).
Much more useful that showing the clippedOverflowRect.
(WebCore::writeStandardPrefix):
(WebCore::writeChildren):
(WebCore::writeSVGResourceContainer):
(WebCore::writeSVGContainer):
(WebCore::write):
(WebCore::writeSVGText):
(WebCore::writeSVGInlineText):
(WebCore::writeSVGImage):
(WebCore::writeSVGGradientStop):
(WebCore::writeResources):
(WebCore::operator&lt;&lt;): Deleted.
* rendering/svg/SVGRenderTreeAsText.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayercpp">trunk/Source/WebCore/rendering/RenderLayer.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderTreeAsTextcpp">trunk/Source/WebCore/rendering/RenderTreeAsText.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderTreeAsTexth">trunk/Source/WebCore/rendering/RenderTreeAsText.h</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgSVGRenderTreeAsTextcpp">trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgSVGRenderTreeAsTexth">trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (193613 => 193614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-12-07 06:27:08 UTC (rev 193613)
+++ trunk/Source/WebCore/ChangeLog        2015-12-07 06:27:48 UTC (rev 193614)
</span><span class="lines">@@ -1,5 +1,41 @@
</span><span class="cx"> 2015-12-06  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Show more information about SVG renderers in showLayerTree() output
+        https://bugs.webkit.org/show_bug.cgi?id=151930
+
+        Reviewed by Zalan Bujtas.
+        
+        In showLayerTree() output, for SVG renderers show:
+        - visual and layout overflow, for boxes
+        - frame rect, for boxes
+        - layout state
+        - class and id
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::showLayerTree):
+        * rendering/RenderTreeAsText.cpp:
+        (WebCore::RenderTreeAsText::writeRenderObject):
+        (WebCore::writeDebugInfo): New function to share dumping with svg output.
+        (WebCore::write):
+        * rendering/RenderTreeAsText.h:
+        * rendering/svg/SVGRenderTreeAsText.cpp:
+        (WebCore::writePositionAndStyle): Show the frameRect for boxes (e.g. RenderSVGRoot).
+        Much more useful that showing the clippedOverflowRect.
+        (WebCore::writeStandardPrefix):
+        (WebCore::writeChildren):
+        (WebCore::writeSVGResourceContainer):
+        (WebCore::writeSVGContainer):
+        (WebCore::write):
+        (WebCore::writeSVGText):
+        (WebCore::writeSVGInlineText):
+        (WebCore::writeSVGImage):
+        (WebCore::writeSVGGradientStop):
+        (WebCore::writeResources):
+        (WebCore::operator&lt;&lt;): Deleted.
+        * rendering/svg/SVGRenderTreeAsText.h:
+
+2015-12-06  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
</ins><span class="cx">         Clipping along compositing borders in svg-edit
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=151791
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (193613 => 193614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayer.cpp        2015-12-07 06:27:08 UTC (rev 193613)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp        2015-12-07 06:27:48 UTC (rev 193614)
</span><span class="lines">@@ -7073,7 +7073,7 @@
</span><span class="cx">     if (!layer)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    WTF::String output = externalRepresentation(&amp;layer-&gt;renderer().frame(), WebCore::RenderAsTextShowAllLayers | WebCore::RenderAsTextShowLayerNesting | WebCore::RenderAsTextShowCompositedLayers | WebCore::RenderAsTextShowAddresses | WebCore::RenderAsTextShowIDAndClass | WebCore::RenderAsTextDontUpdateLayout | WebCore::RenderAsTextShowLayoutState | WebCore::RenderAsTextShowOverflow);
</del><ins>+    WTF::String output = externalRepresentation(&amp;layer-&gt;renderer().frame(), WebCore::RenderAsTextShowAllLayers | WebCore::RenderAsTextShowLayerNesting | WebCore::RenderAsTextShowCompositedLayers | WebCore::RenderAsTextShowAddresses | WebCore::RenderAsTextShowIDAndClass | WebCore::RenderAsTextDontUpdateLayout | WebCore::RenderAsTextShowLayoutState | WebCore::RenderAsTextShowOverflow | WebCore::RenderAsTextShowSVGGeometry);
</ins><span class="cx">     fprintf(stderr, &quot;%s\n&quot;, output.utf8().data());
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderTreeAsTextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTreeAsText.cpp (193613 => 193614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTreeAsText.cpp        2015-12-07 06:27:08 UTC (rev 193613)
+++ trunk/Source/WebCore/rendering/RenderTreeAsText.cpp        2015-12-07 06:27:48 UTC (rev 193614)
</span><span class="lines">@@ -67,6 +67,7 @@
</span><span class="cx"> #include &quot;ShadowRoot.h&quot;
</span><span class="cx"> #include &quot;SimpleLineLayoutResolver.h&quot;
</span><span class="cx"> #include &quot;StyleProperties.h&quot;
</span><ins>+#include &quot;TextStream.h&quot;
</ins><span class="cx"> #include &lt;wtf/HexNumber.h&gt;
</span><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><span class="cx"> #include &lt;wtf/unicode/CharacterNames.h&gt;
</span><span class="lines">@@ -393,8 +394,13 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx">     
</span><ins>+    writeDebugInfo(ts, o, behavior);
+}
+
+void writeDebugInfo(TextStream&amp; ts, const RenderObject&amp; object, RenderAsTextBehavior behavior)
+{
</ins><span class="cx">     if (behavior &amp; RenderAsTextShowIDAndClass) {
</span><del>-        if (Element* element = is&lt;Element&gt;(o.node()) ? downcast&lt;Element&gt;(o.node()) : nullptr) {
</del><ins>+        if (Element* element = is&lt;Element&gt;(object.node()) ? downcast&lt;Element&gt;(object.node()) : nullptr) {
</ins><span class="cx">             if (element-&gt;hasID())
</span><span class="cx">                 ts &lt;&lt; &quot; id=\&quot;&quot; + element-&gt;getIdAttribute() + &quot;\&quot;&quot;;
</span><span class="cx"> 
</span><span class="lines">@@ -409,33 +415,33 @@
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx">     }
</span><del>-    
</del><ins>+
</ins><span class="cx">     if (behavior &amp; RenderAsTextShowLayoutState) {
</span><del>-        bool needsLayout = o.selfNeedsLayout() || o.needsPositionedMovementLayout() || o.posChildNeedsLayout() || o.normalChildNeedsLayout();
</del><ins>+        bool needsLayout = object.selfNeedsLayout() || object.needsPositionedMovementLayout() || object.posChildNeedsLayout() || object.normalChildNeedsLayout();
</ins><span class="cx">         if (needsLayout)
</span><span class="cx">             ts &lt;&lt; &quot; (needs layout:&quot;;
</span><span class="cx">         
</span><span class="cx">         bool havePrevious = false;
</span><del>-        if (o.selfNeedsLayout()) {
</del><ins>+        if (object.selfNeedsLayout()) {
</ins><span class="cx">             ts &lt;&lt; &quot; self&quot;;
</span><span class="cx">             havePrevious = true;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if (o.needsPositionedMovementLayout()) {
</del><ins>+        if (object.needsPositionedMovementLayout()) {
</ins><span class="cx">             if (havePrevious)
</span><span class="cx">                 ts &lt;&lt; &quot;,&quot;;
</span><span class="cx">             havePrevious = true;
</span><span class="cx">             ts &lt;&lt; &quot; positioned movement&quot;;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if (o.normalChildNeedsLayout()) {
</del><ins>+        if (object.normalChildNeedsLayout()) {
</ins><span class="cx">             if (havePrevious)
</span><span class="cx">                 ts &lt;&lt; &quot;,&quot;;
</span><span class="cx">             havePrevious = true;
</span><span class="cx">             ts &lt;&lt; &quot; child&quot;;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if (o.posChildNeedsLayout()) {
</del><ins>+        if (object.posChildNeedsLayout()) {
</ins><span class="cx">             if (havePrevious)
</span><span class="cx">                 ts &lt;&lt; &quot;,&quot;;
</span><span class="cx">             ts &lt;&lt; &quot; positioned child&quot;;
</span><span class="lines">@@ -444,9 +450,9 @@
</span><span class="cx">         if (needsLayout)
</span><span class="cx">             ts &lt;&lt; &quot;)&quot;;
</span><span class="cx">     }
</span><del>-    
-    if (behavior &amp; RenderAsTextShowOverflow &amp;&amp; is&lt;RenderBox&gt;(o)) {
-        const auto&amp; box = downcast&lt;RenderBox&gt;(o);
</del><ins>+
+    if (behavior &amp; RenderAsTextShowOverflow &amp;&amp; is&lt;RenderBox&gt;(object)) {
+        const auto&amp; box = downcast&lt;RenderBox&gt;(object);
</ins><span class="cx">         if (box.hasRenderOverflow()) {
</span><span class="cx">             LayoutRect layoutOverflow = box.layoutOverflowRect();
</span><span class="cx">             ts &lt;&lt; &quot; (layout overflow &quot; &lt;&lt; layoutOverflow.x().toInt() &lt;&lt; &quot;,&quot; &lt;&lt; layoutOverflow.y().toInt() &lt;&lt; &quot; &quot; &lt;&lt; layoutOverflow.width().toInt() &lt;&lt; &quot;x&quot; &lt;&lt; layoutOverflow.height().toInt() &lt;&lt; &quot;)&quot;;
</span><span class="lines">@@ -502,35 +508,35 @@
</span><span class="cx"> void write(TextStream&amp; ts, const RenderObject&amp; o, int indent, RenderAsTextBehavior behavior)
</span><span class="cx"> {
</span><span class="cx">     if (is&lt;RenderSVGShape&gt;(o)) {
</span><del>-        write(ts, downcast&lt;RenderSVGShape&gt;(o), indent);
</del><ins>+        write(ts, downcast&lt;RenderSVGShape&gt;(o), indent, behavior);
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     if (is&lt;RenderSVGGradientStop&gt;(o)) {
</span><del>-        writeSVGGradientStop(ts, downcast&lt;RenderSVGGradientStop&gt;(o), indent);
</del><ins>+        writeSVGGradientStop(ts, downcast&lt;RenderSVGGradientStop&gt;(o), indent, behavior);
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     if (is&lt;RenderSVGResourceContainer&gt;(o)) {
</span><del>-        writeSVGResourceContainer(ts, downcast&lt;RenderSVGResourceContainer&gt;(o), indent);
</del><ins>+        writeSVGResourceContainer(ts, downcast&lt;RenderSVGResourceContainer&gt;(o), indent, behavior);
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     if (is&lt;RenderSVGContainer&gt;(o)) {
</span><del>-        writeSVGContainer(ts, downcast&lt;RenderSVGContainer&gt;(o), indent);
</del><ins>+        writeSVGContainer(ts, downcast&lt;RenderSVGContainer&gt;(o), indent, behavior);
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     if (is&lt;RenderSVGRoot&gt;(o)) {
</span><del>-        write(ts, downcast&lt;RenderSVGRoot&gt;(o), indent);
</del><ins>+        write(ts, downcast&lt;RenderSVGRoot&gt;(o), indent, behavior);
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     if (is&lt;RenderSVGText&gt;(o)) {
</span><del>-        writeSVGText(ts, downcast&lt;RenderSVGText&gt;(o), indent);
</del><ins>+        writeSVGText(ts, downcast&lt;RenderSVGText&gt;(o), indent, behavior);
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     if (is&lt;RenderSVGInlineText&gt;(o)) {
</span><del>-        writeSVGInlineText(ts, downcast&lt;RenderSVGInlineText&gt;(o), indent);
</del><ins>+        writeSVGInlineText(ts, downcast&lt;RenderSVGInlineText&gt;(o), indent, behavior);
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     if (is&lt;RenderSVGImage&gt;(o)) {
</span><del>-        writeSVGImage(ts, downcast&lt;RenderSVGImage&gt;(o), indent);
</del><ins>+        writeSVGImage(ts, downcast&lt;RenderSVGImage&gt;(o), indent, behavior);
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderTreeAsTexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTreeAsText.h (193613 => 193614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTreeAsText.h        2015-12-07 06:27:08 UTC (rev 193613)
+++ trunk/Source/WebCore/rendering/RenderTreeAsText.h        2015-12-07 06:27:48 UTC (rev 193614)
</span><span class="lines">@@ -36,16 +36,17 @@
</span><span class="cx"> class TextStream;
</span><span class="cx"> 
</span><span class="cx"> enum RenderAsTextBehaviorFlags {
</span><del>-    RenderAsTextBehaviorNormal = 0,
-    RenderAsTextShowAllLayers = 1 &lt;&lt; 0, // Dump all layers, not just those that would paint.
-    RenderAsTextShowLayerNesting = 1 &lt;&lt; 1, // Annotate the layer lists.
-    RenderAsTextShowCompositedLayers = 1 &lt;&lt; 2, // Show which layers are composited.
-    RenderAsTextShowAddresses = 1 &lt;&lt; 3, // Show layer and renderer addresses.
-    RenderAsTextShowIDAndClass = 1 &lt;&lt; 4, // Show id and class attributes
-    RenderAsTextPrintingMode = 1 &lt;&lt; 5, // Dump the tree in printing mode.
-    RenderAsTextDontUpdateLayout = 1 &lt;&lt; 6, // Don't update layout, to make it safe to call showLayerTree() from the debugger inside layout or painting code.
-    RenderAsTextShowLayoutState = 1 &lt;&lt; 7, // Print the various 'needs layout' bits on renderers.
-    RenderAsTextShowOverflow = 1 &lt;&lt; 8 // Print layout and visual overflow.
</del><ins>+    RenderAsTextBehaviorNormal          = 0,
+    RenderAsTextShowAllLayers           = 1 &lt;&lt; 0, // Dump all layers, not just those that would paint.
+    RenderAsTextShowLayerNesting        = 1 &lt;&lt; 1, // Annotate the layer lists.
+    RenderAsTextShowCompositedLayers    = 1 &lt;&lt; 2, // Show which layers are composited.
+    RenderAsTextShowAddresses           = 1 &lt;&lt; 3, // Show layer and renderer addresses.
+    RenderAsTextShowIDAndClass          = 1 &lt;&lt; 4, // Show id and class attributes
+    RenderAsTextPrintingMode            = 1 &lt;&lt; 5, // Dump the tree in printing mode.
+    RenderAsTextDontUpdateLayout        = 1 &lt;&lt; 6, // Don't update layout, to make it safe to call showLayerTree() from the debugger inside layout or painting code.
+    RenderAsTextShowLayoutState         = 1 &lt;&lt; 7, // Print the various 'needs layout' bits on renderers.
+    RenderAsTextShowOverflow            = 1 &lt;&lt; 8, // Print layout and visual overflow.
+    RenderAsTextShowSVGGeometry         = 1 &lt;&lt; 9, // Print additional geometry for SVG objects.
</ins><span class="cx"> };
</span><span class="cx"> typedef unsigned RenderAsTextBehavior;
</span><span class="cx"> 
</span><span class="lines">@@ -53,6 +54,7 @@
</span><span class="cx"> WEBCORE_EXPORT String externalRepresentation(Frame*, RenderAsTextBehavior = RenderAsTextBehaviorNormal);
</span><span class="cx"> WEBCORE_EXPORT String externalRepresentation(Element*, RenderAsTextBehavior = RenderAsTextBehaviorNormal);
</span><span class="cx"> void write(TextStream&amp;, const RenderObject&amp;, int indent = 0, RenderAsTextBehavior = RenderAsTextBehaviorNormal);
</span><ins>+void writeDebugInfo(TextStream&amp;, const RenderObject&amp;, RenderAsTextBehavior = RenderAsTextBehaviorNormal);
</ins><span class="cx"> 
</span><span class="cx"> class RenderTreeAsText {
</span><span class="cx"> // FIXME: This is a cheesy hack to allow easy access to RenderStyle colors.  It won't be needed if we convert
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgSVGRenderTreeAsTextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp (193613 => 193614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp        2015-12-07 06:27:08 UTC (rev 193613)
+++ trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp        2015-12-07 06:27:48 UTC (rev 193614)
</span><span class="lines">@@ -47,7 +47,6 @@
</span><span class="cx"> #include &quot;RenderSVGResourceSolidColor.h&quot;
</span><span class="cx"> #include &quot;RenderSVGRoot.h&quot;
</span><span class="cx"> #include &quot;RenderSVGText.h&quot;
</span><del>-#include &quot;RenderTreeAsText.h&quot;
</del><span class="cx"> #include &quot;SVGCircleElement.h&quot;
</span><span class="cx"> #include &quot;SVGEllipseElement.h&quot;
</span><span class="cx"> #include &quot;SVGInlineTextBox.h&quot;
</span><span class="lines">@@ -228,9 +227,19 @@
</span><span class="cx">     writeIfNotEmpty(ts, &quot;end marker&quot;, svgStyle.markerEndResource());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static TextStream&amp; writePositionAndStyle(TextStream&amp; ts, const RenderElement&amp; renderer)
</del><ins>+static TextStream&amp; writePositionAndStyle(TextStream&amp; ts, const RenderElement&amp; renderer, RenderAsTextBehavior behavior = RenderAsTextBehaviorNormal)
</ins><span class="cx"> {
</span><ins>+    if (behavior &amp; RenderAsTextShowSVGGeometry) {
+        if (is&lt;RenderBox&gt;(renderer)) {
+            LayoutRect r = downcast&lt;RenderBox&gt;(renderer).frameRect();
+            ts &lt;&lt; &quot; &quot; &lt;&lt; enclosingIntRect(r);
+        }
+        
+        ts &lt;&lt; &quot; clipped&quot;;
+    }
+
</ins><span class="cx">     ts &lt;&lt; &quot; &quot; &lt;&lt; enclosingIntRect(renderer.absoluteClippedOverflowRect());
</span><ins>+
</ins><span class="cx">     writeStyle(ts, renderer);
</span><span class="cx">     return ts;
</span><span class="cx"> }
</span><span class="lines">@@ -279,11 +288,6 @@
</span><span class="cx">     return ts;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static TextStream&amp; operator&lt;&lt;(TextStream&amp; ts, const RenderSVGRoot&amp; root)
-{
-    return writePositionAndStyle(ts, root);
-}
-
</del><span class="cx"> static void writeRenderSVGTextBox(TextStream&amp; ts, const RenderSVGText&amp; text)
</span><span class="cx"> {
</span><span class="cx">     auto* box = downcast&lt;SVGRootInlineBox&gt;(text.firstRootBox());
</span><span class="lines">@@ -363,19 +367,24 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void writeStandardPrefix(TextStream&amp; ts, const RenderObject&amp; object, int indent)
</del><ins>+static void writeStandardPrefix(TextStream&amp; ts, const RenderObject&amp; object, int indent, RenderAsTextBehavior behavior)
</ins><span class="cx"> {
</span><span class="cx">     writeIndent(ts, indent);
</span><span class="cx">     ts &lt;&lt; object.renderName();
</span><span class="cx"> 
</span><ins>+    if (behavior &amp; RenderAsTextShowAddresses)
+        ts &lt;&lt; &quot; &quot; &lt;&lt; static_cast&lt;const void*&gt;(&amp;object);
+
</ins><span class="cx">     if (object.node())
</span><span class="cx">         ts &lt;&lt; &quot; {&quot; &lt;&lt; object.node()-&gt;nodeName() &lt;&lt; &quot;}&quot;;
</span><ins>+
+    writeDebugInfo(ts, object, behavior);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void writeChildren(TextStream&amp; ts, const RenderElement&amp; parent, int indent)
</del><ins>+static void writeChildren(TextStream&amp; ts, const RenderElement&amp; parent, int indent, RenderAsTextBehavior behavior)
</ins><span class="cx"> {
</span><span class="cx">     for (const auto&amp; child : childrenOfType&lt;RenderObject&gt;(parent))
</span><del>-        write(ts, child, indent + 1);
</del><ins>+        write(ts, child, indent + 1, behavior);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static inline void writeCommonGradientProperties(TextStream&amp; ts, SVGSpreadMethodType spreadMethod, const AffineTransform&amp; gradientTransform, SVGUnitTypes::SVGUnitType gradientUnits)
</span><span class="lines">@@ -389,9 +398,9 @@
</span><span class="cx">         ts &lt;&lt; &quot; [gradientTransform=&quot; &lt;&lt; gradientTransform &lt;&lt; &quot;]&quot;;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void writeSVGResourceContainer(TextStream&amp; ts, const RenderSVGResourceContainer&amp; resource, int indent)
</del><ins>+void writeSVGResourceContainer(TextStream&amp; ts, const RenderSVGResourceContainer&amp; resource, int indent, RenderAsTextBehavior behavior)
</ins><span class="cx"> {
</span><del>-    writeStandardPrefix(ts, resource, indent);
</del><ins>+    writeStandardPrefix(ts, resource, indent, behavior);
</ins><span class="cx"> 
</span><span class="cx">     const AtomicString&amp; id = resource.element().getIdAttribute();
</span><span class="cx">     writeNameAndQuotedValue(ts, &quot;id&quot;, id);    
</span><span class="lines">@@ -468,68 +477,69 @@
</span><span class="cx">         ts &lt;&lt; &quot; [center=&quot; &lt;&lt; centerPoint &lt;&lt; &quot;] [focal=&quot; &lt;&lt; focalPoint &lt;&lt; &quot;] [radius=&quot; &lt;&lt; radius &lt;&lt; &quot;] [focalRadius=&quot; &lt;&lt; focalRadius &lt;&lt; &quot;]\n&quot;;
</span><span class="cx">     } else
</span><span class="cx">         ts &lt;&lt; &quot;\n&quot;;
</span><del>-    writeChildren(ts, resource, indent);
</del><ins>+    writeChildren(ts, resource, indent, behavior);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void writeSVGContainer(TextStream&amp; ts, const RenderSVGContainer&amp; container, int indent)
</del><ins>+void writeSVGContainer(TextStream&amp; ts, const RenderSVGContainer&amp; container, int indent, RenderAsTextBehavior behavior)
</ins><span class="cx"> {
</span><span class="cx">     // Currently RenderSVGResourceFilterPrimitive has no meaningful output.
</span><span class="cx">     if (container.isSVGResourceFilterPrimitive())
</span><span class="cx">         return;
</span><del>-    writeStandardPrefix(ts, container, indent);
-    writePositionAndStyle(ts, container);
</del><ins>+    writeStandardPrefix(ts, container, indent, behavior);
+    writePositionAndStyle(ts, container, behavior);
</ins><span class="cx">     ts &lt;&lt; &quot;\n&quot;;
</span><del>-    writeResources(ts, container, indent);
-    writeChildren(ts, container, indent);
</del><ins>+    writeResources(ts, container, indent, behavior);
+    writeChildren(ts, container, indent, behavior);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void write(TextStream&amp; ts, const RenderSVGRoot&amp; root, int indent)
</del><ins>+void write(TextStream&amp; ts, const RenderSVGRoot&amp; root, int indent, RenderAsTextBehavior behavior)
</ins><span class="cx"> {
</span><del>-    writeStandardPrefix(ts, root, indent);
-    ts &lt;&lt; root &lt;&lt; &quot;\n&quot;;
-    writeChildren(ts, root, indent);
</del><ins>+    writeStandardPrefix(ts, root, indent, behavior);
+    writePositionAndStyle(ts, root, behavior);
+    ts &lt;&lt; &quot;\n&quot;;
+    writeChildren(ts, root, indent, behavior);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void writeSVGText(TextStream&amp; ts, const RenderSVGText&amp; text, int indent)
</del><ins>+void writeSVGText(TextStream&amp; ts, const RenderSVGText&amp; text, int indent, RenderAsTextBehavior behavior)
</ins><span class="cx"> {
</span><del>-    writeStandardPrefix(ts, text, indent);
</del><ins>+    writeStandardPrefix(ts, text, indent, behavior);
</ins><span class="cx">     writeRenderSVGTextBox(ts, text);
</span><span class="cx">     ts &lt;&lt; &quot;\n&quot;;
</span><del>-    writeResources(ts, text, indent);
-    writeChildren(ts, text, indent);
</del><ins>+    writeResources(ts, text, indent, behavior);
+    writeChildren(ts, text, indent, behavior);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void writeSVGInlineText(TextStream&amp; ts, const RenderSVGInlineText&amp; text, int indent)
</del><ins>+void writeSVGInlineText(TextStream&amp; ts, const RenderSVGInlineText&amp; text, int indent, RenderAsTextBehavior behavior)
</ins><span class="cx"> {
</span><del>-    writeStandardPrefix(ts, text, indent);
</del><ins>+    writeStandardPrefix(ts, text, indent, behavior);
</ins><span class="cx">     ts &lt;&lt; &quot; &quot; &lt;&lt; enclosingIntRect(FloatRect(text.firstRunLocation(), text.floatLinesBoundingBox().size())) &lt;&lt; &quot;\n&quot;;
</span><del>-    writeResources(ts, text, indent);
</del><ins>+    writeResources(ts, text, indent, behavior);
</ins><span class="cx">     writeSVGInlineTextBoxes(ts, text, indent);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void writeSVGImage(TextStream&amp; ts, const RenderSVGImage&amp; image, int indent)
</del><ins>+void writeSVGImage(TextStream&amp; ts, const RenderSVGImage&amp; image, int indent, RenderAsTextBehavior behavior)
</ins><span class="cx"> {
</span><del>-    writeStandardPrefix(ts, image, indent);
-    writePositionAndStyle(ts, image);
</del><ins>+    writeStandardPrefix(ts, image, indent, behavior);
+    writePositionAndStyle(ts, image, behavior);
</ins><span class="cx">     ts &lt;&lt; &quot;\n&quot;;
</span><del>-    writeResources(ts, image, indent);
</del><ins>+    writeResources(ts, image, indent, behavior);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void write(TextStream&amp; ts, const RenderSVGShape&amp; shape, int indent)
</del><ins>+void write(TextStream&amp; ts, const RenderSVGShape&amp; shape, int indent, RenderAsTextBehavior behavior)
</ins><span class="cx"> {
</span><del>-    writeStandardPrefix(ts, shape, indent);
</del><ins>+    writeStandardPrefix(ts, shape, indent, behavior);
</ins><span class="cx">     ts &lt;&lt; shape &lt;&lt; &quot;\n&quot;;
</span><del>-    writeResources(ts, shape, indent);
</del><ins>+    writeResources(ts, shape, indent, behavior);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void writeSVGGradientStop(TextStream&amp; ts, const RenderSVGGradientStop&amp; stop, int indent)
</del><ins>+void writeSVGGradientStop(TextStream&amp; ts, const RenderSVGGradientStop&amp; stop, int indent, RenderAsTextBehavior behavior)
</ins><span class="cx"> {
</span><del>-    writeStandardPrefix(ts, stop, indent);
</del><ins>+    writeStandardPrefix(ts, stop, indent, behavior);
</ins><span class="cx"> 
</span><span class="cx">     ts &lt;&lt; &quot; [offset=&quot; &lt;&lt; stop.element().offset() &lt;&lt; &quot;] [color=&quot; &lt;&lt; stop.element().stopColorIncludingOpacity() &lt;&lt; &quot;]\n&quot;;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void writeResources(TextStream&amp; ts, const RenderObject&amp; renderer, int indent)
</del><ins>+void writeResources(TextStream&amp; ts, const RenderObject&amp; renderer, int indent, RenderAsTextBehavior behavior)
</ins><span class="cx"> {
</span><span class="cx">     const RenderStyle&amp; style = renderer.style();
</span><span class="cx">     const SVGRenderStyle&amp; svgStyle = style.svgStyle();
</span><span class="lines">@@ -542,7 +552,7 @@
</span><span class="cx">             ts &lt;&lt; &quot; &quot;;
</span><span class="cx">             writeNameAndQuotedValue(ts, &quot;masker&quot;, svgStyle.maskerResource());
</span><span class="cx">             ts &lt;&lt; &quot; &quot;;
</span><del>-            writeStandardPrefix(ts, *masker, 0);
</del><ins>+            writeStandardPrefix(ts, *masker, 0, behavior);
</ins><span class="cx">             ts &lt;&lt; &quot; &quot; &lt;&lt; masker-&gt;resourceBoundingBox(renderer) &lt;&lt; &quot;\n&quot;;
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -552,7 +562,7 @@
</span><span class="cx">             ts &lt;&lt; &quot; &quot;;
</span><span class="cx">             writeNameAndQuotedValue(ts, &quot;clipPath&quot;, svgStyle.clipperResource());
</span><span class="cx">             ts &lt;&lt; &quot; &quot;;
</span><del>-            writeStandardPrefix(ts, *clipper, 0);
</del><ins>+            writeStandardPrefix(ts, *clipper, 0, behavior);
</ins><span class="cx">             ts &lt;&lt; &quot; &quot; &lt;&lt; clipper-&gt;resourceBoundingBox(renderer) &lt;&lt; &quot;\n&quot;;
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -568,7 +578,7 @@
</span><span class="cx">                     ts &lt;&lt; &quot; &quot;;
</span><span class="cx">                     writeNameAndQuotedValue(ts, &quot;filter&quot;, id);
</span><span class="cx">                     ts &lt;&lt; &quot; &quot;;
</span><del>-                    writeStandardPrefix(ts, *filter, 0);
</del><ins>+                    writeStandardPrefix(ts, *filter, 0, behavior);
</ins><span class="cx">                     ts &lt;&lt; &quot; &quot; &lt;&lt; filter-&gt;resourceBoundingBox(renderer) &lt;&lt; &quot;\n&quot;;
</span><span class="cx">                 }
</span><span class="cx">             }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgSVGRenderTreeAsTexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.h (193613 => 193614)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.h        2015-12-07 06:27:08 UTC (rev 193613)
+++ trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.h        2015-12-07 06:27:48 UTC (rev 193614)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #ifndef SVGRenderTreeAsText_h
</span><span class="cx"> #define SVGRenderTreeAsText_h
</span><span class="cx"> 
</span><ins>+#include &quot;RenderTreeAsText.h&quot;
</ins><span class="cx"> #include &quot;TextStream.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -48,15 +49,15 @@
</span><span class="cx"> class SVGUnitTypes;
</span><span class="cx"> 
</span><span class="cx"> // functions used by the main RenderTreeAsText code
</span><del>-void write(TextStream&amp;, const RenderSVGShape&amp;, int indent);
-void write(TextStream&amp;, const RenderSVGRoot&amp;, int indent);
-void writeSVGGradientStop(TextStream&amp;, const RenderSVGGradientStop&amp;, int indent);
-void writeSVGResourceContainer(TextStream&amp;, const RenderSVGResourceContainer&amp;, int indent);
-void writeSVGContainer(TextStream&amp;, const RenderSVGContainer&amp;, int indent);
-void writeSVGImage(TextStream&amp;, const RenderSVGImage&amp;, int indent);
-void writeSVGInlineText(TextStream&amp;, const RenderSVGInlineText&amp;, int indent);
-void writeSVGText(TextStream&amp;, const RenderSVGText&amp;, int indent);
-void writeResources(TextStream&amp;, const RenderObject&amp;, int indent);
</del><ins>+void write(TextStream&amp;, const RenderSVGShape&amp;, int indent, RenderAsTextBehavior);
+void write(TextStream&amp;, const RenderSVGRoot&amp;, int indent, RenderAsTextBehavior);
+void writeSVGGradientStop(TextStream&amp;, const RenderSVGGradientStop&amp;, int indent, RenderAsTextBehavior);
+void writeSVGResourceContainer(TextStream&amp;, const RenderSVGResourceContainer&amp;, int indent, RenderAsTextBehavior);
+void writeSVGContainer(TextStream&amp;, const RenderSVGContainer&amp;, int indent, RenderAsTextBehavior);
+void writeSVGImage(TextStream&amp;, const RenderSVGImage&amp;, int indent, RenderAsTextBehavior);
+void writeSVGInlineText(TextStream&amp;, const RenderSVGInlineText&amp;, int indent, RenderAsTextBehavior);
+void writeSVGText(TextStream&amp;, const RenderSVGText&amp;, int indent, RenderAsTextBehavior);
+void writeResources(TextStream&amp;, const RenderObject&amp;, int indent, RenderAsTextBehavior);
</ins><span class="cx"> 
</span><span class="cx"> // helper operators specific to dumping the render tree. these are used in various classes to dump the render tree
</span><span class="cx"> // these could be defined in separate namespace to avoid matching these generic signatures unintentionally.
</span></span></pre>
</div>
</div>

</body>
</html>