Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Side by Side Diff: third_party/WebKit/Source/core/css/resolver/CSSVariableResolver.cpp

Issue 1573423002: CSS Custom Properties fail when defined in specific order (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding testcase Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css/variables/variable-resolution-order-independent.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css/variables/variable-resolution-order-independent.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698