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 r
ights reserved. |
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 6 * 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/) | 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
8 * Copyright (C) 2011 Google Inc. All rights reserved. | 8 * Copyright (C) 2011 Google Inc. All rights reserved. |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 // of the document it was moved to. By increasing the DOMTreeVersion of the
donating document here | 46 // of the document it was moved to. By increasing the DOMTreeVersion of the
donating document here |
47 // we ensure that the collection cache will be invalidated as needed when th
e element is moved back. | 47 // we ensure that the collection cache will be invalidated as needed when th
e element is moved back. |
48 Document* oldDocument = m_oldScope ? m_oldScope->rootNode()->document() : 0; | 48 Document* oldDocument = m_oldScope ? m_oldScope->rootNode()->document() : 0; |
49 Document* newDocument = m_newScope->rootNode()->document(); | 49 Document* newDocument = m_newScope->rootNode()->document(); |
50 bool willMoveToNewDocument = oldDocument != newDocument; | 50 bool willMoveToNewDocument = oldDocument != newDocument; |
51 if (oldDocument && willMoveToNewDocument) | 51 if (oldDocument && willMoveToNewDocument) |
52 oldDocument->incDOMTreeVersion(); | 52 oldDocument->incDOMTreeVersion(); |
53 | 53 |
54 for (Node* node = root; node; node = node->traverseNextNode(root)) { | 54 for (Node* node = root; node; node = node->traverseNextNode(root)) { |
55 NodeRareData* rareData = node->setTreeScope(newDocument == m_newScope ?
0 : m_newScope); | 55 NodeRareData* rareData = node->setTreeScope(newDocument == m_newScope ?
0 : m_newScope); |
56 if (rareData && rareData->nodeLists()) { | 56 if (rareData && rareData->nodeLists()) |
57 rareData->nodeLists()->invalidateCaches(); | 57 rareData->nodeLists()->adoptTreeScope(m_oldScope, m_newScope, oldDoc
ument, newDocument); |
58 if (m_oldScope) | |
59 m_oldScope->removeNodeListCache(); | |
60 m_newScope->addNodeListCache(); | |
61 } | |
62 | 58 |
63 if (willMoveToNewDocument) | 59 if (willMoveToNewDocument) |
64 moveNodeToNewDocument(node, oldDocument, newDocument); | 60 moveNodeToNewDocument(node, oldDocument, newDocument); |
65 | 61 |
66 for (ShadowRoot* shadow = node->youngestShadowRoot(); shadow; shadow = s
hadow->olderShadowRoot()) { | 62 for (ShadowRoot* shadow = node->youngestShadowRoot(); shadow; shadow = s
hadow->olderShadowRoot()) { |
67 shadow->setParentTreeScope(m_newScope); | 63 shadow->setParentTreeScope(m_newScope); |
68 if (willMoveToNewDocument) | 64 if (willMoveToNewDocument) |
69 moveTreeToNewDocument(shadow, oldDocument, newDocument); | 65 moveTreeToNewDocument(shadow, oldDocument, newDocument); |
70 } | 66 } |
71 } | 67 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 #endif | 104 #endif |
109 | 105 |
110 node->didMoveToNewDocument(oldDocument); | 106 node->didMoveToNewDocument(oldDocument); |
111 ASSERT(didMoveToNewDocumentWasCalled); | 107 ASSERT(didMoveToNewDocumentWasCalled); |
112 | 108 |
113 if (oldDocument) | 109 if (oldDocument) |
114 oldDocument->guardDeref(); | 110 oldDocument->guardDeref(); |
115 } | 111 } |
116 | 112 |
117 } | 113 } |
OLD | NEW |