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 // that element may contain stale data as changes made to it will have updat
ed the DOMTreeVersion | 46 // that element may contain stale data as changes made to it will have updat
ed the DOMTreeVersion |
47 // of the document it was moved to. By increasing the DOMTreeVersion of the
donating document here | 47 // of the document it was moved to. By increasing the DOMTreeVersion of the
donating document here |
48 // we ensure that the collection cache will be invalidated as needed when th
e element is moved back. | 48 // we ensure that the collection cache will be invalidated as needed when th
e element is moved back. |
49 Document& oldDocument = oldScope().document(); | 49 Document& oldDocument = oldScope().document(); |
50 Document& newDocument = newScope().document(); | 50 Document& newDocument = newScope().document(); |
51 bool willMoveToNewDocument = oldDocument != newDocument; | 51 bool willMoveToNewDocument = oldDocument != newDocument; |
52 AXObjectCache* axObjectCache = oldDocument.existingAXObjectCache(); | 52 AXObjectCache* axObjectCache = oldDocument.existingAXObjectCache(); |
53 if (willMoveToNewDocument) | 53 if (willMoveToNewDocument) |
54 oldDocument.incDOMTreeVersion(); | 54 oldDocument.incDOMTreeVersion(); |
55 | 55 |
56 for (Node* node = &root; node; node = NodeTraversal::next(*node, &root)) { | 56 for (Node& node : NodeTraversal::inclusiveDescendantsOf(root)) { |
57 updateTreeScope(*node); | 57 updateTreeScope(node); |
58 | 58 |
59 if (willMoveToNewDocument) { | 59 if (willMoveToNewDocument) { |
60 if (axObjectCache) | 60 if (axObjectCache) |
61 axObjectCache->remove(node); | 61 axObjectCache->remove(&node); |
62 moveNodeToNewDocument(*node, oldDocument, newDocument); | 62 moveNodeToNewDocument(node, oldDocument, newDocument); |
63 } else if (node->hasRareData()) { | 63 } else if (node.hasRareData()) { |
64 NodeRareData* rareData = node->rareData(); | 64 NodeRareData* rareData = node.rareData(); |
65 if (rareData->nodeLists()) | 65 if (rareData->nodeLists()) |
66 rareData->nodeLists()->adoptTreeScope(); | 66 rareData->nodeLists()->adoptTreeScope(); |
67 } | 67 } |
68 | 68 |
69 if (!node->isElementNode()) | 69 if (!node.isElementNode()) |
70 continue; | 70 continue; |
71 | 71 |
72 if (node->hasSyntheticAttrChildNodes()) { | 72 if (node.hasSyntheticAttrChildNodes()) { |
73 WillBeHeapVector<RefPtrWillBeMember<Attr> >& attrs = *toElement(node
)->attrNodeList(); | 73 WillBeHeapVector<RefPtrWillBeMember<Attr> >& attrs = *toElement(node
).attrNodeList(); |
74 for (unsigned i = 0; i < attrs.size(); ++i) | 74 for (unsigned i = 0; i < attrs.size(); ++i) |
75 moveTreeToNewScope(*attrs[i]); | 75 moveTreeToNewScope(*attrs[i]); |
76 } | 76 } |
77 | 77 |
78 for (ShadowRoot* shadow = node->youngestShadowRoot(); shadow; shadow = s
hadow->olderShadowRoot()) { | 78 for (ShadowRoot* shadow = node.youngestShadowRoot(); shadow; shadow = sh
adow->olderShadowRoot()) { |
79 shadow->setParentTreeScope(newScope()); | 79 shadow->setParentTreeScope(newScope()); |
80 if (willMoveToNewDocument) | 80 if (willMoveToNewDocument) |
81 moveTreeToNewDocument(*shadow, oldDocument, newDocument); | 81 moveTreeToNewDocument(*shadow, oldDocument, newDocument); |
82 } | 82 } |
83 } | 83 } |
84 | 84 |
85 #if !ENABLE(OILPAN) | 85 #if !ENABLE(OILPAN) |
86 oldScope().guardDeref(); | 86 oldScope().guardDeref(); |
87 #endif | 87 #endif |
88 } | 88 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 #if ENABLE(ASSERT) | 145 #if ENABLE(ASSERT) |
146 didMoveToNewDocumentWasCalled = false; | 146 didMoveToNewDocumentWasCalled = false; |
147 oldDocumentDidMoveToNewDocumentWasCalledWith = &oldDocument; | 147 oldDocumentDidMoveToNewDocumentWasCalledWith = &oldDocument; |
148 #endif | 148 #endif |
149 | 149 |
150 node.didMoveToNewDocument(oldDocument); | 150 node.didMoveToNewDocument(oldDocument); |
151 ASSERT(didMoveToNewDocumentWasCalled); | 151 ASSERT(didMoveToNewDocumentWasCalled); |
152 } | 152 } |
153 | 153 |
154 } | 154 } |
OLD | NEW |