| 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 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 return; | 551 return; |
| 552 } | 552 } |
| 553 | 553 |
| 554 pushChildNodesToFrontend(nodeId, sanitizedDepth); | 554 pushChildNodesToFrontend(nodeId, sanitizedDepth); |
| 555 } | 555 } |
| 556 | 556 |
| 557 void InspectorDOMAgent::querySelector(ErrorString* errorString, int nodeId, cons
t String& selectors, int* elementId) | 557 void InspectorDOMAgent::querySelector(ErrorString* errorString, int nodeId, cons
t String& selectors, int* elementId) |
| 558 { | 558 { |
| 559 *elementId = 0; | 559 *elementId = 0; |
| 560 Node* node = assertNode(errorString, nodeId); | 560 Node* node = assertNode(errorString, nodeId); |
| 561 if (!node) | 561 if (!node || !node->isContainerNode()) |
| 562 return; | 562 return; |
| 563 | 563 |
| 564 TrackExceptionState exceptionState; | 564 TrackExceptionState exceptionState; |
| 565 RefPtr<Element> element = node->querySelector(AtomicString(selectors), excep
tionState); | 565 RefPtr<Element> element = toContainerNode(node)->querySelector(AtomicString(
selectors), exceptionState); |
| 566 if (exceptionState.hadException()) { | 566 if (exceptionState.hadException()) { |
| 567 *errorString = "DOM Error while querying"; | 567 *errorString = "DOM Error while querying"; |
| 568 return; | 568 return; |
| 569 } | 569 } |
| 570 | 570 |
| 571 if (element) | 571 if (element) |
| 572 *elementId = pushNodePathToFrontend(element.get()); | 572 *elementId = pushNodePathToFrontend(element.get()); |
| 573 } | 573 } |
| 574 | 574 |
| 575 void InspectorDOMAgent::querySelectorAll(ErrorString* errorString, int nodeId, c
onst String& selectors, RefPtr<TypeBuilder::Array<int> >& result) | 575 void InspectorDOMAgent::querySelectorAll(ErrorString* errorString, int nodeId, c
onst String& selectors, RefPtr<TypeBuilder::Array<int> >& result) |
| 576 { | 576 { |
| 577 Node* node = assertNode(errorString, nodeId); | 577 Node* node = assertNode(errorString, nodeId); |
| 578 if (!node) | 578 if (!node || !node->isContainerNode()) |
| 579 return; | 579 return; |
| 580 | 580 |
| 581 TrackExceptionState exceptionState; | 581 TrackExceptionState exceptionState; |
| 582 RefPtr<NodeList> nodes = node->querySelectorAll(AtomicString(selectors), exc
eptionState); | 582 RefPtr<NodeList> nodes = toContainerNode(node)->querySelectorAll(AtomicStrin
g(selectors), exceptionState); |
| 583 if (exceptionState.hadException()) { | 583 if (exceptionState.hadException()) { |
| 584 *errorString = "DOM Error while querying"; | 584 *errorString = "DOM Error while querying"; |
| 585 return; | 585 return; |
| 586 } | 586 } |
| 587 | 587 |
| 588 result = TypeBuilder::Array<int>::create(); | 588 result = TypeBuilder::Array<int>::create(); |
| 589 | 589 |
| 590 for (unsigned i = 0; i < nodes->length(); ++i) | 590 for (unsigned i = 0; i < nodes->length(); ++i) |
| 591 result->addItem(pushNodePathToFrontend(nodes->item(i))); | 591 result->addItem(pushNodePathToFrontend(nodes->item(i))); |
| 592 } | 592 } |
| (...skipping 1435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2028 if (!m_documentNodeToIdMap.contains(m_document)) { | 2028 if (!m_documentNodeToIdMap.contains(m_document)) { |
| 2029 RefPtr<TypeBuilder::DOM::Node> root; | 2029 RefPtr<TypeBuilder::DOM::Node> root; |
| 2030 getDocument(errorString, root); | 2030 getDocument(errorString, root); |
| 2031 return errorString->isEmpty(); | 2031 return errorString->isEmpty(); |
| 2032 } | 2032 } |
| 2033 return true; | 2033 return true; |
| 2034 } | 2034 } |
| 2035 | 2035 |
| 2036 } // namespace WebCore | 2036 } // namespace WebCore |
| 2037 | 2037 |
| OLD | NEW |