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 17 matching lines...) Expand all Loading... |
28 #include "core/dom/ClassNodeList.h" | 28 #include "core/dom/ClassNodeList.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/events/MutationEvent.h" | 39 #include "core/events/MutationEvent.h" |
39 #include "core/events/ThreadLocalEventNames.h" | 40 #include "core/events/ThreadLocalEventNames.h" |
40 #include "core/html/HTMLCollection.h" | 41 #include "core/html/HTMLCollection.h" |
41 #include "core/html/RadioNodeList.h" | 42 #include "core/html/RadioNodeList.h" |
42 #include "core/rendering/InlineTextBox.h" | 43 #include "core/rendering/InlineTextBox.h" |
43 #include "core/rendering/RenderText.h" | 44 #include "core/rendering/RenderText.h" |
44 #include "core/rendering/RenderTheme.h" | 45 #include "core/rendering/RenderTheme.h" |
45 #include "core/rendering/RenderView.h" | 46 #include "core/rendering/RenderView.h" |
46 #include "core/rendering/RenderWidget.h" | 47 #include "core/rendering/RenderWidget.h" |
47 | 48 |
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
903 | 904 |
904 Node *ContainerNode::childNode(unsigned index) const | 905 Node *ContainerNode::childNode(unsigned index) const |
905 { | 906 { |
906 unsigned i; | 907 unsigned i; |
907 Node *n = firstChild(); | 908 Node *n = firstChild(); |
908 for (i = 0; n != 0 && i < index; i++) | 909 for (i = 0; n != 0 && i < index; i++) |
909 n = n->nextSibling(); | 910 n = n->nextSibling(); |
910 return n; | 911 return n; |
911 } | 912 } |
912 | 913 |
| 914 PassRefPtr<Element> ContainerNode::querySelector(const AtomicString& selectors,
ExceptionState& exceptionState) |
| 915 { |
| 916 if (selectors.isEmpty()) { |
| 917 exceptionState.throwDOMException(SyntaxError, "The provided selector is
empty."); |
| 918 return 0; |
| 919 } |
| 920 |
| 921 SelectorQuery* selectorQuery = document().selectorQueryCache().add(selectors
, document(), exceptionState); |
| 922 if (!selectorQuery) |
| 923 return 0; |
| 924 return selectorQuery->queryFirst(*this); |
| 925 } |
| 926 |
| 927 PassRefPtr<NodeList> ContainerNode::querySelectorAll(const AtomicString& selecto
rs, ExceptionState& exceptionState) |
| 928 { |
| 929 if (selectors.isEmpty()) { |
| 930 exceptionState.throwDOMException(SyntaxError, "The provided selector is
empty."); |
| 931 return 0; |
| 932 } |
| 933 |
| 934 SelectorQuery* selectorQuery = document().selectorQueryCache().add(selectors
, document(), exceptionState); |
| 935 if (!selectorQuery) |
| 936 return 0; |
| 937 return selectorQuery->queryAll(*this); |
| 938 } |
| 939 |
913 static void dispatchChildInsertionEvents(Node& child) | 940 static void dispatchChildInsertionEvents(Node& child) |
914 { | 941 { |
915 if (child.isInShadowTree()) | 942 if (child.isInShadowTree()) |
916 return; | 943 return; |
917 | 944 |
918 ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden()); | 945 ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden()); |
919 | 946 |
920 RefPtr<Node> c(child); | 947 RefPtr<Node> c(child); |
921 RefPtr<Document> document(child.document()); | 948 RefPtr<Document> document(child.document()); |
922 | 949 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1024 return true; | 1051 return true; |
1025 | 1052 |
1026 if (node->isElementNode() && toElement(node)->shadow()) | 1053 if (node->isElementNode() && toElement(node)->shadow()) |
1027 return true; | 1054 return true; |
1028 | 1055 |
1029 return false; | 1056 return false; |
1030 } | 1057 } |
1031 #endif | 1058 #endif |
1032 | 1059 |
1033 } // namespace WebCore | 1060 } // namespace WebCore |
OLD | NEW |