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

Unified Diff: third_party/WebKit/Source/core/css/PropertySetCSSStyleDeclaration.cpp

Issue 1455053003: Custom property CSSOM patch with templates [not for landing] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@_levisPatch
Patch Set: Created 5 years, 1 month 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: third_party/WebKit/Source/core/css/PropertySetCSSStyleDeclaration.cpp
diff --git a/third_party/WebKit/Source/core/css/PropertySetCSSStyleDeclaration.cpp b/third_party/WebKit/Source/core/css/PropertySetCSSStyleDeclaration.cpp
index 68d25011b7a2af7a3458dc227ed2267bf8c1bce9..2199549777cdbc656e23f4c508fd084f87680cb4 100644
--- a/third_party/WebKit/Source/core/css/PropertySetCSSStyleDeclaration.cpp
+++ b/third_party/WebKit/Source/core/css/PropertySetCSSStyleDeclaration.cpp
@@ -181,20 +181,23 @@ String AbstractPropertySetCSSStyleDeclaration::getPropertyValue(const String& pr
if (!propertyID) {
if (!RuntimeEnabledFeatures::cssVariablesEnabled() || !CSSVariableParser::isValidVariableName(propertyName))
return String();
- return propertySet().getCustomPropertyValue(AtomicString(propertyName));
+ return propertySet().getPropertyValue(AtomicString(propertyName));
}
return propertySet().getPropertyValue(propertyID);
}
String AbstractPropertySetCSSStyleDeclaration::getPropertyPriority(const String& propertyName)
{
+ bool important = false;
CSSPropertyID propertyID = cssPropertyID(propertyName);
if (!propertyID) {
if (!RuntimeEnabledFeatures::cssVariablesEnabled() || !CSSVariableParser::isValidVariableName(propertyName))
return String();
- return propertySet().customPropertyIsImportant(AtomicString(propertyName)) ? "important" : "";
+ important = propertySet().propertyIsImportant(AtomicString(propertyName));
+ } else {
+ important = propertySet().propertyIsImportant(propertyID);
}
- return propertySet().propertyIsImportant(propertyID) ? "important" : "";
+ return important ? "important" : "";
}
String AbstractPropertySetCSSStyleDeclaration::getPropertyShorthand(const String& propertyName)
@@ -249,8 +252,11 @@ String AbstractPropertySetCSSStyleDeclaration::removeProperty(const String& prop
willMutate();
String result;
- bool changed = propertyID == CSSPropertyVariable ? propertySet().removeCustomProperty(AtomicString(propertyName), &result)
- : propertySet().removeProperty(propertyID, &result);
+ bool changed = false;
+ if (propertyID == CSSPropertyVariable)
+ changed = propertySet().removeProperty(AtomicString(propertyName), &result);
+ else
+ changed = propertySet().removeProperty(propertyID, &result);
didMutate(changed ? PropertyChanged : NoChanges);
@@ -269,13 +275,16 @@ String AbstractPropertySetCSSStyleDeclaration::getPropertyValueInternal(CSSPrope
return propertySet().getPropertyValue(propertyID);
}
-void AbstractPropertySetCSSStyleDeclaration::setPropertyInternal(CSSPropertyID unresolvedProperty, const String& propertyName, const String& value, bool important, ExceptionState&)
+void AbstractPropertySetCSSStyleDeclaration::setPropertyInternal(CSSPropertyID unresolvedProperty, const String& customPropertyName, const String& value, bool important, ExceptionState&)
{
StyleAttributeMutationScope mutationScope(this);
willMutate();
- bool changed = unresolvedProperty == CSSPropertyVariable ? propertySet().setCustomProperty(AtomicString(propertyName), value, important, contextStyleSheet())
- : propertySet().setProperty(unresolvedProperty, value, important, contextStyleSheet());
+ bool changed = false;
+ if (unresolvedProperty == CSSPropertyVariable)
+ changed = propertySet().setProperty(AtomicString(customPropertyName), value, important, contextStyleSheet());
+ else
+ changed = propertySet().setProperty(unresolvedProperty, value, important, contextStyleSheet());
didMutate(changed ? PropertyChanged : NoChanges);

Powered by Google App Engine
This is Rietveld 408576698