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

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

Issue 137433008: Have HTMLCollection::item() return an Element as per specification (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase 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
« no previous file with comments | « Source/web/WebDocument.cpp ('k') | Source/web/WebNodeCollection.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 177
178 // Returns a pointer to the WebPlugin by finding the single <object> tag in the page. 178 // Returns a pointer to the WebPlugin by finding the single <object> tag in the page.
179 WebPlugin* WebHelperPluginImpl::getPlugin() 179 WebPlugin* WebHelperPluginImpl::getPlugin()
180 { 180 {
181 ASSERT(m_page); 181 ASSERT(m_page);
182 182
183 RefPtr<HTMLCollection> objectElements = m_page->mainFrame()->document()->get ElementsByTagName(WebCore::HTMLNames::objectTag.localName()); 183 RefPtr<HTMLCollection> objectElements = m_page->mainFrame()->document()->get ElementsByTagName(WebCore::HTMLNames::objectTag.localName());
184 ASSERT(objectElements && objectElements->length() == 1); 184 ASSERT(objectElements && objectElements->length() == 1);
185 if (!objectElements || objectElements->length() < 1) 185 if (!objectElements || objectElements->length() < 1)
186 return 0; 186 return 0;
187 Node* node = objectElements->item(0); 187 Element* element = objectElements->item(0);
188 ASSERT(node->hasTagName(WebCore::HTMLNames::objectTag)); 188 ASSERT(element->hasTagName(WebCore::HTMLNames::objectTag));
189 WebCore::Widget* widget = toHTMLPlugInElement(node)->pluginWidget(); 189 WebCore::Widget* widget = toHTMLPlugInElement(element)->pluginWidget();
190 if (!widget) 190 if (!widget)
191 return 0; 191 return 0;
192 WebPlugin* plugin = toWebPluginContainerImpl(widget)->plugin(); 192 WebPlugin* plugin = toWebPluginContainerImpl(widget)->plugin();
193 ASSERT(plugin); 193 ASSERT(plugin);
194 // If the plugin is a placeholder, it is not useful to the caller, and it 194 // If the plugin is a placeholder, it is not useful to the caller, and it
195 // could be replaced at any time. Therefore, do not return it. 195 // could be replaced at any time. Therefore, do not return it.
196 if (plugin->isPlaceholder()) 196 if (plugin->isPlaceholder())
197 return 0; 197 return 0;
198 198
199 // The plugin was instantiated and will outlive this object. 199 // The plugin was instantiated and will outlive this object.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 { 260 {
261 RELEASE_ASSERT(client); 261 RELEASE_ASSERT(client);
262 262
263 // The returned object is owned by the caller, which must destroy it by 263 // The returned object is owned by the caller, which must destroy it by
264 // calling closeAndDelete(). The WebWidgetClient must not call close() 264 // calling closeAndDelete(). The WebWidgetClient must not call close()
265 // other than as a result of closeAndDelete(). 265 // other than as a result of closeAndDelete().
266 return new WebHelperPluginImpl(client); 266 return new WebHelperPluginImpl(client);
267 } 267 }
268 268
269 } // namespace blink 269 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebDocument.cpp ('k') | Source/web/WebNodeCollection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698