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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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_placeholder); | 89 visitor->trace(m_placeholder); |
90 visitor->trace(m_persistedPluginWidget); | |
90 HTMLFrameOwnerElement::trace(visitor); | 91 HTMLFrameOwnerElement::trace(visitor); |
91 } | 92 } |
92 | 93 |
94 #if ENABLE(OILPAN) | |
95 void HTMLPlugInElement::disconnectContentFrame() | |
96 { | |
97 if (m_persistedPluginWidget) { | |
98 m_persistedPluginWidget->dispose(); | |
99 m_persistedPluginWidget = nullptr; | |
100 } | |
101 HTMLFrameOwnerElement::disconnectContentFrame(); | |
102 } | |
103 | |
104 void HTMLPlugInElement::shouldDisposePlugin() | |
105 { | |
106 if (m_persistedPluginWidget && m_persistedPluginWidget->isPluginView()) | |
107 toPluginView(m_persistedPluginWidget.get())->shouldDisposePlugin(); | |
108 } | |
109 #endif | |
110 | |
111 void HTMLPlugInElement::setPersistedPluginWidget(Widget* widget) | |
112 { | |
113 #if ENABLE(OILPAN) | |
114 if (m_persistedPluginWidget && m_persistedPluginWidget != widget) { | |
115 if (m_persistedPluginWidget->isPluginView()) { | |
116 if (LocalFrame* frame = toPluginView(m_persistedPluginWidget.get())- >pluginFrame()) { | |
haraken
2014/10/11 17:33:02
Can we add ASSERT(frame) instead of having an if b
sof
2014/10/12 08:16:22
Done.
| |
117 frame->unregisterPluginElement(this); | |
118 } | |
119 } | |
120 } | |
121 if (widget && widget->isPluginView()) { | |
122 if (LocalFrame* frame = toPluginView(widget)->pluginFrame()) { | |
haraken
2014/10/11 17:33:02
Ditto.
sof
2014/10/12 08:16:22
Done.
| |
123 frame->registerPluginElement(this); | |
124 } | |
125 } | |
126 #endif | |
127 m_persistedPluginWidget = widget; | |
128 } | |
129 | |
93 bool HTMLPlugInElement::canProcessDrag() const | 130 bool HTMLPlugInElement::canProcessDrag() const |
94 { | 131 { |
95 return pluginWidget() && pluginWidget()->isPluginView() && toPluginView(plug inWidget())->canProcessDrag(); | 132 return pluginWidget() && pluginWidget()->isPluginView() && toPluginView(plug inWidget())->canProcessDrag(); |
96 } | 133 } |
97 | 134 |
98 bool HTMLPlugInElement::willRespondToMouseClickEvents() | 135 bool HTMLPlugInElement::willRespondToMouseClickEvents() |
99 { | 136 { |
100 if (isDisabledFormControl()) | 137 if (isDisabledFormControl()) |
101 return false; | 138 return false; |
102 RenderObject* r = renderer(); | 139 RenderObject* r = renderer(); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
195 if (renderer() && !useFallbackContent()) | 232 if (renderer() && !useFallbackContent()) |
196 setNeedsWidgetUpdate(true); | 233 setNeedsWidgetUpdate(true); |
197 if (m_isDelayingLoadEvent) { | 234 if (m_isDelayingLoadEvent) { |
198 m_isDelayingLoadEvent = false; | 235 m_isDelayingLoadEvent = false; |
199 document().decrementLoadEventDelayCount(); | 236 document().decrementLoadEventDelayCount(); |
200 } | 237 } |
201 | 238 |
202 // Only try to persist a plugin widget we actually own. | 239 // Only try to persist a plugin widget we actually own. |
203 Widget* plugin = ownedWidget(); | 240 Widget* plugin = ownedWidget(); |
204 if (plugin && plugin->pluginShouldPersist()) | 241 if (plugin && plugin->pluginShouldPersist()) |
205 m_persistedPluginWidget = plugin; | 242 setPersistedPluginWidget(plugin); |
206 #if ENABLE(OILPAN) | 243 |
207 else if (plugin) | |
208 plugin->detach(); | |
209 #endif | |
210 resetInstance(); | 244 resetInstance(); |
211 // FIXME - is this next line necessary? | 245 // Clear the widget; will trigger disposal of it with Oilpan. |
212 setWidget(nullptr); | 246 setWidget(nullptr); |
213 | 247 |
214 if (m_isCapturingMouseEvents) { | 248 if (m_isCapturingMouseEvents) { |
215 if (LocalFrame* frame = document().frame()) | 249 if (LocalFrame* frame = document().frame()) |
216 frame->eventHandler().setCapturingMouseEventsNode(nullptr); | 250 frame->eventHandler().setCapturingMouseEventsNode(nullptr); |
217 m_isCapturingMouseEvents = false; | 251 m_isCapturingMouseEvents = false; |
218 } | 252 } |
219 | 253 |
220 if (m_NPObject) { | 254 if (m_NPObject) { |
221 _NPN_ReleaseObject(m_NPObject); | 255 _NPN_ReleaseObject(m_NPObject); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
329 // FIXME: Mouse down and scroll events are passed down to plug-in via custom | 363 // FIXME: Mouse down and scroll events are passed down to plug-in via custom |
330 // code in EventHandler; these code paths should be united. | 364 // code in EventHandler; these code paths should be united. |
331 | 365 |
332 RenderObject* r = renderer(); | 366 RenderObject* r = renderer(); |
333 if (!r || !r->isRenderPart()) | 367 if (!r || !r->isRenderPart()) |
334 return; | 368 return; |
335 if (r->isEmbeddedObject()) { | 369 if (r->isEmbeddedObject()) { |
336 if (toRenderEmbeddedObject(r)->showsUnavailablePluginIndicator()) | 370 if (toRenderEmbeddedObject(r)->showsUnavailablePluginIndicator()) |
337 return; | 371 return; |
338 } | 372 } |
339 RefPtr<Widget> widget = toRenderPart(r)->widget(); | 373 RefPtrWillBeRawPtr<Widget> widget = toRenderPart(r)->widget(); |
340 if (!widget) | 374 if (!widget) |
341 return; | 375 return; |
342 widget->handleEvent(event); | 376 widget->handleEvent(event); |
343 if (event->defaultHandled()) | 377 if (event->defaultHandled()) |
344 return; | 378 return; |
345 HTMLFrameOwnerElement::defaultEventHandler(event); | 379 HTMLFrameOwnerElement::defaultEventHandler(event); |
346 } | 380 } |
347 | 381 |
348 RenderPart* HTMLPlugInElement::renderPartForJSBindings() const | 382 RenderPart* HTMLPlugInElement::renderPartForJSBindings() const |
349 { | 383 { |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
472 | 506 |
473 RenderEmbeddedObject* renderer = renderEmbeddedObject(); | 507 RenderEmbeddedObject* renderer = renderEmbeddedObject(); |
474 // FIXME: This code should not depend on renderer! | 508 // FIXME: This code should not depend on renderer! |
475 if ((!renderer && requireRenderer) || useFallback) | 509 if ((!renderer && requireRenderer) || useFallback) |
476 return false; | 510 return false; |
477 | 511 |
478 WTF_LOG(Plugins, "%p Plug-in URL: %s", this, m_url.utf8().data()); | 512 WTF_LOG(Plugins, "%p Plug-in URL: %s", this, m_url.utf8().data()); |
479 WTF_LOG(Plugins, " Loaded URL: %s", url.string().utf8().data()); | 513 WTF_LOG(Plugins, " Loaded URL: %s", url.string().utf8().data()); |
480 m_loadedUrl = url; | 514 m_loadedUrl = url; |
481 | 515 |
482 OwnPtrWillBeRawPtr<PluginPlaceholder> placeholder; | 516 OwnPtrWillBeRawPtr<PluginPlaceholder> placeholder = nullptr; |
483 RefPtr<Widget> widget = m_persistedPluginWidget; | 517 RefPtrWillBeRawPtr<Widget> widget = m_persistedPluginWidget; |
484 if (!widget) { | 518 if (!widget) { |
485 bool loadManually = document().isPluginDocument() && !document().contain sPlugins(); | 519 bool loadManually = document().isPluginDocument() && !document().contain sPlugins(); |
486 placeholder = frame->loader().client()->createPluginPlaceholder(document (), url, paramNames, paramValues, mimeType, loadManually); | 520 placeholder = frame->loader().client()->createPluginPlaceholder(document (), url, paramNames, paramValues, mimeType, loadManually); |
487 if (!placeholder) { | 521 if (!placeholder) { |
488 FrameLoaderClient::DetachedPluginPolicy policy = requireRenderer ? F rameLoaderClient::FailOnDetachedPlugin : FrameLoaderClient::AllowDetachedPlugin; | 522 FrameLoaderClient::DetachedPluginPolicy policy = requireRenderer ? F rameLoaderClient::FailOnDetachedPlugin : FrameLoaderClient::AllowDetachedPlugin; |
489 widget = frame->loader().client()->createPlugin(this, url, paramName s, paramValues, mimeType, loadManually, policy); | 523 widget = frame->loader().client()->createPlugin(this, url, paramName s, paramValues, mimeType, loadManually, policy); |
490 } | 524 } |
491 } | 525 } |
492 | 526 |
493 if (!placeholder && !widget) { | 527 if (!placeholder && !widget) { |
494 if (renderer && !renderer->showsUnavailablePluginIndicator()) | 528 if (renderer && !renderer->showsUnavailablePluginIndicator()) |
495 renderer->setPluginUnavailabilityReason(RenderEmbeddedObject::Plugin Missing); | 529 renderer->setPluginUnavailabilityReason(RenderEmbeddedObject::Plugin Missing); |
496 setPlaceholder(nullptr); | 530 setPlaceholder(nullptr); |
497 return false; | 531 return false; |
498 } | 532 } |
499 | 533 |
500 if (placeholder) { | 534 if (placeholder) { |
501 setPlaceholder(placeholder.release()); | 535 setPlaceholder(placeholder.release()); |
502 return true; | 536 return true; |
503 } | 537 } |
504 | 538 |
505 if (renderer) { | 539 if (renderer) { |
506 setWidget(widget); | 540 setWidget(widget); |
507 m_persistedPluginWidget = nullptr; | 541 setPersistedPluginWidget(nullptr); |
508 } else if (widget != m_persistedPluginWidget) { | 542 } else if (widget != m_persistedPluginWidget) { |
haraken
2014/10/11 17:33:02
The 'widget != m_persistedPluginWidget' check won'
sof
2014/10/12 08:16:22
Not quite, but I've now made setPersistendPluginWi
| |
509 m_persistedPluginWidget = widget; | 543 setPersistedPluginWidget(widget.get()); |
510 } | 544 } |
511 setPlaceholder(nullptr); | 545 setPlaceholder(nullptr); |
512 document().setContainsPlugins(); | 546 document().setContainsPlugins(); |
513 scheduleSVGFilterLayerUpdateHack(); | 547 scheduleSVGFilterLayerUpdateHack(); |
514 // Make sure any input event handlers introduced by the plugin are taken int o account. | 548 // Make sure any input event handlers introduced by the plugin are taken int o account. |
515 if (Page* page = document().frame()->page()) { | 549 if (Page* page = document().frame()->page()) { |
516 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina tor()) | 550 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordina tor()) |
517 scrollingCoordinator->notifyLayoutUpdated(); | 551 scrollingCoordinator->notifyLayoutUpdated(); |
518 } | 552 } |
519 return true; | 553 return true; |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
612 return hasAuthorShadowRoot(); | 646 return hasAuthorShadowRoot(); |
613 } | 647 } |
614 | 648 |
615 void HTMLPlugInElement::lazyReattachIfNeeded() | 649 void HTMLPlugInElement::lazyReattachIfNeeded() |
616 { | 650 { |
617 if (!useFallbackContent() && !usePlaceholderContent() && needsWidgetUpdate() && renderer() && !isImageType()) | 651 if (!useFallbackContent() && !usePlaceholderContent() && needsWidgetUpdate() && renderer() && !isImageType()) |
618 lazyReattachIfAttached(); | 652 lazyReattachIfAttached(); |
619 } | 653 } |
620 | 654 |
621 } | 655 } |
OLD | NEW |