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

Unified Diff: sky/engine/core/dom/StyleSheetCollection.cpp

Issue 846183002: Remove tracking of pending sheets. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « sky/engine/core/dom/StyleSheetCollection.h ('k') | sky/tests/lowlevel/home.sky » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/dom/StyleSheetCollection.cpp
diff --git a/sky/engine/core/dom/StyleSheetCollection.cpp b/sky/engine/core/dom/StyleSheetCollection.cpp
index 937b28fc668e7638a9fb6ee8cf146152410ba8ea..383f17d2d5eda8132e5270e7997b0f4e4bcae6b6 100644
--- a/sky/engine/core/dom/StyleSheetCollection.cpp
+++ b/sky/engine/core/dom/StyleSheetCollection.cpp
@@ -38,7 +38,6 @@ namespace blink {
StyleSheetCollection::StyleSheetCollection(TreeScope& treeScope)
: m_treeScope(treeScope)
- , m_needsUpdate(true)
{
}
@@ -50,13 +49,11 @@ void StyleSheetCollection::addStyleSheetCandidateNode(HTMLStyleElement& element)
{
ASSERT(element.inActiveDocument());
m_styleSheetCandidateNodes.add(&element);
- m_needsUpdate = true;
}
void StyleSheetCollection::removeStyleSheetCandidateNode(HTMLStyleElement& element)
{
m_styleSheetCandidateNodes.remove(&element);
- m_needsUpdate = true;
}
void StyleSheetCollection::collectStyleSheets(Vector<RefPtr<CSSStyleSheet>>& sheets)
@@ -70,15 +67,10 @@ void StyleSheetCollection::collectStyleSheets(Vector<RefPtr<CSSStyleSheet>>& she
void StyleSheetCollection::updateActiveStyleSheets(StyleResolver& resolver)
{
- if (!m_needsUpdate)
- return;
-
Vector<RefPtr<CSSStyleSheet>> candidateSheets;
collectStyleSheets(candidateSheets);
m_treeScope.scopedStyleResolver().resetAuthorStyle();
- resolver.removePendingAuthorStyleSheets(m_activeAuthorStyleSheets);
- resolver.lazyAppendAuthorStyleSheets(0, candidateSheets);
Node& root = m_treeScope.rootNode();
@@ -92,7 +84,9 @@ void StyleSheetCollection::updateActiveStyleSheets(StyleResolver& resolver)
toShadowRoot(root).host()->setNeedsStyleRecalc(SubtreeStyleChange);
m_activeAuthorStyleSheets.swap(candidateSheets);
- m_needsUpdate = false;
+
+ for (RefPtr<CSSStyleSheet>& sheet : m_activeAuthorStyleSheets)
+ resolver.appendCSSStyleSheet(sheet.get());
}
}
« no previous file with comments | « sky/engine/core/dom/StyleSheetCollection.h ('k') | sky/tests/lowlevel/home.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698