| Index: Source/web/WebNode.cpp
|
| diff --git a/Source/web/WebNode.cpp b/Source/web/WebNode.cpp
|
| index e1a768f8d84da5bacabf4e56ab4f4e1741940400..1fafc90fbd23ca0b8a3d01115a09fc2cbde97d75 100644
|
| --- a/Source/web/WebNode.cpp
|
| +++ b/Source/web/WebNode.cpp
|
| @@ -36,6 +36,7 @@
|
| #include "core/dom/Element.h"
|
| #include "core/dom/Node.h"
|
| #include "core/dom/NodeList.h"
|
| +#include "core/dom/StaticNodeList.h"
|
| #include "core/dom/TagCollection.h"
|
| #include "core/editing/serializers/Serialization.h"
|
| #include "core/events/Event.h"
|
| @@ -241,16 +242,32 @@ WebElementCollection WebNode::getElementsByHTMLTagName(const WebString& tag) con
|
| return WebElementCollection();
|
| }
|
|
|
| -WebElement WebNode::querySelector(const WebString& tag, WebExceptionCode& ec) const
|
| +WebElement WebNode::querySelector(const WebString& selector, WebExceptionCode& ec) const
|
| {
|
| + if (!m_private->isContainerNode())
|
| + return WebElement();
|
| TrackExceptionState exceptionState;
|
| - WebElement element;
|
| - if (m_private->isContainerNode())
|
| - element = toContainerNode(m_private.get())->querySelector(tag, exceptionState);
|
| + WebElement element = toContainerNode(m_private.get())->querySelector(selector, exceptionState);
|
| ec = exceptionState.code();
|
| return element;
|
| }
|
|
|
| +void WebNode::querySelectorAll(const WebString& selector, WebExceptionCode& ec, WebVector<WebElement>& results) const
|
| +{
|
| + if (!m_private->isContainerNode())
|
| + return;
|
| + TrackExceptionState exceptionState;
|
| + RefPtrWillBeRawPtr<StaticElementList> elements = toContainerNode(m_private.get())->querySelectorAll(selector, exceptionState);
|
| + ec = exceptionState.code();
|
| + if (exceptionState.hadException())
|
| + return;
|
| + Vector<WebElement> temp;
|
| + temp.reserveCapacity(elements->length());
|
| + for (unsigned i = 0; i < elements->length(); ++i)
|
| + temp.append(WebElement(elements->item(i)));
|
| + results.assign(temp);
|
| +}
|
| +
|
| bool WebNode::focused() const
|
| {
|
| return m_private->focused();
|
|
|