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

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

Issue 313813002: Oilpan: Replace RefPtrs to Node and its subclasses in core/dom/ with Oilpan transtion types. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase and improvements Created 6 years, 6 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
« no previous file with comments | « Source/core/dom/ContainerNode.h ('k') | Source/core/dom/ContainerNodeAlgorithms.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 bool ContainerNode::checkAcceptChildGuaranteedNodeTypes(const Node& newChild, Ex ceptionState& exceptionState) const 169 bool ContainerNode::checkAcceptChildGuaranteedNodeTypes(const Node& newChild, Ex ceptionState& exceptionState) const
170 { 170 {
171 ASSERT(isChildTypeAllowed(newChild)); 171 ASSERT(isChildTypeAllowed(newChild));
172 if (newChild.contains(this)) { 172 if (newChild.contains(this)) {
173 exceptionState.throwDOMException(HierarchyRequestError, "The new child e lement contains the parent."); 173 exceptionState.throwDOMException(HierarchyRequestError, "The new child e lement contains the parent.");
174 return false; 174 return false;
175 } 175 }
176 return true; 176 return true;
177 } 177 }
178 178
179 void ContainerNode::insertBefore(PassRefPtr<Node> newChild, Node* refChild, Exce ptionState& exceptionState) 179 void ContainerNode::insertBefore(PassRefPtrWillBeRawPtr<Node> newChild, Node* re fChild, ExceptionState& exceptionState)
180 { 180 {
181 #if !ENABLE(OILPAN) 181 #if !ENABLE(OILPAN)
182 // Check that this node is not "floating". 182 // Check that this node is not "floating".
183 // If it is, it can be deleted as a side effect of sending mutation events. 183 // If it is, it can be deleted as a side effect of sending mutation events.
184 ASSERT(refCount() || parentOrShadowHostNode()); 184 ASSERT(refCount() || parentOrShadowHostNode());
185 #endif 185 #endif
186 186
187 RefPtrWillBeRawPtr<Node> protect(this); 187 RefPtrWillBeRawPtr<Node> protect(this);
188 188
189 // insertBefore(node, 0) is equivalent to appendChild(node) 189 // insertBefore(node, 0) is equivalent to appendChild(node)
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 prev->setNextSibling(&newChild); 264 prev->setNextSibling(&newChild);
265 } else { 265 } else {
266 ASSERT(firstChild() == nextChild); 266 ASSERT(firstChild() == nextChild);
267 m_firstChild = &newChild; 267 m_firstChild = &newChild;
268 } 268 }
269 newChild.setParentOrShadowHostNode(this); 269 newChild.setParentOrShadowHostNode(this);
270 newChild.setPreviousSibling(prev); 270 newChild.setPreviousSibling(prev);
271 newChild.setNextSibling(&nextChild); 271 newChild.setNextSibling(&nextChild);
272 } 272 }
273 273
274 void ContainerNode::parserInsertBefore(PassRefPtr<Node> newChild, Node& nextChil d) 274 void ContainerNode::parserInsertBefore(PassRefPtrWillBeRawPtr<Node> newChild, No de& nextChild)
275 { 275 {
276 ASSERT(newChild); 276 ASSERT(newChild);
277 ASSERT(nextChild.parentNode() == this); 277 ASSERT(nextChild.parentNode() == this);
278 ASSERT(!newChild->isDocumentFragment()); 278 ASSERT(!newChild->isDocumentFragment());
279 ASSERT(!isHTMLTemplateElement(this)); 279 ASSERT(!isHTMLTemplateElement(this));
280 280
281 if (nextChild.previousSibling() == newChild || nextChild == newChild) // not hing to do 281 if (nextChild.previousSibling() == newChild || &nextChild == newChild) // no thing to do
282 return; 282 return;
283 283
284 if (document() != newChild->document()) 284 if (document() != newChild->document())
285 document().adoptNode(newChild.get(), ASSERT_NO_EXCEPTION); 285 document().adoptNode(newChild.get(), ASSERT_NO_EXCEPTION);
286 286
287 insertBeforeCommon(nextChild, *newChild); 287 insertBeforeCommon(nextChild, *newChild);
288 288
289 newChild->updateAncestorConnectedSubframeCountForInsertion(); 289 newChild->updateAncestorConnectedSubframeCountForInsertion();
290 290
291 ChildListMutationScope(*this).childAdded(*newChild); 291 ChildListMutationScope(*this).childAdded(*newChild);
292 292
293 childrenChanged(true, newChild->previousSibling(), &nextChild, 1); 293 childrenChanged(true, newChild->previousSibling(), &nextChild, 1);
294 294
295 notifyNodeInserted(*newChild); 295 notifyNodeInserted(*newChild);
296 } 296 }
297 297
298 void ContainerNode::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, Exce ptionState& exceptionState) 298 void ContainerNode::replaceChild(PassRefPtrWillBeRawPtr<Node> newChild, Node* ol dChild, ExceptionState& exceptionState)
299 { 299 {
300 #if !ENABLE(OILPAN) 300 #if !ENABLE(OILPAN)
301 // Check that this node is not "floating". 301 // Check that this node is not "floating".
302 // If it is, it can be deleted as a side effect of sending mutation events. 302 // If it is, it can be deleted as a side effect of sending mutation events.
303 ASSERT(refCount() || parentOrShadowHostNode()); 303 ASSERT(refCount() || parentOrShadowHostNode());
304 #endif 304 #endif
305 305
306 RefPtrWillBeRawPtr<Node> protect(this); 306 RefPtrWillBeRawPtr<Node> protect(this);
307 307
308 if (oldChild == newChild) // nothing to do 308 if (oldChild == newChild) // nothing to do
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 566
567 childrenChanged(false, 0, 0, -static_cast<int>(removedChildren.size())); 567 childrenChanged(false, 0, 0, -static_cast<int>(removedChildren.size()));
568 568
569 for (size_t i = 0; i < removedChildren.size(); ++i) 569 for (size_t i = 0; i < removedChildren.size(); ++i)
570 notifyNodeRemoved(*removedChildren[i]); 570 notifyNodeRemoved(*removedChildren[i]);
571 } 571 }
572 572
573 dispatchSubtreeModifiedEvent(); 573 dispatchSubtreeModifiedEvent();
574 } 574 }
575 575
576 void ContainerNode::appendChild(PassRefPtr<Node> newChild, ExceptionState& excep tionState) 576 void ContainerNode::appendChild(PassRefPtrWillBeRawPtr<Node> newChild, Exception State& exceptionState)
577 { 577 {
578 RefPtrWillBeRawPtr<ContainerNode> protect(this); 578 RefPtrWillBeRawPtr<ContainerNode> protect(this);
579 579
580 #if !ENABLE(OILPAN) 580 #if !ENABLE(OILPAN)
581 // Check that this node is not "floating". 581 // Check that this node is not "floating".
582 // If it is, it can be deleted as a side effect of sending mutation events. 582 // If it is, it can be deleted as a side effect of sending mutation events.
583 ASSERT(refCount() || parentOrShadowHostNode()); 583 ASSERT(refCount() || parentOrShadowHostNode());
584 #endif 584 #endif
585 585
586 // Make sure adding the new child is ok 586 // Make sure adding the new child is ok
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 treeScope().adoptIfNeeded(child); 624 treeScope().adoptIfNeeded(child);
625 appendChildToContainer(child, *this); 625 appendChildToContainer(child, *this);
626 } 626 }
627 627
628 updateTreeAfterInsertion(child); 628 updateTreeAfterInsertion(child);
629 } 629 }
630 630
631 dispatchSubtreeModifiedEvent(); 631 dispatchSubtreeModifiedEvent();
632 } 632 }
633 633
634 void ContainerNode::parserAppendChild(PassRefPtr<Node> newChild) 634 void ContainerNode::parserAppendChild(PassRefPtrWillBeRawPtr<Node> newChild)
635 { 635 {
636 ASSERT(newChild); 636 ASSERT(newChild);
637 ASSERT(!newChild->parentNode()); // Use appendChild if you need to handle re parenting (and want DOM mutation events). 637 ASSERT(!newChild->parentNode()); // Use appendChild if you need to handle re parenting (and want DOM mutation events).
638 ASSERT(!newChild->isDocumentFragment()); 638 ASSERT(!newChild->isDocumentFragment());
639 ASSERT(!isHTMLTemplateElement(this)); 639 ASSERT(!isHTMLTemplateElement(this));
640 640
641 if (document() != newChild->document()) 641 if (document() != newChild->document())
642 document().adoptNode(newChild.get(), ASSERT_NO_EXCEPTION); 642 document().adoptNode(newChild.get(), ASSERT_NO_EXCEPTION);
643 643
644 Node* last = m_lastChild; 644 Node* last = m_lastChild;
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
1278 return true; 1278 return true;
1279 1279
1280 if (node->isElementNode() && toElement(node)->shadow()) 1280 if (node->isElementNode() && toElement(node)->shadow())
1281 return true; 1281 return true;
1282 1282
1283 return false; 1283 return false;
1284 } 1284 }
1285 #endif 1285 #endif
1286 1286
1287 } // namespace WebCore 1287 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/ContainerNode.h ('k') | Source/core/dom/ContainerNodeAlgorithms.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698