Index: Source/core/html/HTMLPlugInElement.cpp |
diff --git a/Source/core/html/HTMLPlugInElement.cpp b/Source/core/html/HTMLPlugInElement.cpp |
index 0b2df23c31693eb216d32f4f308cd4248aba55c8..9fe43cc0d199c215aca354dbe07bacb5c08625ee 100644 |
--- a/Source/core/html/HTMLPlugInElement.cpp |
+++ b/Source/core/html/HTMLPlugInElement.cpp |
@@ -68,6 +68,7 @@ HTMLPlugInElement::HTMLPlugInElement(const QualifiedName& tagName, Document& doc |
, m_needsWidgetUpdate(!createdByParser) |
, m_shouldPreferPlugInsForImages(preferPlugInsForImagesOption == ShouldPreferPlugInsForImages) |
, m_displayState(Playing) |
+ , m_protectWidgetDuringReattach(0) |
{ |
setHasCustomStyleCallbacks(); |
} |
@@ -118,6 +119,16 @@ void HTMLPlugInElement::attach(const AttachContext& context) |
if (!renderer() || useFallbackContent()) |
return; |
+ |
+ if (m_protectWidgetDuringReattach) { |
+ if (RenderEmbeddedObject* object = renderEmbeddedObject()) { |
+ setNeedsWidgetUpdate(false); |
+ object->setWidget(m_protectWidgetDuringReattach.get()); |
+ } |
+ m_protectWidgetDuringReattach.clear(); |
+ return; |
+ } |
+ |
if (isImageType()) { |
if (!m_imageLoader) |
m_imageLoader = adoptPtr(new HTMLImageLoader(this)); |
@@ -144,6 +155,9 @@ void HTMLPlugInElement::updateWidget() |
void HTMLPlugInElement::detach(const AttachContext& context) |
{ |
+ if (context.performingReattach && renderEmbeddedObject()) |
+ m_protectWidgetDuringReattach = pluginWidget(); |
+ |
// Update the widget the next time we attach (detaching destroys the plugin). |
// FIXME: None of this "needsWidgetUpdate" related code looks right. |
if (renderer() && !useFallbackContent()) |