| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 = sh
adow->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 } |
| 89 | 89 |
| 90 void TreeScopeAdopter::moveTreeToNewDocument(Node& root, Document& oldDocument,
Document& newDocument) const | 90 void TreeScopeAdopter::moveTreeToNewDocument(Node& root, Document& oldDocument,
Document& newDocument) const |
| 91 { | 91 { |
| 92 ASSERT(oldDocument != newDocument); | 92 ASSERT(oldDocument != newDocument); |
| 93 for (Node& node : NodeTraversal::inclusiveDescendantsOf(root)) { | 93 for (Node& node : NodeTraversal::inclusiveDescendantsOf(root)) { |
| 94 moveNodeToNewDocument(node, oldDocument, newDocument); | 94 moveNodeToNewDocument(node, oldDocument, newDocument); |
| 95 | 95 |
| 96 if (node.hasSyntheticAttrChildNodes()) { | 96 if (node.hasSyntheticAttrChildNodes()) { |
| 97 WillBeHeapVector<RefPtrWillBeMember<Attr> >& attrs = *toElement(node
).attrNodeList(); | 97 WillBeHeapVector<RefPtrWillBeMember<Attr>>& attrs = *toElement(node)
.attrNodeList(); |
| 98 for (unsigned i = 0; i < attrs.size(); ++i) | 98 for (unsigned i = 0; i < attrs.size(); ++i) |
| 99 moveTreeToNewDocument(*attrs[i], oldDocument, newDocument); | 99 moveTreeToNewDocument(*attrs[i], oldDocument, newDocument); |
| 100 } | 100 } |
| 101 | 101 |
| 102 for (ShadowRoot* shadow = node.youngestShadowRoot(); shadow; shadow = sh
adow->olderShadowRoot()) | 102 for (ShadowRoot* shadow = node.youngestShadowRoot(); shadow; shadow = sh
adow->olderShadowRoot()) |
| 103 moveTreeToNewDocument(*shadow, oldDocument, newDocument); | 103 moveTreeToNewDocument(*shadow, oldDocument, newDocument); |
| 104 } | 104 } |
| 105 } | 105 } |
| 106 | 106 |
| 107 #if ENABLE(ASSERT) | 107 #if ENABLE(ASSERT) |
| (...skipping 37 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 |