Bug 832641 - Invalidate popups when they become visible rather than handling invalidations while they are hidden. r=roc, a=lsblakk
--- 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.