| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 4 * Copyright (C) 2009 Joseph Pecoraro | 4 * Copyright (C) 2009 Joseph Pecoraro |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "bindings/v8/ExceptionState.h" | 34 #include "bindings/v8/ExceptionState.h" |
| 35 #include "bindings/v8/ScriptEventListener.h" | 35 #include "bindings/v8/ScriptEventListener.h" |
| 36 #include "core/dom/Attr.h" | 36 #include "core/dom/Attr.h" |
| 37 #include "core/dom/CharacterData.h" | 37 #include "core/dom/CharacterData.h" |
| 38 #include "core/dom/ContainerNode.h" | 38 #include "core/dom/ContainerNode.h" |
| 39 #include "core/dom/DOMException.h" | 39 #include "core/dom/DOMException.h" |
| 40 #include "core/dom/Document.h" | 40 #include "core/dom/Document.h" |
| 41 #include "core/dom/DocumentFragment.h" | 41 #include "core/dom/DocumentFragment.h" |
| 42 #include "core/dom/DocumentType.h" | 42 #include "core/dom/DocumentType.h" |
| 43 #include "core/dom/Element.h" | 43 #include "core/dom/Element.h" |
| 44 #include "core/events/EventListener.h" | |
| 45 #include "core/events/EventTarget.h" | |
| 46 #include "core/dom/Node.h" | 44 #include "core/dom/Node.h" |
| 47 #include "core/dom/NodeList.h" | |
| 48 #include "core/dom/NodeTraversal.h" | 45 #include "core/dom/NodeTraversal.h" |
| 49 #include "core/dom/PseudoElement.h" | 46 #include "core/dom/PseudoElement.h" |
| 47 #include "core/dom/StaticNodeList.h" |
| 50 #include "core/dom/Text.h" | 48 #include "core/dom/Text.h" |
| 51 #include "core/dom/shadow/ElementShadow.h" | 49 #include "core/dom/shadow/ElementShadow.h" |
| 52 #include "core/dom/shadow/ShadowRoot.h" | 50 #include "core/dom/shadow/ShadowRoot.h" |
| 53 #include "core/editing/markup.h" | 51 #include "core/editing/markup.h" |
| 52 #include "core/events/EventListener.h" |
| 53 #include "core/events/EventTarget.h" |
| 54 #include "core/fileapi/File.h" | 54 #include "core/fileapi/File.h" |
| 55 #include "core/fileapi/FileList.h" | 55 #include "core/fileapi/FileList.h" |
| 56 #include "core/frame/LocalFrame.h" | 56 #include "core/frame/LocalFrame.h" |
| 57 #include "core/html/HTMLFrameOwnerElement.h" | 57 #include "core/html/HTMLFrameOwnerElement.h" |
| 58 #include "core/html/HTMLInputElement.h" | 58 #include "core/html/HTMLInputElement.h" |
| 59 #include "core/html/HTMLLinkElement.h" | 59 #include "core/html/HTMLLinkElement.h" |
| 60 #include "core/html/HTMLTemplateElement.h" | 60 #include "core/html/HTMLTemplateElement.h" |
| 61 #include "core/html/imports/HTMLImportChild.h" | 61 #include "core/html/imports/HTMLImportChild.h" |
| 62 #include "core/html/imports/HTMLImportLoader.h" | 62 #include "core/html/imports/HTMLImportLoader.h" |
| 63 #include "core/inspector/DOMEditor.h" | 63 #include "core/inspector/DOMEditor.h" |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 *elementId = pushNodePathToFrontend(element.get()); | 614 *elementId = pushNodePathToFrontend(element.get()); |
| 615 } | 615 } |
| 616 | 616 |
| 617 void InspectorDOMAgent::querySelectorAll(ErrorString* errorString, int nodeId, c
onst String& selectors, RefPtr<TypeBuilder::Array<int> >& result) | 617 void InspectorDOMAgent::querySelectorAll(ErrorString* errorString, int nodeId, c
onst String& selectors, RefPtr<TypeBuilder::Array<int> >& result) |
| 618 { | 618 { |
| 619 Node* node = assertNode(errorString, nodeId); | 619 Node* node = assertNode(errorString, nodeId); |
| 620 if (!node || !node->isContainerNode()) | 620 if (!node || !node->isContainerNode()) |
| 621 return; | 621 return; |
| 622 | 622 |
| 623 TrackExceptionState exceptionState; | 623 TrackExceptionState exceptionState; |
| 624 RefPtrWillBeRawPtr<NodeList> nodes = toContainerNode(node)->querySelectorAll
(AtomicString(selectors), exceptionState); | 624 RefPtrWillBeRawPtr<StaticNodeList> nodes = toContainerNode(node)->querySelec
torAll(AtomicString(selectors), exceptionState); |
| 625 if (exceptionState.hadException()) { | 625 if (exceptionState.hadException()) { |
| 626 *errorString = "DOM Error while querying"; | 626 *errorString = "DOM Error while querying"; |
| 627 return; | 627 return; |
| 628 } | 628 } |
| 629 | 629 |
| 630 result = TypeBuilder::Array<int>::create(); | 630 result = TypeBuilder::Array<int>::create(); |
| 631 | 631 |
| 632 for (unsigned i = 0; i < nodes->length(); ++i) | 632 for (unsigned i = 0; i < nodes->length(); ++i) |
| 633 result->addItem(pushNodePathToFrontend(nodes->item(i))); | 633 result->addItem(pushNodePathToFrontend(nodes->item(i))); |
| 634 } | 634 } |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1025 if (node->nodeType() == Node::ATTRIBUTE_NODE) | 1025 if (node->nodeType() == Node::ATTRIBUTE_NODE) |
| 1026 node = toAttr(node)->ownerElement(); | 1026 node = toAttr(node)->ownerElement(); |
| 1027 resultCollector.add(node); | 1027 resultCollector.add(node); |
| 1028 } | 1028 } |
| 1029 } | 1029 } |
| 1030 | 1030 |
| 1031 // Selector evaluation | 1031 // Selector evaluation |
| 1032 for (Vector<Document*>::iterator it = docs.begin(); it != docs.end(); ++
it) { | 1032 for (Vector<Document*>::iterator it = docs.begin(); it != docs.end(); ++
it) { |
| 1033 Document* document = *it; | 1033 Document* document = *it; |
| 1034 TrackExceptionState exceptionState; | 1034 TrackExceptionState exceptionState; |
| 1035 RefPtrWillBeRawPtr<NodeList> nodeList = document->querySelectorAll(A
tomicString(whitespaceTrimmedQuery), exceptionState); | 1035 RefPtrWillBeRawPtr<StaticNodeList> nodeList = document->querySelecto
rAll(AtomicString(whitespaceTrimmedQuery), exceptionState); |
| 1036 if (exceptionState.hadException() || !nodeList) | 1036 if (exceptionState.hadException() || !nodeList) |
| 1037 continue; | 1037 continue; |
| 1038 | 1038 |
| 1039 unsigned size = nodeList->length(); | 1039 unsigned size = nodeList->length(); |
| 1040 for (unsigned i = 0; i < size; ++i) | 1040 for (unsigned i = 0; i < size; ++i) |
| 1041 resultCollector.add(nodeList->item(i)); | 1041 resultCollector.add(nodeList->item(i)); |
| 1042 } | 1042 } |
| 1043 } | 1043 } |
| 1044 | 1044 |
| 1045 *searchId = IdentifiersFactory::createIdentifier(); | 1045 *searchId = IdentifiersFactory::createIdentifier(); |
| (...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2098 if (!m_documentNodeToIdMap->contains(m_document.get())) { | 2098 if (!m_documentNodeToIdMap->contains(m_document.get())) { |
| 2099 RefPtr<TypeBuilder::DOM::Node> root; | 2099 RefPtr<TypeBuilder::DOM::Node> root; |
| 2100 getDocument(errorString, root); | 2100 getDocument(errorString, root); |
| 2101 return errorString->isEmpty(); | 2101 return errorString->isEmpty(); |
| 2102 } | 2102 } |
| 2103 return true; | 2103 return true; |
| 2104 } | 2104 } |
| 2105 | 2105 |
| 2106 } // namespace WebCore | 2106 } // namespace WebCore |
| 2107 | 2107 |
| OLD | NEW |