Bug 832641 - Invalidate popups when they become visible rather than handling invalidations while they are hidden. r=roc, a=lsblakk
authorMatt Woodrow <mwoodrow@mozilla.com>
Wed, 23 Jan 2013 18:46:36 +1300
changeset 123773 13a8dd1531dab6687b5e9c1ebd76e9aa59144fe2
parent 123772 4be66100afd168ca823522d147ef7648243b802f
child 123774 b88a7f9585925d6912a857ca47e6dfe692e4c442
push idunknown
push userunknown
push dateunknown
reviewersroc, lsblakk
bugs832641
milestone20.0a2
Bug 832641 - Invalidate popups when they become visible rather than handling invalidations while they are hidden. r=roc, a=lsblakk
layout/xul/base/src/nsMenuPopupFrame.cpp
widget/android/nsWindow.cpp
widget/nsIWidget.h
--- a/layout/xul/base/src/nsMenuPopupFrame.cpp
+++ b/layout/xul/base/src/nsMenuPopupFrame.cpp
@@ -708,16 +708,18 @@ nsMenuPopupFrame::InitializePopupWithAnc
   }
 }
 
 void
 nsMenuPopupFrame::ShowPopup(bool aIsContextMenu, bool aSelectFirstItem)
 {
   mIsContextMenu = aIsContextMenu;
 
+  InvalidateFrameSubtree();
+
   if (mPopupState == ePopupShowing) {
     mPopupState = ePopupOpen;
     mIsOpenChanged = true;
 
     nsMenuFrame* menuFrame = do_QueryFrame(GetParent());
     if (menuFrame) {
       nsWeakFrame weakFrame(this);
       menuFrame->PopupOpened();
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -2348,15 +2348,12 @@ nsWindow::WidgetPaintsBackground()
 }
 
 bool
 nsWindow::NeedsPaint()
 {
   if (sCompositorPaused || FindTopLevel() != nsWindow::TopWindow()) {
     return false;
   }
-  nsIntRect bounds;
-  nsresult rv = GetBounds(bounds);
-  NS_ENSURE_SUCCESS(rv, false);
-  return !bounds.IsEmpty();
+  return nsIWidget::NeedsPaint();
 }
 
 
--- a/widget/nsIWidget.h
+++ b/widget/nsIWidget.h
@@ -1636,17 +1636,23 @@ 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; }
 
     virtual bool NeedsPaint() {
-      return true;
+       if (!IsVisible()) {
+           return false;
+       }
+       nsIntRect bounds;
+       nsresult rv = GetBounds(bounds);
+       NS_ENSURE_SUCCESS(rv, false);
+       return !bounds.IsEmpty();
     }
     /**
      * Get the natural bounds of this widget.  This method is only
      * meaningful for widgets for which Gecko implements screen
      * rotation natively.  When this is the case, GetBounds() returns
      * the widget bounds taking rotation into account, and
      * GetNaturalBounds() returns the bounds *not* taking rotation
      * into account.