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

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

Issue 1285293003: Remove ScopedStyleResolver::treeScopeFor. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Apply sheets for html imports to the main document. 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
« no previous file with comments | « Source/core/css/resolver/ScopedStyleResolver.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..b9f3a54aba58637c15ec50a070720997ba60aeed 100644
--- a/Source/core/css/resolver/StyleResolver.cpp
+++ b/Source/core/css/resolver/StyleResolver.cpp
@@ -187,13 +187,18 @@ void StyleResolver::removePendingAuthorStyleSheets(const WillBeHeapVector<RefPtr
void StyleResolver::appendCSSStyleSheet(CSSStyleSheet& cssSheet)
{
ASSERT(!cssSheet.disabled());
- if (cssSheet.mediaQueries() && !m_medium->eval(cssSheet.mediaQueries(), &m_viewportDependentMediaQueryResults))
- return;
+ ASSERT(cssSheet.ownerDocument());
+ ASSERT(cssSheet.ownerNode());
+ ASSERT(isHTMLStyleElement(cssSheet.ownerNode()) || isSVGStyleElement(cssSheet.ownerNode()) || cssSheet.ownerNode()->treeScope() == cssSheet.ownerDocument());
- TreeScope* treeScope = ScopedStyleResolver::treeScopeFor(document(), &cssSheet);
- if (!treeScope)
+ if (cssSheet.mediaQueries() && !m_medium->eval(cssSheet.mediaQueries(), &m_viewportDependentMediaQueryResults))
return;
+ TreeScope* treeScope = &cssSheet.ownerNode()->treeScope();
+ // Sheets in the document scope of HTML imports apply to the main document
+ // (m_document), so we override it for all document scoped sheets.
+ if (treeScope->rootNode().isDocumentNode())
+ treeScope = m_document;
treeScope->ensureScopedStyleResolver().appendCSSStyleSheet(cssSheet, *m_medium);
}
« no previous file with comments | « Source/core/css/resolver/ScopedStyleResolver.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698