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

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

Issue 192293002: Use new is*Element() helper functions in DOM code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 newChild.setParentOrShadowHostNode(this); 261 newChild.setParentOrShadowHostNode(this);
262 newChild.setPreviousSibling(prev); 262 newChild.setPreviousSibling(prev);
263 newChild.setNextSibling(&nextChild); 263 newChild.setNextSibling(&nextChild);
264 } 264 }
265 265
266 void ContainerNode::parserInsertBefore(PassRefPtr<Node> newChild, Node& nextChil d) 266 void ContainerNode::parserInsertBefore(PassRefPtr<Node> newChild, Node& nextChil d)
267 { 267 {
268 ASSERT(newChild); 268 ASSERT(newChild);
269 ASSERT(nextChild.parentNode() == this); 269 ASSERT(nextChild.parentNode() == this);
270 ASSERT(!newChild->isDocumentFragment()); 270 ASSERT(!newChild->isDocumentFragment());
271 ASSERT(!hasTagName(templateTag)); 271 ASSERT(!isHTMLTemplateElement(this));
eseidel 2014/03/10 18:17:01 This makes so much more sense! Now if we could on
272 272
273 if (nextChild.previousSibling() == newChild || nextChild == newChild) // not hing to do 273 if (nextChild.previousSibling() == newChild || nextChild == newChild) // not hing to do
274 return; 274 return;
275 275
276 if (document() != newChild->document()) 276 if (document() != newChild->document())
277 document().adoptNode(newChild.get(), ASSERT_NO_EXCEPTION); 277 document().adoptNode(newChild.get(), ASSERT_NO_EXCEPTION);
278 278
279 insertBeforeCommon(nextChild, *newChild); 279 insertBeforeCommon(nextChild, *newChild);
280 280
281 newChild->updateAncestorConnectedSubframeCountForInsertion(); 281 newChild->updateAncestorConnectedSubframeCountForInsertion();
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 } 607 }
608 608
609 dispatchSubtreeModifiedEvent(); 609 dispatchSubtreeModifiedEvent();
610 } 610 }
611 611
612 void ContainerNode::parserAppendChild(PassRefPtr<Node> newChild) 612 void ContainerNode::parserAppendChild(PassRefPtr<Node> newChild)
613 { 613 {
614 ASSERT(newChild); 614 ASSERT(newChild);
615 ASSERT(!newChild->parentNode()); // Use appendChild if you need to handle re parenting (and want DOM mutation events). 615 ASSERT(!newChild->parentNode()); // Use appendChild if you need to handle re parenting (and want DOM mutation events).
616 ASSERT(!newChild->isDocumentFragment()); 616 ASSERT(!newChild->isDocumentFragment());
617 ASSERT(!hasTagName(templateTag)); 617 ASSERT(!isHTMLTemplateElement(this));
618 618
619 if (document() != newChild->document()) 619 if (document() != newChild->document())
620 document().adoptNode(newChild.get(), ASSERT_NO_EXCEPTION); 620 document().adoptNode(newChild.get(), ASSERT_NO_EXCEPTION);
621 621
622 Node* last = m_lastChild; 622 Node* last = m_lastChild;
623 { 623 {
624 NoEventDispatchAssertion assertNoEventDispatch; 624 NoEventDispatchAssertion assertNoEventDispatch;
625 // FIXME: This method should take a PassRefPtr. 625 // FIXME: This method should take a PassRefPtr.
626 appendChildToContainer(*newChild, *this); 626 appendChildToContainer(*newChild, *this);
627 treeScope().adoptIfNeeded(*newChild); 627 treeScope().adoptIfNeeded(*newChild);
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 1027
1028 // Takes an AtomicString in argument because it is common for elements to share the same set of class names. 1028 // Takes an AtomicString in argument because it is common for elements to share the same set of class names.
1029 // Therefore, the ClassNodeList factory function expects an AtomicString type. 1029 // Therefore, the ClassNodeList factory function expects an AtomicString type.
1030 PassRefPtr<HTMLCollection> ContainerNode::getElementsByClassName(const AtomicStr ing& classNames) 1030 PassRefPtr<HTMLCollection> ContainerNode::getElementsByClassName(const AtomicStr ing& classNames)
1031 { 1031 {
1032 return ensureRareData().ensureNodeLists().addCache<ClassCollection>(*this, C lassCollectionType, classNames); 1032 return ensureRareData().ensureNodeLists().addCache<ClassCollection>(*this, C lassCollectionType, classNames);
1033 } 1033 }
1034 1034
1035 PassRefPtr<RadioNodeList> ContainerNode::radioNodeList(const AtomicString& name, bool onlyMatchImgElements) 1035 PassRefPtr<RadioNodeList> ContainerNode::radioNodeList(const AtomicString& name, bool onlyMatchImgElements)
1036 { 1036 {
1037 ASSERT(hasTagName(formTag) || hasTagName(fieldsetTag)); 1037 ASSERT(isHTMLFormElement(this) || isHTMLFieldSetElement(this));
1038 CollectionType type = onlyMatchImgElements ? RadioImgNodeListType : RadioNod eListType; 1038 CollectionType type = onlyMatchImgElements ? RadioImgNodeListType : RadioNod eListType;
1039 return ensureRareData().ensureNodeLists().addCache<RadioNodeList>(*this, typ e, name); 1039 return ensureRareData().ensureNodeLists().addCache<RadioNodeList>(*this, typ e, name);
1040 } 1040 }
1041 1041
1042 #ifndef NDEBUG 1042 #ifndef NDEBUG
1043 bool childAttachedAllowedWhenAttachingChildren(ContainerNode* node) 1043 bool childAttachedAllowedWhenAttachingChildren(ContainerNode* node)
1044 { 1044 {
1045 if (node->isShadowRoot()) 1045 if (node->isShadowRoot())
1046 return true; 1046 return true;
1047 1047
1048 if (node->isInsertionPoint()) 1048 if (node->isInsertionPoint())
1049 return true; 1049 return true;
1050 1050
1051 if (node->isElementNode() && toElement(node)->shadow()) 1051 if (node->isElementNode() && toElement(node)->shadow())
1052 return true; 1052 return true;
1053 1053
1054 return false; 1054 return false;
1055 } 1055 }
1056 #endif 1056 #endif
1057 1057
1058 } // namespace WebCore 1058 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698