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

Unified Diff: third_party/WebKit/Source/core/dom/StyleEngine.cpp

Issue 2472973002: Link stylesheets in shadow trees do not belong to document scope. (Closed)
Patch Set: Rebased onto dependency Created 4 years, 1 month 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: third_party/WebKit/Source/core/dom/StyleEngine.cpp
diff --git a/third_party/WebKit/Source/core/dom/StyleEngine.cpp b/third_party/WebKit/Source/core/dom/StyleEngine.cpp
index 9b5866ef5b46146e2ab6d35aa5be07ace2b87db0..7827729e2ef52d73cf7887071eb572c51f5c937b 100644
--- a/third_party/WebKit/Source/core/dom/StyleEngine.cpp
+++ b/third_party/WebKit/Source/core/dom/StyleEngine.cpp
@@ -81,10 +81,6 @@ StyleEngine::StyleEngine(Document& document)
StyleEngine::~StyleEngine() {}
-static bool isStyleElement(Node& node) {
- return isHTMLStyleElement(node) || isSVGStyleElement(node);
-}
-
inline Document* StyleEngine::master() {
if (isMaster())
return m_document;
@@ -159,11 +155,8 @@ void StyleEngine::addPendingSheet(StyleEngineContext& context) {
// This method is called whenever a top-level stylesheet has finished loading.
void StyleEngine::removePendingSheet(Node& styleSheetCandidateNode,
const StyleEngineContext& context) {
- TreeScope* treeScope = isStyleElement(styleSheetCandidateNode)
- ? &styleSheetCandidateNode.treeScope()
- : m_document.get();
if (styleSheetCandidateNode.isConnected())
- markTreeScopeDirty(*treeScope);
+ markTreeScopeDirty(styleSheetCandidateNode.treeScope());
if (context.addedPendingSheetBeforeBody()) {
DCHECK_GT(m_pendingRenderBlockingStylesheets, 0);
@@ -193,12 +186,8 @@ void StyleEngine::setNeedsActiveStyleUpdate(
if (sheet && document().isActive()) {
Node* node = sheet->ownerNode();
- if (node && node->isConnected()) {
- TreeScope& treeScope =
- isStyleElement(*node) ? node->treeScope() : *m_document;
- DCHECK(isStyleElement(*node) || node->treeScope() == m_document);
- markTreeScopeDirty(treeScope);
- }
+ if (node && node->isConnected())
+ markTreeScopeDirty(node->treeScope());
}
resolverChanged(updateMode);
@@ -226,7 +215,6 @@ void StyleEngine::removeStyleSheetCandidateNode(Node& node) {
void StyleEngine::removeStyleSheetCandidateNode(Node& node,
TreeScope& treeScope) {
- DCHECK(isStyleElement(node) || treeScope == m_document);
DCHECK(!isXSLStyleSheet(node));
TreeScopeStyleSheetCollection* collection =
@@ -244,9 +232,7 @@ void StyleEngine::modifiedStyleSheetCandidateNode(Node& node) {
if (!node.isConnected())
return;
- TreeScope& treeScope = isStyleElement(node) ? node.treeScope() : *m_document;
- DCHECK(isStyleElement(node) || treeScope == m_document);
- markTreeScopeDirty(treeScope);
+ markTreeScopeDirty(node.treeScope());
resolverChanged(AnalyzedStyleUpdate);
}

Powered by Google App Engine
This is Rietveld 408576698