| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 { | 140 { |
| 141 if (isDisabledFormControl()) | 141 if (isDisabledFormControl()) |
| 142 return false; | 142 return false; |
| 143 LayoutObject* r = layoutObject(); | 143 LayoutObject* r = layoutObject(); |
| 144 return r && (r->isEmbeddedObject() || r->isLayoutPart()); | 144 return r && (r->isEmbeddedObject() || r->isLayoutPart()); |
| 145 } | 145 } |
| 146 | 146 |
| 147 void HTMLPlugInElement::removeAllEventListeners() | 147 void HTMLPlugInElement::removeAllEventListeners() |
| 148 { | 148 { |
| 149 HTMLFrameOwnerElement::removeAllEventListeners(); | 149 HTMLFrameOwnerElement::removeAllEventListeners(); |
| 150 if (LayoutPart* renderer = existingLayoutPart()) { | 150 if (LayoutPart* layoutObject = existingLayoutPart()) { |
| 151 if (Widget* widget = renderer->widget()) | 151 if (Widget* widget = layoutObject->widget()) |
| 152 widget->eventListenersRemoved(); | 152 widget->eventListenersRemoved(); |
| 153 } | 153 } |
| 154 } | 154 } |
| 155 | 155 |
| 156 void HTMLPlugInElement::didMoveToNewDocument(Document& oldDocument) | 156 void HTMLPlugInElement::didMoveToNewDocument(Document& oldDocument) |
| 157 { | 157 { |
| 158 if (m_imageLoader) | 158 if (m_imageLoader) |
| 159 m_imageLoader->elementDidMoveToNewDocument(); | 159 m_imageLoader->elementDidMoveToNewDocument(); |
| 160 HTMLFrameOwnerElement::didMoveToNewDocument(oldDocument); | 160 HTMLFrameOwnerElement::didMoveToNewDocument(oldDocument); |
| 161 } | 161 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 185 void HTMLPlugInElement::updateWidget() | 185 void HTMLPlugInElement::updateWidget() |
| 186 { | 186 { |
| 187 RefPtrWillBeRawPtr<HTMLPlugInElement> protector(this); | 187 RefPtrWillBeRawPtr<HTMLPlugInElement> protector(this); |
| 188 updateWidgetInternal(); | 188 updateWidgetInternal(); |
| 189 if (m_isDelayingLoadEvent) { | 189 if (m_isDelayingLoadEvent) { |
| 190 m_isDelayingLoadEvent = false; | 190 m_isDelayingLoadEvent = false; |
| 191 document().decrementLoadEventDelayCount(); | 191 document().decrementLoadEventDelayCount(); |
| 192 } | 192 } |
| 193 } | 193 } |
| 194 | 194 |
| 195 void HTMLPlugInElement::requestPluginCreationWithoutRendererIfPossible() | 195 void HTMLPlugInElement::requestPluginCreationWithoutLayoutObjectIfPossible() |
| 196 { | 196 { |
| 197 if (m_serviceType.isEmpty()) | 197 if (m_serviceType.isEmpty()) |
| 198 return; | 198 return; |
| 199 | 199 |
| 200 if (!document().frame() | 200 if (!document().frame() |
| 201 || !document().frame()->loader().client()->canCreatePluginWithoutRendere
r(m_serviceType)) | 201 || !document().frame()->loader().client()->canCreatePluginWithoutRendere
r(m_serviceType)) |
| 202 return; | 202 return; |
| 203 | 203 |
| 204 if (layoutObject() && layoutObject()->isLayoutPart()) | 204 if (layoutObject() && layoutObject()->isLayoutPart()) |
| 205 return; | 205 return; |
| 206 | 206 |
| 207 createPluginWithoutRenderer(); | 207 createPluginWithoutLayoutObject(); |
| 208 } | 208 } |
| 209 | 209 |
| 210 void HTMLPlugInElement::createPluginWithoutRenderer() | 210 void HTMLPlugInElement::createPluginWithoutLayoutObject() |
| 211 { | 211 { |
| 212 ASSERT(document().frame()->loader().client()->canCreatePluginWithoutRenderer
(m_serviceType)); | 212 ASSERT(document().frame()->loader().client()->canCreatePluginWithoutRenderer
(m_serviceType)); |
| 213 | 213 |
| 214 KURL url; | 214 KURL url; |
| 215 Vector<String> paramNames; | 215 Vector<String> paramNames; |
| 216 Vector<String> paramValues; | 216 Vector<String> paramValues; |
| 217 | 217 |
| 218 paramNames.append("type"); | 218 paramNames.append("type"); |
| 219 paramValues.append(m_serviceType); | 219 paramValues.append(m_serviceType); |
| 220 | 220 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 if (m_NPObject) { | 258 if (m_NPObject) { |
| 259 _NPN_ReleaseObject(m_NPObject); | 259 _NPN_ReleaseObject(m_NPObject); |
| 260 m_NPObject = 0; | 260 m_NPObject = 0; |
| 261 } | 261 } |
| 262 | 262 |
| 263 HTMLFrameOwnerElement::detach(context); | 263 HTMLFrameOwnerElement::detach(context); |
| 264 } | 264 } |
| 265 | 265 |
| 266 LayoutObject* HTMLPlugInElement::createLayoutObject(const ComputedStyle& style) | 266 LayoutObject* HTMLPlugInElement::createLayoutObject(const ComputedStyle& style) |
| 267 { | 267 { |
| 268 // Fallback content breaks the DOM->Renderer class relationship of this | 268 // Fallback content breaks the DOM->layoutObject class relationship of this |
| 269 // class and all superclasses because createObject won't necessarily return | 269 // class and all superclasses because createObject won't necessarily return |
| 270 // a LayoutEmbeddedObject or LayoutPart. | 270 // a LayoutEmbeddedObject or LayoutPart. |
| 271 if (useFallbackContent()) | 271 if (useFallbackContent()) |
| 272 return LayoutObject::createObject(this, style); | 272 return LayoutObject::createObject(this, style); |
| 273 | 273 |
| 274 if (isImageType()) { | 274 if (isImageType()) { |
| 275 LayoutImage* image = new LayoutImage(this); | 275 LayoutImage* image = new LayoutImage(this); |
| 276 image->setImageResource(LayoutImageResource::create()); | 276 image->setImageResource(LayoutImageResource::create()); |
| 277 return image; | 277 return image; |
| 278 } | 278 } |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 if (LocalFrame* frame = document().frame()) { | 457 if (LocalFrame* frame = document().frame()) { |
| 458 KURL completedURL = document().completeURL(m_url); | 458 KURL completedURL = document().completeURL(m_url); |
| 459 return frame->loader().client()->objectContentType(completedURL, m_servi
ceType, shouldPreferPlugInsForImages()) == ObjectContentImage; | 459 return frame->loader().client()->objectContentType(completedURL, m_servi
ceType, shouldPreferPlugInsForImages()) == ObjectContentImage; |
| 460 } | 460 } |
| 461 | 461 |
| 462 return Image::supportsType(m_serviceType); | 462 return Image::supportsType(m_serviceType); |
| 463 } | 463 } |
| 464 | 464 |
| 465 LayoutEmbeddedObject* HTMLPlugInElement::layoutEmbeddedObject() const | 465 LayoutEmbeddedObject* HTMLPlugInElement::layoutEmbeddedObject() const |
| 466 { | 466 { |
| 467 // HTMLObjectElement and HTMLEmbedElement may return arbitrary renderers | 467 // HTMLObjectElement and HTMLEmbedElement may return arbitrary layoutObjects |
| 468 // when using fallback content. | 468 // when using fallback content. |
| 469 if (!layoutObject() || !layoutObject()->isEmbeddedObject()) | 469 if (!layoutObject() || !layoutObject()->isEmbeddedObject()) |
| 470 return nullptr; | 470 return nullptr; |
| 471 return toLayoutEmbeddedObject(layoutObject()); | 471 return toLayoutEmbeddedObject(layoutObject()); |
| 472 } | 472 } |
| 473 | 473 |
| 474 // We don't use m_url, as it may not be the final URL that the object loads, | 474 // We don't use m_url, as it may not be the final URL that the object loads, |
| 475 // depending on <param> values. | 475 // depending on <param> values. |
| 476 bool HTMLPlugInElement::allowedToLoadFrameURL(const String& url) | 476 bool HTMLPlugInElement::allowedToLoadFrameURL(const String& url) |
| 477 { | 477 { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 if (shouldUsePlugin(completedURL, mimeType, hasFallbackContent(), useFallbac
k)) | 509 if (shouldUsePlugin(completedURL, mimeType, hasFallbackContent(), useFallbac
k)) |
| 510 return loadPlugin(completedURL, mimeType, paramNames, paramValues, useFa
llback, true); | 510 return loadPlugin(completedURL, mimeType, paramNames, paramValues, useFa
llback, true); |
| 511 | 511 |
| 512 // If the plugin element already contains a subframe, | 512 // If the plugin element already contains a subframe, |
| 513 // loadOrRedirectSubframe will re-use it. Otherwise, it will create a new | 513 // loadOrRedirectSubframe will re-use it. Otherwise, it will create a new |
| 514 // frame and set it as the LayoutPart's widget, causing what was previously | 514 // frame and set it as the LayoutPart's widget, causing what was previously |
| 515 // in the widget to be torn down. | 515 // in the widget to be torn down. |
| 516 return loadOrRedirectSubframe(completedURL, getNameAttribute(), true); | 516 return loadOrRedirectSubframe(completedURL, getNameAttribute(), true); |
| 517 } | 517 } |
| 518 | 518 |
| 519 bool HTMLPlugInElement::loadPlugin(const KURL& url, const String& mimeType, cons
t Vector<String>& paramNames, const Vector<String>& paramValues, bool useFallbac
k, bool requireRenderer) | 519 bool HTMLPlugInElement::loadPlugin(const KURL& url, const String& mimeType, cons
t Vector<String>& paramNames, const Vector<String>& paramValues, bool useFallbac
k, bool requireLayoutObject) |
| 520 { | 520 { |
| 521 LocalFrame* frame = document().frame(); | 521 LocalFrame* frame = document().frame(); |
| 522 | 522 |
| 523 if (!frame->loader().allowPlugins(AboutToInstantiatePlugin)) | 523 if (!frame->loader().allowPlugins(AboutToInstantiatePlugin)) |
| 524 return false; | 524 return false; |
| 525 | 525 |
| 526 LayoutEmbeddedObject* renderer = layoutEmbeddedObject(); | 526 LayoutEmbeddedObject* layoutObject = layoutEmbeddedObject(); |
| 527 // FIXME: This code should not depend on renderer! | 527 // FIXME: This code should not depend on layoutObject! |
| 528 if ((!renderer && requireRenderer) || useFallback) | 528 if ((!layoutObject && requireLayoutObject) || useFallback) |
| 529 return false; | 529 return false; |
| 530 | 530 |
| 531 WTF_LOG(Plugins, "%p Plugin URL: %s", this, m_url.utf8().data()); | 531 WTF_LOG(Plugins, "%p Plugin URL: %s", this, m_url.utf8().data()); |
| 532 WTF_LOG(Plugins, " Loaded URL: %s", url.string().utf8().data()); | 532 WTF_LOG(Plugins, " Loaded URL: %s", url.string().utf8().data()); |
| 533 m_loadedUrl = url; | 533 m_loadedUrl = url; |
| 534 | 534 |
| 535 OwnPtrWillBeRawPtr<PluginPlaceholder> placeholder = nullptr; | 535 OwnPtrWillBeRawPtr<PluginPlaceholder> placeholder = nullptr; |
| 536 RefPtrWillBeRawPtr<Widget> widget = m_persistedPluginWidget; | 536 RefPtrWillBeRawPtr<Widget> widget = m_persistedPluginWidget; |
| 537 if (!widget) { | 537 if (!widget) { |
| 538 bool loadManually = document().isPluginDocument() && !document().contain
sPlugins(); | 538 bool loadManually = document().isPluginDocument() && !document().contain
sPlugins(); |
| 539 placeholder = frame->loader().client()->createPluginPlaceholder(document
(), url, paramNames, paramValues, mimeType, loadManually); | 539 placeholder = frame->loader().client()->createPluginPlaceholder(document
(), url, paramNames, paramValues, mimeType, loadManually); |
| 540 if (!placeholder) { | 540 if (!placeholder) { |
| 541 FrameLoaderClient::DetachedPluginPolicy policy = requireRenderer ? F
rameLoaderClient::FailOnDetachedPlugin : FrameLoaderClient::AllowDetachedPlugin; | 541 FrameLoaderClient::DetachedPluginPolicy policy = requireLayoutObject
? FrameLoaderClient::FailOnDetachedPlugin : FrameLoaderClient::AllowDetachedPlu
gin; |
| 542 widget = frame->loader().client()->createPlugin(this, url, paramName
s, paramValues, mimeType, loadManually, policy); | 542 widget = frame->loader().client()->createPlugin(this, url, paramName
s, paramValues, mimeType, loadManually, policy); |
| 543 } | 543 } |
| 544 } | 544 } |
| 545 | 545 |
| 546 if (!placeholder && !widget) { | 546 if (!placeholder && !widget) { |
| 547 if (renderer && !renderer->showsUnavailablePluginIndicator()) | 547 if (layoutObject && !layoutObject->showsUnavailablePluginIndicator()) |
| 548 renderer->setPluginUnavailabilityReason(LayoutEmbeddedObject::Plugin
Missing); | 548 layoutObject->setPluginUnavailabilityReason(LayoutEmbeddedObject::Pl
uginMissing); |
| 549 setPlaceholder(nullptr); | 549 setPlaceholder(nullptr); |
| 550 return false; | 550 return false; |
| 551 } | 551 } |
| 552 | 552 |
| 553 if (placeholder) { | 553 if (placeholder) { |
| 554 setPlaceholder(placeholder.release()); | 554 setPlaceholder(placeholder.release()); |
| 555 return true; | 555 return true; |
| 556 } | 556 } |
| 557 | 557 |
| 558 if (renderer) { | 558 if (layoutObject) { |
| 559 setWidget(widget); | 559 setWidget(widget); |
| 560 setPersistedPluginWidget(nullptr); | 560 setPersistedPluginWidget(nullptr); |
| 561 } else { | 561 } else { |
| 562 setPersistedPluginWidget(widget.get()); | 562 setPersistedPluginWidget(widget.get()); |
| 563 } | 563 } |
| 564 setPlaceholder(nullptr); | 564 setPlaceholder(nullptr); |
| 565 document().setContainsPlugins(); | 565 document().setContainsPlugins(); |
| 566 scheduleSVGFilterLayerUpdateHack(); | 566 scheduleSVGFilterLayerUpdateHack(); |
| 567 // Make sure any input event handlers introduced by the plugin are taken int
o account. | 567 // Make sure any input event handlers introduced by the plugin are taken int
o account. |
| 568 if (Page* page = document().frame()->page()) { | 568 if (Page* page = document().frame()->page()) { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 return hasOpenShadowRoot(); | 668 return hasOpenShadowRoot(); |
| 669 } | 669 } |
| 670 | 670 |
| 671 void HTMLPlugInElement::lazyReattachIfNeeded() | 671 void HTMLPlugInElement::lazyReattachIfNeeded() |
| 672 { | 672 { |
| 673 if (!useFallbackContent() && !usePlaceholderContent() && needsWidgetUpdate()
&& layoutObject() && !isImageType()) | 673 if (!useFallbackContent() && !usePlaceholderContent() && needsWidgetUpdate()
&& layoutObject() && !isImageType()) |
| 674 lazyReattachIfAttached(); | 674 lazyReattachIfAttached(); |
| 675 } | 675 } |
| 676 | 676 |
| 677 } | 677 } |
| OLD | NEW |