| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "public/web/WebNode.h" | 32 #include "public/web/WebNode.h" |
| 33 | 33 |
| 34 #include "bindings/core/v8/ExceptionState.h" | 34 #include "bindings/core/v8/ExceptionState.h" |
| 35 #include "core/dom/Document.h" | 35 #include "core/dom/Document.h" |
| 36 #include "core/dom/Element.h" | 36 #include "core/dom/Element.h" |
| 37 #include "core/dom/Node.h" | 37 #include "core/dom/Node.h" |
| 38 #include "core/dom/NodeList.h" | 38 #include "core/dom/NodeList.h" |
| 39 #include "core/dom/StaticNodeList.h" |
| 39 #include "core/dom/TagCollection.h" | 40 #include "core/dom/TagCollection.h" |
| 40 #include "core/editing/serializers/Serialization.h" | 41 #include "core/editing/serializers/Serialization.h" |
| 41 #include "core/events/Event.h" | 42 #include "core/events/Event.h" |
| 42 #include "core/html/HTMLCollection.h" | 43 #include "core/html/HTMLCollection.h" |
| 43 #include "core/html/HTMLElement.h" | 44 #include "core/html/HTMLElement.h" |
| 44 #include "core/layout/LayoutObject.h" | 45 #include "core/layout/LayoutObject.h" |
| 45 #include "core/layout/LayoutPart.h" | 46 #include "core/layout/LayoutPart.h" |
| 46 #include "modules/accessibility/AXObject.h" | 47 #include "modules/accessibility/AXObject.h" |
| 47 #include "modules/accessibility/AXObjectCacheImpl.h" | 48 #include "modules/accessibility/AXObjectCacheImpl.h" |
| 48 #include "platform/Task.h" | 49 #include "platform/Task.h" |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 m_private->executionContext()->postSuspendableTask(adoptPtr(new NodeDispatch
SimulatedClickTask(m_private))); | 235 m_private->executionContext()->postSuspendableTask(adoptPtr(new NodeDispatch
SimulatedClickTask(m_private))); |
| 235 } | 236 } |
| 236 | 237 |
| 237 WebElementCollection WebNode::getElementsByHTMLTagName(const WebString& tag) con
st | 238 WebElementCollection WebNode::getElementsByHTMLTagName(const WebString& tag) con
st |
| 238 { | 239 { |
| 239 if (m_private->isContainerNode()) | 240 if (m_private->isContainerNode()) |
| 240 return WebElementCollection(toContainerNode(m_private.get())->getElement
sByTagNameNS(HTMLNames::xhtmlNamespaceURI, tag)); | 241 return WebElementCollection(toContainerNode(m_private.get())->getElement
sByTagNameNS(HTMLNames::xhtmlNamespaceURI, tag)); |
| 241 return WebElementCollection(); | 242 return WebElementCollection(); |
| 242 } | 243 } |
| 243 | 244 |
| 244 WebElement WebNode::querySelector(const WebString& tag, WebExceptionCode& ec) co
nst | 245 WebElement WebNode::querySelector(const WebString& selector, WebExceptionCode& e
c) const |
| 245 { | 246 { |
| 247 if (!m_private->isContainerNode()) |
| 248 return WebElement(); |
| 246 TrackExceptionState exceptionState; | 249 TrackExceptionState exceptionState; |
| 247 WebElement element; | 250 WebElement element = toContainerNode(m_private.get())->querySelector(selecto
r, exceptionState); |
| 248 if (m_private->isContainerNode()) | |
| 249 element = toContainerNode(m_private.get())->querySelector(tag, exception
State); | |
| 250 ec = exceptionState.code(); | 251 ec = exceptionState.code(); |
| 251 return element; | 252 return element; |
| 252 } | 253 } |
| 253 | 254 |
| 255 void WebNode::querySelectorAll(const WebString& selector, WebExceptionCode& ec,
WebVector<WebElement>& results) const |
| 256 { |
| 257 if (!m_private->isContainerNode()) |
| 258 return; |
| 259 TrackExceptionState exceptionState; |
| 260 RefPtrWillBeRawPtr<StaticElementList> elements = toContainerNode(m_private.g
et())->querySelectorAll(selector, exceptionState); |
| 261 ec = exceptionState.code(); |
| 262 if (exceptionState.hadException()) |
| 263 return; |
| 264 Vector<WebElement> temp; |
| 265 temp.reserveCapacity(elements->length()); |
| 266 for (unsigned i = 0; i < elements->length(); ++i) |
| 267 temp.append(WebElement(elements->item(i))); |
| 268 results.assign(temp); |
| 269 } |
| 270 |
| 254 bool WebNode::focused() const | 271 bool WebNode::focused() const |
| 255 { | 272 { |
| 256 return m_private->focused(); | 273 return m_private->focused(); |
| 257 } | 274 } |
| 258 | 275 |
| 259 bool WebNode::remove() | 276 bool WebNode::remove() |
| 260 { | 277 { |
| 261 TrackExceptionState exceptionState; | 278 TrackExceptionState exceptionState; |
| 262 m_private->remove(exceptionState); | 279 m_private->remove(exceptionState); |
| 263 return !exceptionState.hadException(); | 280 return !exceptionState.hadException(); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 m_private = node; | 326 m_private = node; |
| 310 return *this; | 327 return *this; |
| 311 } | 328 } |
| 312 | 329 |
| 313 WebNode::operator PassRefPtrWillBeRawPtr<Node>() const | 330 WebNode::operator PassRefPtrWillBeRawPtr<Node>() const |
| 314 { | 331 { |
| 315 return m_private.get(); | 332 return m_private.get(); |
| 316 } | 333 } |
| 317 | 334 |
| 318 } // namespace blink | 335 } // namespace blink |
| OLD | NEW |