| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CSSVariableData_h | 5 #ifndef CSSVariableData_h |
| 6 #define CSSVariableData_h | 6 #define CSSVariableData_h |
| 7 | 7 |
| 8 #include "core/css/parser/CSSParserToken.h" | 8 #include "core/css/parser/CSSParserToken.h" |
| 9 #include "core/css/parser/CSSParserTokenRange.h" | 9 #include "core/css/parser/CSSParserTokenRange.h" |
| 10 #include "wtf/RefCounted.h" | 10 #include "wtf/RefCounted.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 return adoptRef(new CSSVariableData(range, needsVariableResolution)); | 23 return adoptRef(new CSSVariableData(range, needsVariableResolution)); |
| 24 } | 24 } |
| 25 | 25 |
| 26 static PassRefPtr<CSSVariableData> createResolved(const Vector<CSSParserToke
n>& resolvedTokens, PassRefPtr<CSSVariableData> unresolvedData) | 26 static PassRefPtr<CSSVariableData> createResolved(const Vector<CSSParserToke
n>& resolvedTokens, PassRefPtr<CSSVariableData> unresolvedData) |
| 27 { | 27 { |
| 28 return adoptRef(new CSSVariableData(resolvedTokens, unresolvedData->m_ba
ckingString)); | 28 return adoptRef(new CSSVariableData(resolvedTokens, unresolvedData->m_ba
ckingString)); |
| 29 } | 29 } |
| 30 | 30 |
| 31 CSSParserTokenRange tokenRange() { return m_tokens; } | 31 CSSParserTokenRange tokenRange() { return m_tokens; } |
| 32 | 32 |
| 33 const Vector<CSSParserToken>& tokens() { return m_tokens; } | 33 const Vector<CSSParserToken>& tokens() const { return m_tokens; } |
| 34 |
| 35 bool operator==(const CSSVariableData& other) const; |
| 34 | 36 |
| 35 bool needsVariableResolution() const { return m_needsVariableResolution; } | 37 bool needsVariableResolution() const { return m_needsVariableResolution; } |
| 36 private: | 38 private: |
| 37 CSSVariableData(const CSSParserTokenRange&, bool needsVariableResolution); | 39 CSSVariableData(const CSSParserTokenRange&, bool needsVariableResolution); |
| 38 | 40 |
| 39 // We can safely copy the tokens (which have raw pointers to substrings) bec
ause | 41 // We can safely copy the tokens (which have raw pointers to substrings) bec
ause |
| 40 // StylePropertySets contain references to CSSCustomPropertyDeclarations, wh
ich | 42 // StylePropertySets contain references to CSSCustomPropertyDeclarations, wh
ich |
| 41 // point to the unresolved CSSVariableData values that own the backing strin
gs | 43 // point to the unresolved CSSVariableData values that own the backing strin
gs |
| 42 // this will potentially reference. | 44 // this will potentially reference. |
| 43 CSSVariableData(const Vector<CSSParserToken>& resolvedTokens, String backing
String) | 45 CSSVariableData(const Vector<CSSParserToken>& resolvedTokens, String backing
String) |
| 44 : m_backingString(backingString) | 46 : m_backingString(backingString) |
| 45 , m_tokens(resolvedTokens) | 47 , m_tokens(resolvedTokens) |
| 46 , m_needsVariableResolution(false) | 48 , m_needsVariableResolution(false) |
| 47 { } | 49 { } |
| 48 | 50 |
| 49 void consumeAndUpdateTokens(const CSSParserTokenRange&); | 51 void consumeAndUpdateTokens(const CSSParserTokenRange&); |
| 50 template<typename CharacterType> void updateTokens(const CSSParserTokenRange
&); | 52 template<typename CharacterType> void updateTokens(const CSSParserTokenRange
&); |
| 51 | 53 |
| 52 String m_backingString; | 54 String m_backingString; |
| 53 Vector<CSSParserToken> m_tokens; | 55 Vector<CSSParserToken> m_tokens; |
| 54 const bool m_needsVariableResolution; | 56 const bool m_needsVariableResolution; |
| 55 }; | 57 }; |
| 56 | 58 |
| 57 } // namespace blink | 59 } // namespace blink |
| 58 | 60 |
| 59 #endif // CSSVariableData_h | 61 #endif // CSSVariableData_h |
| OLD | NEW |