Bug 728284. Don't try to paint an opaque background for widgets that do it themselves. r=roc
authorTimothy Nikkel <tnikkel@gmail.com>
Tue, 17 Apr 2012 01:04:05 -0500
changeset 91834 8951d7e2d564ffdc7f7fb8c3947ab7f688a450a8
parent 91833 6dbdb799fa6dd7161a05e1712e36c426bd192f5b
child 91835 e78c08c87860fc30afacccfd658f2ca53f7c4e27
push id687
push userrcampbell@mozilla.com
push dateTue, 17 Apr 2012 17:29:54 +0000
treeherderfx-team@3a9629092a5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs728284
milestone14.0a1
Bug 728284. Don't try to paint an opaque background for widgets that do it themselves. r=roc
layout/base/nsPresShell.cpp
widget/android/nsWindow.h
widget/nsIWidget.h
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -5055,17 +5055,18 @@ void PresShell::UpdateCanvasBackground()
       tabChild->SetBackgroundColor(mCanvasBackgroundColor);
     }
   }
 }
 
 nscolor PresShell::ComputeBackstopColor(nsIView* aDisplayRoot)
 {
   nsIWidget* widget = aDisplayRoot->GetWidget();
-  if (widget && widget->GetTransparencyMode() != eTransparencyOpaque) {
+  if (widget && (widget->GetTransparencyMode() != eTransparencyOpaque ||
+                 widget->WidgetPaintsBackground())) {
     // Within a transparent widget, so the backstop color must be
     // totally transparent.
     return NS_RGBA(0,0,0,0);
   }
   // Within an opaque widget (or no widget at all), so the backstop
   // color must be totally opaque. The user's default background
   // as reported by the prescontext is guaranteed to be opaque.
   return GetDefaultBackgroundColorToDraw();
--- a/widget/android/nsWindow.h
+++ b/widget/android/nsWindow.h
@@ -182,16 +182,18 @@ public:
     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();
     static void ScheduleResumeComposition();
+
+    virtual bool WidgetPaintsBackground() { return true; }
 #endif
 
 protected:
     void BringToFront();
     nsWindow *FindTopLevel();
     bool DrawTo(gfxASurface *targetSurface);
     bool DrawTo(gfxASurface *targetSurface, const nsIntRect &aRect);
     bool IsTopLevel();
--- a/widget/nsIWidget.h
+++ b/widget/nsIWidget.h
@@ -113,18 +113,18 @@ typedef nsEventStatus (* EVENT_CALLBACK)
 #endif
 #ifdef XP_WIN
 #define NS_NATIVE_TSF_THREAD_MGR       100
 #define NS_NATIVE_TSF_CATEGORY_MGR     101
 #define NS_NATIVE_TSF_DISPLAY_ATTR_MGR 102
 #endif
 
 #define NS_IWIDGET_IID \
-  { 0xb5bb55c7, 0x9a50, 0x4fa8, \
-    { 0xa7, 0x6e, 0xbd, 0x31, 0x6f, 0x3e, 0x9c, 0x13 } }
+  { 0x7c7ff2ff, 0x61f9, 0x4240, \
+    { 0xaa, 0x58, 0x74, 0xb0, 0xcd, 0xa9, 0xe3, 0x05 } }
 
 /*
  * Window shadow styles
  * Also used for the -moz-window-shadow CSS property
  */
 
 #define NS_STYLE_WINDOW_SHADOW_NONE             0
 #define NS_STYLE_WINDOW_SHADOW_DEFAULT          1
@@ -1590,16 +1590,23 @@ class nsIWidget : public nsISupports {
      */
     virtual PRUint32 GetGLFrameBufferFormat() { return 0; /*GL_NONE*/ }
 
     /**
      * Return true if widget has it's own GL context
      */
     virtual bool HasGLContext() { return false; }
 
+    /**
+     * 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; }
+
 protected:
 
     // keep the list of children.  We also keep track of our siblings.
     // The ownership model is as follows: parent holds a strong ref to
     // the first element of the list, and each element holds a strong
     // ref to the next element in the list.  The prevsibling and
     // lastchild pointers are weak, which is fine as long as they are
     // maintained properly.