| 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 21 matching lines...) Expand all Loading... |
| 32 #include "Frame.h" | 32 #include "Frame.h" |
| 33 #include "FrameView.h" | 33 #include "FrameView.h" |
| 34 #include "InlineTextBox.h" | 34 #include "InlineTextBox.h" |
| 35 #include "InspectorInstrumentation.h" | 35 #include "InspectorInstrumentation.h" |
| 36 #include "MemoryCache.h" | 36 #include "MemoryCache.h" |
| 37 #include "MutationEvent.h" | 37 #include "MutationEvent.h" |
| 38 #include "ResourceLoadScheduler.h" | 38 #include "ResourceLoadScheduler.h" |
| 39 #include "Page.h" | 39 #include "Page.h" |
| 40 #include "RenderBox.h" | 40 #include "RenderBox.h" |
| 41 #include "RenderTheme.h" | 41 #include "RenderTheme.h" |
| 42 #include "RenderWidget.h" |
| 42 #include "RootInlineBox.h" | 43 #include "RootInlineBox.h" |
| 43 #include <wtf/CurrentTime.h> | 44 #include <wtf/CurrentTime.h> |
| 44 #include <wtf/Vector.h> | 45 #include <wtf/Vector.h> |
| 45 | 46 |
| 46 using namespace std; | 47 using namespace std; |
| 47 | 48 |
| 48 namespace WebCore { | 49 namespace WebCore { |
| 49 | 50 |
| 50 static void dispatchChildInsertionEvents(Node*); | 51 static void dispatchChildInsertionEvents(Node*); |
| 51 static void dispatchChildRemovalEvents(Node*); | 52 static void dispatchChildRemovalEvents(Node*); |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 } | 401 } |
| 401 | 402 |
| 402 willRemoveChild(child.get()); | 403 willRemoveChild(child.get()); |
| 403 | 404 |
| 404 // Mutation events might have moved this child into a different parent. | 405 // Mutation events might have moved this child into a different parent. |
| 405 if (child->parentNode() != this) { | 406 if (child->parentNode() != this) { |
| 406 ec = NOT_FOUND_ERR; | 407 ec = NOT_FOUND_ERR; |
| 407 return false; | 408 return false; |
| 408 } | 409 } |
| 409 | 410 |
| 411 RenderWidget::suspendWidgetHierarchyUpdates(); |
| 412 |
| 410 Node* prev = child->previousSibling(); | 413 Node* prev = child->previousSibling(); |
| 411 Node* next = child->nextSibling(); | 414 Node* next = child->nextSibling(); |
| 412 removeBetween(prev, next, child.get()); | 415 removeBetween(prev, next, child.get()); |
| 416 childrenChanged(false, prev, next, -1); |
| 417 ChildNodeRemovalNotifier(this).notify(child.get()); |
| 413 | 418 |
| 414 childrenChanged(false, prev, next, -1); | 419 RenderWidget::resumeWidgetHierarchyUpdates(); |
| 415 | |
| 416 ChildNodeRemovalNotifier(this).notify(child.get()); | |
| 417 dispatchSubtreeModifiedEvent(); | 420 dispatchSubtreeModifiedEvent(); |
| 418 | 421 |
| 419 return child; | 422 return child; |
| 420 } | 423 } |
| 421 | 424 |
| 422 void ContainerNode::removeBetween(Node* previousChild, Node* nextChild, Node* ol
dChild) | 425 void ContainerNode::removeBetween(Node* previousChild, Node* nextChild, Node* ol
dChild) |
| 423 { | 426 { |
| 424 ASSERT(oldChild); | 427 ASSERT(oldChild); |
| 425 ASSERT(oldChild->parentNode() == this); | 428 ASSERT(oldChild->parentNode() == this); |
| 426 | 429 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 document()->removeFocusedNodeOfSubtree(this, true); | 479 document()->removeFocusedNodeOfSubtree(this, true); |
| 477 | 480 |
| 478 #if ENABLE(FULLSCREEN_API) | 481 #if ENABLE(FULLSCREEN_API) |
| 479 document()->removeFullScreenElementOfSubtree(this, true); | 482 document()->removeFullScreenElementOfSubtree(this, true); |
| 480 #endif | 483 #endif |
| 481 | 484 |
| 482 // Do any prep work needed before actually starting to detach | 485 // Do any prep work needed before actually starting to detach |
| 483 // and remove... e.g. stop loading frames, fire unload events. | 486 // and remove... e.g. stop loading frames, fire unload events. |
| 484 willRemoveChildren(protect.get()); | 487 willRemoveChildren(protect.get()); |
| 485 | 488 |
| 489 RenderWidget::suspendWidgetHierarchyUpdates(); |
| 486 forbidEventDispatch(); | 490 forbidEventDispatch(); |
| 487 Vector<RefPtr<Node>, 10> removedChildren; | 491 Vector<RefPtr<Node>, 10> removedChildren; |
| 488 removedChildren.reserveInitialCapacity(childNodeCount()); | 492 removedChildren.reserveInitialCapacity(childNodeCount()); |
| 489 while (RefPtr<Node> n = m_firstChild) { | 493 while (RefPtr<Node> n = m_firstChild) { |
| 490 Node* next = n->nextSibling(); | 494 Node* next = n->nextSibling(); |
| 491 | 495 |
| 492 // Remove the node from the tree before calling detach or removedFromDoc
ument (4427024, 4129744). | 496 // Remove the node from the tree before calling detach or removedFromDoc
ument (4427024, 4129744). |
| 493 // removeChild() does this after calling detach(). There is no explanati
on for | 497 // removeChild() does this after calling detach(). There is no explanati
on for |
| 494 // this discrepancy between removeChild() and its optimized version remo
veChildren(). | 498 // this discrepancy between removeChild() and its optimized version remo
veChildren(). |
| 495 n->setPreviousSibling(0); | 499 n->setPreviousSibling(0); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 517 if (removedChild->attached()) | 521 if (removedChild->attached()) |
| 518 removedChild->detach(); | 522 removedChild->detach(); |
| 519 } | 523 } |
| 520 | 524 |
| 521 childrenChanged(false, 0, 0, -static_cast<int>(removedChildrenCount)); | 525 childrenChanged(false, 0, 0, -static_cast<int>(removedChildrenCount)); |
| 522 | 526 |
| 523 for (i = 0; i < removedChildrenCount; ++i) | 527 for (i = 0; i < removedChildrenCount; ++i) |
| 524 ChildNodeRemovalNotifier(this).notify(removedChildren[i].get()); | 528 ChildNodeRemovalNotifier(this).notify(removedChildren[i].get()); |
| 525 | 529 |
| 526 allowEventDispatch(); | 530 allowEventDispatch(); |
| 531 RenderWidget::resumeWidgetHierarchyUpdates(); |
| 532 |
| 527 dispatchSubtreeModifiedEvent(); | 533 dispatchSubtreeModifiedEvent(); |
| 528 } | 534 } |
| 529 | 535 |
| 530 bool ContainerNode::appendChild(PassRefPtr<Node> newChild, ExceptionCode& ec, bo
ol shouldLazyAttach) | 536 bool ContainerNode::appendChild(PassRefPtr<Node> newChild, ExceptionCode& ec, bo
ol shouldLazyAttach) |
| 531 { | 537 { |
| 532 RefPtr<ContainerNode> protect(this); | 538 RefPtr<ContainerNode> protect(this); |
| 533 | 539 |
| 534 // Check that this node is not "floating". | 540 // Check that this node is not "floating". |
| 535 // If it is, it can be deleted as a side effect of sending mutation events. | 541 // If it is, it can be deleted as a side effect of sending mutation events. |
| 536 ASSERT(refCount() || parentOrHostNode()); | 542 ASSERT(refCount() || parentOrHostNode()); |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 989 if (shouldLazyAttach) | 995 if (shouldLazyAttach) |
| 990 child->lazyAttach(); | 996 child->lazyAttach(); |
| 991 else | 997 else |
| 992 child->attach(); | 998 child->attach(); |
| 993 } | 999 } |
| 994 | 1000 |
| 995 dispatchChildInsertionEvents(child); | 1001 dispatchChildInsertionEvents(child); |
| 996 } | 1002 } |
| 997 | 1003 |
| 998 } // namespace WebCore | 1004 } // namespace WebCore |
| OLD | NEW |