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

Unified Diff: third_party/WebKit/Source/core/style/StyleNonInheritedVariables.h

Issue 2366313006: CSS Properties and Values API: Support non-inherited custom properties (Closed)
Patch Set: use de morgan's law Created 4 years, 3 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
Index: third_party/WebKit/Source/core/style/StyleNonInheritedVariables.h
diff --git a/third_party/WebKit/Source/core/style/StyleNonInheritedVariables.h b/third_party/WebKit/Source/core/style/StyleNonInheritedVariables.h
new file mode 100644
index 0000000000000000000000000000000000000000..69673130d51a4efc2c1d6322260f740a0afb307f
--- /dev/null
+++ b/third_party/WebKit/Source/core/style/StyleNonInheritedVariables.h
@@ -0,0 +1,44 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef StyleNonInheritedVariables_h
+#define StyleNonInheritedVariables_h
+
+#include "core/css/CSSValue.h"
+#include "core/css/CSSVariableData.h"
+#include "wtf/Forward.h"
+#include "wtf/HashMap.h"
+#include "wtf/text/AtomicStringHash.h"
+
+namespace blink {
+
+class StyleNonInheritedVariables {
+public:
+ static std::unique_ptr<StyleNonInheritedVariables> create() { return wrapUnique(new StyleNonInheritedVariables); }
+
+ std::unique_ptr<StyleNonInheritedVariables> copy() { return wrapUnique(new StyleNonInheritedVariables(*this)); }
+
+ bool operator==(const StyleNonInheritedVariables& other) const;
+ bool operator!=(const StyleNonInheritedVariables& other) const { return !(*this == other); }
+
+ void setVariable(const AtomicString& name, PassRefPtr<CSSVariableData> value) { m_data.set(name, value); }
+ CSSVariableData* getVariable(const AtomicString& name) const;
+ void removeVariable(const AtomicString&);
+
+ void setRegisteredVariable(const AtomicString&, const CSSValue*);
+ CSSValue* registeredVariable(const AtomicString& name) const { return m_registeredData.get(name); }
+
+private:
+ StyleNonInheritedVariables() = default;
+ StyleNonInheritedVariables(StyleNonInheritedVariables&);
+
+ friend class CSSVariableResolver;
+
+ HashMap<AtomicString, RefPtr<CSSVariableData>> m_data;
+ HashMap<AtomicString, Persistent<CSSValue>> m_registeredData;
+};
+
+} // namespace blink
+
+#endif // StyleNonInheritedVariables_h

Powered by Google App Engine
This is Rietveld 408576698