Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All |
| 6 * rights reserved. | 6 * rights reserved. |
| 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. |
| 9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
| 10 * Copyright (C) 2011 Google Inc. All rights reserved. | 10 * Copyright (C) 2011 Google Inc. All rights reserved. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 45 // increasing the DOMTreeVersion of the donating document here we ensure that | 45 // increasing the DOMTreeVersion of the donating document here we ensure that |
| 46 // the collection cache will be invalidated as needed when the element is | 46 // the collection cache will be invalidated as needed when the element is |
| 47 // moved back. | 47 // moved back. |
| 48 Document& oldDocument = oldScope().document(); | 48 Document& oldDocument = oldScope().document(); |
| 49 Document& newDocument = newScope().document(); | 49 Document& newDocument = newScope().document(); |
| 50 bool willMoveToNewDocument = oldDocument != newDocument; | 50 bool willMoveToNewDocument = oldDocument != newDocument; |
| 51 if (willMoveToNewDocument) | 51 if (willMoveToNewDocument) |
| 52 oldDocument.incDOMTreeVersion(); | 52 oldDocument.incDOMTreeVersion(); |
| 53 | 53 |
| 54 for (Node& node : NodeTraversal::inclusiveDescendantsOf(root)) { | 54 for (Node& node : NodeTraversal::inclusiveDescendantsOf(root)) { |
| 55 // Before node.document() changes, allow the node to do pre-move changes. | |
|
bokan
2017/01/12 16:54:48
Please add a comment in TreeScopeAdopter::moveNode
wjmaclean
2017/01/13 17:40:30
Done.
| |
| 56 if (willMoveToNewDocument) | |
| 57 node.willMoveToNewDocument(); | |
| 58 | |
| 55 updateTreeScope(node); | 59 updateTreeScope(node); |
| 56 | 60 |
| 57 if (willMoveToNewDocument) { | 61 if (willMoveToNewDocument) { |
| 58 moveNodeToNewDocument(node, oldDocument, newDocument); | 62 moveNodeToNewDocument(node, oldDocument, newDocument); |
| 59 } else if (node.hasRareData()) { | 63 } else if (node.hasRareData()) { |
| 60 NodeRareData* rareData = node.rareData(); | 64 NodeRareData* rareData = node.rareData(); |
| 61 if (rareData->nodeLists()) | 65 if (rareData->nodeLists()) |
| 62 rareData->nodeLists()->adoptTreeScope(); | 66 rareData->nodeLists()->adoptTreeScope(); |
| 63 } | 67 } |
| 64 | 68 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 150 oldDocumentDidMoveToNewDocumentWasCalledWith = &oldDocument; | 154 oldDocumentDidMoveToNewDocumentWasCalledWith = &oldDocument; |
| 151 #endif | 155 #endif |
| 152 | 156 |
| 153 node.didMoveToNewDocument(oldDocument); | 157 node.didMoveToNewDocument(oldDocument); |
| 154 #if DCHECK_IS_ON() | 158 #if DCHECK_IS_ON() |
| 155 DCHECK(didMoveToNewDocumentWasCalled); | 159 DCHECK(didMoveToNewDocumentWasCalled); |
| 156 #endif | 160 #endif |
| 157 } | 161 } |
| 158 | 162 |
| 159 } // namespace blink | 163 } // namespace blink |
| OLD | NEW |