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

Unified Diff: third_party/WebKit/Source/core/style/ComputedStyle.cpp

Issue 1192983003: CSS Custom Properties (Variables) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Use m_unit 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/style/ComputedStyle.cpp
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.cpp b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
index 222c33205baa930c3adfa2e98fbc00881dbdb0b1..2cfe368864871fa0ff9c64f8a2c15dfc50456082 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyle.cpp
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
@@ -1269,6 +1269,32 @@ const Vector<AppliedTextDecoration>& ComputedStyle::appliedTextDecorations() con
return rareInheritedData->appliedTextDecorations->vector();
}
+StyleVariableData* ComputedStyle::variables() const
+{
+ ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
+ return rareInheritedData->variables.get();
+}
+
+void ComputedStyle::setVariable(const AtomicString& name, PassRefPtr<CSSVariableData> value)
+{
+ RefPtr<StyleVariableData>& variables = rareInheritedData.access()->variables;
+ if (!variables)
+ variables = StyleVariableData::create();
+ else if (!variables->hasOneRef())
+ variables = variables->copy();
+ variables->setVariable(name, value);
+}
+
+void ComputedStyle::removeVariable(const AtomicString& name)
+{
+ RefPtr<StyleVariableData>& variables = rareInheritedData.access()->variables;
+ if (!variables)
+ return;
+ if (!variables->hasOneRef())
+ variables = variables->copy();
+ variables->removeVariable(name);
+}
+
float ComputedStyle::wordSpacing() const { return fontDescription().wordSpacing(); }
float ComputedStyle::letterSpacing() const { return fontDescription().letterSpacing(); }
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.h ('k') | third_party/WebKit/Source/core/style/StyleRareInheritedData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698