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

Unified Diff: Source/core/css/CSSPrimitiveValue.cpp

Issue 114373004: Remove the SVGColor and SVGPaint DOM interfaces (were deprecated). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: text diff fix Created 7 years 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/core.gypi ('k') | Source/core/svg/SVGAnimatedType.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSPrimitiveValue.cpp
diff --git a/Source/core/css/CSSPrimitiveValue.cpp b/Source/core/css/CSSPrimitiveValue.cpp
index eb350e7a9c08f786ef201246fcfdbbca73bcc720..f943d69746201186965eb760d05195a5f9ec7e5c 100644
--- a/Source/core/css/CSSPrimitiveValue.cpp
+++ b/Source/core/css/CSSPrimitiveValue.cpp
@@ -1046,32 +1046,7 @@ String CSSPrimitiveValue::customCSSText(CSSTextFormattingFlags formattingFlag) c
if (m_primitiveUnitType == CSS_PARSER_HEXCOLOR)
Color::parseHexColor(m_value.string, rgbColor);
Color color(rgbColor);
-
- StringBuilder result;
- result.reserveCapacity(32);
- bool colorHasAlpha = color.hasAlpha();
- if (colorHasAlpha)
- result.append("rgba(", 5);
- else
- result.append("rgb(", 4);
-
- result.appendNumber(static_cast<unsigned char>(color.red()));
- result.append(", ", 2);
-
- result.appendNumber(static_cast<unsigned char>(color.green()));
- result.append(", ", 2);
-
- result.appendNumber(static_cast<unsigned char>(color.blue()));
- if (colorHasAlpha) {
- result.append(", ", 2);
-
- NumberToStringBuffer buffer;
- const char* alphaString = numberToFixedPrecisionString(color.alpha() / 255.0f, 6, buffer, true);
- result.append(alphaString, strlen(alphaString));
- }
-
- result.append(')');
- text = result.toString();
+ text = color.serializedAsCSSComponentValue();
break;
}
case CSS_FR:
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/svg/SVGAnimatedType.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698