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

Unified Diff: Source/core/dom/TreeScopeStyleSheetCollection.cpp

Issue 1192983003: CSS Custom Properties (Variables) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: with missing files Created 5 years, 6 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/dom/TreeScopeStyleSheetCollection.cpp
diff --git a/Source/core/dom/TreeScopeStyleSheetCollection.cpp b/Source/core/dom/TreeScopeStyleSheetCollection.cpp
index 93a42764f127816bf550ff57c50f3a480f8540ba..424b51cc5accfe3d9e84af3faae8b16625548c2a 100644
--- a/Source/core/dom/TreeScopeStyleSheetCollection.cpp
+++ b/Source/core/dom/TreeScopeStyleSheetCollection.cpp
@@ -43,6 +43,7 @@ TreeScopeStyleSheetCollection::TreeScopeStyleSheetCollection(TreeScope& treeScop
: m_treeScope(treeScope)
, m_hadActiveLoadingStylesheet(false)
, m_usesRemUnits(false)
+ , m_usesVariables(false)
{
}
@@ -176,18 +177,19 @@ void TreeScopeStyleSheetCollection::clearMediaQueryRuleSetStyleSheets()
}
}
-static bool styleSheetsUseRemUnits(const WillBeHeapVector<RefPtrWillBeMember<CSSStyleSheet>>& sheets)
+void TreeScopeStyleSheetCollection::updateUsesRemUnitsAndVariables()
{
- for (unsigned i = 0; i < sheets.size(); ++i) {
- if (sheets[i]->contents()->usesRemUnits())
- return true;
+ m_usesRemUnits = m_usesVariables = false;
+ unsigned numberOfStylesheets = m_activeAuthorStyleSheets.size();
+ for (unsigned i = 0; i < numberOfStylesheets; ++i) {
+ StyleSheetContents* contents = m_activeAuthorStyleSheets[i]->contents();
+ if (contents->usesRemUnits())
+ m_usesRemUnits = true;
+ if (contents->usesVariables()) {
+ ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
+ m_usesVariables = true;
+ }
}
- return false;
-}
-
-void TreeScopeStyleSheetCollection::updateUsesRemUnits()
-{
- m_usesRemUnits = styleSheetsUseRemUnits(m_activeAuthorStyleSheets);
}
DEFINE_TRACE(TreeScopeStyleSheetCollection)

Powered by Google App Engine
This is Rietveld 408576698