| Index: Source/core/dom/TreeScopeAdopter.cpp
|
| diff --git a/Source/core/dom/TreeScopeAdopter.cpp b/Source/core/dom/TreeScopeAdopter.cpp
|
| index 366b4af3fa15f793b06ee6ab9733cfd114fc46f2..d3832629729a537c7eab041b0b7f34d8fb9c74f9 100644
|
| --- a/Source/core/dom/TreeScopeAdopter.cpp
|
| +++ b/Source/core/dom/TreeScopeAdopter.cpp
|
| @@ -44,18 +44,17 @@ void TreeScopeAdopter::moveTreeToNewScope(Node& root) const
|
| // that element may contain stale data as changes made to it will have updated the DOMTreeVersion
|
| // of the document it was moved to. By increasing the DOMTreeVersion of the donating document here
|
| // we ensure that the collection cache will be invalidated as needed when the element is moved back.
|
| - Document* oldDocument = m_oldScope.documentScope();
|
| - ASSERT(oldDocument);
|
| - Document* newDocument = m_newScope.documentScope();
|
| + Document& oldDocument = m_oldScope.documentScope();
|
| + Document& newDocument = m_newScope.documentScope();
|
| bool willMoveToNewDocument = oldDocument != newDocument;
|
| if (willMoveToNewDocument)
|
| - oldDocument->incDOMTreeVersion();
|
| + oldDocument.incDOMTreeVersion();
|
|
|
| for (Node* node = &root; node; node = NodeTraversal::next(*node, &root)) {
|
| updateTreeScope(*node);
|
|
|
| if (willMoveToNewDocument)
|
| - moveNodeToNewDocument(*node, *oldDocument, newDocument);
|
| + moveNodeToNewDocument(*node, oldDocument, newDocument);
|
| else if (node->hasRareData()) {
|
| NodeRareData* rareData = node->rareData();
|
| if (rareData->nodeLists())
|
| @@ -74,14 +73,14 @@ void TreeScopeAdopter::moveTreeToNewScope(Node& root) const
|
| for (ShadowRoot* shadow = node->youngestShadowRoot(); shadow; shadow = shadow->olderShadowRoot()) {
|
| shadow->setParentTreeScope(&m_newScope);
|
| if (willMoveToNewDocument)
|
| - moveTreeToNewDocument(*shadow, *oldDocument, newDocument);
|
| + moveTreeToNewDocument(*shadow, oldDocument, newDocument);
|
| }
|
| }
|
|
|
| m_oldScope.guardDeref();
|
| }
|
|
|
| -void TreeScopeAdopter::moveTreeToNewDocument(Node& root, Document& oldDocument, Document* newDocument) const
|
| +void TreeScopeAdopter::moveTreeToNewDocument(Node& root, Document& oldDocument, Document& newDocument) const
|
| {
|
| for (Node* node = &root; node; node = NodeTraversal::next(*node, &root)) {
|
| moveNodeToNewDocument(*node, oldDocument, newDocument);
|
| @@ -111,17 +110,17 @@ inline void TreeScopeAdopter::updateTreeScope(Node& node) const
|
| node.setTreeScope(&m_newScope);
|
| }
|
|
|
| -inline void TreeScopeAdopter::moveNodeToNewDocument(Node& node, Document& oldDocument, Document* newDocument) const
|
| +inline void TreeScopeAdopter::moveNodeToNewDocument(Node& node, Document& oldDocument, Document& newDocument) const
|
| {
|
| ASSERT(!node.inDocument() || oldDocument != newDocument);
|
|
|
| if (node.hasRareData()) {
|
| NodeRareData* rareData = node.rareData();
|
| if (rareData->nodeLists())
|
| - rareData->nodeLists()->adoptDocument(&oldDocument, newDocument);
|
| + rareData->nodeLists()->adoptDocument(oldDocument, newDocument);
|
| }
|
|
|
| - oldDocument.moveNodeIteratorsToNewDocument(&node, newDocument);
|
| + oldDocument.moveNodeIteratorsToNewDocument(node, newDocument);
|
|
|
| if (node.isShadowRoot())
|
| toShadowRoot(node).setDocumentScope(newDocument);
|
|
|