Bug 1148978 - Trigger paints when moving plugin windows around on the browser main thread. r=mattwoodrow
authorJim Mathies <jmathies@mozilla.com>
Thu, 24 Mar 2016 09:32:02 -0500
changeset 290939 b2feb217e8f987e13d2af4e5996904ef4f42274b
parent 290938 80c450b87a71814459f51ee337f15f5321216b83
child 290940 f6306cddab36e0d0ef9b4ad11c3bde27e8d17e1e
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1148978
milestone48.0a1
Bug 1148978 - Trigger paints when moving plugin windows around on the browser main thread. r=mattwoodrow MozReview-Commit-ID: B75An9a5VTd
gfx/layers/ipc/CompositorBridgeChild.cpp
--- a/gfx/layers/ipc/CompositorBridgeChild.cpp
+++ b/gfx/layers/ipc/CompositorBridgeChild.cpp
@@ -293,33 +293,35 @@ CompositorBridgeChild::RecvUpdatePluginC
       parent = widget->GetParent();
     }
     bool isVisible = aPlugins[pluginsIdx].visible();
     if (widget && !widget->Destroyed()) {
       LayoutDeviceIntRect bounds;
       LayoutDeviceIntRect visibleBounds;
       // If the plugin is visible update it's geometry.
       if (isVisible) {
-        // bounds (content origin) - don't pass true to Resize, it triggers a
-        // sync paint update to the plugin process on Windows, which happens
-        // prior to clipping information being applied.
+        // Set bounds (content origin)
         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<LayoutDeviceIntRect> rectsOut;
         // This call may change the value of isVisible
         CalculatePluginClip(bounds, aPlugins[pluginsIdx].clip(),
                             aContentOffset,
                             aParentLayerVisibleRegion,
                             rectsOut, visibleBounds, isVisible);
         // content clipping region (widget origin)
         rv = widget->SetWindowClipRegion(rectsOut, false);
         NS_ASSERTION(NS_SUCCEEDED(rv), "widget call failure");
+        // This will trigger a browser window paint event for areas uncovered
+        // by a child window move, and will call invalidate on the plugin
+        // parent window which the browser owns. The latter gets picked up in
+        // our OnPaint handler and forwarded over to the plugin process async.
+        rv = widget->Resize(aContentOffset.x + bounds.x,
+                            aContentOffset.y + bounds.y,
+                            bounds.width, bounds.height, true);
+        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");