Index: third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp |
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp b/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp |
index 2baa7e91459bd6918ceca8814865baa7e6b87b8e..9d67471662806ebae405f92442b995c1fb17ee1d 100644 |
--- a/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp |
+++ b/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp |
@@ -928,42 +928,37 @@ void StyleBuilderFunctions::applyValueCSSPropertyVariable( |
initial = true; |
} |
- DCHECK(initial ^ inherit); |
Timothy Loh
2017/01/17 05:51:05
Can we just keep this? You loosened the check so n
alancutter (OOO until 2018)
2017/01/17 06:08:15
Ah, true. I mainly changed it so that the code bel
|
- |
+ state.style()->removeVariable(name, isInheritedProperty); |
if (initial) { |
- if (isInheritedProperty) |
- state.style()->removeInheritedVariable(name); |
- else |
- state.style()->removeNonInheritedVariable(name); |
return; |
} |
- if (isInheritedProperty) { |
- state.style()->removeInheritedVariable(name); |
- StyleInheritedVariables* parentVariables = |
- state.parentStyle()->inheritedVariables(); |
- if (!parentVariables) |
- return; |
- CSSVariableData* parentValue = parentVariables->getVariable(name); |
+ DCHECK(inherit); |
+ CSSVariableData* parentValue = |
+ state.parentStyle()->getVariable(name, isInheritedProperty); |
+ const CSSValue* parentCSSValue = |
+ registration && parentValue |
+ ? state.parentStyle()->getRegisteredVariable(name, |
+ isInheritedProperty) |
+ : nullptr; |
+ |
+ if (!isInheritedProperty) { |
+ DCHECK(registration); |
if (parentValue) { |
- if (!registration) |
- state.style()->setResolvedUnregisteredVariable(name, parentValue); |
- else |
- state.style()->setResolvedInheritedVariable( |
- name, parentValue, parentVariables->registeredVariable(name)); |
+ state.style()->setResolvedNonInheritedVariable(name, parentValue, |
+ parentCSSValue); |
} |
return; |
} |
- state.style()->removeNonInheritedVariable(name); |
- StyleNonInheritedVariables* parentVariables = |
- state.parentStyle()->nonInheritedVariables(); |
- if (!parentVariables) |
- return; |
- CSSVariableData* parentValue = parentVariables->getVariable(name); |
- if (parentValue) |
- state.style()->setResolvedNonInheritedVariable( |
- name, parentValue, parentVariables->registeredVariable(name)); |
+ if (parentValue) { |
+ if (!registration) { |
+ state.style()->setResolvedUnregisteredVariable(name, parentValue); |
+ } else { |
+ state.style()->setResolvedInheritedVariable(name, parentValue, |
+ parentCSSValue); |
+ } |
+ } |
} |
void StyleBuilderFunctions::applyInheritCSSPropertyBaselineShift( |