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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
79 | 79 |
80 if (m_NPObject) { | 80 if (m_NPObject) { |
81 _NPN_ReleaseObject(m_NPObject); | 81 _NPN_ReleaseObject(m_NPObject); |
82 m_NPObject = 0; | 82 m_NPObject = 0; |
83 } | 83 } |
84 } | 84 } |
85 | 85 |
86 void HTMLPlugInElement::trace(Visitor* visitor) | 86 void HTMLPlugInElement::trace(Visitor* visitor) |
87 { | 87 { |
88 visitor->trace(m_imageLoader); | 88 visitor->trace(m_imageLoader); |
89 visitor->trace(m_persistedPluginWidget); | |
89 HTMLFrameOwnerElement::trace(visitor); | 90 HTMLFrameOwnerElement::trace(visitor); |
90 } | 91 } |
91 | 92 |
93 #if ENABLE(OILPAN) | |
94 void HTMLPlugInElement::disconnectContentFrame() | |
95 { | |
96 if (m_persistedPluginWidget) { | |
97 m_persistedPluginWidget->dispose(); | |
98 m_persistedPluginWidget = nullptr; | |
99 } | |
100 HTMLFrameOwnerElement::disconnectContentFrame(); | |
101 } | |
102 | |
103 void HTMLPlugInElement::setIsAllowedToDisposePlugin() | |
haraken
2014/10/10 02:50:32
setIsAllowedToDisposePlugin => shouldDisposePlugin
sof
2014/10/10 08:40:55
That's a better verb to use, thanks. disposal isn'
| |
104 { | |
105 if (m_persistedPluginWidget && m_persistedPluginWidget->isPluginView()) { | |
106 PluginView* plugin = toPluginView(m_persistedPluginWidget.get()); | |
107 plugin->setIsAllowedToDisposePlugin(); | |
108 } | |
109 } | |
110 #endif | |
111 | |
112 void HTMLPlugInElement::setPersistedPluginWidget(Widget* widget) | |
113 { | |
114 #if ENABLE(OILPAN) | |
115 if (m_persistedPluginWidget && m_persistedPluginWidget != widget) { | |
116 if (m_persistedPluginWidget->isPluginView()) { | |
117 PluginView* oldPlugin = toPluginView(m_persistedPluginWidget.get()); | |
118 if (LocalFrame* frame = oldPlugin->pluginFrame()) { | |
haraken
2014/10/10 02:50:32
Help me understand: In a case where oldPlugin->plu
sof
2014/10/10 05:22:19
The condition cannot happen (see below.)
| |
119 frame->unregisterPluginElement(this); | |
120 } | |
121 } | |
122 } | |
123 if (widget && widget->isPluginView()) { | |
124 PluginView* plugin = toPluginView(widget); | |
125 if (LocalFrame* frame = plugin->pluginFrame()) { | |
haraken
2014/10/10 02:50:32
Help me understand: Who calls dispose() for a plug
sof
2014/10/10 05:22:18
I don't think any such plugins exist. i.e., WebPlu
| |
126 frame->registerPluginElement(this); | |
127 } | |
128 } | |
129 #endif | |
130 m_persistedPluginWidget = widget; | |
131 } | |
132 | |
92 bool HTMLPlugInElement::canProcessDrag() const | 133 bool HTMLPlugInElement::canProcessDrag() const |
93 { | 134 { |
94 return pluginWidget() && pluginWidget()->isPluginView() && toPluginView(plug inWidget())->canProcessDrag(); | 135 return pluginWidget() && pluginWidget()->isPluginView() && toPluginView(plug inWidget())->canProcessDrag(); |
95 } | 136 } |
96 | 137 |
97 bool HTMLPlugInElement::willRespondToMouseClickEvents() | 138 bool HTMLPlugInElement::willRespondToMouseClickEvents() |
98 { | 139 { |
99 if (isDisabledFormControl()) | 140 if (isDisabledFormControl()) |
100 return false; | 141 return false; |
101 RenderObject* r = renderer(); | 142 RenderObject* r = renderer(); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
194 if (renderer() && !useFallbackContent()) | 235 if (renderer() && !useFallbackContent()) |
195 setNeedsWidgetUpdate(true); | 236 setNeedsWidgetUpdate(true); |
196 if (m_isDelayingLoadEvent) { | 237 if (m_isDelayingLoadEvent) { |
197 m_isDelayingLoadEvent = false; | 238 m_isDelayingLoadEvent = false; |
198 document().decrementLoadEventDelayCount(); | 239 document().decrementLoadEventDelayCount(); |
199 } | 240 } |
200 | 241 |
201 // Only try to persist a plugin widget we actually own. | 242 // Only try to persist a plugin widget we actually own. |
202 Widget* plugin = ownedWidget(); | 243 Widget* plugin = ownedWidget(); |
203 if (plugin && plugin->pluginShouldPersist()) | 244 if (plugin && plugin->pluginShouldPersist()) |
204 m_persistedPluginWidget = plugin; | 245 setPersistedPluginWidget(plugin); |
205 #if ENABLE(OILPAN) | 246 |
206 else if (plugin) | |
207 plugin->detach(); | |
208 #endif | |
209 resetInstance(); | 247 resetInstance(); |
210 // FIXME - is this next line necessary? | 248 // Clear the widget; will trigger disposal of it with Oilpan. |
211 setWidget(nullptr); | 249 setWidget(nullptr); |
212 | 250 |
213 if (m_isCapturingMouseEvents) { | 251 if (m_isCapturingMouseEvents) { |
214 if (LocalFrame* frame = document().frame()) | 252 if (LocalFrame* frame = document().frame()) |
215 frame->eventHandler().setCapturingMouseEventsNode(nullptr); | 253 frame->eventHandler().setCapturingMouseEventsNode(nullptr); |
216 m_isCapturingMouseEvents = false; | 254 m_isCapturingMouseEvents = false; |
217 } | 255 } |
218 | 256 |
219 if (m_NPObject) { | 257 if (m_NPObject) { |
220 _NPN_ReleaseObject(m_NPObject); | 258 _NPN_ReleaseObject(m_NPObject); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
328 // FIXME: Mouse down and scroll events are passed down to plug-in via custom | 366 // FIXME: Mouse down and scroll events are passed down to plug-in via custom |
329 // code in EventHandler; these code paths should be united. | 367 // code in EventHandler; these code paths should be united. |
330 | 368 |
331 RenderObject* r = renderer(); | 369 RenderObject* r = renderer(); |
332 if (!r || !r->isWidget()) | 370 if (!r || !r->isWidget()) |
333 return; | 371 return; |
334 if (r->isEmbeddedObject()) { | 372 if (r->isEmbeddedObject()) { |
335 if (toRenderEmbeddedObject(r)->showsUnavailablePluginIndicator()) | 373 if (toRenderEmbeddedObject(r)->showsUnavailablePluginIndicator()) |
336 return; | 374 return; |
337 } | 375 } |
338 RefPtr<Widget> widget = toRenderWidget(r)->widget(); | 376 RefPtrWillBeRawPtr<Widget> widget = toRenderWidget(r)->widget(); |
339 if (!widget) | 377 if (!widget) |
340 return; | 378 return; |
341 widget->handleEvent(event); | 379 widget->handleEvent(event); |
342 if (event->defaultHandled()) | 380 if (event->defaultHandled()) |
343 return; | 381 return; |
344 HTMLFrameOwnerElement::defaultEventHandler(event); | 382 HTMLFrameOwnerElement::defaultEventHandler(event); |
345 } | 383 } |
346 | 384 |
347 RenderWidget* HTMLPlugInElement::renderWidgetForJSBindings() const | 385 RenderWidget* HTMLPlugInElement::renderWidgetForJSBindings() const |
348 { | 386 { |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
471 | 509 |
472 RenderEmbeddedObject* renderer = renderEmbeddedObject(); | 510 RenderEmbeddedObject* renderer = renderEmbeddedObject(); |
473 // FIXME: This code should not depend on renderer! | 511 // FIXME: This code should not depend on renderer! |
474 if ((!renderer && requireRenderer) || useFallback) | 512 if ((!renderer && requireRenderer) || useFallback) |
475 return false; | 513 return false; |
476 | 514 |
477 WTF_LOG(Plugins, "%p Plug-in URL: %s", this, m_url.utf8().data()); | 515 WTF_LOG(Plugins, "%p Plug-in URL: %s", this, m_url.utf8().data()); |
478 WTF_LOG(Plugins, " Loaded URL: %s", url.string().utf8().data()); | 516 WTF_LOG(Plugins, " Loaded URL: %s", url.string().utf8().data()); |
479 m_loadedUrl = url; | 517 m_loadedUrl = url; |
480 | 518 |
481 RefPtr<Widget> widget = m_persistedPluginWidget; | 519 RefPtrWillBeRawPtr<Widget> widget = m_persistedPluginWidget; |
482 if (!widget) { | 520 if (!widget) { |
483 bool loadManually = document().isPluginDocument() && !document().contain sPlugins(); | 521 bool loadManually = document().isPluginDocument() && !document().contain sPlugins(); |
484 FrameLoaderClient::DetachedPluginPolicy policy = requireRenderer ? Frame LoaderClient::FailOnDetachedPlugin : FrameLoaderClient::AllowDetachedPlugin; | 522 FrameLoaderClient::DetachedPluginPolicy policy = requireRenderer ? Frame LoaderClient::FailOnDetachedPlugin : FrameLoaderClient::AllowDetachedPlugin; |
485 widget = frame->loader().client()->createPlugin(this, url, paramNames, p aramValues, mimeType, loadManually, policy); | 523 widget = frame->loader().client()->createPlugin(this, url, paramNames, p aramValues, mimeType, loadManually, policy); |
486 } | 524 } |
487 | 525 |
488 if (!widget) { | 526 if (!widget) { |
489 if (renderer && !renderer->showsUnavailablePluginIndicator()) | 527 if (renderer && !renderer->showsUnavailablePluginIndicator()) |
490 renderer->setPluginUnavailabilityReason(RenderEmbeddedObject::Plugin Missing); | 528 renderer->setPluginUnavailabilityReason(RenderEmbeddedObject::Plugin Missing); |
491 return false; | 529 return false; |
492 } | 530 } |
493 | 531 |
494 if (renderer) { | 532 if (renderer) { |
495 setWidget(widget); | 533 setWidget(widget); |
496 m_persistedPluginWidget = nullptr; | 534 setPersistedPluginWidget(nullptr); |
497 } else if (widget != m_persistedPluginWidget) { | 535 } else if (widget != m_persistedPluginWidget) { |
498 m_persistedPluginWidget = widget; | 536 setPersistedPluginWidget(widget.get()); |
499 } | 537 } |
500 document().setContainsPlugins(); | 538 document().setContainsPlugins(); |
501 scheduleSVGFilterLayerUpdateHack(); | 539 scheduleSVGFilterLayerUpdateHack(); |
502 // Make sure any input event handlers introduced by the plugin are taken int o account. | 540 // Make sure any input event handlers introduced by the plugin are taken int o account. |
503 if (Page* page = document().frame()->page()) { | 541 if (Page* page = document().frame()->page()) { |
504 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina tor()) | 542 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina tor()) |
505 scrollingCoordinator->notifyLayoutUpdated(); | 543 scrollingCoordinator->notifyLayoutUpdated(); |
506 } | 544 } |
507 return true; | 545 return true; |
508 } | 546 } |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
593 } | 631 } |
594 } | 632 } |
595 | 633 |
596 void HTMLPlugInElement::lazyReattachIfNeeded() | 634 void HTMLPlugInElement::lazyReattachIfNeeded() |
597 { | 635 { |
598 if (!useFallbackContent() && !usePlaceholderContent() && needsWidgetUpdate() && renderer() && !isImageType()) | 636 if (!useFallbackContent() && !usePlaceholderContent() && needsWidgetUpdate() && renderer() && !isImageType()) |
599 lazyReattachIfAttached(); | 637 lazyReattachIfAttached(); |
600 } | 638 } |
601 | 639 |
602 } | 640 } |
OLD | NEW |