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 eb8165d634ee583bb3b57a3521d67fe7faaea43f..4f3f20dcfe88d55a6ffaf83c2d95349e4a952024 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 |
+{ |
+ 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->customCSSText()); |
+ 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; |