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