| Index: Source/core/css/resolver/StyleResolver.cpp
|
| diff --git a/Source/core/css/resolver/StyleResolver.cpp b/Source/core/css/resolver/StyleResolver.cpp
|
| index 57f33842d5b36cd49c3ec1a293008548b1376e85..1024137ad52f4c6404de9d21887bcd6d7cb49964 100644
|
| --- a/Source/core/css/resolver/StyleResolver.cpp
|
| +++ b/Source/core/css/resolver/StyleResolver.cpp
|
| @@ -59,6 +59,7 @@
|
| #include "core/css/StyleRuleImport.h"
|
| #include "core/css/StyleSheetContents.h"
|
| #include "core/css/resolver/AnimatedStyleBuilder.h"
|
| +#include "core/css/resolver/CSSVariableResolver.h"
|
| #include "core/css/resolver/MatchResult.h"
|
| #include "core/css/resolver/MediaQueryResult.h"
|
| #include "core/css/resolver/ScopedStyleResolver.h"
|
| @@ -637,6 +638,9 @@ PassRefPtr<ComputedStyle> StyleResolver::styleForElement(Element* element, const
|
| if (state.style()->hasRemUnits())
|
| document().styleEngine().setUsesRemUnit(true);
|
|
|
| + if (state.style()->variables())
|
| + document().styleEngine().setUsesVariables(true);
|
| +
|
| // Now return the style.
|
| return state.takeStyle();
|
| }
|
| @@ -1304,6 +1308,14 @@ void StyleResolver::applyMatchedProperties(StyleResolverState& state, const Matc
|
| applyInheritedOnly = true;
|
| }
|
|
|
| + // TODO(leviw): We need the proper bit for tracking whether we need to do this work.
|
| + if (RuntimeEnabledFeatures::cssVariablesEnabled()) {
|
| + applyMatchedProperties<ResolveVariables>(state, matchResult, false, matchResult.beginAuthor(), matchResult.endAuthor(), applyInheritedOnly);
|
| + applyMatchedProperties<ResolveVariables>(state, matchResult, true, matchResult.beginAuthor(), matchResult.endAuthor(), applyInheritedOnly);
|
| + // TODO(leviw): stop recalculating every time
|
| + CSSVariableResolver::resolveVariableDefinitions(state);
|
| + }
|
| +
|
| // Now we have all of the matched rules in the appropriate order. Walk the rules and apply
|
| // high-priority properties first, i.e., those properties that other properties depend on.
|
| // The order is (1) high-priority not important, (2) high-priority important, (3) normal not important
|
|
|