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 "core/dom/ExceptionCode.h" | 32 #include "core/dom/ExceptionCode.h" |
33 #include "core/dom/FullscreenElementStack.h" | 33 #include "core/dom/FullscreenElementStack.h" |
34 #include "core/dom/NameNodeList.h" | 34 #include "core/dom/NameNodeList.h" |
35 #include "core/dom/NoEventDispatchAssertion.h" | 35 #include "core/dom/NoEventDispatchAssertion.h" |
36 #include "core/dom/NodeChildRemovalTracker.h" | 36 #include "core/dom/NodeChildRemovalTracker.h" |
37 #include "core/dom/NodeRareData.h" | 37 #include "core/dom/NodeRareData.h" |
38 #include "core/dom/NodeRenderStyle.h" | 38 #include "core/dom/NodeRenderStyle.h" |
39 #include "core/dom/NodeTraversal.h" | 39 #include "core/dom/NodeTraversal.h" |
40 #include "core/dom/ScriptForbiddenScope.h" | 40 #include "core/dom/ScriptForbiddenScope.h" |
41 #include "core/dom/SelectorQuery.h" | 41 #include "core/dom/SelectorQuery.h" |
| 42 #include "core/dom/StaticNodeList.h" |
42 #include "core/dom/shadow/ElementShadow.h" | 43 #include "core/dom/shadow/ElementShadow.h" |
43 #include "core/dom/shadow/ShadowRoot.h" | 44 #include "core/dom/shadow/ShadowRoot.h" |
44 #include "core/events/MutationEvent.h" | 45 #include "core/events/MutationEvent.h" |
45 #include "core/html/HTMLCollection.h" | 46 #include "core/html/HTMLCollection.h" |
46 #include "core/html/HTMLFrameOwnerElement.h" | 47 #include "core/html/HTMLFrameOwnerElement.h" |
47 #include "core/html/RadioNodeList.h" | 48 #include "core/html/RadioNodeList.h" |
48 #include "core/inspector/InspectorInstrumentation.h" | 49 #include "core/inspector/InspectorInstrumentation.h" |
49 #include "core/rendering/InlineTextBox.h" | 50 #include "core/rendering/InlineTextBox.h" |
50 #include "core/rendering/RenderText.h" | 51 #include "core/rendering/RenderText.h" |
51 #include "core/rendering/RenderTheme.h" | 52 #include "core/rendering/RenderTheme.h" |
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 exceptionState.throwDOMException(SyntaxError, "The provided selector is
empty."); | 1015 exceptionState.throwDOMException(SyntaxError, "The provided selector is
empty."); |
1015 return nullptr; | 1016 return nullptr; |
1016 } | 1017 } |
1017 | 1018 |
1018 SelectorQuery* selectorQuery = document().selectorQueryCache().add(selectors
, document(), exceptionState); | 1019 SelectorQuery* selectorQuery = document().selectorQueryCache().add(selectors
, document(), exceptionState); |
1019 if (!selectorQuery) | 1020 if (!selectorQuery) |
1020 return nullptr; | 1021 return nullptr; |
1021 return selectorQuery->queryFirst(*this); | 1022 return selectorQuery->queryFirst(*this); |
1022 } | 1023 } |
1023 | 1024 |
1024 PassRefPtrWillBeRawPtr<NodeList> ContainerNode::querySelectorAll(const AtomicStr
ing& selectors, ExceptionState& exceptionState) | 1025 PassRefPtrWillBeRawPtr<StaticNodeList> ContainerNode::querySelectorAll(const Ato
micString& selectors, ExceptionState& exceptionState) |
1025 { | 1026 { |
1026 if (selectors.isEmpty()) { | 1027 if (selectors.isEmpty()) { |
1027 exceptionState.throwDOMException(SyntaxError, "The provided selector is
empty."); | 1028 exceptionState.throwDOMException(SyntaxError, "The provided selector is
empty."); |
1028 return nullptr; | 1029 return nullptr; |
1029 } | 1030 } |
1030 | 1031 |
1031 SelectorQuery* selectorQuery = document().selectorQueryCache().add(selectors
, document(), exceptionState); | 1032 SelectorQuery* selectorQuery = document().selectorQueryCache().add(selectors
, document(), exceptionState); |
1032 if (!selectorQuery) | 1033 if (!selectorQuery) |
1033 return nullptr; | 1034 return nullptr; |
1034 | 1035 |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1206 } | 1207 } |
1207 | 1208 |
1208 // The + selector. We need to invalidate the first element following the ins
ertion point. It is the only possible element | 1209 // The + selector. We need to invalidate the first element following the ins
ertion point. It is the only possible element |
1209 // that could be affected by this DOM change. | 1210 // that could be affected by this DOM change. |
1210 if (childrenAffectedByDirectAdjacentRules() && afterChange) { | 1211 if (childrenAffectedByDirectAdjacentRules() && afterChange) { |
1211 if (Node* firstElementAfterInsertion = afterChange->isElementNode() ? af
terChange : ElementTraversal::nextSibling(*afterChange)) | 1212 if (Node* firstElementAfterInsertion = afterChange->isElementNode() ? af
terChange : ElementTraversal::nextSibling(*afterChange)) |
1212 firstElementAfterInsertion->setNeedsStyleRecalc(SubtreeStyleChange); | 1213 firstElementAfterInsertion->setNeedsStyleRecalc(SubtreeStyleChange); |
1213 } | 1214 } |
1214 } | 1215 } |
1215 | 1216 |
1216 PassRefPtrWillBeRawPtr<HTMLCollection> ContainerNode::getElementsByTagName(const
AtomicString& localName) | 1217 PassRefPtrWillBeRawPtr<TagCollection> ContainerNode::getElementsByTagName(const
AtomicString& localName) |
1217 { | 1218 { |
1218 if (localName.isNull()) | 1219 if (localName.isNull()) |
1219 return nullptr; | 1220 return nullptr; |
1220 | 1221 |
1221 if (document().isHTMLDocument()) | 1222 if (document().isHTMLDocument()) |
1222 return ensureRareData().ensureNodeLists().addCache<HTMLTagCollection>(*t
his, HTMLTagCollectionType, localName); | 1223 return ensureRareData().ensureNodeLists().addCache<HTMLTagCollection>(*t
his, HTMLTagCollectionType, localName); |
1223 return ensureRareData().ensureNodeLists().addCache<TagCollection>(*this, Tag
CollectionType, localName); | 1224 return ensureRareData().ensureNodeLists().addCache<TagCollection>(*this, Tag
CollectionType, localName); |
1224 } | 1225 } |
1225 | 1226 |
1226 PassRefPtrWillBeRawPtr<HTMLCollection> ContainerNode::getElementsByTagNameNS(con
st AtomicString& namespaceURI, const AtomicString& localName) | 1227 PassRefPtrWillBeRawPtr<TagCollection> ContainerNode::getElementsByTagNameNS(cons
t AtomicString& namespaceURI, const AtomicString& localName) |
1227 { | 1228 { |
1228 if (localName.isNull()) | 1229 if (localName.isNull()) |
1229 return nullptr; | 1230 return nullptr; |
1230 | 1231 |
1231 if (namespaceURI == starAtom) | 1232 if (namespaceURI == starAtom) |
1232 return getElementsByTagName(localName); | 1233 return getElementsByTagName(localName); |
1233 | 1234 |
1234 return ensureRareData().ensureNodeLists().addCache(*this, namespaceURI.isEmp
ty() ? nullAtom : namespaceURI, localName); | 1235 return ensureRareData().ensureNodeLists().addCache(*this, namespaceURI.isEmp
ty() ? nullAtom : namespaceURI, localName); |
1235 } | 1236 } |
1236 | 1237 |
1237 // Takes an AtomicString in argument because it is common for elements to share
the same name attribute. | 1238 // Takes an AtomicString in argument because it is common for elements to share
the same name attribute. |
1238 // Therefore, the NameNodeList factory function expects an AtomicString type. | 1239 // Therefore, the NameNodeList factory function expects an AtomicString type. |
1239 PassRefPtrWillBeRawPtr<NodeList> ContainerNode::getElementsByName(const AtomicSt
ring& elementName) | 1240 PassRefPtrWillBeRawPtr<NameNodeList> ContainerNode::getElementsByName(const Atom
icString& elementName) |
1240 { | 1241 { |
1241 return ensureRareData().ensureNodeLists().addCache<NameNodeList>(*this, Name
NodeListType, elementName); | 1242 return ensureRareData().ensureNodeLists().addCache<NameNodeList>(*this, Name
NodeListType, elementName); |
1242 } | 1243 } |
1243 | 1244 |
1244 // Takes an AtomicString in argument because it is common for elements to share
the same set of class names. | 1245 // Takes an AtomicString in argument because it is common for elements to share
the same set of class names. |
1245 // Therefore, the ClassNodeList factory function expects an AtomicString type. | 1246 // Therefore, the ClassNodeList factory function expects an AtomicString type. |
1246 PassRefPtrWillBeRawPtr<HTMLCollection> ContainerNode::getElementsByClassName(con
st AtomicString& classNames) | 1247 PassRefPtrWillBeRawPtr<ClassCollection> ContainerNode::getElementsByClassName(co
nst AtomicString& classNames) |
1247 { | 1248 { |
1248 return ensureRareData().ensureNodeLists().addCache<ClassCollection>(*this, C
lassCollectionType, classNames); | 1249 return ensureRareData().ensureNodeLists().addCache<ClassCollection>(*this, C
lassCollectionType, classNames); |
1249 } | 1250 } |
1250 | 1251 |
1251 PassRefPtrWillBeRawPtr<RadioNodeList> ContainerNode::radioNodeList(const AtomicS
tring& name, bool onlyMatchImgElements) | 1252 PassRefPtrWillBeRawPtr<RadioNodeList> ContainerNode::radioNodeList(const AtomicS
tring& name, bool onlyMatchImgElements) |
1252 { | 1253 { |
1253 ASSERT(isHTMLFormElement(this) || isHTMLFieldSetElement(this)); | 1254 ASSERT(isHTMLFormElement(this) || isHTMLFieldSetElement(this)); |
1254 CollectionType type = onlyMatchImgElements ? RadioImgNodeListType : RadioNod
eListType; | 1255 CollectionType type = onlyMatchImgElements ? RadioImgNodeListType : RadioNod
eListType; |
1255 return ensureRareData().ensureNodeLists().addCache<RadioNodeList>(*this, typ
e, name); | 1256 return ensureRareData().ensureNodeLists().addCache<RadioNodeList>(*this, typ
e, name); |
1256 } | 1257 } |
(...skipping 28 matching lines...) Expand all Loading... |
1285 return true; | 1286 return true; |
1286 | 1287 |
1287 if (node->isElementNode() && toElement(node)->shadow()) | 1288 if (node->isElementNode() && toElement(node)->shadow()) |
1288 return true; | 1289 return true; |
1289 | 1290 |
1290 return false; | 1291 return false; |
1291 } | 1292 } |
1292 #endif | 1293 #endif |
1293 | 1294 |
1294 } // namespace WebCore | 1295 } // namespace WebCore |
OLD | NEW |