| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 DCHECK(m_registry || !RuntimeEnabledFeatures::cssVariables2Enabled()); | 47 DCHECK(m_registry || !RuntimeEnabledFeatures::cssVariables2Enabled()); |
| 48 const PropertyRegistry::Registration* registration = | 48 const PropertyRegistry::Registration* registration = |
| 49 m_registry ? m_registry->registration(name) : nullptr; | 49 m_registry ? m_registry->registration(name) : nullptr; |
| 50 | 50 |
| 51 CSSVariableData* variableData = nullptr; | 51 CSSVariableData* variableData = nullptr; |
| 52 if (!registration || registration->inherits()) { | 52 if (!registration || registration->inherits()) { |
| 53 if (m_inheritedVariables) | 53 if (m_inheritedVariables) |
| 54 variableData = m_inheritedVariables->getVariable(name); | 54 variableData = m_inheritedVariables->getVariable(name); |
| 55 } else { | 55 } else { |
| 56 variableData = m_nonInheritedVariables->getVariable(name); | 56 if (m_nonInheritedVariables) |
| 57 variableData = m_nonInheritedVariables->getVariable(name); |
| 57 } | 58 } |
| 58 if (!variableData) | 59 if (!variableData) |
| 59 return registration ? registration->initialVariableData() : nullptr; | 60 return registration ? registration->initialVariableData() : nullptr; |
| 60 if (!variableData->needsVariableResolution()) | 61 if (!variableData->needsVariableResolution()) |
| 61 return variableData; | 62 return variableData; |
| 62 | 63 |
| 63 RefPtr<CSSVariableData> newVariableData = | 64 RefPtr<CSSVariableData> newVariableData = |
| 64 resolveCustomProperty(name, *variableData); | 65 resolveCustomProperty(name, *variableData); |
| 65 if (!registration) { | 66 if (!registration) { |
| 66 m_inheritedVariables->setVariable(name, newVariableData); | 67 m_inheritedVariables->setVariable(name, newVariableData); |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 CSSVariableResolver::CSSVariableResolver(const StyleResolverState& state) | 331 CSSVariableResolver::CSSVariableResolver(const StyleResolverState& state) |
| 331 : m_inheritedVariables(state.style()->inheritedVariables()), | 332 : m_inheritedVariables(state.style()->inheritedVariables()), |
| 332 m_nonInheritedVariables(state.style()->nonInheritedVariables()), | 333 m_nonInheritedVariables(state.style()->nonInheritedVariables()), |
| 333 m_registry(state.document().propertyRegistry()) {} | 334 m_registry(state.document().propertyRegistry()) {} |
| 334 | 335 |
| 335 DEFINE_TRACE(CSSVariableResolver) { | 336 DEFINE_TRACE(CSSVariableResolver) { |
| 336 visitor->trace(m_registry); | 337 visitor->trace(m_registry); |
| 337 } | 338 } |
| 338 | 339 |
| 339 } // namespace blink | 340 } // namespace blink |
| OLD | NEW |