Chromium Code Reviews| Index: third_party/WebKit/Source/core/css/StylePropertySerializer.cpp |
| diff --git a/third_party/WebKit/Source/core/css/StylePropertySerializer.cpp b/third_party/WebKit/Source/core/css/StylePropertySerializer.cpp |
| index b40d7b90244694943f4b3cdb4b09ed7ae6c35521..f28e82fd5cf57e6dbe26116257d27fbce65809c0 100644 |
| --- a/third_party/WebKit/Source/core/css/StylePropertySerializer.cpp |
| +++ b/third_party/WebKit/Source/core/css/StylePropertySerializer.cpp |
| @@ -25,6 +25,7 @@ |
| #include "core/CSSValueKeywords.h" |
| #include "core/StylePropertyShorthand.h" |
| +#include "core/css/CSSCustomPropertyDeclaration.h" |
| #include "core/css/CSSPropertyMetadata.h" |
| #include "core/css/CSSValuePool.h" |
| #include "wtf/BitArray.h" |
| @@ -176,6 +177,22 @@ StylePropertySerializer::StylePropertySerializer(const StylePropertySet& propert |
| { |
| } |
| +String StylePropertySerializer::getCustomPropertyText(const PropertyValueForSerializer& property, bool isNotFirstDecl) const |
|
Timothy Loh
2015/11/14 02:21:05
can this be static (not on the StylePropertySerial
leviw_travelin_and_unemployed
2015/11/17 01:25:07
Not if it wants to reference PropertyValueForSeria
|
| +{ |
| + ASSERT(property.id() == CSSPropertyVariable); |
| + StringBuilder result; |
| + if (isNotFirstDecl) |
| + result.append(' '); |
| + const CSSCustomPropertyDeclaration* value = toCSSCustomPropertyDeclaration(property.value()); |
| + result.append(value->name()); |
| + result.appendLiteral(": "); |
| + result.append(value->value()->tokenRange().serialize()); |
| + if (property.isImportant()) |
| + result.appendLiteral(" !important"); |
| + result.append(';'); |
| + return result.toString(); |
| +} |
| + |
| String StylePropertySerializer::getPropertyText(CSSPropertyID propertyID, const String& value, bool isImportant, bool isNotFirstDecl) const |
| { |
| StringBuilder result; |
| @@ -343,6 +360,9 @@ String StylePropertySerializer::asText() const |
| case CSSPropertyWebkitMaskOrigin: |
| shorthandPropertyID = CSSPropertyWebkitMask; |
| break; |
| + case CSSPropertyVariable: |
| + result.append(getCustomPropertyText(property, numDecls++)); |
| + continue; |
| case CSSPropertyAll: |
| result.append(getPropertyText(propertyID, property.value()->cssText(), property.isImportant(), numDecls++)); |
| continue; |