| 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/StylePropertySet.h" | 8 #include "core/css/StylePropertySet.h" |
| 9 #include "core/css/parser/CSSParserToken.h" | 9 #include "core/css/parser/CSSParserToken.h" |
| 10 #include "core/css/parser/CSSParserTokenRange.h" | 10 #include "core/css/parser/CSSParserTokenRange.h" |
| 11 #include "wtf/Forward.h" | 11 #include "wtf/Forward.h" |
| 12 #include "wtf/PassRefPtr.h" | 12 #include "wtf/PassRefPtr.h" |
| 13 #include "wtf/text/WTFString.h" | 13 #include "wtf/text/WTFString.h" |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 class CSSParserTokenRange; | 17 class CSSParserTokenRange; |
| 18 class CSSSyntaxDescriptor; |
| 18 | 19 |
| 19 class CSSVariableData : public RefCounted<CSSVariableData> { | 20 class CSSVariableData : public RefCounted<CSSVariableData> { |
| 20 WTF_MAKE_NONCOPYABLE(CSSVariableData); | 21 WTF_MAKE_NONCOPYABLE(CSSVariableData); |
| 21 USING_FAST_MALLOC(CSSVariableData); | 22 USING_FAST_MALLOC(CSSVariableData); |
| 22 public: | 23 public: |
| 23 static PassRefPtr<CSSVariableData> create(const CSSParserTokenRange& range,
bool needsVariableResolution = true) | 24 static PassRefPtr<CSSVariableData> create(const CSSParserTokenRange& range,
bool needsVariableResolution = true) |
| 24 { | 25 { |
| 25 return adoptRef(new CSSVariableData(range, needsVariableResolution)); | 26 return adoptRef(new CSSVariableData(range, needsVariableResolution)); |
| 26 } | 27 } |
| 27 | 28 |
| 28 static PassRefPtr<CSSVariableData> createResolved(const Vector<CSSParserToke
n>& resolvedTokens, const CSSVariableData& unresolvedData) | 29 static PassRefPtr<CSSVariableData> createResolved(const Vector<CSSParserToke
n>& resolvedTokens, const CSSVariableData& unresolvedData) |
| 29 { | 30 { |
| 30 return adoptRef(new CSSVariableData(resolvedTokens, unresolvedData.m_bac
kingString)); | 31 return adoptRef(new CSSVariableData(resolvedTokens, unresolvedData.m_bac
kingString)); |
| 31 } | 32 } |
| 32 | 33 |
| 33 CSSParserTokenRange tokenRange() { return m_tokens; } | 34 CSSParserTokenRange tokenRange() const { return m_tokens; } |
| 34 | 35 |
| 35 const Vector<CSSParserToken>& tokens() const { return m_tokens; } | 36 const Vector<CSSParserToken>& tokens() const { return m_tokens; } |
| 36 | 37 |
| 37 bool operator==(const CSSVariableData& other) const; | 38 bool operator==(const CSSVariableData& other) const; |
| 38 | 39 |
| 39 bool needsVariableResolution() const { return m_needsVariableResolution; } | 40 bool needsVariableResolution() const { return m_needsVariableResolution; } |
| 40 | 41 |
| 42 const CSSValue* parseForSyntax(const CSSSyntaxDescriptor&) const; |
| 43 |
| 41 StylePropertySet* propertySet(); | 44 StylePropertySet* propertySet(); |
| 42 | 45 |
| 43 private: | 46 private: |
| 44 CSSVariableData(const CSSParserTokenRange&, bool needsVariableResolution); | 47 CSSVariableData(const CSSParserTokenRange&, bool needsVariableResolution); |
| 45 | 48 |
| 46 // We can safely copy the tokens (which have raw pointers to substrings) bec
ause | 49 // We can safely copy the tokens (which have raw pointers to substrings) bec
ause |
| 47 // StylePropertySets contain references to CSSCustomPropertyDeclarations, wh
ich | 50 // StylePropertySets contain references to CSSCustomPropertyDeclarations, wh
ich |
| 48 // point to the unresolved CSSVariableData values that own the backing strin
gs | 51 // point to the unresolved CSSVariableData values that own the backing strin
gs |
| 49 // this will potentially reference. | 52 // this will potentially reference. |
| 50 CSSVariableData(const Vector<CSSParserToken>& resolvedTokens, String backing
String) | 53 CSSVariableData(const Vector<CSSParserToken>& resolvedTokens, String backing
String) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 62 const bool m_needsVariableResolution; | 65 const bool m_needsVariableResolution; |
| 63 | 66 |
| 64 // Parsed representation for @apply | 67 // Parsed representation for @apply |
| 65 bool m_cachedPropertySet; | 68 bool m_cachedPropertySet; |
| 66 Persistent<StylePropertySet> m_propertySet; | 69 Persistent<StylePropertySet> m_propertySet; |
| 67 }; | 70 }; |
| 68 | 71 |
| 69 } // namespace blink | 72 } // namespace blink |
| 70 | 73 |
| 71 #endif // CSSVariableData_h | 74 #endif // CSSVariableData_h |
| OLD | NEW |