| 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 r
ights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All |
| 6 * rights reserved. |
| 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. |
| 9 * (http://www.torchmobile.com/) |
| 8 * Copyright (C) 2011 Google Inc. All rights reserved. | 10 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 9 * | 11 * |
| 10 * This library is free software; you can redistribute it and/or | 12 * This library is free software; you can redistribute it and/or |
| 11 * modify it under the terms of the GNU Library General Public | 13 * modify it under the terms of the GNU Library General Public |
| 12 * License as published by the Free Software Foundation; either | 14 * License as published by the Free Software Foundation; either |
| 13 * version 2 of the License, or (at your option) any later version. | 15 * version 2 of the License, or (at your option) any later version. |
| 14 * | 16 * |
| 15 * This library is distributed in the hope that it will be useful, | 17 * This library is distributed in the hope that it will be useful, |
| 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| (...skipping 12 matching lines...) Expand all Loading... |
| 30 #include "core/dom/NodeTraversal.h" | 32 #include "core/dom/NodeTraversal.h" |
| 31 #include "core/dom/custom/CustomElement.h" | 33 #include "core/dom/custom/CustomElement.h" |
| 32 #include "core/dom/shadow/ElementShadow.h" | 34 #include "core/dom/shadow/ElementShadow.h" |
| 33 #include "core/dom/shadow/ShadowRoot.h" | 35 #include "core/dom/shadow/ShadowRoot.h" |
| 34 | 36 |
| 35 namespace blink { | 37 namespace blink { |
| 36 | 38 |
| 37 void TreeScopeAdopter::moveTreeToNewScope(Node& root) const { | 39 void TreeScopeAdopter::moveTreeToNewScope(Node& root) const { |
| 38 DCHECK(needsScopeChange()); | 40 DCHECK(needsScopeChange()); |
| 39 | 41 |
| 40 // If an element is moved from a document and then eventually back again the c
ollection cache for | 42 // If an element is moved from a document and then eventually back again the |
| 41 // that element may contain stale data as changes made to it will have updated
the DOMTreeVersion | 43 // collection cache for that element may contain stale data as changes made to |
| 42 // of the document it was moved to. By increasing the DOMTreeVersion of the do
nating document here | 44 // it will have updated the DOMTreeVersion of the document it was moved to. By |
| 43 // we ensure that the collection cache will be invalidated as needed when the
element is moved back. | 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 |
| 47 // moved back. |
| 44 Document& oldDocument = oldScope().document(); | 48 Document& oldDocument = oldScope().document(); |
| 45 Document& newDocument = newScope().document(); | 49 Document& newDocument = newScope().document(); |
| 46 bool willMoveToNewDocument = oldDocument != newDocument; | 50 bool willMoveToNewDocument = oldDocument != newDocument; |
| 47 if (willMoveToNewDocument) | 51 if (willMoveToNewDocument) |
| 48 oldDocument.incDOMTreeVersion(); | 52 oldDocument.incDOMTreeVersion(); |
| 49 | 53 |
| 50 for (Node& node : NodeTraversal::inclusiveDescendantsOf(root)) { | 54 for (Node& node : NodeTraversal::inclusiveDescendantsOf(root)) { |
| 51 updateTreeScope(node); | 55 updateTreeScope(node); |
| 52 | 56 |
| 53 if (willMoveToNewDocument) { | 57 if (willMoveToNewDocument) { |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 oldDocumentDidMoveToNewDocumentWasCalledWith = &oldDocument; | 151 oldDocumentDidMoveToNewDocumentWasCalledWith = &oldDocument; |
| 148 #endif | 152 #endif |
| 149 | 153 |
| 150 node.didMoveToNewDocument(oldDocument); | 154 node.didMoveToNewDocument(oldDocument); |
| 151 #if DCHECK_IS_ON() | 155 #if DCHECK_IS_ON() |
| 152 DCHECK(didMoveToNewDocumentWasCalled); | 156 DCHECK(didMoveToNewDocumentWasCalled); |
| 153 #endif | 157 #endif |
| 154 } | 158 } |
| 155 | 159 |
| 156 } // namespace blink | 160 } // namespace blink |
| OLD | NEW |