Index: third_party/WebKit/Source/core/css/CSSVariableData.h |
diff --git a/third_party/WebKit/Source/core/css/CSSVariableData.h b/third_party/WebKit/Source/core/css/CSSVariableData.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..91dfd676b1ee2a30936889d55ffb8fcc73db69f4 |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/css/CSSVariableData.h |
@@ -0,0 +1,53 @@ |
+// 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 CSSVariableData_h |
+#define CSSVariableData_h |
+ |
+#include "core/css/parser/CSSParserToken.h" |
+#include "core/css/parser/CSSParserTokenRange.h" |
+#include "wtf/RefCounted.h" |
+#include "wtf/text/WTFString.h" |
+ |
+namespace blink { |
+ |
+class CSSParserTokenRange; |
+ |
+class CSSVariableData : public RefCounted<CSSVariableData> { |
+ WTF_MAKE_NONCOPYABLE(CSSVariableData); |
+ WTF_MAKE_FAST_ALLOCATED(CSSVariableData); |
+public: |
+ static PassRefPtr<CSSVariableData> create(const CSSParserTokenRange& range, bool needsVariableResolution = true) |
+ { |
+ return adoptRef(new CSSVariableData(range, needsVariableResolution)); |
+ } |
+ |
+ static PassRefPtr<CSSVariableData> createResolved(const Vector<CSSParserToken>& resolvedTokens) |
+ { |
+ return adoptRef(new CSSVariableData(resolvedTokens)); |
+ } |
+ |
+ CSSParserTokenRange tokenRange() { return m_tokens; } |
+ |
+ const Vector<CSSParserToken>& tokens() { return m_tokens; } |
+ |
+ bool needsVariableResolution() const { return m_needsVariableResolution; } |
+private: |
+ CSSVariableData(const CSSParserTokenRange&, bool needsVariableResolution); |
+ CSSVariableData(const Vector<CSSParserToken>& resolvedTokens) |
alancutter (OOO until 2018)
2015/10/28 07:31:20
What guarantees do we have that the backing string
leviw_travelin_and_unemployed
2015/10/30 21:41:16
I added a comment about why its safe, and added an
|
+ : m_tokens(resolvedTokens) |
+ , m_needsVariableResolution(false) |
+ { } |
+ |
+ void consumeAndUpdateTokens(const CSSParserTokenRange&); |
+ template<typename CharacterType> void updateTokens(const CSSParserTokenRange&); |
+ |
+ String m_backingString; |
+ Vector<CSSParserToken> m_tokens; |
+ const bool m_needsVariableResolution; |
+}; |
+ |
+} // namespace blink |
+ |
+#endif // CSSVariableData_h |