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

Unified Diff: Source/core/dom/TreeScopeAdopter.cpp

Issue 718293002: Tentative: fix (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add missing resourse pending case in ProcessingInstruction::removedFrom() Created 6 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
« no previous file with comments | « Source/core/dom/ProcessingInstruction.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/TreeScopeAdopter.cpp
diff --git a/Source/core/dom/TreeScopeAdopter.cpp b/Source/core/dom/TreeScopeAdopter.cpp
index 79e17059048c5dbf33198255da7da9b516917ef7..dfef0255cbf1021499d867b452ba3bdaae2c8617 100644
--- a/Source/core/dom/TreeScopeAdopter.cpp
+++ b/Source/core/dom/TreeScopeAdopter.cpp
@@ -29,6 +29,7 @@
#include "core/dom/Attr.h"
#include "core/dom/NodeRareData.h"
#include "core/dom/NodeTraversal.h"
+#include "core/dom/StyleEngine.h"
#include "core/dom/shadow/ElementShadow.h"
#include "core/dom/shadow/ShadowRoot.h"
@@ -137,10 +138,21 @@ inline void TreeScopeAdopter::moveNodeToNewDocument(Node& node, Document& oldDoc
rareData->nodeLists()->adoptDocument(oldDocument, newDocument);
}
+ ScopedStyleResolver* resolver = nullptr;
+ if (node.isShadowRoot()) {
+ resolver = node.treeScope().scopedStyleResolver();
+ // StyledScopeResolver may be null because it is lazily created.
+ if (resolver)
+ oldDocument.styleEngine()->removeScopedStyleResolver(resolver);
+ }
+
oldDocument.moveNodeIteratorsToNewDocument(node, newDocument);
- if (node.isShadowRoot())
+ if (node.isShadowRoot()) {
toShadowRoot(node).setDocument(newDocument);
+ if (resolver)
+ newDocument.styleEngine()->addScopedStyleResolver(resolver);
+ }
#if ENABLE(ASSERT)
didMoveToNewDocumentWasCalled = false;
« no previous file with comments | « Source/core/dom/ProcessingInstruction.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698