Index: Source/core/css/resolver/CSSVariableResolver.h |
diff --git a/Source/core/css/resolver/CSSVariableResolver.h b/Source/core/css/resolver/CSSVariableResolver.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2624343cde0ad6959e582b1e95b67b1ad94df933 |
--- /dev/null |
+++ b/Source/core/css/resolver/CSSVariableResolver.h |
@@ -0,0 +1,46 @@ |
+// Copyright 2015 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 CSSVariableResolver_h |
+#define CSSVariableResolver_h |
+ |
+#include "core/CSSPropertyNames.h" |
+#include "core/css/parser/CSSParserToken.h" |
+#include "wtf/HashSet.h" |
+#include "wtf/text/AtomicString.h" |
+#include "wtf/text/AtomicStringHash.h" |
+ |
+namespace blink { |
+ |
+class CSSPrimitiveValue; |
+class StyleResolverState; |
+class StyleVariableData; |
+ |
+// TODO(leviw): Refactor to not just use static methods, and instead have private members. |
+class CSSVariableResolver { |
+public: |
+ static void resolveVariableDefinitions(StyleResolverState&); |
+ static void resolveAndApplyVariableReferences(StyleResolverState&, CSSPropertyID, CSSPrimitiveValue*); |
+ |
+private: |
+ enum ResolutionBehavior { |
+ ResolvingVariableDefinitions, |
+ DoNotResolveVariableDefinitions |
+ }; |
+ |
+ CSSVariableResolver(const StyleVariableData*); |
+ CSSVariableResolver(const StyleVariableData*, AtomicString& variable); |
+ |
+ unsigned resolveVariableTokensRecursive(Vector<CSSParserToken>&, unsigned startOffset); |
+ void resolveVariableReferencesFromTokens(Vector<CSSParserToken>& tokens); |
+ |
+ const StyleVariableData* m_styleVariableData; |
+ HashSet<AtomicString> m_variablesSeen; |
+ bool m_cycleDetected; |
+ ResolutionBehavior m_resolutionBehavior; |
+}; |
+ |
+} // namespace blink |
+ |
+#endif // CSSVariableResolver |