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

Unified Diff: Source/core/css/resolver/StyleResolver.cpp

Issue 1192983003: CSS Custom Properties (Variables) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Missing file :( Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698