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

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

Issue 18311002: Partial implementation of CSSVariablesMap for CSS Variables CSSOM (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased onto ToT, cleaned up includes Created 7 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 | « Source/core/css/PropertySetCSSStyleDeclaration.h ('k') | Source/core/css/StylePropertySet.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/PropertySetCSSStyleDeclaration.cpp
diff --git a/Source/core/css/PropertySetCSSStyleDeclaration.cpp b/Source/core/css/PropertySetCSSStyleDeclaration.cpp
index a78d436011ca9d59c36c1d23deb14489f688ed7d..74a46aaa852638cb69e579722f60b32bbc7f2a1a 100644
--- a/Source/core/css/PropertySetCSSStyleDeclaration.cpp
+++ b/Source/core/css/PropertySetCSSStyleDeclaration.cpp
@@ -23,6 +23,7 @@
#include "core/css/PropertySetCSSStyleDeclaration.h"
#include "HTMLNames.h"
+#include "RuntimeEnabledFeatures.h"
#include "core/css/CSSParser.h"
#include "core/css/CSSStyleSheet.h"
#include "core/css/StylePropertySet.h"
@@ -271,6 +272,52 @@ void PropertySetCSSStyleDeclaration::setPropertyInternal(CSSPropertyID propertyI
mutationScope.enqueueMutationRecord();
}
+unsigned PropertySetCSSStyleDeclaration::variableCount() const
+{
+ ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
+ return m_propertySet->variableCount();
+}
+
+String PropertySetCSSStyleDeclaration::variableValue(const AtomicString& name) const
+{
+ ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
+ return m_propertySet->variableValue(name);
+}
+
+void PropertySetCSSStyleDeclaration::setVariableValue(const AtomicString& name, const String& value, ExceptionCode&)
+{
+ ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
+ StyleAttributeMutationScope mutationScope(this);
+ willMutate();
+ bool changed = m_propertySet->setVariableValue(name, value);
+ didMutate(changed ? PropertyChanged : NoChanges);
+ if (changed)
+ mutationScope.enqueueMutationRecord();
+}
+
+bool PropertySetCSSStyleDeclaration::removeVariable(const AtomicString& name)
+{
+ ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
+ StyleAttributeMutationScope mutationScope(this);
+ willMutate();
+ bool changed = m_propertySet->removeVariable(name);
+ didMutate(changed ? PropertyChanged : NoChanges);
+ if (changed)
+ mutationScope.enqueueMutationRecord();
+ return changed;
+}
+
+void PropertySetCSSStyleDeclaration::clearVariables(ExceptionCode&)
+{
+ ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
+ StyleAttributeMutationScope mutationScope(this);
+ willMutate();
+ bool changed = m_propertySet->clearVariables();
+ didMutate(changed ? PropertyChanged : NoChanges);
+ if (changed)
+ mutationScope.enqueueMutationRecord();
+}
+
CSSValue* PropertySetCSSStyleDeclaration::cloneAndCacheForCSSOM(CSSValue* internalValue)
{
if (!internalValue)
« no previous file with comments | « Source/core/css/PropertySetCSSStyleDeclaration.h ('k') | Source/core/css/StylePropertySet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698