Bug 1294479 - Invalidate when recompositing plugin frame; r=snorp
authorJim Chen <nchen@mozilla.com>
Tue, 23 Aug 2016 18:55:12 -0400
changeset 341689 9f8fa66e5b4c6e35c27a88ec59652b037d482526
parent 341688 aa257626c558ebe8077aba7534fdc18d9f26d8d8
child 341690 ca1fbb8218da27833878ac481b194b7ddf865a67
push id5
push userfmarier@mozilla.com
push dateFri, 26 Aug 2016 00:45:46 +0000
reviewerssnorp
bugs1294479
milestone51.0a1
Bug 1294479 - Invalidate when recompositing plugin frame; r=snorp Invalidate in addition to scheduling a composition, so that compositing actually works.
dom/plugins/base/nsPluginInstanceOwner.cpp
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -85,16 +85,17 @@ static NS_DEFINE_CID(kAppShellCID, NS_AP
 #ifdef MOZ_WIDGET_GTK
 #include <gdk/gdk.h>
 #include <gtk/gtk.h>
 #endif
 
 #ifdef MOZ_WIDGET_ANDROID
 #include "ANPBase.h"
 #include "AndroidBridge.h"
+#include "ClientLayerManager.h"
 #include "nsWindow.h"
 
 static nsPluginInstanceOwner* sFullScreenInstance = nullptr;
 
 using namespace mozilla::dom;
 
 #include <android/log.h>
 #define LOG(args...)  __android_log_print(ANDROID_LOG_INFO, "GeckoPlugins" , ## args)
@@ -1599,17 +1600,22 @@ void nsPluginInstanceOwner::Invalidate()
 
 void nsPluginInstanceOwner::Recomposite() {
   nsIWidget* const widget = mPluginFrame->GetNearestWidget();
   NS_ENSURE_TRUE_VOID(widget);
 
   LayerManager* const lm = widget->GetLayerManager();
   NS_ENSURE_TRUE_VOID(lm);
 
-  lm->Composite();
+  ClientLayerManager* const clm = lm->AsClientLayerManager();
+  NS_ENSURE_TRUE_VOID(clm && clm->GetRoot());
+
+  clm->SendInvalidRegion(
+      clm->GetRoot()->GetLocalVisibleRegion().ToUnknownRegion().GetBounds());
+  clm->Composite();
 }
 
 void nsPluginInstanceOwner::RequestFullScreen() {
   if (mFullScreen)
     return;
 
   // Remove whatever view we currently have (if any, fullscreen or otherwise)
   RemovePluginView();