| 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. |
| 11 * | 11 * |
| 12 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
| 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 * Library General Public License for more details. | 15 * Library General Public License for more details. |
| 16 * | 16 * |
| 17 * You should have received a copy of the GNU Library General Public License | 17 * You should have received a copy of the GNU Library General Public License |
| 18 * along with this library; see the file COPYING.LIB. If not, write to | 18 * along with this library; see the file COPYING.LIB. If not, write to |
| 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 20 * Boston, MA 02110-1301, USA. | 20 * Boston, MA 02110-1301, USA. |
| 21 */ | 21 */ |
| 22 | 22 |
| 23 #include "config.h" | 23 #include "config.h" |
| 24 #include "core/dom/ContainerNode.h" | 24 #include "core/dom/ContainerNode.h" |
| 25 | 25 |
| 26 #include "bindings/v8/ExceptionState.h" | 26 #include "bindings/v8/ExceptionState.h" |
| 27 #include "core/dom/ChildListMutationScope.h" | 27 #include "core/dom/ChildListMutationScope.h" |
| 28 #include "core/dom/ClassNodeList.h" | 28 #include "core/dom/ClassCollection.h" |
| 29 #include "core/dom/ContainerNodeAlgorithms.h" | 29 #include "core/dom/ContainerNodeAlgorithms.h" |
| 30 #include "core/dom/ElementTraversal.h" | 30 #include "core/dom/ElementTraversal.h" |
| 31 #include "core/dom/ExceptionCode.h" | 31 #include "core/dom/ExceptionCode.h" |
| 32 #include "core/dom/FullscreenElementStack.h" | 32 #include "core/dom/FullscreenElementStack.h" |
| 33 #include "core/dom/NameNodeList.h" | 33 #include "core/dom/NameNodeList.h" |
| 34 #include "core/dom/NodeChildRemovalTracker.h" | 34 #include "core/dom/NodeChildRemovalTracker.h" |
| 35 #include "core/dom/NodeRareData.h" | 35 #include "core/dom/NodeRareData.h" |
| 36 #include "core/dom/NodeRenderStyle.h" | 36 #include "core/dom/NodeRenderStyle.h" |
| 37 #include "core/dom/NodeTraversal.h" | 37 #include "core/dom/NodeTraversal.h" |
| 38 #include "core/dom/SelectorQuery.h" | 38 #include "core/dom/SelectorQuery.h" |
| (...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 | 992 |
| 993 ChildListMutationScope(*this).childAdded(child); | 993 ChildListMutationScope(*this).childAdded(child); |
| 994 | 994 |
| 995 childrenChanged(false, child.previousSibling(), child.nextSibling(), 1); | 995 childrenChanged(false, child.previousSibling(), child.nextSibling(), 1); |
| 996 | 996 |
| 997 ChildNodeInsertionNotifier(*this).notify(child); | 997 ChildNodeInsertionNotifier(*this).notify(child); |
| 998 | 998 |
| 999 dispatchChildInsertionEvents(child); | 999 dispatchChildInsertionEvents(child); |
| 1000 } | 1000 } |
| 1001 | 1001 |
| 1002 PassRefPtr<NodeList> ContainerNode::getElementsByTagName(const AtomicString& loc
alName) | 1002 PassRefPtr<HTMLCollection> ContainerNode::getElementsByTagName(const AtomicStrin
g& localName) |
| 1003 { | 1003 { |
| 1004 if (localName.isNull()) | 1004 if (localName.isNull()) |
| 1005 return 0; | 1005 return 0; |
| 1006 | 1006 |
| 1007 if (document().isHTMLDocument()) | 1007 if (document().isHTMLDocument()) |
| 1008 return ensureRareData().ensureNodeLists().addCacheWithAtomicName<HTMLTag
NodeList>(this, HTMLTagNodeListType, localName); | 1008 return ensureRareData().ensureNodeLists().addCacheWithAtomicName<HTMLTag
Collection>(this, HTMLTagCollectionType, localName); |
| 1009 return ensureRareData().ensureNodeLists().addCacheWithAtomicName<TagNodeList
>(this, TagNodeListType, localName); | 1009 return ensureRareData().ensureNodeLists().addCacheWithAtomicName<TagCollecti
on>(this, TagCollectionType, localName); |
| 1010 } | 1010 } |
| 1011 | 1011 |
| 1012 PassRefPtr<NodeList> ContainerNode::getElementsByTagNameNS(const AtomicString& n
amespaceURI, const AtomicString& localName) | 1012 PassRefPtr<HTMLCollection> ContainerNode::getElementsByTagNameNS(const AtomicStr
ing& namespaceURI, const AtomicString& localName) |
| 1013 { | 1013 { |
| 1014 if (localName.isNull()) | 1014 if (localName.isNull()) |
| 1015 return 0; | 1015 return 0; |
| 1016 | 1016 |
| 1017 if (namespaceURI == starAtom) | 1017 if (namespaceURI == starAtom) |
| 1018 return getElementsByTagName(localName); | 1018 return getElementsByTagName(localName); |
| 1019 | 1019 |
| 1020 return ensureRareData().ensureNodeLists().addCacheWithQualifiedName(this, na
mespaceURI.isEmpty() ? nullAtom : namespaceURI, localName); | 1020 return ensureRareData().ensureNodeLists().addCacheWithQualifiedName(this, na
mespaceURI.isEmpty() ? nullAtom : namespaceURI, localName); |
| 1021 } | 1021 } |
| 1022 | 1022 |
| 1023 // Takes an AtomicString in argument because it is common for elements to share
the same name attribute. | 1023 // Takes an AtomicString in argument because it is common for elements to share
the same name attribute. |
| 1024 // Therefore, the NameNodeList factory function expects an AtomicString type. | 1024 // Therefore, the NameNodeList factory function expects an AtomicString type. |
| 1025 PassRefPtr<NodeList> ContainerNode::getElementsByName(const AtomicString& elemen
tName) | 1025 PassRefPtr<NodeList> ContainerNode::getElementsByName(const AtomicString& elemen
tName) |
| 1026 { | 1026 { |
| 1027 return ensureRareData().ensureNodeLists().addCacheWithAtomicName<NameNodeLis
t>(this, NameNodeListType, elementName); | 1027 return ensureRareData().ensureNodeLists().addCacheWithAtomicName<NameNodeLis
t>(this, NameNodeListType, elementName); |
| 1028 } | 1028 } |
| 1029 | 1029 |
| 1030 // Takes an AtomicString in argument because it is common for elements to share
the same set of class names. | 1030 // Takes an AtomicString in argument because it is common for elements to share
the same set of class names. |
| 1031 // Therefore, the ClassNodeList factory function expects an AtomicString type. | 1031 // Therefore, the ClassNodeList factory function expects an AtomicString type. |
| 1032 PassRefPtr<NodeList> ContainerNode::getElementsByClassName(const AtomicString& c
lassNames) | 1032 PassRefPtr<HTMLCollection> ContainerNode::getElementsByClassName(const AtomicStr
ing& classNames) |
| 1033 { | 1033 { |
| 1034 return ensureRareData().ensureNodeLists().addCacheWithAtomicName<ClassNodeLi
st>(this, ClassNodeListType, classNames); | 1034 return ensureRareData().ensureNodeLists().addCacheWithAtomicName<ClassCollec
tion>(this, ClassCollectionType, classNames); |
| 1035 } | 1035 } |
| 1036 | 1036 |
| 1037 PassRefPtr<RadioNodeList> ContainerNode::radioNodeList(const AtomicString& name,
bool onlyMatchImgElements) | 1037 PassRefPtr<RadioNodeList> ContainerNode::radioNodeList(const AtomicString& name,
bool onlyMatchImgElements) |
| 1038 { | 1038 { |
| 1039 ASSERT(hasTagName(formTag) || hasTagName(fieldsetTag)); | 1039 ASSERT(hasTagName(formTag) || hasTagName(fieldsetTag)); |
| 1040 CollectionType type = onlyMatchImgElements ? RadioImgNodeListType : RadioNod
eListType; | 1040 CollectionType type = onlyMatchImgElements ? RadioImgNodeListType : RadioNod
eListType; |
| 1041 return ensureRareData().ensureNodeLists().addCacheWithAtomicName<RadioNodeLi
st>(this, type, name); | 1041 return ensureRareData().ensureNodeLists().addCacheWithAtomicName<RadioNodeLi
st>(this, type, name); |
| 1042 } | 1042 } |
| 1043 | 1043 |
| 1044 #ifndef NDEBUG | 1044 #ifndef NDEBUG |
| 1045 bool childAttachedAllowedWhenAttachingChildren(ContainerNode* node) | 1045 bool childAttachedAllowedWhenAttachingChildren(ContainerNode* node) |
| 1046 { | 1046 { |
| 1047 if (node->isShadowRoot()) | 1047 if (node->isShadowRoot()) |
| 1048 return true; | 1048 return true; |
| 1049 | 1049 |
| 1050 if (node->isInsertionPoint()) | 1050 if (node->isInsertionPoint()) |
| 1051 return true; | 1051 return true; |
| 1052 | 1052 |
| 1053 if (node->isElementNode() && toElement(node)->shadow()) | 1053 if (node->isElementNode() && toElement(node)->shadow()) |
| 1054 return true; | 1054 return true; |
| 1055 | 1055 |
| 1056 return false; | 1056 return false; |
| 1057 } | 1057 } |
| 1058 #endif | 1058 #endif |
| 1059 | 1059 |
| 1060 } // namespace WebCore | 1060 } // namespace WebCore |
| OLD | NEW |