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/resolver/CSSVariableResolver.h" | 5 #include "core/css/resolver/CSSVariableResolver.h" |
6 | 6 |
7 #include "core/CSSPropertyNames.h" | 7 #include "core/CSSPropertyNames.h" |
8 #include "core/CSSValueKeywords.h" | 8 #include "core/CSSValueKeywords.h" |
9 #include "core/StyleBuilderFunctions.h" | 9 #include "core/StyleBuilderFunctions.h" |
10 #include "core/StylePropertyShorthand.h" | 10 #include "core/StylePropertyShorthand.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 context.cycleStartPoints.add(variableName); | 48 context.cycleStartPoints.add(variableName); |
49 resolveFallback(range, trash, context); | 49 resolveFallback(range, trash, context); |
50 return; | 50 return; |
51 } | 51 } |
52 | 52 |
53 CSSVariableData* variableData = m_styleVariableData ? m_styleVariableData->g
etVariable(variableName) : nullptr; | 53 CSSVariableData* variableData = m_styleVariableData ? m_styleVariableData->g
etVariable(variableName) : nullptr; |
54 if (variableData) { | 54 if (variableData) { |
55 Vector<CSSParserToken> tokens; | 55 Vector<CSSParserToken> tokens; |
56 if (variableData->needsVariableResolution()) { | 56 if (variableData->needsVariableResolution()) { |
57 m_variablesSeen.add(variableName); | 57 m_variablesSeen.add(variableName); |
58 resolveVariableReferencesFromTokens(variableData->tokens(), result,
context); | 58 resolveVariableReferencesFromTokens(variableData->tokens(), tokens,
context); |
59 m_variablesSeen.remove(variableName); | 59 m_variablesSeen.remove(variableName); |
60 | 60 |
61 // The old variable data holds onto the backing string the new resol
ved CSSVariableData | 61 // The old variable data holds onto the backing string the new resol
ved CSSVariableData |
62 // relies on. Ensure it will live beyond us overwriting the RefPtr i
n StyleVariableData. | 62 // relies on. Ensure it will live beyond us overwriting the RefPtr i
n StyleVariableData. |
63 ASSERT(variableData->refCount() > 1); | 63 ASSERT(variableData->refCount() > 1); |
64 | 64 |
65 m_styleVariableData->setVariable(variableName, CSSVariableData::crea
teResolved(tokens, variableData)); | 65 m_styleVariableData->setVariable(variableName, CSSVariableData::crea
teResolved(tokens, variableData)); |
66 if (!context.cycleStartPoints.isEmpty()) { | 66 if (!context.cycleStartPoints.isEmpty()) { |
67 if (context.cycleStartPoints.contains(variableName)) | 67 if (context.cycleStartPoints.contains(variableName)) |
68 context.cycleStartPoints.remove(variableName); | 68 context.cycleStartPoints.remove(variableName); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 { | 165 { |
166 } | 166 } |
167 | 167 |
168 CSSVariableResolver::CSSVariableResolver(StyleVariableData* styleVariableData, A
tomicString& variable) | 168 CSSVariableResolver::CSSVariableResolver(StyleVariableData* styleVariableData, A
tomicString& variable) |
169 : m_styleVariableData(styleVariableData) | 169 : m_styleVariableData(styleVariableData) |
170 { | 170 { |
171 m_variablesSeen.add(variable); | 171 m_variablesSeen.add(variable); |
172 } | 172 } |
173 | 173 |
174 } // namespace blink | 174 } // namespace blink |
OLD | NEW |