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

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

Issue 732783002: Reland HTMLPlugInElement: Use custom focus logic only when there is a plugin. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 6 years, 1 month 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
« no previous file with comments | « Source/core/html/HTMLPlugInElement.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLPlugInElement.cpp
diff --git a/Source/core/html/HTMLPlugInElement.cpp b/Source/core/html/HTMLPlugInElement.cpp
index 5f5dd4f0eeab0b089444ad2e45ad77b2df31c1d0..227eb35d67fef7049f9d0367bda1644f4258f1d6 100644
--- a/Source/core/html/HTMLPlugInElement.cpp
+++ b/Source/core/html/HTMLPlugInElement.cpp
@@ -129,7 +129,9 @@ void HTMLPlugInElement::setPersistedPluginWidget(Widget* widget)
bool HTMLPlugInElement::canProcessDrag() const
{
- return pluginWidget() && pluginWidget()->isPluginView() && toPluginView(pluginWidget())->canProcessDrag();
+ if (Widget* widget = existingPluginWidget())
+ return widget->isPluginView() && toPluginView(widget)->canProcessDrag();
+ return false;
}
bool HTMLPlugInElement::willRespondToMouseClickEvents()
@@ -310,7 +312,7 @@ SharedPersistent<v8::Object>* HTMLPlugInElement::pluginWrapper()
if (m_persistedPluginWidget)
plugin = m_persistedPluginWidget.get();
else
- plugin = pluginWidget();
+ plugin = pluginWidgetForJSBindings();
if (plugin)
m_pluginWrapper = frame->script().createPluginWrapper(plugin);
@@ -318,7 +320,14 @@ SharedPersistent<v8::Object>* HTMLPlugInElement::pluginWrapper()
return m_pluginWrapper.get();
}
-Widget* HTMLPlugInElement::pluginWidget() const
+Widget* HTMLPlugInElement::existingPluginWidget() const
+{
+ if (RenderPart* renderPart = existingRenderPart())
+ return renderPart->widget();
+ return nullptr;
+}
+
+Widget* HTMLPlugInElement::pluginWidgetForJSBindings()
{
if (RenderPart* renderPart = renderPartForJSBindings())
return renderPart->widget();
@@ -390,14 +399,21 @@ RenderPart* HTMLPlugInElement::renderPartForJSBindings() const
bool HTMLPlugInElement::isKeyboardFocusable() const
{
+ if (useFallbackContent() || usePlaceholderContent())
+ return HTMLElement::isKeyboardFocusable();
+
if (!document().isActive())
return false;
- return pluginWidget() && pluginWidget()->isPluginView() && toPluginView(pluginWidget())->supportsKeyboardFocus();
+
+ if (Widget* widget = existingPluginWidget())
+ return widget->isPluginView() && toPluginView(widget)->supportsKeyboardFocus();
+
+ return false;
}
bool HTMLPlugInElement::hasCustomFocusLogic() const
{
- return !hasAuthorShadowRoot();
+ return !useFallbackContent() && !usePlaceholderContent();
}
bool HTMLPlugInElement::isPluginElement() const
« no previous file with comments | « Source/core/html/HTMLPlugInElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698