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

Unified Diff: Source/core/css/CSSComputedStyleDeclaration.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/CSSComputedStyleDeclaration.h ('k') | Source/core/css/CSSParser-in.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSComputedStyleDeclaration.cpp
diff --git a/Source/core/css/CSSComputedStyleDeclaration.cpp b/Source/core/css/CSSComputedStyleDeclaration.cpp
index 8ccea82f6f6fe4c946ac66497c89d6580d7db4ea..c93276ba830c7ee7613883e4fa5181ba7cbb4f30 100644
--- a/Source/core/css/CSSComputedStyleDeclaration.cpp
+++ b/Source/core/css/CSSComputedStyleDeclaration.cpp
@@ -3003,6 +3003,57 @@ void CSSComputedStyleDeclaration::setPropertyInternal(CSSPropertyID, const Strin
ec = NoModificationAllowedError;
}
+const HashMap<AtomicString, String>* CSSComputedStyleDeclaration::variableMap() const
+{
+ ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
+ Node* styledNode = this->styledNode();
+ if (!styledNode)
+ return 0;
+ RefPtr<RenderStyle> style = styledNode->computedStyle(styledNode->isPseudoElement() ? NOPSEUDO : m_pseudoElementSpecifier);
+ if (!style)
+ return 0;
+ return style->variables();
+}
+
+unsigned CSSComputedStyleDeclaration::variableCount() const
+{
+ ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
+ const HashMap<AtomicString, String>* variables = variableMap();
+ if (!variables)
+ return 0;
+ return variables->size();
+}
+
+String CSSComputedStyleDeclaration::variableValue(const AtomicString& name) const
+{
+ ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
+ const HashMap<AtomicString, String>* variables = variableMap();
+ if (!variables)
+ return emptyString();
+ HashMap<AtomicString, String>::const_iterator it = variables->find(name);
+ if (it == variables->end())
+ return emptyString();
+ return it->value;
+}
+
+void CSSComputedStyleDeclaration::setVariableValue(const AtomicString&, const String&, ExceptionCode& ec)
+{
+ ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
+ ec = NoModificationAllowedError;
+}
+
+bool CSSComputedStyleDeclaration::removeVariable(const AtomicString&)
+{
+ ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
+ return false;
+}
+
+void CSSComputedStyleDeclaration::clearVariables(ExceptionCode& ec)
+{
+ ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
+ ec = NoModificationAllowedError;
+}
+
PassRefPtr<CSSValueList> CSSComputedStyleDeclaration::getBackgroundShorthandValue() const
{
static const CSSPropertyID propertiesBeforeSlashSeperator[5] = { CSSPropertyBackgroundColor, CSSPropertyBackgroundImage,
« no previous file with comments | « Source/core/css/CSSComputedStyleDeclaration.h ('k') | Source/core/css/CSSParser-in.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698