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) |