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, 2013 Apple Inc. All rights
reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights
reserved. |
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 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 willRemoveChild(*child); | 579 willRemoveChild(*child); |
580 | 580 |
581 // Mutation events might have moved this child into a different parent. | 581 // Mutation events might have moved this child into a different parent. |
582 if (child->parentNode() != this) { | 582 if (child->parentNode() != this) { |
583 exceptionState.throwDOMException(NotFoundError, "The node to be removed
is no longer a child of this node. Perhaps it was moved in response to a mutatio
n?"); | 583 exceptionState.throwDOMException(NotFoundError, "The node to be removed
is no longer a child of this node. Perhaps it was moved in response to a mutatio
n?"); |
584 return nullptr; | 584 return nullptr; |
585 } | 585 } |
586 | 586 |
587 { | 587 { |
588 HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates; | 588 HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates; |
| 589 DocumentOrderedMap::RemoveScope treeRemoveScope; |
589 | 590 |
590 Node* prev = child->previousSibling(); | 591 Node* prev = child->previousSibling(); |
591 Node* next = child->nextSibling(); | 592 Node* next = child->nextSibling(); |
592 removeBetween(prev, next, *child); | 593 removeBetween(prev, next, *child); |
593 notifyNodeRemoved(*child); | 594 notifyNodeRemoved(*child); |
594 childrenChanged(ChildrenChange::forRemoval(*child, prev, next, ChildrenC
hangeSourceAPI)); | 595 childrenChanged(ChildrenChange::forRemoval(*child, prev, next, ChildrenC
hangeSourceAPI)); |
595 } | 596 } |
596 dispatchSubtreeModifiedEvent(); | 597 dispatchSubtreeModifiedEvent(); |
597 return child; | 598 return child; |
598 } | 599 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 if (oldChild.connectedSubframeCount()) | 632 if (oldChild.connectedSubframeCount()) |
632 ChildFrameDisconnector(oldChild).disconnect(); | 633 ChildFrameDisconnector(oldChild).disconnect(); |
633 | 634 |
634 if (oldChild.parentNode() != this) | 635 if (oldChild.parentNode() != this) |
635 return; | 636 return; |
636 | 637 |
637 ChildListMutationScope(*this).willRemoveChild(oldChild); | 638 ChildListMutationScope(*this).willRemoveChild(oldChild); |
638 oldChild.notifyMutationObserversNodeWillDetach(); | 639 oldChild.notifyMutationObserversNodeWillDetach(); |
639 | 640 |
640 HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates; | 641 HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates; |
| 642 DocumentOrderedMap::RemoveScope treeRemoveScope; |
| 643 |
641 Node* prev = oldChild.previousSibling(); | 644 Node* prev = oldChild.previousSibling(); |
642 Node* next = oldChild.nextSibling(); | 645 Node* next = oldChild.nextSibling(); |
643 removeBetween(prev, next, oldChild); | 646 removeBetween(prev, next, oldChild); |
644 | 647 |
645 notifyNodeRemoved(oldChild); | 648 notifyNodeRemoved(oldChild); |
646 childrenChanged(ChildrenChange::forRemoval(oldChild, prev, next, ChildrenCha
ngeSourceParser)); | 649 childrenChanged(ChildrenChange::forRemoval(oldChild, prev, next, ChildrenCha
ngeSourceParser)); |
647 } | 650 } |
648 | 651 |
649 // This differs from other remove functions because it forcibly removes all the
children, | 652 // This differs from other remove functions because it forcibly removes all the
children, |
650 // regardless of read-only status or event exceptions, e.g. | 653 // regardless of read-only status or event exceptions, e.g. |
(...skipping 27 matching lines...) Expand all Loading... |
678 #if !ENABLE(OILPAN) | 681 #if !ENABLE(OILPAN) |
679 // FIXME: Remove this NodeVector. Right now WebPluginContainerImpl::m_elemen
t is a | 682 // FIXME: Remove this NodeVector. Right now WebPluginContainerImpl::m_elemen
t is a |
680 // raw ptr which means the code below can drop the last ref to a plugin elem
ent and | 683 // raw ptr which means the code below can drop the last ref to a plugin elem
ent and |
681 // then the code in UpdateSuspendScope::performDeferredWidgetTreeOperations
will | 684 // then the code in UpdateSuspendScope::performDeferredWidgetTreeOperations
will |
682 // try to destroy the plugin which will be a use-after-free. We should use a
RefPtr | 685 // try to destroy the plugin which will be a use-after-free. We should use a
RefPtr |
683 // in the WebPluginContainerImpl instead. | 686 // in the WebPluginContainerImpl instead. |
684 NodeVector removedChildren; | 687 NodeVector removedChildren; |
685 #endif | 688 #endif |
686 { | 689 { |
687 HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates; | 690 HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates; |
688 | 691 DocumentOrderedMap::RemoveScope treeRemoveScope; |
689 { | 692 { |
690 EventDispatchForbiddenScope assertNoEventDispatch; | 693 EventDispatchForbiddenScope assertNoEventDispatch; |
691 ScriptForbiddenScope forbidScript; | 694 ScriptForbiddenScope forbidScript; |
692 | 695 |
693 #if !ENABLE(OILPAN) | 696 #if !ENABLE(OILPAN) |
694 removedChildren.reserveInitialCapacity(countChildren()); | 697 removedChildren.reserveInitialCapacity(countChildren()); |
695 #endif | 698 #endif |
696 while (RefPtrWillBeRawPtr<Node> child = m_firstChild) { | 699 while (RefPtrWillBeRawPtr<Node> child = m_firstChild) { |
697 removeBetween(0, child->nextSibling(), *child); | 700 removeBetween(0, child->nextSibling(), *child); |
698 #if !ENABLE(OILPAN) | 701 #if !ENABLE(OILPAN) |
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1534 return true; | 1537 return true; |
1535 | 1538 |
1536 if (node->isElementNode() && toElement(node)->shadow()) | 1539 if (node->isElementNode() && toElement(node)->shadow()) |
1537 return true; | 1540 return true; |
1538 | 1541 |
1539 return false; | 1542 return false; |
1540 } | 1543 } |
1541 #endif | 1544 #endif |
1542 | 1545 |
1543 } // namespace blink | 1546 } // namespace blink |
OLD | NEW |