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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 for (Node* node = &root; node; node = NodeTraversal::next(*node, &root)) { | 48 for (Node* node = &root; node; node = NodeTraversal::next(*node, &root)) { |
49 updateTreeScope(*node); | 49 updateTreeScope(*node); |
50 | 50 |
51 if (willMoveToNewDocument) | 51 if (willMoveToNewDocument) |
52 moveNodeToNewDocument(*node, oldDocument, newDocument); | 52 moveNodeToNewDocument(*node, oldDocument, newDocument); |
53 | 53 |
54 if (!node->isElementNode()) | 54 if (!node->isElementNode()) |
55 continue; | 55 continue; |
56 | 56 |
57 if (node->hasSyntheticAttrChildNodes()) { | |
58 Vector<RefPtr<Attr> >& attrs = *toElement(node)->attrNodeList(); | |
59 for (unsigned i = 0; i < attrs.size(); ++i) | |
60 moveTreeToNewScope(*attrs[i]); | |
61 } | |
62 | |
63 for (ShadowRoot* shadow = node->youngestShadowRoot(); shadow; shadow = s
hadow->olderShadowRoot()) { | 57 for (ShadowRoot* shadow = node->youngestShadowRoot(); shadow; shadow = s
hadow->olderShadowRoot()) { |
64 shadow->setParentTreeScope(newScope()); | 58 shadow->setParentTreeScope(newScope()); |
65 if (willMoveToNewDocument) | 59 if (willMoveToNewDocument) |
66 moveTreeToNewDocument(*shadow, oldDocument, newDocument); | 60 moveTreeToNewDocument(*shadow, oldDocument, newDocument); |
67 } | 61 } |
68 } | 62 } |
69 | 63 |
70 #if !ENABLE(OILPAN) | 64 #if !ENABLE(OILPAN) |
71 oldScope().guardDeref(); | 65 oldScope().guardDeref(); |
72 #endif | 66 #endif |
73 } | 67 } |
74 | 68 |
75 void TreeScopeAdopter::moveTreeToNewDocument(Node& root, Document& oldDocument,
Document& newDocument) const | 69 void TreeScopeAdopter::moveTreeToNewDocument(Node& root, Document& oldDocument,
Document& newDocument) const |
76 { | 70 { |
77 ASSERT(oldDocument != newDocument); | 71 ASSERT(oldDocument != newDocument); |
78 for (Node* node = &root; node; node = NodeTraversal::next(*node, &root)) { | 72 for (Node* node = &root; node; node = NodeTraversal::next(*node, &root)) { |
79 moveNodeToNewDocument(*node, oldDocument, newDocument); | 73 moveNodeToNewDocument(*node, oldDocument, newDocument); |
80 | 74 |
81 if (node->hasSyntheticAttrChildNodes()) { | |
82 Vector<RefPtr<Attr> >& attrs = *toElement(node)->attrNodeList(); | |
83 for (unsigned i = 0; i < attrs.size(); ++i) | |
84 moveTreeToNewDocument(*attrs[i], oldDocument, newDocument); | |
85 } | |
86 | |
87 for (ShadowRoot* shadow = node->youngestShadowRoot(); shadow; shadow = s
hadow->olderShadowRoot()) | 75 for (ShadowRoot* shadow = node->youngestShadowRoot(); shadow; shadow = s
hadow->olderShadowRoot()) |
88 moveTreeToNewDocument(*shadow, oldDocument, newDocument); | 76 moveTreeToNewDocument(*shadow, oldDocument, newDocument); |
89 } | 77 } |
90 } | 78 } |
91 | 79 |
92 #if ENABLE(ASSERT) | 80 #if ENABLE(ASSERT) |
93 static bool didMoveToNewDocumentWasCalled = false; | 81 static bool didMoveToNewDocumentWasCalled = false; |
94 static Document* oldDocumentDidMoveToNewDocumentWasCalledWith = 0; | 82 static Document* oldDocumentDidMoveToNewDocumentWasCalledWith = 0; |
95 | 83 |
96 void TreeScopeAdopter::ensureDidMoveToNewDocumentWasCalled(Document& oldDocument
) | 84 void TreeScopeAdopter::ensureDidMoveToNewDocumentWasCalled(Document& oldDocument
) |
(...skipping 25 matching lines...) Expand all Loading... |
122 #if ENABLE(ASSERT) | 110 #if ENABLE(ASSERT) |
123 didMoveToNewDocumentWasCalled = false; | 111 didMoveToNewDocumentWasCalled = false; |
124 oldDocumentDidMoveToNewDocumentWasCalledWith = &oldDocument; | 112 oldDocumentDidMoveToNewDocumentWasCalledWith = &oldDocument; |
125 #endif | 113 #endif |
126 | 114 |
127 node.didMoveToNewDocument(oldDocument); | 115 node.didMoveToNewDocument(oldDocument); |
128 ASSERT(didMoveToNewDocumentWasCalled); | 116 ASSERT(didMoveToNewDocumentWasCalled); |
129 } | 117 } |
130 | 118 |
131 } | 119 } |
OLD | NEW |