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

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

Issue 973623002: Fix serialization of content property to always quote (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add another method Created 5 years, 10 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
Index: Source/core/css/CSSPrimitiveValue.cpp
diff --git a/Source/core/css/CSSPrimitiveValue.cpp b/Source/core/css/CSSPrimitiveValue.cpp
index 5f99f15e08af1ac4ecf7bb1fe01e9c5f905975de..fd40ac79468f8935f59f8ccc83407c0ffec23529 100644
--- a/Source/core/css/CSSPrimitiveValue.cpp
+++ b/Source/core/css/CSSPrimitiveValue.cpp
@@ -98,6 +98,7 @@ static inline bool isValidCSSUnitTypeForDoubleConversion(CSSPrimitiveValue::Unit
case CSSPrimitiveValue::CSS_QUAD:
case CSSPrimitiveValue::CSS_RGBCOLOR:
case CSSPrimitiveValue::CSS_SHAPE:
+ case CSSPrimitiveValue::CSS_CUSTOM_IDENT:
case CSSPrimitiveValue::CSS_STRING:
case CSSPrimitiveValue::CSS_UNICODE_RANGE:
case CSSPrimitiveValue::CSS_UNKNOWN:
@@ -451,6 +452,7 @@ CSSPrimitiveValue::~CSSPrimitiveValue()
void CSSPrimitiveValue::cleanup()
{
switch (static_cast<UnitType>(m_primitiveUnitType)) {
+ case CSS_CUSTOM_IDENT:
case CSS_STRING:
case CSS_URI:
case CSS_ATTR:
@@ -928,16 +930,17 @@ CSSPrimitiveValue::UnitType CSSPrimitiveValue::lengthUnitTypeToUnitType(LengthUn
String CSSPrimitiveValue::getStringValue() const
{
switch (m_primitiveUnitType) {
- case CSS_STRING:
- case CSS_ATTR:
- case CSS_URI:
- return m_value.string;
- case CSS_VALUE_ID:
- return valueName(m_value.valueID);
- case CSS_PROPERTY_ID:
- return propertyName(m_value.propertyID);
- default:
- break;
+ case CSS_CUSTOM_IDENT:
+ case CSS_STRING:
+ case CSS_ATTR:
+ case CSS_URI:
+ return m_value.string;
+ case CSS_VALUE_ID:
+ return valueName(m_value.valueID);
+ case CSS_PROPERTY_ID:
+ return propertyName(m_value.propertyID);
+ default:
+ break;
}
return String();
@@ -1022,6 +1025,7 @@ const char* CSSPrimitiveValue::unitTypeToString(UnitType type)
case CSS_VMAX:
return "vmax";
case CSS_UNKNOWN:
+ case CSS_CUSTOM_IDENT:
case CSS_STRING:
case CSS_URI:
case CSS_VALUE_ID:
@@ -1045,7 +1049,7 @@ const char* CSSPrimitiveValue::unitTypeToString(UnitType type)
return "";
}
-String CSSPrimitiveValue::customCSSText(CSSTextFormattingFlags formattingFlag) const
+String CSSPrimitiveValue::customCSSText() const
{
if (m_hasCachedCSSText) {
ASSERT(cssTextCache().contains(this));
@@ -1087,8 +1091,11 @@ String CSSPrimitiveValue::customCSSText(CSSTextFormattingFlags formattingFlag) c
case CSS_VMAX:
text = formatNumber(m_value.num, unitTypeToString((UnitType)m_primitiveUnitType));
break;
+ case CSS_CUSTOM_IDENT:
+ text = quoteCSSStringIfNeeded(m_value.string);
+ break;
case CSS_STRING:
- text = formattingFlag == AlwaysQuoteCSSString ? quoteCSSString(m_value.string) : quoteCSSStringIfNeeded(m_value.string);
+ text = quoteCSSString(m_value.string);
break;
case CSS_URI:
text = "url(" + quoteCSSURLIfNeeded(m_value.string) + ")";
@@ -1202,6 +1209,7 @@ bool CSSPrimitiveValue::equals(const CSSPrimitiveValue& other) const
return propertyName(m_value.propertyID) == propertyName(other.m_value.propertyID);
case CSS_VALUE_ID:
return valueName(m_value.valueID) == valueName(other.m_value.valueID);
+ case CSS_CUSTOM_IDENT:
case CSS_STRING:
case CSS_URI:
case CSS_ATTR:

Powered by Google App Engine
This is Rietveld 408576698