Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1447)

Unified Diff: Source/core/rendering/RenderTreeAsText.cpp

Issue 595603002: Cleanup RenderTreeAsText (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/RenderTreeAsText.h ('k') | Source/core/rendering/svg/SVGRenderTreeAsText.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderTreeAsText.cpp
diff --git a/Source/core/rendering/RenderTreeAsText.cpp b/Source/core/rendering/RenderTreeAsText.cpp
index 6f10754855b50b08375c905d050b3ee8d8185a67..6fb01b89623dd2a2645ff5a37939fe8f78a3816d 100644
--- a/Source/core/rendering/RenderTreeAsText.cpp
+++ b/Source/core/rendering/RenderTreeAsText.cpp
@@ -158,6 +158,11 @@ String quoteAndEscapeNonPrintables(const String& s)
return result.toString();
}
+TextStream& operator<<(TextStream& ts, const Color& c)
+{
+ return ts << c.nameForRenderTreeAsText();
+}
+
void RenderTreeAsText::writeRenderObject(TextStream& ts, const RenderObject& o, RenderAsTextBehavior behavior)
{
ts << o.renderName();
@@ -221,23 +226,23 @@ void RenderTreeAsText::writeRenderObject(TextStream& ts, const RenderObject& o,
if (o.parent()) {
Color color = o.resolveColor(CSSPropertyColor);
if (o.parent()->resolveColor(CSSPropertyColor) != color)
- ts << " [color=" << color.nameForRenderTreeAsText() << "]";
+ ts << " [color=" << color << "]";
// Do not dump invalid or transparent backgrounds, since that is the default.
Color backgroundColor = o.resolveColor(CSSPropertyBackgroundColor);
if (o.parent()->resolveColor(CSSPropertyBackgroundColor) != backgroundColor
&& backgroundColor.rgb())
- ts << " [bgcolor=" << backgroundColor.nameForRenderTreeAsText() << "]";
+ ts << " [bgcolor=" << backgroundColor << "]";
Color textFillColor = o.resolveColor(CSSPropertyWebkitTextFillColor);
if (o.parent()->resolveColor(CSSPropertyWebkitTextFillColor) != textFillColor
&& textFillColor != color && textFillColor.rgb())
- ts << " [textFillColor=" << textFillColor.nameForRenderTreeAsText() << "]";
+ ts << " [textFillColor=" << textFillColor << "]";
Color textStrokeColor = o.resolveColor(CSSPropertyWebkitTextStrokeColor);
if (o.parent()->resolveColor(CSSPropertyWebkitTextStrokeColor) != textStrokeColor
&& textStrokeColor != color && textStrokeColor.rgb())
- ts << " [textStrokeColor=" << textStrokeColor.nameForRenderTreeAsText() << "]";
+ ts << " [textStrokeColor=" << textStrokeColor << "]";
if (o.parent()->style()->textStrokeWidth() != o.style()->textStrokeWidth() && o.style()->textStrokeWidth() > 0)
ts << " [textStrokeWidth=" << o.style()->textStrokeWidth() << "]";
@@ -256,8 +261,7 @@ void RenderTreeAsText::writeRenderObject(TextStream& ts, const RenderObject& o,
else {
ts << " (" << box.borderTop() << "px ";
printBorderStyle(ts, o.style()->borderTopStyle());
- Color col = o.resolveColor(CSSPropertyBorderTopColor);
- ts << col.nameForRenderTreeAsText() << ")";
+ ts << o.resolveColor(CSSPropertyBorderTopColor) << ")";
}
if (o.style()->borderRight() != prevBorder) {
@@ -267,8 +271,7 @@ void RenderTreeAsText::writeRenderObject(TextStream& ts, const RenderObject& o,
else {
ts << " (" << box.borderRight() << "px ";
printBorderStyle(ts, o.style()->borderRightStyle());
- Color col = o.resolveColor(CSSPropertyBorderRightColor);
- ts << col.nameForRenderTreeAsText() << ")";
+ ts << o.resolveColor(CSSPropertyBorderRightColor) << ")";
}
}
@@ -279,8 +282,7 @@ void RenderTreeAsText::writeRenderObject(TextStream& ts, const RenderObject& o,
else {
ts << " (" << box.borderBottom() << "px ";
printBorderStyle(ts, o.style()->borderBottomStyle());
- Color col = o.resolveColor(CSSPropertyBorderBottomColor);
- ts << col.nameForRenderTreeAsText() << ")";
+ ts << o.resolveColor(CSSPropertyBorderBottomColor) << ")";
}
}
@@ -291,8 +293,7 @@ void RenderTreeAsText::writeRenderObject(TextStream& ts, const RenderObject& o,
else {
ts << " (" << box.borderLeft() << "px ";
printBorderStyle(ts, o.style()->borderLeftStyle());
- Color col = o.resolveColor(CSSPropertyBorderLeftColor);
- ts << col.nameForRenderTreeAsText() << ")";
+ ts << o.resolveColor(CSSPropertyBorderLeftColor) << ")";
}
}
« no previous file with comments | « Source/core/rendering/RenderTreeAsText.h ('k') | Source/core/rendering/svg/SVGRenderTreeAsText.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698