Bug 1132592 - Avoid showing PluginWidgetParent widgets before they are positioned and clipped. r=aklotz
authorJim Mathies <jmathies@mozilla.com>
Fri, 13 Feb 2015 12:27:56 -0600
changeset 243040 15dea2b0929b0dd78da350fc13fe877c6e6685a9
parent 243039 c598faec1736c6c141fc13b061d9039eb42b2847
child 243041 c99e7a982123e33a55cce791f0fd92dd38d6bfb2
push id696
push userjoshua.m.grant@gmail.com
push dateMon, 16 Feb 2015 15:36:51 +0000
reviewersaklotz
bugs1132592
milestone38.0a1
Bug 1132592 - Avoid showing PluginWidgetParent widgets before they are positioned and clipped. r=aklotz
dom/plugins/ipc/PluginWidgetParent.cpp
gfx/layers/ipc/CompositorChild.cpp
--- a/dom/plugins/ipc/PluginWidgetParent.cpp
+++ b/dom/plugins/ipc/PluginWidgetParent.cpp
@@ -147,20 +147,16 @@ PluginWidgetParent::RecvCreate(nsresult*
     mWidget = nullptr;
     // This should never fail, abort.
     return false;
   }
 
   DebugOnly<nsresult> drv;
   drv = mWidget->EnableDragDrop(true);
   NS_ASSERTION(NS_SUCCEEDED(drv), "widget call failure");
-  drv = mWidget->Show(true);
-  NS_ASSERTION(NS_SUCCEEDED(drv), "widget call failure");
-  drv = mWidget->Enable(true);
-  NS_ASSERTION(NS_SUCCEEDED(drv), "widget call failure");
 
 #if defined(MOZ_WIDGET_GTK)
   // For setup, initially GTK code expects 'window' to hold the parent.
   mWrapper->window = mWidget->GetNativeData(NS_NATIVE_PLUGIN_PORT);
   drv = mWrapper->CreateXEmbedWindow(false);
   NS_ASSERTION(NS_SUCCEEDED(drv), "widget call failure");
   mWrapper->SetAllocation();
   PWLOG("Plugin XID=%p\n", (void*)mWrapper->window);
--- a/gfx/layers/ipc/CompositorChild.cpp
+++ b/gfx/layers/ipc/CompositorChild.cpp
@@ -212,26 +212,28 @@ CompositorChild::RecvUpdatePluginConfigu
         // sync paint update to the plugin process on Windows, which happens
         // prior to clipping information being applied.
         bounds = aPlugins[pluginsIdx].bounds();
         rv = widget->Resize(aContentOffset.x + bounds.x,
                             aContentOffset.y + bounds.y,
                             bounds.width, bounds.height, false);
         NS_ASSERTION(NS_SUCCEEDED(rv), "widget call failure");
         nsTArray<nsIntRect> rectsOut;
+        // This call may change the value of isVisible
         CalculatePluginClip(bounds, aPlugins[pluginsIdx].clip(),
                             aContentOffset, aParentLayerVisibleRegion,
                             rectsOut, visibleBounds, isVisible);
-        if (isVisible) {
-          // content clipping region (widget origin)
-          rv = widget->SetWindowClipRegion(rectsOut, false);
-          NS_ASSERTION(NS_SUCCEEDED(rv), "widget call failure");
-        }
+        // content clipping region (widget origin)
+        rv = widget->SetWindowClipRegion(rectsOut, false);
+        NS_ASSERTION(NS_SUCCEEDED(rv), "widget call failure");
       }
 
+      rv = widget->Enable(isVisible);
+      NS_ASSERTION(NS_SUCCEEDED(rv), "widget call failure");
+
       // visible state - updated after clipping, prior to invalidating
       rv = widget->Show(isVisible);
       NS_ASSERTION(NS_SUCCEEDED(rv), "widget call failure");
 
       // Handle invalidation, this can be costly, avoid if it is not needed.
       if (isVisible) {
         // invalidate region (widget origin)
         nsIntRect bounds = aPlugins[pluginsIdx].bounds();