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 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
895 Node *n = firstChild(); | 895 Node *n = firstChild(); |
896 for (i = 0; n != 0 && i < index; i++) | 896 for (i = 0; n != 0 && i < index; i++) |
897 n = n->nextSibling(); | 897 n = n->nextSibling(); |
898 return n; | 898 return n; |
899 } | 899 } |
900 | 900 |
901 PassRefPtr<Element> ContainerNode::querySelector(const AtomicString& selectors,
ExceptionState& exceptionState) | 901 PassRefPtr<Element> ContainerNode::querySelector(const AtomicString& selectors,
ExceptionState& exceptionState) |
902 { | 902 { |
903 if (selectors.isEmpty()) { | 903 if (selectors.isEmpty()) { |
904 exceptionState.throwDOMException(SyntaxError, "The provided selector is
empty."); | 904 exceptionState.throwDOMException(SyntaxError, "The provided selector is
empty."); |
905 return 0; | 905 return nullptr; |
906 } | 906 } |
907 | 907 |
908 SelectorQuery* selectorQuery = document().selectorQueryCache().add(selectors
, document(), exceptionState); | 908 SelectorQuery* selectorQuery = document().selectorQueryCache().add(selectors
, document(), exceptionState); |
909 if (!selectorQuery) | 909 if (!selectorQuery) |
910 return 0; | 910 return nullptr; |
911 return selectorQuery->queryFirst(*this); | 911 return selectorQuery->queryFirst(*this); |
912 } | 912 } |
913 | 913 |
914 PassRefPtr<NodeList> ContainerNode::querySelectorAll(const AtomicString& selecto
rs, ExceptionState& exceptionState) | 914 PassRefPtr<NodeList> ContainerNode::querySelectorAll(const AtomicString& selecto
rs, ExceptionState& exceptionState) |
915 { | 915 { |
916 if (selectors.isEmpty()) { | 916 if (selectors.isEmpty()) { |
917 exceptionState.throwDOMException(SyntaxError, "The provided selector is
empty."); | 917 exceptionState.throwDOMException(SyntaxError, "The provided selector is
empty."); |
918 return 0; | 918 return nullptr; |
919 } | 919 } |
920 | 920 |
921 SelectorQuery* selectorQuery = document().selectorQueryCache().add(selectors
, document(), exceptionState); | 921 SelectorQuery* selectorQuery = document().selectorQueryCache().add(selectors
, document(), exceptionState); |
922 if (!selectorQuery) | 922 if (!selectorQuery) |
923 return 0; | 923 return nullptr; |
924 return selectorQuery->queryAll(*this); | 924 return selectorQuery->queryAll(*this); |
925 } | 925 } |
926 | 926 |
927 static void dispatchChildInsertionEvents(Node& child) | 927 static void dispatchChildInsertionEvents(Node& child) |
928 { | 928 { |
929 if (child.isInShadowTree()) | 929 if (child.isInShadowTree()) |
930 return; | 930 return; |
931 | 931 |
932 ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden()); | 932 ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden()); |
933 | 933 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 childrenChanged(false, child.previousSibling(), child.nextSibling(), 1); | 982 childrenChanged(false, child.previousSibling(), child.nextSibling(), 1); |
983 | 983 |
984 ChildNodeInsertionNotifier(*this).notify(child); | 984 ChildNodeInsertionNotifier(*this).notify(child); |
985 | 985 |
986 dispatchChildInsertionEvents(child); | 986 dispatchChildInsertionEvents(child); |
987 } | 987 } |
988 | 988 |
989 PassRefPtr<HTMLCollection> ContainerNode::getElementsByTagName(const AtomicStrin
g& localName) | 989 PassRefPtr<HTMLCollection> ContainerNode::getElementsByTagName(const AtomicStrin
g& localName) |
990 { | 990 { |
991 if (localName.isNull()) | 991 if (localName.isNull()) |
992 return 0; | 992 return nullptr; |
993 | 993 |
994 if (document().isHTMLDocument()) | 994 if (document().isHTMLDocument()) |
995 return ensureRareData().ensureNodeLists().addCache<HTMLTagCollection>(th
is, HTMLTagCollectionType, localName); | 995 return ensureRareData().ensureNodeLists().addCache<HTMLTagCollection>(th
is, HTMLTagCollectionType, localName); |
996 return ensureRareData().ensureNodeLists().addCache<TagCollection>(this, TagC
ollectionType, localName); | 996 return ensureRareData().ensureNodeLists().addCache<TagCollection>(this, TagC
ollectionType, localName); |
997 } | 997 } |
998 | 998 |
999 PassRefPtr<HTMLCollection> ContainerNode::getElementsByTagNameNS(const AtomicStr
ing& namespaceURI, const AtomicString& localName) | 999 PassRefPtr<HTMLCollection> ContainerNode::getElementsByTagNameNS(const AtomicStr
ing& namespaceURI, const AtomicString& localName) |
1000 { | 1000 { |
1001 if (localName.isNull()) | 1001 if (localName.isNull()) |
1002 return 0; | 1002 return nullptr; |
1003 | 1003 |
1004 if (namespaceURI == starAtom) | 1004 if (namespaceURI == starAtom) |
1005 return getElementsByTagName(localName); | 1005 return getElementsByTagName(localName); |
1006 | 1006 |
1007 return ensureRareData().ensureNodeLists().addCache(this, namespaceURI.isEmpt
y() ? nullAtom : namespaceURI, localName); | 1007 return ensureRareData().ensureNodeLists().addCache(this, namespaceURI.isEmpt
y() ? nullAtom : namespaceURI, localName); |
1008 } | 1008 } |
1009 | 1009 |
1010 // Takes an AtomicString in argument because it is common for elements to share
the same name attribute. | 1010 // Takes an AtomicString in argument because it is common for elements to share
the same name attribute. |
1011 // Therefore, the NameNodeList factory function expects an AtomicString type. | 1011 // Therefore, the NameNodeList factory function expects an AtomicString type. |
1012 PassRefPtr<NodeList> ContainerNode::getElementsByName(const AtomicString& elemen
tName) | 1012 PassRefPtr<NodeList> ContainerNode::getElementsByName(const AtomicString& elemen
tName) |
(...skipping 25 matching lines...) Expand all Loading... |
1038 return true; | 1038 return true; |
1039 | 1039 |
1040 if (node->isElementNode() && toElement(node)->shadow()) | 1040 if (node->isElementNode() && toElement(node)->shadow()) |
1041 return true; | 1041 return true; |
1042 | 1042 |
1043 return false; | 1043 return false; |
1044 } | 1044 } |
1045 #endif | 1045 #endif |
1046 | 1046 |
1047 } // namespace WebCore | 1047 } // namespace WebCore |
OLD | NEW |