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

Unified Diff: third_party/WebKit/Source/core/css/cssom/InlineStylePropertyMap.cpp

Issue 2115673003: Add support for custom properties and @apply when iterating InlineStylePropertyMap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a test, add a todo Created 4 years, 5 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 | « third_party/WebKit/LayoutTests/typedcssom/inlinestyle/inlineStylePropertyMap_iteration.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/cssom/InlineStylePropertyMap.cpp
diff --git a/third_party/WebKit/Source/core/css/cssom/InlineStylePropertyMap.cpp b/third_party/WebKit/Source/core/css/cssom/InlineStylePropertyMap.cpp
index 215887e5eeffbbc952ce234576e62f4eddd24744..0a1c69be6f52d72d113d6420309ef58fd57587e8 100644
--- a/third_party/WebKit/Source/core/css/cssom/InlineStylePropertyMap.cpp
+++ b/third_party/WebKit/Source/core/css/cssom/InlineStylePropertyMap.cpp
@@ -6,12 +6,15 @@
#include "bindings/core/v8/Iterable.h"
#include "core/CSSPropertyNames.h"
+#include "core/css/CSSCustomIdentValue.h"
+#include "core/css/CSSCustomPropertyDeclaration.h"
#include "core/css/CSSPrimitiveValue.h"
#include "core/css/CSSPropertyMetadata.h"
#include "core/css/CSSValueList.h"
#include "core/css/StylePropertySet.h"
#include "core/css/cssom/CSSOMTypes.h"
#include "core/css/cssom/CSSSimpleLength.h"
+#include "core/css/cssom/CSSUnsupportedStyleValue.h"
#include "core/css/cssom/StyleValueFactory.h"
namespace blink {
@@ -148,13 +151,25 @@ HeapVector<StylePropertyMap::StylePropertyMapEntry> InlineStylePropertyMap::getI
for (unsigned i = 0; i < inlineStyleSet.propertyCount(); i++) {
StylePropertySet::PropertyReference propertyReference = inlineStyleSet.propertyAt(i);
CSSPropertyID propertyID = propertyReference.id();
- CSSStyleValueVector styleValueVector = StyleValueFactory::cssValueToStyleValueVector(propertyID, *propertyReference.value());
+ String name;
CSSStyleValueOrCSSStyleValueSequence value;
- if (styleValueVector.size() == 1)
- value.setCSSStyleValue(styleValueVector[0]);
- else
- value.setCSSStyleValueSequence(styleValueVector);
- result.append(std::make_pair(getPropertyNameString(propertyID), value));
+ if (propertyID == CSSPropertyVariable) {
+ const CSSCustomPropertyDeclaration* customDeclaration = toCSSCustomPropertyDeclaration(propertyReference.value());
+ name = customDeclaration->name();
+ // TODO(meade): Eventually custom properties will support other types, so actually return them instead of always returning a CSSUnsupportedStyleValue.
+ value.setCSSStyleValue(CSSUnsupportedStyleValue::create(customDeclaration->customCSSText()));
+ } else if (propertyID == CSSPropertyApplyAtRule) {
+ name = "@apply";
+ value.setCSSStyleValue(CSSUnsupportedStyleValue::create(toCSSCustomIdentValue(propertyReference.value())->value()));
+ } else {
+ name = getPropertyNameString(propertyID);
+ CSSStyleValueVector styleValueVector = StyleValueFactory::cssValueToStyleValueVector(propertyID, *propertyReference.value());
+ if (styleValueVector.size() == 1)
+ value.setCSSStyleValue(styleValueVector[0]);
+ else
+ value.setCSSStyleValueSequence(styleValueVector);
+ }
+ result.append(std::make_pair(name, value));
}
return result;
}
« no previous file with comments | « third_party/WebKit/LayoutTests/typedcssom/inlinestyle/inlineStylePropertyMap_iteration.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698