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

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

Issue 1284403003: Persist plugins over reattach. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase to master 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
« no previous file with comments | « Source/core/html/HTMLPlugInElement.h ('k') | Source/platform/Widget.h » ('j') | 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 cde57a859cdcdc7988fd99d701bf3571e05cf17c..a93b6f11ffc9845830ee5a861d64ea5c92c68500 100644
--- a/Source/core/html/HTMLPlugInElement.cpp
+++ b/Source/core/html/HTMLPlugInElement.cpp
@@ -163,8 +163,15 @@ void HTMLPlugInElement::attach(const AttachContext& context)
{
HTMLFrameOwnerElement::attach(context);
- if (!layoutObject() || useFallbackContent())
+ if (!layoutObject() || useFallbackContent()) {
+ // If we don't have a layoutObject we have to dispose of any plugins
+ // which we persisted over a reattach.
+ if (m_persistedPluginWidget) {
+ HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates;
+ setPersistedPluginWidget(nullptr);
+ }
return;
+ }
if (isImageType()) {
if (!m_imageLoader)
@@ -191,6 +198,17 @@ void HTMLPlugInElement::updateWidget()
}
}
+void HTMLPlugInElement::removedFrom(ContainerNode* insertionPoint)
+{
+ // If we've persisted the plugin and we're removed from the tree then
+ // make sure we cleanup the persistance pointer.
+ if (m_persistedPluginWidget) {
+ HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates;
+ setPersistedPluginWidget(nullptr);
+ }
+ HTMLFrameOwnerElement::removedFrom(insertionPoint);
+}
+
void HTMLPlugInElement::requestPluginCreationWithoutLayoutObjectIfPossible()
{
if (m_serviceType.isEmpty())
@@ -241,7 +259,7 @@ void HTMLPlugInElement::detach(const AttachContext& context)
// Only try to persist a plugin widget we actually own.
Widget* plugin = ownedWidget();
- if (plugin && plugin->pluginShouldPersist())
+ if (plugin && context.performingReattach)
setPersistedPluginWidget(plugin);
resetInstance();
« no previous file with comments | « Source/core/html/HTMLPlugInElement.h ('k') | Source/platform/Widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698