Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /** | 1 /** |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) | 4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) |
| 5 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. | 5 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 39 #include "core/html/HTMLImageLoader.h" | 39 #include "core/html/HTMLImageLoader.h" |
| 40 #include "core/html/PluginDocument.h" | 40 #include "core/html/PluginDocument.h" |
| 41 #include "core/loader/FrameLoaderClient.h" | 41 #include "core/loader/FrameLoaderClient.h" |
| 42 #include "core/page/EventHandler.h" | 42 #include "core/page/EventHandler.h" |
| 43 #include "core/page/Page.h" | 43 #include "core/page/Page.h" |
| 44 #include "core/page/scrolling/ScrollingCoordinator.h" | 44 #include "core/page/scrolling/ScrollingCoordinator.h" |
| 45 #include "core/plugins/PluginView.h" | 45 #include "core/plugins/PluginView.h" |
| 46 #include "core/rendering/RenderBlockFlow.h" | 46 #include "core/rendering/RenderBlockFlow.h" |
| 47 #include "core/rendering/RenderEmbeddedObject.h" | 47 #include "core/rendering/RenderEmbeddedObject.h" |
| 48 #include "core/rendering/RenderImage.h" | 48 #include "core/rendering/RenderImage.h" |
| 49 #include "core/rendering/RenderWidget.h" | 49 #include "core/rendering/RenderPart.h" |
| 50 #include "platform/Logging.h" | 50 #include "platform/Logging.h" |
| 51 #include "platform/MIMETypeFromURL.h" | 51 #include "platform/MIMETypeFromURL.h" |
| 52 #include "platform/MIMETypeRegistry.h" | 52 #include "platform/MIMETypeRegistry.h" |
| 53 #include "platform/Widget.h" | 53 #include "platform/Widget.h" |
| 54 #include "platform/plugins/PluginData.h" | 54 #include "platform/plugins/PluginData.h" |
| 55 | 55 |
| 56 namespace blink { | 56 namespace blink { |
| 57 | 57 |
| 58 using namespace HTMLNames; | 58 using namespace HTMLNames; |
| 59 | 59 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 98 { | 98 { |
| 99 if (isDisabledFormControl()) | 99 if (isDisabledFormControl()) |
| 100 return false; | 100 return false; |
| 101 RenderObject* r = renderer(); | 101 RenderObject* r = renderer(); |
| 102 return r && (r->isEmbeddedObject() || r->isWidget()); | 102 return r && (r->isEmbeddedObject() || r->isWidget()); |
| 103 } | 103 } |
| 104 | 104 |
| 105 void HTMLPlugInElement::removeAllEventListeners() | 105 void HTMLPlugInElement::removeAllEventListeners() |
| 106 { | 106 { |
| 107 HTMLFrameOwnerElement::removeAllEventListeners(); | 107 HTMLFrameOwnerElement::removeAllEventListeners(); |
| 108 if (RenderWidget* renderer = existingRenderWidget()) { | 108 if (RenderPart* renderer = existingRenderPart()) { |
| 109 if (Widget* widget = renderer->widget()) | 109 if (Widget* widget = renderer->widget()) |
| 110 widget->eventListenersRemoved(); | 110 widget->eventListenersRemoved(); |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 | 113 |
| 114 void HTMLPlugInElement::didMoveToNewDocument(Document& oldDocument) | 114 void HTMLPlugInElement::didMoveToNewDocument(Document& oldDocument) |
| 115 { | 115 { |
| 116 if (m_imageLoader) | 116 if (m_imageLoader) |
| 117 m_imageLoader->elementDidMoveToNewDocument(); | 117 m_imageLoader->elementDidMoveToNewDocument(); |
| 118 HTMLFrameOwnerElement::didMoveToNewDocument(oldDocument); | 118 HTMLFrameOwnerElement::didMoveToNewDocument(oldDocument); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 m_NPObject = 0; | 221 m_NPObject = 0; |
| 222 } | 222 } |
| 223 | 223 |
| 224 HTMLFrameOwnerElement::detach(context); | 224 HTMLFrameOwnerElement::detach(context); |
| 225 } | 225 } |
| 226 | 226 |
| 227 RenderObject* HTMLPlugInElement::createRenderer(RenderStyle* style) | 227 RenderObject* HTMLPlugInElement::createRenderer(RenderStyle* style) |
| 228 { | 228 { |
| 229 // Fallback content breaks the DOM->Renderer class relationship of this | 229 // Fallback content breaks the DOM->Renderer class relationship of this |
| 230 // class and all superclasses because createObject won't necessarily | 230 // class and all superclasses because createObject won't necessarily |
| 231 // return a RenderEmbeddedObject, RenderPart or even RenderWidget. | 231 // return a RenderEmbeddedObject, RenderPart or even RenderPart. |
|
Julien - ping for review
2014/10/07 17:53:22
Maybe a bit redundant: RenderPart or even RenderPa
Zeeshan Qureshi
2014/10/10 19:32:38
Ah, yes! I remember doing this in a commit but pro
| |
| 232 if (useFallbackContent()) | 232 if (useFallbackContent()) |
| 233 return RenderObject::createObject(this, style); | 233 return RenderObject::createObject(this, style); |
| 234 | 234 |
| 235 if (isImageType()) { | 235 if (isImageType()) { |
| 236 RenderImage* image = new RenderImage(this); | 236 RenderImage* image = new RenderImage(this); |
| 237 image->setImageResource(RenderImageResource::create()); | 237 image->setImageResource(RenderImageResource::create()); |
| 238 return image; | 238 return image; |
| 239 } | 239 } |
| 240 | 240 |
| 241 if (usePlaceholderContent()) | 241 if (usePlaceholderContent()) |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 278 plugin = pluginWidget(); | 278 plugin = pluginWidget(); |
| 279 | 279 |
| 280 if (plugin) | 280 if (plugin) |
| 281 m_pluginWrapper = frame->script().createPluginWrapper(plugin); | 281 m_pluginWrapper = frame->script().createPluginWrapper(plugin); |
| 282 } | 282 } |
| 283 return m_pluginWrapper.get(); | 283 return m_pluginWrapper.get(); |
| 284 } | 284 } |
| 285 | 285 |
| 286 Widget* HTMLPlugInElement::pluginWidget() const | 286 Widget* HTMLPlugInElement::pluginWidget() const |
| 287 { | 287 { |
| 288 if (RenderWidget* renderWidget = renderWidgetForJSBindings()) | 288 if (RenderPart* renderPart = renderPartForJSBindings()) |
| 289 return renderWidget->widget(); | 289 return renderPart->widget(); |
| 290 return 0; | 290 return 0; |
| 291 } | 291 } |
| 292 | 292 |
| 293 bool HTMLPlugInElement::isPresentationAttribute(const QualifiedName& name) const | 293 bool HTMLPlugInElement::isPresentationAttribute(const QualifiedName& name) const |
| 294 { | 294 { |
| 295 if (name == widthAttr || name == heightAttr || name == vspaceAttr || name == hspaceAttr || name == alignAttr) | 295 if (name == widthAttr || name == heightAttr || name == vspaceAttr || name == hspaceAttr || name == alignAttr) |
| 296 return true; | 296 return true; |
| 297 return HTMLFrameOwnerElement::isPresentationAttribute(name); | 297 return HTMLFrameOwnerElement::isPresentationAttribute(name); |
| 298 } | 298 } |
| 299 | 299 |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 328 // FIXME: Mouse down and scroll events are passed down to plug-in via custom | 328 // FIXME: Mouse down and scroll events are passed down to plug-in via custom |
| 329 // code in EventHandler; these code paths should be united. | 329 // code in EventHandler; these code paths should be united. |
| 330 | 330 |
| 331 RenderObject* r = renderer(); | 331 RenderObject* r = renderer(); |
| 332 if (!r || !r->isWidget()) | 332 if (!r || !r->isWidget()) |
| 333 return; | 333 return; |
| 334 if (r->isEmbeddedObject()) { | 334 if (r->isEmbeddedObject()) { |
| 335 if (toRenderEmbeddedObject(r)->showsUnavailablePluginIndicator()) | 335 if (toRenderEmbeddedObject(r)->showsUnavailablePluginIndicator()) |
| 336 return; | 336 return; |
| 337 } | 337 } |
| 338 RefPtr<Widget> widget = toRenderWidget(r)->widget(); | 338 RefPtr<Widget> widget = toRenderPart(r)->widget(); |
| 339 if (!widget) | 339 if (!widget) |
| 340 return; | 340 return; |
| 341 widget->handleEvent(event); | 341 widget->handleEvent(event); |
| 342 if (event->defaultHandled()) | 342 if (event->defaultHandled()) |
| 343 return; | 343 return; |
| 344 HTMLFrameOwnerElement::defaultEventHandler(event); | 344 HTMLFrameOwnerElement::defaultEventHandler(event); |
| 345 } | 345 } |
| 346 | 346 |
| 347 RenderWidget* HTMLPlugInElement::renderWidgetForJSBindings() const | 347 RenderPart* HTMLPlugInElement::renderPartForJSBindings() const |
| 348 { | 348 { |
| 349 // Needs to load the plugin immediatedly because this function is called | 349 // Needs to load the plugin immediatedly because this function is called |
| 350 // when JavaScript code accesses the plugin. | 350 // when JavaScript code accesses the plugin. |
| 351 // FIXME: Check if dispatching events here is safe. | 351 // FIXME: Check if dispatching events here is safe. |
| 352 document().updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasks Synchronously); | 352 document().updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasks Synchronously); |
| 353 return existingRenderWidget(); | 353 return existingRenderPart(); |
| 354 } | 354 } |
| 355 | 355 |
| 356 bool HTMLPlugInElement::isKeyboardFocusable() const | 356 bool HTMLPlugInElement::isKeyboardFocusable() const |
| 357 { | 357 { |
| 358 if (!document().isActive()) | 358 if (!document().isActive()) |
| 359 return false; | 359 return false; |
| 360 return pluginWidget() && pluginWidget()->isPluginView() && toPluginView(plug inWidget())->supportsKeyboardFocus(); | 360 return pluginWidget() && pluginWidget()->isPluginView() && toPluginView(plug inWidget())->supportsKeyboardFocus(); |
| 361 } | 361 } |
| 362 | 362 |
| 363 bool HTMLPlugInElement::hasCustomFocusLogic() const | 363 bool HTMLPlugInElement::hasCustomFocusLogic() const |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 590 } | 590 } |
| 591 } | 591 } |
| 592 | 592 |
| 593 void HTMLPlugInElement::lazyReattachIfNeeded() | 593 void HTMLPlugInElement::lazyReattachIfNeeded() |
| 594 { | 594 { |
| 595 if (!useFallbackContent() && !usePlaceholderContent() && needsWidgetUpdate() && renderer() && !isImageType()) | 595 if (!useFallbackContent() && !usePlaceholderContent() && needsWidgetUpdate() && renderer() && !isImageType()) |
| 596 lazyReattachIfAttached(); | 596 lazyReattachIfAttached(); |
| 597 } | 597 } |
| 598 | 598 |
| 599 } | 599 } |
| OLD | NEW |