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, 2010, 2011 Apple Inc. All r
ights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. |
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 #include "HTMLNames.h" | 28 #include "HTMLNames.h" |
29 #include "XMLNames.h" | 29 #include "XMLNames.h" |
30 #include "bindings/v8/ExceptionState.h" | 30 #include "bindings/v8/ExceptionState.h" |
31 #include "bindings/v8/ScriptCallStackFactory.h" | 31 #include "bindings/v8/ScriptCallStackFactory.h" |
32 #include "core/accessibility/AXObjectCache.h" | 32 #include "core/accessibility/AXObjectCache.h" |
33 #include "core/dom/Attr.h" | 33 #include "core/dom/Attr.h" |
34 #include "core/dom/Attribute.h" | 34 #include "core/dom/Attribute.h" |
35 #include "core/dom/ChildListMutationScope.h" | 35 #include "core/dom/ChildListMutationScope.h" |
36 #include "core/dom/ChildNodeList.h" | 36 #include "core/dom/ChildNodeList.h" |
37 #include "core/dom/ClassNodeList.h" | |
38 #include "core/dom/DOMImplementation.h" | 37 #include "core/dom/DOMImplementation.h" |
39 #include "core/dom/Document.h" | 38 #include "core/dom/Document.h" |
40 #include "core/dom/DocumentFragment.h" | 39 #include "core/dom/DocumentFragment.h" |
41 #include "core/dom/DocumentMarkerController.h" | 40 #include "core/dom/DocumentMarkerController.h" |
42 #include "core/dom/DocumentType.h" | 41 #include "core/dom/DocumentType.h" |
43 #include "core/dom/Element.h" | 42 #include "core/dom/Element.h" |
44 #include "core/dom/ElementRareData.h" | 43 #include "core/dom/ElementRareData.h" |
45 #include "core/dom/ExceptionCode.h" | 44 #include "core/dom/ExceptionCode.h" |
46 #include "core/dom/LiveNodeList.h" | 45 #include "core/dom/LiveNodeList.h" |
47 #include "core/dom/NameNodeList.h" | |
48 #include "core/dom/NodeRareData.h" | 46 #include "core/dom/NodeRareData.h" |
49 #include "core/dom/NodeTraversal.h" | 47 #include "core/dom/NodeTraversal.h" |
50 #include "core/dom/ProcessingInstruction.h" | 48 #include "core/dom/ProcessingInstruction.h" |
51 #include "core/dom/Range.h" | 49 #include "core/dom/Range.h" |
52 #include "core/dom/SelectorQuery.h" | 50 #include "core/dom/SelectorQuery.h" |
53 #include "core/dom/StaticNodeList.h" | 51 #include "core/dom/StaticNodeList.h" |
54 #include "core/dom/TagNodeList.h" | 52 #include "core/dom/TagNodeList.h" |
55 #include "core/dom/TemplateContentDocumentFragment.h" | 53 #include "core/dom/TemplateContentDocumentFragment.h" |
56 #include "core/dom/Text.h" | 54 #include "core/dom/Text.h" |
57 #include "core/dom/TreeScopeAdopter.h" | 55 #include "core/dom/TreeScopeAdopter.h" |
(...skipping 14 matching lines...) Expand all Loading... |
72 #include "core/events/MutationEvent.h" | 70 #include "core/events/MutationEvent.h" |
73 #include "core/events/TextEvent.h" | 71 #include "core/events/TextEvent.h" |
74 #include "core/events/ThreadLocalEventNames.h" | 72 #include "core/events/ThreadLocalEventNames.h" |
75 #include "core/events/TouchEvent.h" | 73 #include "core/events/TouchEvent.h" |
76 #include "core/events/UIEvent.h" | 74 #include "core/events/UIEvent.h" |
77 #include "core/events/WheelEvent.h" | 75 #include "core/events/WheelEvent.h" |
78 #include "core/html/HTMLAnchorElement.h" | 76 #include "core/html/HTMLAnchorElement.h" |
79 #include "core/html/HTMLDialogElement.h" | 77 #include "core/html/HTMLDialogElement.h" |
80 #include "core/html/HTMLFrameOwnerElement.h" | 78 #include "core/html/HTMLFrameOwnerElement.h" |
81 #include "core/html/HTMLStyleElement.h" | 79 #include "core/html/HTMLStyleElement.h" |
82 #include "core/html/RadioNodeList.h" | |
83 #include "core/page/ContextMenuController.h" | 80 #include "core/page/ContextMenuController.h" |
84 #include "core/page/EventHandler.h" | 81 #include "core/page/EventHandler.h" |
85 #include "core/frame/Frame.h" | 82 #include "core/frame/Frame.h" |
86 #include "core/page/Page.h" | 83 #include "core/page/Page.h" |
87 #include "core/frame/Settings.h" | 84 #include "core/frame/Settings.h" |
88 #include "core/rendering/FlowThreadController.h" | 85 #include "core/rendering/FlowThreadController.h" |
89 #include "core/rendering/RenderBox.h" | 86 #include "core/rendering/RenderBox.h" |
90 #include "core/svg/graphics/SVGImage.h" | 87 #include "core/svg/graphics/SVGImage.h" |
91 #include "platform/Partitions.h" | 88 #include "platform/Partitions.h" |
92 #include "wtf/HashSet.h" | 89 #include "wtf/HashSet.h" |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 return String(); | 350 return String(); |
354 } | 351 } |
355 | 352 |
356 void Node::setNodeValue(const String&) | 353 void Node::setNodeValue(const String&) |
357 { | 354 { |
358 // By default, setting nodeValue has no effect. | 355 // By default, setting nodeValue has no effect. |
359 } | 356 } |
360 | 357 |
361 PassRefPtr<NodeList> Node::childNodes() | 358 PassRefPtr<NodeList> Node::childNodes() |
362 { | 359 { |
363 return ensureRareData().ensureNodeLists().ensureChildNodeList(this); | 360 if (isContainerNode()) |
| 361 return ensureRareData().ensureNodeLists().ensureChildNodeList(toContaine
rNode(this)); |
| 362 return ensureRareData().ensureNodeLists().ensureEmptyChildNodeList(this); |
364 } | 363 } |
365 | 364 |
366 Node& Node::lastDescendant() const | 365 Node& Node::lastDescendant() const |
367 { | 366 { |
368 Node* n = const_cast<Node*>(this); | 367 Node* n = const_cast<Node*>(this); |
369 while (n && n->lastChild()) | 368 while (n && n->lastChild()) |
370 n = n->lastChild(); | 369 n = n->lastChild(); |
371 ASSERT(n); | 370 ASSERT(n); |
372 return *n; | 371 return *n; |
373 } | 372 } |
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1251 return result; | 1250 return result; |
1252 } | 1251 } |
1253 | 1252 |
1254 bool Node::inSameContainingBlockFlowElement(Node *n) | 1253 bool Node::inSameContainingBlockFlowElement(Node *n) |
1255 { | 1254 { |
1256 return n ? enclosingBlockFlowElement() == n->enclosingBlockFlowElement() : f
alse; | 1255 return n ? enclosingBlockFlowElement() == n->enclosingBlockFlowElement() : f
alse; |
1257 } | 1256 } |
1258 | 1257 |
1259 // FIXME: End of obviously misplaced HTML editing functions. Try to move these
out of Node. | 1258 // FIXME: End of obviously misplaced HTML editing functions. Try to move these
out of Node. |
1260 | 1259 |
1261 PassRefPtr<NodeList> Node::getElementsByTagName(const AtomicString& localName) | |
1262 { | |
1263 if (localName.isNull()) | |
1264 return 0; | |
1265 | |
1266 if (document().isHTMLDocument()) | |
1267 return ensureRareData().ensureNodeLists().addCacheWithAtomicName<HTMLTag
NodeList>(this, HTMLTagNodeListType, localName); | |
1268 return ensureRareData().ensureNodeLists().addCacheWithAtomicName<TagNodeList
>(this, TagNodeListType, localName); | |
1269 } | |
1270 | |
1271 PassRefPtr<NodeList> Node::getElementsByTagNameNS(const AtomicString& namespaceU
RI, const AtomicString& localName) | |
1272 { | |
1273 if (localName.isNull()) | |
1274 return 0; | |
1275 | |
1276 if (namespaceURI == starAtom) | |
1277 return getElementsByTagName(localName); | |
1278 | |
1279 return ensureRareData().ensureNodeLists().addCacheWithQualifiedName(this, na
mespaceURI.isEmpty() ? nullAtom : namespaceURI, localName); | |
1280 } | |
1281 | |
1282 // Takes an AtomicString in argument because it is common for elements to share
the same name attribute. | |
1283 // Therefore, the NameNodeList factory function expects an AtomicString type. | |
1284 PassRefPtr<NodeList> Node::getElementsByName(const AtomicString& elementName) | |
1285 { | |
1286 return ensureRareData().ensureNodeLists().addCacheWithAtomicName<NameNodeLis
t>(this, NameNodeListType, elementName); | |
1287 } | |
1288 | |
1289 // Takes an AtomicString in argument because it is common for elements to share
the same set of class names. | |
1290 // Therefore, the ClassNodeList factory function expects an AtomicString type. | |
1291 PassRefPtr<NodeList> Node::getElementsByClassName(const AtomicString& classNames
) | |
1292 { | |
1293 return ensureRareData().ensureNodeLists().addCacheWithAtomicName<ClassNodeLi
st>(this, ClassNodeListType, classNames); | |
1294 } | |
1295 | |
1296 PassRefPtr<RadioNodeList> Node::radioNodeList(const AtomicString& name, bool onl
yMatchImgElements) | |
1297 { | |
1298 ASSERT(hasTagName(formTag) || hasTagName(fieldsetTag)); | |
1299 CollectionType type = onlyMatchImgElements ? RadioImgNodeListType : RadioNod
eListType; | |
1300 return ensureRareData().ensureNodeLists().addCacheWithAtomicName<RadioNodeLi
st>(this, type, name); | |
1301 } | |
1302 | |
1303 PassRefPtr<Element> Node::querySelector(const AtomicString& selectors, Exception
State& exceptionState) | 1260 PassRefPtr<Element> Node::querySelector(const AtomicString& selectors, Exception
State& exceptionState) |
1304 { | 1261 { |
1305 if (selectors.isEmpty()) { | 1262 if (selectors.isEmpty()) { |
1306 exceptionState.throwDOMException(SyntaxError, "The provided selector is
empty."); | 1263 exceptionState.throwDOMException(SyntaxError, "The provided selector is
empty."); |
1307 return 0; | 1264 return 0; |
1308 } | 1265 } |
1309 | 1266 |
1310 SelectorQuery* selectorQuery = document().selectorQueryCache().add(selectors
, document(), exceptionState); | 1267 SelectorQuery* selectorQuery = document().selectorQueryCache().add(selectors
, document(), exceptionState); |
1311 if (!selectorQuery) | 1268 if (!selectorQuery) |
1312 return 0; | 1269 return 0; |
(...skipping 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2631 node->showTreeForThis(); | 2588 node->showTreeForThis(); |
2632 } | 2589 } |
2633 | 2590 |
2634 void showNodePath(const WebCore::Node* node) | 2591 void showNodePath(const WebCore::Node* node) |
2635 { | 2592 { |
2636 if (node) | 2593 if (node) |
2637 node->showNodePathForThis(); | 2594 node->showNodePathForThis(); |
2638 } | 2595 } |
2639 | 2596 |
2640 #endif | 2597 #endif |
OLD | NEW |