| 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) 2012 Google Inc. All rights reserved. | 8 * Copyright (C) 2012 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 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 #include "Element.h" | 29 #include "Element.h" |
| 30 #include "ElementShadow.h" | 30 #include "ElementShadow.h" |
| 31 #include "HTMLFrameOwnerElement.h" | 31 #include "HTMLFrameOwnerElement.h" |
| 32 | 32 |
| 33 namespace WebCore { | 33 namespace WebCore { |
| 34 | 34 |
| 35 void ChildNodeInsertionNotifier::notifyDescendantInsertedIntoDocument(ContainerN
ode* node) | 35 void ChildNodeInsertionNotifier::notifyDescendantInsertedIntoDocument(ContainerN
ode* node) |
| 36 { | 36 { |
| 37 ChildNodesLazySnapshot snapshot(node); | 37 ChildNodesLazySnapshot snapshot(node); |
| 38 while (Node* child = snapshot.nextNode()) { | 38 while (RefPtr<Node> child = snapshot.nextNode()) { |
| 39 // If we have been removed from the document during this loop, then | 39 // If we have been removed from the document during this loop, then |
| 40 // we don't want to tell the rest of our children that they've been | 40 // we don't want to tell the rest of our children that they've been |
| 41 // inserted into the document because they haven't. | 41 // inserted into the document because they haven't. |
| 42 if (node->inDocument() && child->parentNode() == node) | 42 if (node->inDocument() && child->parentNode() == node) |
| 43 notifyNodeInsertedIntoDocument(child); | 43 notifyNodeInsertedIntoDocument(child.get()); |
| 44 } | 44 } |
| 45 | 45 |
| 46 if (!node->isElementNode()) | 46 if (!node->isElementNode()) |
| 47 return; | 47 return; |
| 48 | 48 |
| 49 if (ElementShadow* shadow = toElement(node)->shadow()) { | 49 if (ElementShadow* shadow = toElement(node)->shadow()) { |
| 50 ShadowRootVector roots(shadow); | 50 ShadowRootVector roots(shadow); |
| 51 for (size_t i = 0; i < roots.size(); ++i) { | 51 for (size_t i = 0; i < roots.size(); ++i) { |
| 52 if (node->inDocument() && roots[i]->host() == node) | 52 if (node->inDocument() && roots[i]->host() == node) |
| 53 notifyNodeInsertedIntoDocument(roots[i].get()); | 53 notifyNodeInsertedIntoDocument(roots[i].get()); |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 | 57 |
| 58 void ChildNodeInsertionNotifier::notifyDescendantInsertedIntoTree(ContainerNode*
node) | 58 void ChildNodeInsertionNotifier::notifyDescendantInsertedIntoTree(ContainerNode*
node) |
| 59 { | 59 { |
| 60 for (Node* child = node->firstChild(); child; child = child->nextSibling())
{ | 60 for (Node* child = node->firstChild(); child; child = child->nextSibling())
{ |
| 61 if (child->isContainerNode()) | 61 if (child->isContainerNode()) |
| 62 notifyNodeInsertedIntoTree(toContainerNode(child)); | 62 notifyNodeInsertedIntoTree(toContainerNode(child)); |
| 63 } | 63 } |
| 64 | 64 |
| 65 for (ShadowRoot* root = node->youngestShadowRoot(); root; root = root->older
ShadowRoot()) | 65 for (ShadowRoot* root = node->youngestShadowRoot(); root; root = root->older
ShadowRoot()) |
| 66 notifyNodeInsertedIntoTree(root); | 66 notifyNodeInsertedIntoTree(root); |
| 67 } | 67 } |
| 68 | 68 |
| 69 void ChildNodeRemovalNotifier::notifyDescendantRemovedFromDocument(ContainerNode
* node) | 69 void ChildNodeRemovalNotifier::notifyDescendantRemovedFromDocument(ContainerNode
* node) |
| 70 { | 70 { |
| 71 ChildNodesLazySnapshot snapshot(node); | 71 ChildNodesLazySnapshot snapshot(node); |
| 72 while (Node* child = snapshot.nextNode()) { | 72 while (RefPtr<Node> child = snapshot.nextNode()) { |
| 73 // If we have been added to the document during this loop, then we | 73 // If we have been added to the document during this loop, then we |
| 74 // don't want to tell the rest of our children that they've been | 74 // don't want to tell the rest of our children that they've been |
| 75 // removed from the document because they haven't. | 75 // removed from the document because they haven't. |
| 76 if (!node->inDocument() && child->parentNode() == node) | 76 if (!node->inDocument() && child->parentNode() == node) |
| 77 notifyNodeRemovedFromDocument(child); | 77 notifyNodeRemovedFromDocument(child.get()); |
| 78 } | 78 } |
| 79 | 79 |
| 80 if (!node->isElementNode()) | 80 if (!node->isElementNode()) |
| 81 return; | 81 return; |
| 82 | 82 |
| 83 if (node->document()->cssTarget() == node) | 83 if (node->document()->cssTarget() == node) |
| 84 node->document()->setCSSTarget(0); | 84 node->document()->setCSSTarget(0); |
| 85 | 85 |
| 86 if (ElementShadow* shadow = toElement(node)->shadow()) { | 86 if (ElementShadow* shadow = toElement(node)->shadow()) { |
| 87 ShadowRootVector roots(shadow); | 87 ShadowRootVector roots(shadow); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 115 collectDescendant(root, IncludeRoot); | 115 collectDescendant(root, IncludeRoot); |
| 116 } | 116 } |
| 117 | 117 |
| 118 void ChildFrameDisconnector::Target::disconnect() | 118 void ChildFrameDisconnector::Target::disconnect() |
| 119 { | 119 { |
| 120 ASSERT(isValid()); | 120 ASSERT(isValid()); |
| 121 toFrameOwnerElement(m_owner.get())->disconnectContentFrame(); | 121 toFrameOwnerElement(m_owner.get())->disconnectContentFrame(); |
| 122 } | 122 } |
| 123 | 123 |
| 124 } | 124 } |
| OLD | NEW |