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

Unified Diff: Source/core/html/HTMLPlugInElement.cpp

Issue 1313763002: Blink Plugins: Remove Shadow DOM Plugin Placeholder (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/html/HTMLPlugInElement.cpp
diff --git a/Source/core/html/HTMLPlugInElement.cpp b/Source/core/html/HTMLPlugInElement.cpp
index cde57a859cdcdc7988fd99d701bf3571e05cf17c..5d34f1bceccc0b80074fdf0e755c7c1197bf629b 100644
--- a/Source/core/html/HTMLPlugInElement.cpp
+++ b/Source/core/html/HTMLPlugInElement.cpp
@@ -47,7 +47,6 @@
#include "core/loader/MixedContentChecker.h"
#include "core/page/Page.h"
#include "core/page/scrolling/ScrollingCoordinator.h"
-#include "core/plugins/PluginPlaceholder.h"
#include "core/plugins/PluginView.h"
#include "platform/Logging.h"
#include "platform/MIMETypeFromURL.h"
@@ -87,7 +86,6 @@ HTMLPlugInElement::~HTMLPlugInElement()
DEFINE_TRACE(HTMLPlugInElement)
{
visitor->trace(m_imageLoader);
- visitor->trace(m_placeholder);
visitor->trace(m_persistedPluginWidget);
HTMLFrameOwnerElement::trace(visitor);
}
@@ -130,9 +128,7 @@ void HTMLPlugInElement::setPersistedPluginWidget(Widget* widget)
bool HTMLPlugInElement::canProcessDrag() const
{
- if (Widget* widget = existingPluginWidget())
- return widget->isPluginView() && toPluginView(widget)->canProcessDrag();
- return false;
+ return pluginWidget() && pluginWidget()->isPluginView() && toPluginView(pluginWidget())->canProcessDrag();
}
bool HTMLPlugInElement::willRespondToMouseClickEvents()
@@ -270,8 +266,6 @@ LayoutObject* HTMLPlugInElement::createLayoutObject(const ComputedStyle& style)
return image;
}
- if (usePlaceholderContent())
- return new LayoutBlockFlow(this);
return new LayoutEmbeddedObject(this);
}
@@ -307,7 +301,7 @@ SharedPersistent<v8::Object>* HTMLPlugInElement::pluginWrapper()
if (m_persistedPluginWidget)
plugin = m_persistedPluginWidget.get();
else
- plugin = pluginWidgetForJSBindings();
+ plugin = pluginWidget();
if (plugin)
m_pluginWrapper = frame->script().createPluginWrapper(plugin);
@@ -315,14 +309,7 @@ SharedPersistent<v8::Object>* HTMLPlugInElement::pluginWrapper()
return m_pluginWrapper.get();
}
-Widget* HTMLPlugInElement::existingPluginWidget() const
-{
- if (LayoutPart* layoutPart = existingLayoutPart())
- return layoutPart->widget();
- return nullptr;
-}
-
-Widget* HTMLPlugInElement::pluginWidgetForJSBindings()
+Widget* HTMLPlugInElement::pluginWidget() const
{
if (LayoutPart* layoutPart = layoutPartForJSBindings())
return layoutPart->widget();
@@ -394,21 +381,14 @@ LayoutPart* HTMLPlugInElement::layoutPartForJSBindings() const
bool HTMLPlugInElement::isKeyboardFocusable() const
{
- if (useFallbackContent() || usePlaceholderContent())
- return HTMLElement::isKeyboardFocusable();
-
if (!document().isActive())
return false;
-
- if (Widget* widget = existingPluginWidget())
- return widget->isPluginView() && toPluginView(widget)->supportsKeyboardFocus();
-
- return false;
+ return pluginWidget() && pluginWidget()->isPluginView() && toPluginView(pluginWidget())->supportsKeyboardFocus();
}
bool HTMLPlugInElement::hasCustomFocusLogic() const
{
- return !useFallbackContent() && !usePlaceholderContent();
+ return !useFallbackContent();
}
bool HTMLPlugInElement::isPluginElement() const
@@ -436,10 +416,9 @@ NPObject* HTMLPlugInElement::getNPObject()
void HTMLPlugInElement::setPluginFocus(bool focused)
{
- Widget* focusedWidget = existingPluginWidget();
// NPAPI flash requires to receive messages when web contents focus changes.
- if (getNPObject() && focusedWidget)
- focusedWidget->setFocus(focused, WebFocusTypeNone);
+ if (getNPObject() && pluginWidget() && pluginWidget()->isPluginView())
tommycli 2015/08/25 00:18:10 Extra scrutiny here: This was added by this patch
jbroman 2015/08/25 00:34:10 Do we even still support NPAPI Flash? I'd suspect
+ toPluginView(pluginWidget())->setFocus(focused, WebFocusTypeNone);
}
bool HTMLPlugInElement::isImageType()
@@ -525,36 +504,25 @@ bool HTMLPlugInElement::loadPlugin(const KURL& url, const String& mimeType, cons
WTF_LOG(Plugins, " Loaded URL: %s", url.string().utf8().data());
m_loadedUrl = url;
- OwnPtrWillBeRawPtr<PluginPlaceholder> placeholder = nullptr;
RefPtrWillBeRawPtr<Widget> widget = m_persistedPluginWidget;
if (!widget) {
bool loadManually = document().isPluginDocument() && !document().containsPlugins();
- placeholder = frame->loader().client()->createPluginPlaceholder(document(), url, paramNames, paramValues, mimeType, loadManually);
- if (!placeholder) {
- FrameLoaderClient::DetachedPluginPolicy policy = requireLayoutObject ? FrameLoaderClient::FailOnDetachedPlugin : FrameLoaderClient::AllowDetachedPlugin;
- widget = frame->loader().client()->createPlugin(this, url, paramNames, paramValues, mimeType, loadManually, policy);
- }
+ FrameLoaderClient::DetachedPluginPolicy policy = requireLayoutObject ? FrameLoaderClient::FailOnDetachedPlugin : FrameLoaderClient::AllowDetachedPlugin;
+ widget = frame->loader().client()->createPlugin(this, url, paramNames, paramValues, mimeType, loadManually, policy);
}
- if (!placeholder && !widget) {
+ if (!widget) {
if (layoutObject && !layoutObject->showsUnavailablePluginIndicator())
layoutObject->setPluginUnavailabilityReason(LayoutEmbeddedObject::PluginMissing);
- setPlaceholder(nullptr);
return false;
}
- if (placeholder) {
- setPlaceholder(placeholder.release());
- return true;
- }
-
if (layoutObject) {
setWidget(widget);
setPersistedPluginWidget(nullptr);
} else {
setPersistedPluginWidget(widget.get());
}
- setPlaceholder(nullptr);
document().setContainsPlugins();
// TODO(esprehn): WebPluginContainerImpl::setWebLayer also schedules a compositing update, do we need both?
setNeedsCompositingUpdate();
@@ -583,22 +551,7 @@ bool HTMLPlugInElement::shouldUsePlugin(const KURL& url, const String& mimeType,
// it be handled as a plugin to show the broken plugin icon.
useFallback = objectType == ObjectContentNone && hasFallback;
return objectType == ObjectContentNone || objectType == ObjectContentNetscapePlugin || objectType == ObjectContentOtherPlugin;
-}
-void HTMLPlugInElement::setPlaceholder(PassOwnPtrWillBeRawPtr<PluginPlaceholder> placeholder)
-{
- bool needsLazyReattach = (!placeholder) != (!m_placeholder);
- if (placeholder) {
- placeholder->loadIntoContainer(ensureUserAgentShadowRoot());
- m_placeholder = placeholder;
- } else {
- ShadowRoot& shadowRoot = ensureUserAgentShadowRoot();
- shadowRoot.removeChildren();
- shadowRoot.appendChild(HTMLContentElement::create(document()));
- m_placeholder.clear();
- }
- if (needsLazyReattach)
- lazyReattachIfAttached();
}
void HTMLPlugInElement::dispatchErrorEvent()
@@ -664,7 +617,7 @@ bool HTMLPlugInElement::useFallbackContent() const
void HTMLPlugInElement::lazyReattachIfNeeded()
{
- if (!useFallbackContent() && !usePlaceholderContent() && needsWidgetUpdate() && layoutObject() && !isImageType())
+ if (!useFallbackContent() && needsWidgetUpdate() && layoutObject() && !isImageType())
lazyReattachIfAttached();
}

Powered by Google App Engine
This is Rietveld 408576698