Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Side by Side Diff: Source/web/WebNode.cpp

Issue 143453010: Have getElementsByClassName() / getElementsByTagName*() return an HTMLCollection (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Null HTMLCollection handling Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 20 matching lines...) Expand all
31 #include "config.h" 31 #include "config.h"
32 #include "WebNode.h" 32 #include "WebNode.h"
33 33
34 #include "EventListenerWrapper.h" 34 #include "EventListenerWrapper.h"
35 #include "FrameLoaderClientImpl.h" 35 #include "FrameLoaderClientImpl.h"
36 #include "WebDOMEvent.h" 36 #include "WebDOMEvent.h"
37 #include "WebDOMEventListener.h" 37 #include "WebDOMEventListener.h"
38 #include "WebDocument.h" 38 #include "WebDocument.h"
39 #include "WebElement.h" 39 #include "WebElement.h"
40 #include "WebFrameImpl.h" 40 #include "WebFrameImpl.h"
41 #include "WebNodeCollection.h"
41 #include "WebNodeList.h" 42 #include "WebNodeList.h"
42 #include "WebPluginContainer.h" 43 #include "WebPluginContainer.h"
43 #include "WebPluginContainerImpl.h" 44 #include "WebPluginContainerImpl.h"
44 #include "bindings/v8/ExceptionState.h" 45 #include "bindings/v8/ExceptionState.h"
45 #include "core/dom/Document.h" 46 #include "core/dom/Document.h"
46 #include "core/dom/Element.h" 47 #include "core/dom/Element.h"
47 #include "core/dom/EmptyNodeList.h"
48 #include "core/events/Event.h"
49 #include "core/dom/Node.h" 48 #include "core/dom/Node.h"
50 #include "core/dom/NodeList.h" 49 #include "core/dom/NodeList.h"
51 #include "core/editing/markup.h" 50 #include "core/editing/markup.h"
51 #include "core/events/Event.h"
52 #include "core/html/HTMLCollection.h"
52 #include "core/rendering/RenderObject.h" 53 #include "core/rendering/RenderObject.h"
53 #include "core/rendering/RenderWidget.h" 54 #include "core/rendering/RenderWidget.h"
54 #include "platform/Widget.h" 55 #include "platform/Widget.h"
55 #include "public/platform/WebString.h" 56 #include "public/platform/WebString.h"
56 #include "public/platform/WebVector.h" 57 #include "public/platform/WebVector.h"
57 58
58 using namespace WebCore; 59 using namespace WebCore;
59 60
60 namespace blink { 61 namespace blink {
61 62
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 if (!event.isNull()) 185 if (!event.isNull())
185 return m_private->dispatchEvent(event); 186 return m_private->dispatchEvent(event);
186 return false; 187 return false;
187 } 188 }
188 189
189 void WebNode::simulateClick() 190 void WebNode::simulateClick()
190 { 191 {
191 m_private->dispatchSimulatedClick(0); 192 m_private->dispatchSimulatedClick(0);
192 } 193 }
193 194
194 WebNodeList WebNode::getElementsByTagName(const WebString& tag) const 195 WebNodeCollection WebNode::getElementsByTagName(const WebString& tag) const
195 { 196 {
196 if (m_private->isContainerNode()) 197 if (m_private->isContainerNode())
197 return WebNodeList(toContainerNode(m_private.get())->getElementsByTagNam e(tag)); 198 return WebNodeCollection(toContainerNode(m_private.get())->getElementsBy TagName(tag));
198 return WebNodeList(EmptyNodeList::create(m_private.get())); 199 return WebNodeCollection();
199 } 200 }
200 201
201 WebElement WebNode::querySelector(const WebString& tag, WebExceptionCode& ec) co nst 202 WebElement WebNode::querySelector(const WebString& tag, WebExceptionCode& ec) co nst
202 { 203 {
203 TrackExceptionState exceptionState; 204 TrackExceptionState exceptionState;
204 WebElement element; 205 WebElement element;
205 if (m_private->isContainerNode()) 206 if (m_private->isContainerNode())
206 element = toContainerNode(m_private.get())->querySelector(tag, exception State); 207 element = toContainerNode(m_private.get())->querySelector(tag, exception State);
207 ec = exceptionState.code(); 208 ec = exceptionState.code();
208 return element; 209 return element;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 m_private = node; 266 m_private = node;
266 return *this; 267 return *this;
267 } 268 }
268 269
269 WebNode::operator PassRefPtr<Node>() const 270 WebNode::operator PassRefPtr<Node>() const
270 { 271 {
271 return m_private.get(); 272 return m_private.get();
272 } 273 }
273 274
274 } // namespace blink 275 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698