| Index: third_party/WebKit/Source/core/dom/Element.cpp
|
| diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp
|
| index b7cc35fd88b08689c815799321c8a9e47c565e40..5f89773399a8113b7c57402448419a37c7cbc2d7 100644
|
| --- a/third_party/WebKit/Source/core/dom/Element.cpp
|
| +++ b/third_party/WebKit/Source/core/dom/Element.cpp
|
| @@ -1897,7 +1897,7 @@ void Element::recalcStyle(StyleRecalcChange change, Text* nextTextSibling) {
|
|
|
| PassRefPtr<ComputedStyle> Element::propagateInheritedProperties(
|
| StyleRecalcChange change) {
|
| - if (change != IndependentInherit)
|
| + if (change != IndependentInherit && change != IndependentInheritWithVariables)
|
| return nullptr;
|
| if (isPseudoElement())
|
| return nullptr;
|
| @@ -1910,6 +1910,16 @@ PassRefPtr<ComputedStyle> Element::propagateInheritedProperties(
|
| const ComputedStyle* style = computedStyle();
|
| if (!style || style->animations() || style->transitions())
|
| return nullptr;
|
| + if (change == IndependentInheritWithVariables &&
|
| + (style->hasVariableReferenceFromInheritedProperty() ||
|
| + style->hasVariableReferenceFromNonInheritedProperty()
|
| + // If this element sets any variables, they may refer to other variables.
|
| + // To be safe, recalc the element's style.
|
| + // TODO(sashab): Set the hasVariableReferenceFromInheritedProperty flag
|
| + // on ComputedStyle when a variable references another variable and
|
| + // remove this additional check.
|
| + || style->hasAnyNonInheritedVariableDefinitions()))
|
| + return nullptr;
|
| RefPtr<ComputedStyle> newStyle = ComputedStyle::clone(*style);
|
| newStyle->propagateIndependentInheritedProperties(*parentStyle);
|
| INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(),
|
| @@ -1942,6 +1952,13 @@ StyleRecalcChange Element::recalcOwnStyle(StyleRecalcChange change,
|
| INCREMENT_STYLE_STATS_COUNTER(document().styleEngine(), stylesChanged, 1);
|
| }
|
|
|
| + if (change == IndependentInheritWithVariables && localChange == NoChange) {
|
| + // If we are in a propagation fast-path, but we have changed variables,
|
| + // there
|
| + // might still be properties that need to be updated below. Force continue.
|
| + localChange = IndependentInheritWithVariables;
|
| + }
|
| +
|
| if (localChange == Reattach) {
|
| StyleReattachData styleReattachData;
|
| styleReattachData.computedStyle = std::move(newStyle);
|
|
|