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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 void TreeScopeAdopter::moveTreeToNewDocument(Node& root, Document& oldDocument,
Document& newDocument) const | 86 void TreeScopeAdopter::moveTreeToNewDocument(Node& root, Document& oldDocument,
Document& newDocument) const |
87 { | 87 { |
88 ASSERT(oldDocument != newDocument); | 88 ASSERT(oldDocument != newDocument); |
89 for (Node* node = &root; node; node = NodeTraversal::next(*node, &root)) { | 89 for (Node* node = &root; node; node = NodeTraversal::next(*node, &root)) { |
90 moveNodeToNewDocument(*node, oldDocument, newDocument); | 90 moveNodeToNewDocument(*node, oldDocument, newDocument); |
91 for (ShadowRoot* shadow = node->youngestShadowRoot(); shadow; shadow = s
hadow->olderShadowRoot()) | 91 for (ShadowRoot* shadow = node->youngestShadowRoot(); shadow; shadow = s
hadow->olderShadowRoot()) |
92 moveTreeToNewDocument(*shadow, oldDocument, newDocument); | 92 moveTreeToNewDocument(*shadow, oldDocument, newDocument); |
93 } | 93 } |
94 } | 94 } |
95 | 95 |
96 #ifndef NDEBUG | 96 #if ENABLE(ASSERT) |
97 static bool didMoveToNewDocumentWasCalled = false; | 97 static bool didMoveToNewDocumentWasCalled = false; |
98 static Document* oldDocumentDidMoveToNewDocumentWasCalledWith = 0; | 98 static Document* oldDocumentDidMoveToNewDocumentWasCalledWith = 0; |
99 | 99 |
100 void TreeScopeAdopter::ensureDidMoveToNewDocumentWasCalled(Document& oldDocument
) | 100 void TreeScopeAdopter::ensureDidMoveToNewDocumentWasCalled(Document& oldDocument
) |
101 { | 101 { |
102 ASSERT(!didMoveToNewDocumentWasCalled); | 102 ASSERT(!didMoveToNewDocumentWasCalled); |
103 ASSERT_UNUSED(oldDocument, oldDocument == oldDocumentDidMoveToNewDocumentWas
CalledWith); | 103 ASSERT_UNUSED(oldDocument, oldDocument == oldDocumentDidMoveToNewDocumentWas
CalledWith); |
104 didMoveToNewDocumentWasCalled = true; | 104 didMoveToNewDocumentWasCalled = true; |
105 } | 105 } |
106 #endif | 106 #endif |
(...skipping 17 matching lines...) Expand all Loading... |
124 NodeRareData* rareData = node.rareData(); | 124 NodeRareData* rareData = node.rareData(); |
125 if (rareData->nodeLists()) | 125 if (rareData->nodeLists()) |
126 rareData->nodeLists()->adoptDocument(oldDocument, newDocument); | 126 rareData->nodeLists()->adoptDocument(oldDocument, newDocument); |
127 } | 127 } |
128 | 128 |
129 oldDocument.moveNodeIteratorsToNewDocument(node, newDocument); | 129 oldDocument.moveNodeIteratorsToNewDocument(node, newDocument); |
130 | 130 |
131 if (node.isShadowRoot()) | 131 if (node.isShadowRoot()) |
132 toShadowRoot(node).setDocument(newDocument); | 132 toShadowRoot(node).setDocument(newDocument); |
133 | 133 |
134 #ifndef NDEBUG | 134 #if ENABLE(ASSERT) |
135 didMoveToNewDocumentWasCalled = false; | 135 didMoveToNewDocumentWasCalled = false; |
136 oldDocumentDidMoveToNewDocumentWasCalledWith = &oldDocument; | 136 oldDocumentDidMoveToNewDocumentWasCalledWith = &oldDocument; |
137 #endif | 137 #endif |
138 | 138 |
139 node.didMoveToNewDocument(oldDocument); | 139 node.didMoveToNewDocument(oldDocument); |
140 ASSERT(didMoveToNewDocumentWasCalled); | 140 ASSERT(didMoveToNewDocumentWasCalled); |
141 } | 141 } |
142 | 142 |
143 } | 143 } |
OLD | NEW |