Bug 539356 - Part 24 - Don't paint android widgets that aren't being composited, or at the front. r=roc
authorMatt Woodrow <mwoodrow@mozilla.com>
Sat, 30 Jun 2012 15:06:13 +1200
changeset 98026 6e8c5c011767c7d7e5072dc27cb192750ce347c0
parent 98025 3f8e99e9234442b96484b5fe66d9d39e57c63a20
child 98027 f7599b247eef46459e794f3a9661dec6fbbf7acc
push id23017
push userryanvm@gmail.com
push dateSat, 30 Jun 2012 19:29:24 +0000
treeherdermozilla-central@4c2ddc60f360 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs539356
milestone16.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 539356 - Part 24 - Don't paint android widgets that aren't being composited, or at the front. r=roc
widget/android/nsWindow.cpp
widget/android/nsWindow.h
widget/nsIWidget.h
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -2331,10 +2331,19 @@ nsWindow::WidgetPaintsBackground()
         mozilla::Preferences::AddBoolVarCache(&sWidgetPaintsBackground,
                                               "android.widget_paints_background",
                                               true);
     }
 
     return sWidgetPaintsBackground;
 }
 
+bool
+nsWindow::NeedsPaint()
+{
+  if (sCompositorPaused || FindTopLevel() != nsWindow::TopWindow()) {
+    return false;
+  }
+  return nsIWidget::NeedsPaint();
+}
+
 #endif
 
--- a/widget/android/nsWindow.h
+++ b/widget/android/nsWindow.h
@@ -143,16 +143,17 @@ public:
     LayerManager* GetLayerManager (PLayersChild* aShadowManager = nsnull, 
                                    LayersBackend aBackendHint = LayerManager::LAYERS_NONE, 
                                    LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT, 
                                    bool* aAllowRetaining = nsnull);
 
     NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent);
 
 #ifdef MOZ_JAVA_COMPOSITOR
+    virtual bool NeedsPaint();
     virtual void DrawWindowUnderlay(LayerManager* aManager, nsIntRect aRect);
     virtual void DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect);
 
     static void SetCompositor(mozilla::layers::CompositorParent* aCompositorParent,
                               mozilla::layers::CompositorChild* aCompositorChild,
                               ::base::Thread* aCompositorThread);
     static void ScheduleComposite();
     static void SchedulePauseComposition();
--- a/widget/nsIWidget.h
+++ b/widget/nsIWidget.h
@@ -1567,17 +1567,17 @@ class nsIWidget : public nsISupports {
     /**
      * Returns true to indicate that this widget paints an opaque background
      * that we want to be visible under the page, so layout should not force
      * a default background.
      */
     virtual bool WidgetPaintsBackground() { return false; }
 
     void SetNeedsPaint(bool aNeedsPaint) { mNeedsPaint = aNeedsPaint; }
-    bool NeedsPaint() { 
+    virtual bool NeedsPaint() { 
       if (!mNeedsPaint) {
         return false;
       }
 
       bool visible;
       nsresult rv = IsVisible(visible);
       NS_ENSURE_SUCCESS(rv, false);
       if (!visible) {