| 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 Apple Inc. All rights reserv
ed. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 dispatchChildRemovalEvents(child); | 414 dispatchChildRemovalEvents(child); |
| 415 child->document().nodeWillBeRemoved(child); // e.g. mutation event listener
can create a new range. | 415 child->document().nodeWillBeRemoved(child); // e.g. mutation event listener
can create a new range. |
| 416 ChildFrameDisconnector(child).disconnect(); | 416 ChildFrameDisconnector(child).disconnect(); |
| 417 } | 417 } |
| 418 | 418 |
| 419 static void willRemoveChildren(ContainerNode* container) | 419 static void willRemoveChildren(ContainerNode* container) |
| 420 { | 420 { |
| 421 NodeVector children; | 421 NodeVector children; |
| 422 getChildNodes(container, children); | 422 getChildNodes(container, children); |
| 423 | 423 |
| 424 container->document().nodeChildrenWillBeRemoved(container); | |
| 425 | |
| 426 ChildListMutationScope mutation(container); | 424 ChildListMutationScope mutation(container); |
| 427 for (NodeVector::const_iterator it = children.begin(); it != children.end();
it++) { | 425 for (NodeVector::const_iterator it = children.begin(); it != children.end();
it++) { |
| 428 Node* child = it->get(); | 426 Node* child = it->get(); |
| 429 mutation.willRemoveChild(child); | 427 mutation.willRemoveChild(child); |
| 430 child->notifyMutationObserversNodeWillDetach(); | 428 child->notifyMutationObserversNodeWillDetach(); |
| 431 | 429 |
| 432 // fire removed from document mutation events. | 430 // fire removed from document mutation events. |
| 433 dispatchChildRemovalEvents(child); | 431 dispatchChildRemovalEvents(child); |
| 434 } | 432 } |
| 435 | 433 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 // or widget updates (e.g., for <embed>). | 556 // or widget updates (e.g., for <embed>). |
| 559 SubframeLoadingDisabler disabler(this); | 557 SubframeLoadingDisabler disabler(this); |
| 560 | 558 |
| 561 // Exclude this node when looking for removed focusedElement since only | 559 // Exclude this node when looking for removed focusedElement since only |
| 562 // children will be removed. | 560 // children will be removed. |
| 563 // This must be later than willRemoveChildren, which might change focus | 561 // This must be later than willRemoveChildren, which might change focus |
| 564 // state of a child. | 562 // state of a child. |
| 565 document().removeFocusedElementOfSubtree(this, true); | 563 document().removeFocusedElementOfSubtree(this, true); |
| 566 } | 564 } |
| 567 | 565 |
| 566 document().nodeChildrenWillBeRemoved(this); |
| 567 |
| 568 NodeVector removedChildren; | 568 NodeVector removedChildren; |
| 569 { | 569 { |
| 570 WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates; | 570 WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates; |
| 571 { | 571 { |
| 572 NoEventDispatchAssertion assertNoEventDispatch; | 572 NoEventDispatchAssertion assertNoEventDispatch; |
| 573 removedChildren.reserveInitialCapacity(childNodeCount()); | 573 removedChildren.reserveInitialCapacity(childNodeCount()); |
| 574 while (m_firstChild) { | 574 while (m_firstChild) { |
| 575 removedChildren.append(m_firstChild); | 575 removedChildren.append(m_firstChild); |
| 576 removeBetween(0, m_firstChild->nextSibling(), m_firstChild); | 576 removeBetween(0, m_firstChild->nextSibling(), m_firstChild); |
| 577 } | 577 } |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 999 return true; | 999 return true; |
| 1000 | 1000 |
| 1001 if (node->isElementNode() && toElement(node)->shadow()) | 1001 if (node->isElementNode() && toElement(node)->shadow()) |
| 1002 return true; | 1002 return true; |
| 1003 | 1003 |
| 1004 return false; | 1004 return false; |
| 1005 } | 1005 } |
| 1006 #endif | 1006 #endif |
| 1007 | 1007 |
| 1008 } // namespace WebCore | 1008 } // namespace WebCore |
| OLD | NEW |