Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: Source/core/dom/ContainerNode.cpp

Issue 24430002: Rename attach and detach to createRenderTree/destroyRenderTree (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 mutation.willRemoveChild(children[i].get()); 90 mutation.willRemoveChild(children[i].get());
91 } 91 }
92 92
93 // FIXME: We need to do notifyMutationObserversNodeWillDetach() for each chi ld, 93 // FIXME: We need to do notifyMutationObserversNodeWillDetach() for each chi ld,
94 // probably inside removeDetachedChildrenInContainer. 94 // probably inside removeDetachedChildrenInContainer.
95 95
96 oldParent->removeDetachedChildren(); 96 oldParent->removeDetachedChildren();
97 97
98 for (unsigned i = 0; i < children.size(); ++i) { 98 for (unsigned i = 0; i < children.size(); ++i) {
99 if (children[i]->attached()) 99 if (children[i]->attached())
100 children[i]->detach(); 100 children[i]->destroyRenderTree();
101 // FIXME: We need a no mutation event version of adoptNode. 101 // FIXME: We need a no mutation event version of adoptNode.
102 RefPtr<Node> child = document().adoptNode(children[i].release(), ASSERT_ NO_EXCEPTION); 102 RefPtr<Node> child = document().adoptNode(children[i].release(), ASSERT_ NO_EXCEPTION);
103 // FIXME: Together with adoptNode above, the tree scope might get update d recursively twice 103 // FIXME: Together with adoptNode above, the tree scope might get update d recursively twice
104 // (if the document changed or oldParent was in a shadow tree, AND *this is in a shadow tree). 104 // (if the document changed or oldParent was in a shadow tree, AND *this is in a shadow tree).
105 // Can we do better? 105 // Can we do better?
106 treeScope().adoptIfNeeded(child.get()); 106 treeScope().adoptIfNeeded(child.get());
107 parserAppendChild(child.get()); 107 parserAppendChild(child.get());
108 } 108 }
109 } 109 }
110 110
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 491
492 void ContainerNode::removeBetween(Node* previousChild, Node* nextChild, Node* ol dChild) 492 void ContainerNode::removeBetween(Node* previousChild, Node* nextChild, Node* ol dChild)
493 { 493 {
494 NoEventDispatchAssertion assertNoEventDispatch; 494 NoEventDispatchAssertion assertNoEventDispatch;
495 495
496 ASSERT(oldChild); 496 ASSERT(oldChild);
497 ASSERT(oldChild->parentNode() == this); 497 ASSERT(oldChild->parentNode() == this);
498 498
499 // Remove from rendering tree 499 // Remove from rendering tree
500 if (oldChild->attached()) 500 if (oldChild->attached())
501 oldChild->detach(); 501 oldChild->destroyRenderTree();
502 502
503 if (nextChild) 503 if (nextChild)
504 nextChild->setPreviousSibling(previousChild); 504 nextChild->setPreviousSibling(previousChild);
505 if (previousChild) 505 if (previousChild)
506 previousChild->setNextSibling(nextChild); 506 previousChild->setNextSibling(nextChild);
507 if (m_firstChild == oldChild) 507 if (m_firstChild == oldChild)
508 m_firstChild = nextChild; 508 m_firstChild = nextChild;
509 if (m_lastChild == oldChild) 509 if (m_lastChild == oldChild)
510 m_lastChild = previousChild; 510 m_lastChild = previousChild;
511 511
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 } 659 }
660 660
661 newChild->updateAncestorConnectedSubframeCountForInsertion(); 661 newChild->updateAncestorConnectedSubframeCountForInsertion();
662 662
663 ChildListMutationScope(this).childAdded(newChild.get()); 663 ChildListMutationScope(this).childAdded(newChild.get());
664 664
665 childrenChanged(true, last, 0, 1); 665 childrenChanged(true, last, 0, 1);
666 ChildNodeInsertionNotifier(this).notify(newChild.get()); 666 ChildNodeInsertionNotifier(this).notify(newChild.get());
667 } 667 }
668 668
669 void ContainerNode::attach(const AttachContext& context) 669 void ContainerNode::createRenderTree(const AttachContext& context)
670 { 670 {
671 attachChildren(context); 671 AttachContext childrenContext(context);
672 childrenContext.resolvedStyle = 0;
673
674 for (Node* child = firstChild(); child; child = child->nextSibling()) {
675 ASSERT(!child->attached() || childAttachedAllowedWhenAttachingChildren(t his));
676 if (!child->attached())
677 child->createRenderTree(childrenContext);
678 }
679
672 clearChildNeedsStyleRecalc(); 680 clearChildNeedsStyleRecalc();
673 Node::attach(context); 681 Node::createRenderTree(context);
674 } 682 }
675 683
676 void ContainerNode::detach(const AttachContext& context) 684 void ContainerNode::destroyRenderTree(const AttachContext& context)
677 { 685 {
678 detachChildren(context); 686 AttachContext childrenContext(context);
687 childrenContext.resolvedStyle = 0;
688
689 for (Node* child = firstChild(); child; child = child->nextSibling())
690 child->destroyRenderTree(childrenContext);
691
679 clearChildNeedsStyleRecalc(); 692 clearChildNeedsStyleRecalc();
680 Node::detach(context); 693 Node::destroyRenderTree(context);
681 } 694 }
682 695
683 void ContainerNode::childrenChanged(bool changedByParser, Node*, Node*, int chil dCountDelta) 696 void ContainerNode::childrenChanged(bool changedByParser, Node*, Node*, int chil dCountDelta)
684 { 697 {
685 document().incDOMTreeVersion(); 698 document().incDOMTreeVersion();
686 if (!changedByParser && childCountDelta) 699 if (!changedByParser && childCountDelta)
687 document().updateRangesAfterChildrenChanged(this); 700 document().updateRangesAfterChildrenChanged(this);
688 invalidateNodeListCachesInAncestors(); 701 invalidateNodeListCachesInAncestors();
689 } 702 }
690 703
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 return true; 1012 return true;
1000 1013
1001 if (node->isElementNode() && toElement(node)->shadow()) 1014 if (node->isElementNode() && toElement(node)->shadow())
1002 return true; 1015 return true;
1003 1016
1004 return false; 1017 return false;
1005 } 1018 }
1006 #endif 1019 #endif
1007 1020
1008 } // namespace WebCore 1021 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698