| 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 #include "core/css/CSSVariableData.h" | 5 #include "core/css/CSSVariableData.h" |
| 6 | 6 |
| 7 #include "core/css/parser/CSSParser.h" | 7 #include "core/css/parser/CSSParser.h" |
| 8 #include "core/css/parser/CSSParserTokenRange.h" | 8 #include "core/css/parser/CSSParserTokenRange.h" |
| 9 #include "wtf/text/StringBuilder.h" | 9 #include "wtf/text/StringBuilder.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 StylePropertySet* CSSVariableData::propertySet() | 13 StylePropertySet* CSSVariableData::propertySet() |
| 14 { | 14 { |
| 15 ASSERT(!m_needsVariableResolution); | 15 ASSERT(!m_needsVariableResolution); |
| 16 if (!m_cachedPropertySet) { | 16 if (!m_cachedPropertySet) { |
| 17 m_propertySet = CSSParser::parseCustomPropertySet(m_tokens); | 17 m_propertySet = CSSParser::parseCustomPropertySet(CSSParserTokenRange(m_
tokens.begin(), m_tokens.end())); |
| 18 m_cachedPropertySet = true; | 18 m_cachedPropertySet = true; |
| 19 } | 19 } |
| 20 return m_propertySet.get(); | 20 return m_propertySet.get(); |
| 21 } | 21 } |
| 22 | 22 |
| 23 template<typename CharacterType> void CSSVariableData::updateTokens(const CSSPar
serTokenRange& range) | 23 template<typename CharacterType> void CSSVariableData::updateTokens(const CSSPar
serTokenRange& range) |
| 24 { | 24 { |
| 25 const CharacterType* currentOffset = m_backingString.getCharacters<Character
Type>(); | 25 const CharacterType* currentOffset = m_backingString.getCharacters<Character
Type>(); |
| 26 for (const CSSParserToken& token : range) { | 26 for (const CSSParserToken& token : range) { |
| 27 if (token.hasStringBacking()) { | 27 if (token.hasStringBacking()) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 66 |
| 67 CSSVariableData::CSSVariableData(const CSSParserTokenRange& range, bool needsVar
iableResolution) | 67 CSSVariableData::CSSVariableData(const CSSParserTokenRange& range, bool needsVar
iableResolution) |
| 68 : m_needsVariableResolution(needsVariableResolution) | 68 : m_needsVariableResolution(needsVariableResolution) |
| 69 , m_cachedPropertySet(false) | 69 , m_cachedPropertySet(false) |
| 70 { | 70 { |
| 71 ASSERT(!range.atEnd()); | 71 ASSERT(!range.atEnd()); |
| 72 consumeAndUpdateTokens(range); | 72 consumeAndUpdateTokens(range); |
| 73 } | 73 } |
| 74 | 74 |
| 75 } // namespace blink | 75 } // namespace blink |
| OLD | NEW |