| 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 11 matching lines...) Expand all Loading... |
| 22 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 22 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 23 * Boston, MA 02110-1301, USA. | 23 * Boston, MA 02110-1301, USA. |
| 24 */ | 24 */ |
| 25 #include "config.h" | 25 #include "config.h" |
| 26 #include "core/dom/TreeScopeAdopter.h" | 26 #include "core/dom/TreeScopeAdopter.h" |
| 27 | 27 |
| 28 #include "core/accessibility/AXObjectCache.h" | 28 #include "core/accessibility/AXObjectCache.h" |
| 29 #include "core/dom/Attr.h" | 29 #include "core/dom/Attr.h" |
| 30 #include "core/dom/NodeRareData.h" | 30 #include "core/dom/NodeRareData.h" |
| 31 #include "core/dom/NodeTraversal.h" | 31 #include "core/dom/NodeTraversal.h" |
| 32 #include "core/dom/StyleEngine.h" |
| 32 #include "core/dom/shadow/ElementShadow.h" | 33 #include "core/dom/shadow/ElementShadow.h" |
| 33 #include "core/dom/shadow/ShadowRoot.h" | 34 #include "core/dom/shadow/ShadowRoot.h" |
| 34 | 35 |
| 35 namespace blink { | 36 namespace blink { |
| 36 | 37 |
| 37 void TreeScopeAdopter::moveTreeToNewScope(Node& root) const | 38 void TreeScopeAdopter::moveTreeToNewScope(Node& root) const |
| 38 { | 39 { |
| 39 ASSERT(needsScopeChange()); | 40 ASSERT(needsScopeChange()); |
| 40 | 41 |
| 41 #if !ENABLE(OILPAN) | 42 #if !ENABLE(OILPAN) |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 inline void TreeScopeAdopter::moveNodeToNewDocument(Node& node, Document& oldDoc
ument, Document& newDocument) const | 131 inline void TreeScopeAdopter::moveNodeToNewDocument(Node& node, Document& oldDoc
ument, Document& newDocument) const |
| 131 { | 132 { |
| 132 ASSERT(oldDocument != newDocument); | 133 ASSERT(oldDocument != newDocument); |
| 133 | 134 |
| 134 if (node.hasRareData()) { | 135 if (node.hasRareData()) { |
| 135 NodeRareData* rareData = node.rareData(); | 136 NodeRareData* rareData = node.rareData(); |
| 136 if (rareData->nodeLists()) | 137 if (rareData->nodeLists()) |
| 137 rareData->nodeLists()->adoptDocument(oldDocument, newDocument); | 138 rareData->nodeLists()->adoptDocument(oldDocument, newDocument); |
| 138 } | 139 } |
| 139 | 140 |
| 141 ScopedStyleResolver* resolver = nullptr; |
| 142 if (node.isShadowRoot()) { |
| 143 resolver = node.treeScope().scopedStyleResolver(); |
| 144 // StyledScopeResolver may be null because it is lazily created. |
| 145 if (resolver) |
| 146 oldDocument.styleEngine()->removeScopedStyleResolver(resolver); |
| 147 } |
| 148 |
| 140 oldDocument.moveNodeIteratorsToNewDocument(node, newDocument); | 149 oldDocument.moveNodeIteratorsToNewDocument(node, newDocument); |
| 141 | 150 |
| 142 if (node.isShadowRoot()) | 151 if (node.isShadowRoot()) { |
| 143 toShadowRoot(node).setDocument(newDocument); | 152 toShadowRoot(node).setDocument(newDocument); |
| 153 if (resolver) |
| 154 newDocument.styleEngine()->addScopedStyleResolver(resolver); |
| 155 } |
| 144 | 156 |
| 145 #if ENABLE(ASSERT) | 157 #if ENABLE(ASSERT) |
| 146 didMoveToNewDocumentWasCalled = false; | 158 didMoveToNewDocumentWasCalled = false; |
| 147 oldDocumentDidMoveToNewDocumentWasCalledWith = &oldDocument; | 159 oldDocumentDidMoveToNewDocumentWasCalledWith = &oldDocument; |
| 148 #endif | 160 #endif |
| 149 | 161 |
| 150 node.didMoveToNewDocument(oldDocument); | 162 node.didMoveToNewDocument(oldDocument); |
| 151 ASSERT(didMoveToNewDocumentWasCalled); | 163 ASSERT(didMoveToNewDocumentWasCalled); |
| 152 } | 164 } |
| 153 | 165 |
| 154 } | 166 } |
| OLD | NEW |