| 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, 2013 Apple Inc. All rights | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights |
| 6 * reserved. | 6 * reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "core/dom/ChildFrameDisconnector.h" | 27 #include "core/dom/ChildFrameDisconnector.h" |
| 28 #include "core/dom/ChildListMutationScope.h" | 28 #include "core/dom/ChildListMutationScope.h" |
| 29 #include "core/dom/ClassCollection.h" | 29 #include "core/dom/ClassCollection.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/NameNodeList.h" | 32 #include "core/dom/NameNodeList.h" |
| 33 #include "core/dom/NodeChildRemovalTracker.h" | 33 #include "core/dom/NodeChildRemovalTracker.h" |
| 34 #include "core/dom/NodeComputedStyle.h" | 34 #include "core/dom/NodeComputedStyle.h" |
| 35 #include "core/dom/NodeRareData.h" | 35 #include "core/dom/NodeRareData.h" |
| 36 #include "core/dom/NodeTraversal.h" | 36 #include "core/dom/NodeTraversal.h" |
| 37 #include "core/dom/NthIndexCache.h" | |
| 38 #include "core/dom/SelectorQuery.h" | 37 #include "core/dom/SelectorQuery.h" |
| 39 #include "core/dom/StaticNodeList.h" | 38 #include "core/dom/StaticNodeList.h" |
| 40 #include "core/dom/StyleChangeReason.h" | 39 #include "core/dom/StyleChangeReason.h" |
| 41 #include "core/dom/StyleEngine.h" | 40 #include "core/dom/StyleEngine.h" |
| 42 #include "core/dom/shadow/ElementShadow.h" | 41 #include "core/dom/shadow/ElementShadow.h" |
| 43 #include "core/dom/shadow/ShadowRoot.h" | 42 #include "core/dom/shadow/ShadowRoot.h" |
| 44 #include "core/events/MutationEvent.h" | 43 #include "core/events/MutationEvent.h" |
| 45 #include "core/frame/FrameView.h" | 44 #include "core/frame/FrameView.h" |
| 46 #include "core/html/HTMLCollection.h" | 45 #include "core/html/HTMLCollection.h" |
| 47 #include "core/html/HTMLFrameOwnerElement.h" | 46 #include "core/html/HTMLFrameOwnerElement.h" |
| (...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1166 | 1165 |
| 1167 unsigned ContainerNode::countChildren() const { | 1166 unsigned ContainerNode::countChildren() const { |
| 1168 unsigned count = 0; | 1167 unsigned count = 0; |
| 1169 for (Node* node = firstChild(); node; node = node->nextSibling()) | 1168 for (Node* node = firstChild(); node; node = node->nextSibling()) |
| 1170 count++; | 1169 count++; |
| 1171 return count; | 1170 return count; |
| 1172 } | 1171 } |
| 1173 | 1172 |
| 1174 Element* ContainerNode::querySelector(const AtomicString& selectors, | 1173 Element* ContainerNode::querySelector(const AtomicString& selectors, |
| 1175 ExceptionState& exceptionState) { | 1174 ExceptionState& exceptionState) { |
| 1176 if (selectors.isEmpty()) { | |
| 1177 exceptionState.throwDOMException(SyntaxError, | |
| 1178 "The provided selector is empty."); | |
| 1179 return nullptr; | |
| 1180 } | |
| 1181 | |
| 1182 SelectorQuery* selectorQuery = document().selectorQueryCache().add( | 1175 SelectorQuery* selectorQuery = document().selectorQueryCache().add( |
| 1183 selectors, document(), exceptionState); | 1176 selectors, document(), exceptionState); |
| 1184 if (!selectorQuery) | 1177 if (!selectorQuery) |
| 1185 return nullptr; | 1178 return nullptr; |
| 1186 | |
| 1187 NthIndexCache nthIndexCache(document()); | |
| 1188 return selectorQuery->queryFirst(*this); | 1179 return selectorQuery->queryFirst(*this); |
| 1189 } | 1180 } |
| 1190 | 1181 |
| 1191 StaticElementList* ContainerNode::querySelectorAll( | 1182 StaticElementList* ContainerNode::querySelectorAll( |
| 1192 const AtomicString& selectors, | 1183 const AtomicString& selectors, |
| 1193 ExceptionState& exceptionState) { | 1184 ExceptionState& exceptionState) { |
| 1194 if (selectors.isEmpty()) { | |
| 1195 exceptionState.throwDOMException(SyntaxError, | |
| 1196 "The provided selector is empty."); | |
| 1197 return nullptr; | |
| 1198 } | |
| 1199 | |
| 1200 SelectorQuery* selectorQuery = document().selectorQueryCache().add( | 1185 SelectorQuery* selectorQuery = document().selectorQueryCache().add( |
| 1201 selectors, document(), exceptionState); | 1186 selectors, document(), exceptionState); |
| 1202 if (!selectorQuery) | 1187 if (!selectorQuery) |
| 1203 return nullptr; | 1188 return nullptr; |
| 1204 | |
| 1205 NthIndexCache nthIndexCache(document()); | |
| 1206 return selectorQuery->queryAll(*this); | 1189 return selectorQuery->queryAll(*this); |
| 1207 } | 1190 } |
| 1208 | 1191 |
| 1209 static void dispatchChildInsertionEvents(Node& child) { | 1192 static void dispatchChildInsertionEvents(Node& child) { |
| 1210 if (child.isInShadowTree()) | 1193 if (child.isInShadowTree()) |
| 1211 return; | 1194 return; |
| 1212 | 1195 |
| 1213 #if DCHECK_IS_ON() | 1196 #if DCHECK_IS_ON() |
| 1214 DCHECK(!EventDispatchForbiddenScope::isEventDispatchForbidden()); | 1197 DCHECK(!EventDispatchForbiddenScope::isEventDispatchForbidden()); |
| 1215 #endif | 1198 #endif |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1501 return true; | 1484 return true; |
| 1502 | 1485 |
| 1503 if (node->isElementNode() && toElement(node)->shadow()) | 1486 if (node->isElementNode() && toElement(node)->shadow()) |
| 1504 return true; | 1487 return true; |
| 1505 | 1488 |
| 1506 return false; | 1489 return false; |
| 1507 } | 1490 } |
| 1508 #endif | 1491 #endif |
| 1509 | 1492 |
| 1510 } // namespace blink | 1493 } // namespace blink |
| OLD | NEW |