<!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>[163316] 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/163316">163316</a></dd>
<dt>Author</dt> <dd>akling@apple.com</dd>
<dt>Date</dt> <dd>2014-02-03 10:52:12 -0800 (Mon, 03 Feb 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>CTTE: Grab bag of SVGRenderTreeAsText cleanups.
<https://webkit.org/b/128099>
Made some of the DRT SVG functions take more specific types than
RenderObject. Removed some redundant casts.
Reviewed by Anders Carlsson.
* rendering/RenderTreeAsText.cpp:
(WebCore::write):
* rendering/svg/SVGRenderTreeAsText.h:
* rendering/svg/SVGRenderTreeAsText.cpp:
(WebCore::writeSVGResourceContainer):
(WebCore::writeSVGContainer):
Make writeSVGResourceContainer() and writeSVGContainer() take the
final type instead of RenderObject.
(WebCore::writeStyle):
(WebCore::writePositionAndStyle):
Make these take RenderElement instead of RenderObject.
(WebCore::writeChildren):
Use child renderer iterator.
(WebCore::writeResources):
Remove unnecessary cast.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderTreeAsTextcpp">trunk/Source/WebCore/rendering/RenderTreeAsText.cpp</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 (163315 => 163316)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-02-03 18:38:54 UTC (rev 163315)
+++ trunk/Source/WebCore/ChangeLog        2014-02-03 18:52:12 UTC (rev 163316)
</span><span class="lines">@@ -1,3 +1,36 @@
</span><ins>+2014-02-03 Andreas Kling <akling@apple.com>
+
+ CTTE: Grab bag of SVGRenderTreeAsText cleanups.
+ <https://webkit.org/b/128099>
+
+ Made some of the DRT SVG functions take more specific types than
+ RenderObject. Removed some redundant casts.
+
+ Reviewed by Anders Carlsson.
+
+ * rendering/RenderTreeAsText.cpp:
+ (WebCore::write):
+ * rendering/svg/SVGRenderTreeAsText.h:
+ * rendering/svg/SVGRenderTreeAsText.cpp:
+ (WebCore::writeSVGResourceContainer):
+ (WebCore::writeSVGContainer):
+
+ Make writeSVGResourceContainer() and writeSVGContainer() take the
+ final type instead of RenderObject.
+
+ (WebCore::writeStyle):
+ (WebCore::writePositionAndStyle):
+
+ Make these take RenderElement instead of RenderObject.
+
+ (WebCore::writeChildren):
+
+ Use child renderer iterator.
+
+ (WebCore::writeResources):
+
+ Remove unnecessary cast.
+
</ins><span class="cx"> 2014-01-25 Darin Adler <darin@apple.com>
</span><span class="cx">
</span><span class="cx"> Stop using Unicode.h
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderTreeAsTextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTreeAsText.cpp (163315 => 163316)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTreeAsText.cpp        2014-02-03 18:38:54 UTC (rev 163315)
+++ trunk/Source/WebCore/rendering/RenderTreeAsText.cpp        2014-02-03 18:52:12 UTC (rev 163316)
</span><span class="lines">@@ -66,6 +66,7 @@
</span><span class="cx"> #include "RenderSVGImage.h"
</span><span class="cx"> #include "RenderSVGInlineText.h"
</span><span class="cx"> #include "RenderSVGPath.h"
</span><ins>+#include "RenderSVGResourceContainer.h"
</ins><span class="cx"> #include "RenderSVGRoot.h"
</span><span class="cx"> #include "RenderSVGText.h"
</span><span class="cx"> #include "SVGRenderTreeAsText.h"
</span><span class="lines">@@ -518,11 +519,11 @@
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx"> if (o.isSVGResourceContainer()) {
</span><del>- writeSVGResourceContainer(ts, o, indent);
</del><ins>+ writeSVGResourceContainer(ts, toRenderSVGResourceContainer(o), indent);
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx"> if (o.isSVGContainer()) {
</span><del>- writeSVGContainer(ts, o, indent);
</del><ins>+ writeSVGContainer(ts, toRenderSVGContainer(o), indent);
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx"> if (o.isSVGRoot()) {
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgSVGRenderTreeAsTextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp (163315 => 163316)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp        2014-02-03 18:38:54 UTC (rev 163315)
+++ trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp        2014-02-03 18:52:12 UTC (rev 163316)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> #include "HTMLNames.h"
</span><span class="cx"> #include "NodeRenderStyle.h"
</span><span class="cx"> #include "RenderImage.h"
</span><ins>+#include "RenderIterator.h"
</ins><span class="cx"> #include "RenderSVGGradientStop.h"
</span><span class="cx"> #include "RenderSVGImage.h"
</span><span class="cx"> #include "RenderSVGPath.h"
</span><span class="lines">@@ -250,17 +251,17 @@
</span><span class="cx"> ts << " [id=\"" << element.getIdAttribute() << "\"]";
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static void writeStyle(TextStream& ts, const RenderObject& object)
</del><ins>+static void writeStyle(TextStream& ts, const RenderElement& renderer)
</ins><span class="cx"> {
</span><del>- const RenderStyle& style = object.style();
</del><ins>+ const RenderStyle& style = renderer.style();
</ins><span class="cx"> const SVGRenderStyle& svgStyle = style.svgStyle();
</span><span class="cx">
</span><del>- if (!object.localTransform().isIdentity())
- writeNameValuePair(ts, "transform", object.localTransform());
</del><ins>+ if (!renderer.localTransform().isIdentity())
+ writeNameValuePair(ts, "transform", renderer.localTransform());
</ins><span class="cx"> writeIfNotDefault(ts, "image rendering", style.imageRendering(), RenderStyle::initialImageRendering());
</span><span class="cx"> writeIfNotDefault(ts, "opacity", style.opacity(), RenderStyle::initialOpacity());
</span><del>- if (object.isSVGShape()) {
- const RenderSVGShape& shape = static_cast<const RenderSVGShape&>(object);
</del><ins>+ if (renderer.isSVGShape()) {
+ const auto& shape = toRenderSVGShape(renderer);
</ins><span class="cx">
</span><span class="cx"> Color fallbackColor;
</span><span class="cx"> if (RenderSVGResource* strokePaintingResource = RenderSVGResource::strokePaintingResource(const_cast<RenderSVGShape&>(shape), shape.style(), fallbackColor)) {
</span><span class="lines">@@ -307,10 +308,10 @@
</span><span class="cx"> writeIfNotEmpty(ts, "end marker", svgStyle.markerEndResource());
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static TextStream& writePositionAndStyle(TextStream& ts, const RenderObject& object)
</del><ins>+static TextStream& writePositionAndStyle(TextStream& ts, const RenderElement& renderer)
</ins><span class="cx"> {
</span><del>- ts << " " << enclosingIntRect(const_cast<RenderObject&>(object).absoluteClippedOverflowRect());
- writeStyle(ts, object);
</del><ins>+ ts << " " << enclosingIntRect(renderer.absoluteClippedOverflowRect());
+ writeStyle(ts, renderer);
</ins><span class="cx"> return ts;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -451,10 +452,10 @@
</span><span class="cx"> ts << " {" << object.node()->nodeName() << "}";
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static void writeChildren(TextStream& ts, const RenderObject& object, int indent)
</del><ins>+static void writeChildren(TextStream& ts, const RenderElement& parent, int indent)
</ins><span class="cx"> {
</span><del>- for (RenderObject* child = object.firstChildSlow(); child; child = child->nextSibling())
- write(ts, *child, indent + 1);
</del><ins>+ for (const auto& child : childrenOfType<RenderObject>(parent))
+ write(ts, child, indent + 1);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static inline void writeCommonGradientProperties(TextStream& ts, SVGSpreadMethodType spreadMethod, const AffineTransform& gradientTransform, SVGUnitTypes::SVGUnitType gradientUnits)
</span><span class="lines">@@ -468,16 +469,13 @@
</span><span class="cx"> ts << " [gradientTransform=" << gradientTransform << "]";
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void writeSVGResourceContainer(TextStream& ts, const RenderObject& object, int indent)
</del><ins>+void writeSVGResourceContainer(TextStream& ts, const RenderSVGResourceContainer& resource, int indent)
</ins><span class="cx"> {
</span><del>- writeStandardPrefix(ts, object, indent);
</del><ins>+ writeStandardPrefix(ts, resource, indent);
</ins><span class="cx">
</span><del>- Element* element = toElement(object.node());
- const AtomicString& id = element->getIdAttribute();
</del><ins>+ const AtomicString& id = resource.element().getIdAttribute();
</ins><span class="cx"> writeNameAndQuotedValue(ts, "id", id);
</span><span class="cx">
</span><del>- const auto& resource = toRenderSVGResourceContainer(object);
-
</del><span class="cx"> if (resource.resourceType() == MaskerResourceType) {
</span><span class="cx"> const auto& masker = static_cast<const RenderSVGResourceMasker&>(resource);
</span><span class="cx"> writeNameValuePair(ts, "maskUnits", masker.maskUnits());
</span><span class="lines">@@ -552,10 +550,10 @@
</span><span class="cx"> ts << " [center=" << centerPoint << "] [focal=" << focalPoint << "] [radius=" << radius << "] [focalRadius=" << focalRadius << "]\n";
</span><span class="cx"> } else
</span><span class="cx"> ts << "\n";
</span><del>- writeChildren(ts, object, indent);
</del><ins>+ writeChildren(ts, resource, indent);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void writeSVGContainer(TextStream& ts, const RenderObject& container, int indent)
</del><ins>+void writeSVGContainer(TextStream& ts, const RenderSVGContainer& container, int indent)
</ins><span class="cx"> {
</span><span class="cx"> // Currently RenderSVGResourceFilterPrimitive has no meaningful output.
</span><span class="cx"> if (container.isSVGResourceFilterPrimitive())
</span><span class="lines">@@ -616,16 +614,15 @@
</span><span class="cx"> ts << " [offset=" << stopElement->offset() << "] [color=" << stopElement->stopColorIncludingOpacity() << "]\n";
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void writeResources(TextStream& ts, const RenderObject& object, int indent)
</del><ins>+void writeResources(TextStream& ts, const RenderObject& renderer, int indent)
</ins><span class="cx"> {
</span><del>- const RenderStyle& style = object.style();
</del><ins>+ const RenderStyle& style = renderer.style();
</ins><span class="cx"> const SVGRenderStyle& svgStyle = style.svgStyle();
</span><span class="cx">
</span><span class="cx"> // FIXME: We want to use SVGResourcesCache to determine which resources are present, instead of quering the resource <-> id cache.
</span><span class="cx"> // For now leave the DRT output as is, but later on we should change this so cycles are properly ignored in the DRT output.
</span><del>- RenderObject& renderer = const_cast<RenderObject&>(object);
</del><span class="cx"> if (!svgStyle.maskerResource().isEmpty()) {
</span><del>- if (RenderSVGResourceMasker* masker = getRenderSVGResourceById<RenderSVGResourceMasker>(object.document(), svgStyle.maskerResource())) {
</del><ins>+ if (RenderSVGResourceMasker* masker = getRenderSVGResourceById<RenderSVGResourceMasker>(renderer.document(), svgStyle.maskerResource())) {
</ins><span class="cx"> writeIndent(ts, indent);
</span><span class="cx"> ts << " ";
</span><span class="cx"> writeNameAndQuotedValue(ts, "masker", svgStyle.maskerResource());
</span><span class="lines">@@ -635,7 +632,7 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> if (!svgStyle.clipperResource().isEmpty()) {
</span><del>- if (RenderSVGResourceClipper* clipper = getRenderSVGResourceById<RenderSVGResourceClipper>(object.document(), svgStyle.clipperResource())) {
</del><ins>+ if (RenderSVGResourceClipper* clipper = getRenderSVGResourceById<RenderSVGResourceClipper>(renderer.document(), svgStyle.clipperResource())) {
</ins><span class="cx"> writeIndent(ts, indent);
</span><span class="cx"> ts << " ";
</span><span class="cx"> writeNameAndQuotedValue(ts, "clipPath", svgStyle.clipperResource());
</span><span class="lines">@@ -646,7 +643,7 @@
</span><span class="cx"> }
</span><span class="cx"> #if ENABLE(FILTERS)
</span><span class="cx"> if (!svgStyle.filterResource().isEmpty()) {
</span><del>- if (RenderSVGResourceFilter* filter = getRenderSVGResourceById<RenderSVGResourceFilter>(object.document(), svgStyle.filterResource())) {
</del><ins>+ if (RenderSVGResourceFilter* filter = getRenderSVGResourceById<RenderSVGResourceFilter>(renderer.document(), svgStyle.filterResource())) {
</ins><span class="cx"> writeIndent(ts, indent);
</span><span class="cx"> ts << " ";
</span><span class="cx"> writeNameAndQuotedValue(ts, "filter", svgStyle.filterResource());
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgSVGRenderTreeAsTexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.h (163315 => 163316)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.h        2014-02-03 18:38:54 UTC (rev 163315)
+++ trunk/Source/WebCore/rendering/svg/SVGRenderTreeAsText.h        2014-02-03 18:52:12 UTC (rev 163316)
</span><span class="lines">@@ -38,9 +38,11 @@
</span><span class="cx"> class Node;
</span><span class="cx"> class RenderImage;
</span><span class="cx"> class RenderObject;
</span><ins>+class RenderSVGContainer;
</ins><span class="cx"> class RenderSVGGradientStop;
</span><span class="cx"> class RenderSVGImage;
</span><span class="cx"> class RenderSVGInlineText;
</span><ins>+class RenderSVGResourceContainer;
</ins><span class="cx"> class RenderSVGShape;
</span><span class="cx"> class RenderSVGRoot;
</span><span class="cx"> class RenderSVGText;
</span><span class="lines">@@ -51,8 +53,8 @@
</span><span class="cx"> void write(TextStream&, const RenderSVGShape&, int indent);
</span><span class="cx"> void write(TextStream&, const RenderSVGRoot&, int indent);
</span><span class="cx"> void writeSVGGradientStop(TextStream&, const RenderSVGGradientStop&, int indent);
</span><del>-void writeSVGResourceContainer(TextStream&, const RenderObject&, int indent);
-void writeSVGContainer(TextStream&, const RenderObject&, int indent);
</del><ins>+void writeSVGResourceContainer(TextStream&, const RenderSVGResourceContainer&, int indent);
+void writeSVGContainer(TextStream&, const RenderSVGContainer&, int indent);
</ins><span class="cx"> void writeSVGImage(TextStream&, const RenderSVGImage&, int indent);
</span><span class="cx"> void writeSVGInlineText(TextStream&, const RenderSVGInlineText&, int indent);
</span><span class="cx"> void writeSVGText(TextStream&, const RenderSVGText&, int indent);
</span></span></pre>
</div>
</div>
</body>
</html>