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

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

Issue 315173002: Revert of Remove scoped styles. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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/css/resolver/ScopedStyleResolver.cpp
diff --git a/Source/core/css/resolver/ScopedStyleResolver.cpp b/Source/core/css/resolver/ScopedStyleResolver.cpp
index ff18794ba7ce7845da87c7edeb2270e654ab908f..3190423c3475c843f8b945b41a9dc98ec57d7d73 100644
--- a/Source/core/css/resolver/ScopedStyleResolver.cpp
+++ b/Source/core/css/resolver/ScopedStyleResolver.cpp
@@ -49,15 +49,22 @@
Document* sheetDocument = sheet->ownerDocument();
if (!sheetDocument)
return 0;
-
Node* ownerNode = sheet->ownerNode();
if (!isHTMLStyleElement(ownerNode))
return &document;
HTMLStyleElement& styleElement = toHTMLStyleElement(*ownerNode);
- if (styleElement.isInShadowTree())
- return styleElement.containingShadowRoot();
- return &document;
+ if (!styleElement.scoped()) {
+ if (styleElement.isInShadowTree())
+ return styleElement.containingShadowRoot();
+ return &document;
+ }
+
+ ContainerNode* parent = styleElement.parentNode();
+ if (!parent)
+ return 0;
+
+ return (parent->isElementNode() || parent->isShadowRoot()) ? parent : 0;
}
void ScopedStyleResolver::addRulesFromSheet(CSSStyleSheet* cssSheet, const MediaQueryEvaluator& medium, StyleResolver* resolver)
« no previous file with comments | « Source/core/css/invalidation/StyleSheetInvalidationAnalysis.cpp ('k') | Source/core/css/resolver/ScopedStyleTree.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698