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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 ASSERT_UNUSED(oldDocument, oldDocument == oldDocumentDidMoveToNewDocumentWas
CalledWith); | 89 ASSERT_UNUSED(oldDocument, oldDocument == oldDocumentDidMoveToNewDocumentWas
CalledWith); |
90 didMoveToNewDocumentWasCalled = true; | 90 didMoveToNewDocumentWasCalled = true; |
91 } | 91 } |
92 #endif | 92 #endif |
93 | 93 |
94 inline void TreeScopeAdopter::moveNodeToNewDocument(Node* node, Document* oldDoc
ument, Document* newDocument) const | 94 inline void TreeScopeAdopter::moveNodeToNewDocument(Node* node, Document* oldDoc
ument, Document* newDocument) const |
95 { | 95 { |
96 ASSERT(!node->inDocument() || oldDocument != newDocument); | 96 ASSERT(!node->inDocument() || oldDocument != newDocument); |
97 | 97 |
98 newDocument->guardRef(); | 98 newDocument->guardRef(); |
99 if (oldDocument) { | 99 if (oldDocument) |
100 oldDocument->moveNodeIteratorsToNewDocument(node, newDocument); | 100 oldDocument->moveNodeIteratorsToNewDocument(node, newDocument); |
101 oldDocument->guardDeref(); | |
102 } | |
103 | 101 |
104 node->setDocument(newDocument); | 102 node->setDocument(newDocument); |
105 | 103 |
106 #ifndef NDEBUG | 104 #ifndef NDEBUG |
107 didMoveToNewDocumentWasCalled = false; | 105 didMoveToNewDocumentWasCalled = false; |
108 oldDocumentDidMoveToNewDocumentWasCalledWith = oldDocument; | 106 oldDocumentDidMoveToNewDocumentWasCalledWith = oldDocument; |
109 #endif | 107 #endif |
110 | 108 |
111 node->didMoveToNewDocument(oldDocument); | 109 node->didMoveToNewDocument(oldDocument); |
112 ASSERT(didMoveToNewDocumentWasCalled); | 110 ASSERT(didMoveToNewDocumentWasCalled); |
| 111 |
| 112 if (oldDocument) |
| 113 oldDocument->guardDeref(); |
113 } | 114 } |
114 | 115 |
115 } | 116 } |
OLD | NEW |