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

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

Issue 844133002: Simplify tree scope tracking in StyleEngine. (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/engine/core/dom/shadow/ShadowRoot.cpp » ('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 3c220fc254844b18f8de2c29d4cd9aa4d807d13c..91470b462ba608629193cda1131e98691e2f7d20 100644
--- a/sky/engine/core/dom/StyleSheetCollection.cpp
+++ b/sky/engine/core/dom/StyleSheetCollection.cpp
@@ -46,31 +46,21 @@ StyleSheetCollection::~StyleSheetCollection()
{
}
-void StyleSheetCollection::addStyleSheetCandidateNode(Node* node, bool)
+void StyleSheetCollection::addStyleSheetCandidateNode(HTMLStyleElement& element)
{
- if (!node->inDocument())
- return;
-
- // Until the <body> exists, we have no choice but to compare document positions,
- // since styles outside of the body and head continue to be shunted into the head
- // (and thus can shift to end up before dynamically added DOM content that is also
- // outside the body).
- m_styleSheetCandidateNodes.add(node);
+ ASSERT(element.inActiveDocument());
+ m_styleSheetCandidateNodes.add(&element);
}
-void StyleSheetCollection::removeStyleSheetCandidateNode(Node* node, ContainerNode* scopingNode)
+void StyleSheetCollection::removeStyleSheetCandidateNode(HTMLStyleElement& element)
{
- m_styleSheetCandidateNodes.remove(node);
+ m_styleSheetCandidateNodes.remove(&element);
}
void StyleSheetCollection::collectStyleSheets(Vector<RefPtr<CSSStyleSheet>>& sheets)
{
- DocumentOrderedList::iterator begin = m_styleSheetCandidateNodes.begin();
- DocumentOrderedList::iterator end = m_styleSheetCandidateNodes.end();
- for (DocumentOrderedList::iterator it = begin; it != end; ++it) {
- Node* node = *it;
- if (!isHTMLStyleElement(*node))
- continue;
+ for (Node* node : m_styleSheetCandidateNodes) {
+ ASSERT(isHTMLStyleElement(*node));
if (CSSStyleSheet* sheet = toHTMLStyleElement(node)->sheet())
sheets.append(sheet);
}
« no previous file with comments | « sky/engine/core/dom/StyleSheetCollection.h ('k') | sky/engine/core/dom/shadow/ShadowRoot.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698