From b692b60d20a407b41827a44338c565ca6330eeb8 Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Mon, 13 Aug 2012 22:10:10 +1200 Subject: [PATCH] Bug 539356 - Part 17 - Don't paint widgets that an invisible or empty bounds. r=roc * * * Bug 539356 - Part 13 - Only repaint widgets that have had changes since the last paint --- widget/nsIWidget.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/widget/nsIWidget.h b/widget/nsIWidget.h index b4bfb119f865..b0731523b0d0 100644 --- a/widget/nsIWidget.h +++ b/widget/nsIWidget.h @@ -409,7 +409,6 @@ class nsIWidget : public nsISupports { nsIWidget() : mLastChild(nullptr) , mPrevSibling(nullptr) - , mNeedsPaint(false) {} @@ -1595,7 +1594,13 @@ class nsIWidget : public nsISupports { virtual bool WidgetPaintsBackground() { return false; } 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 @@ -1647,7 +1652,6 @@ protected: nsIWidget* mLastChild; nsCOMPtr mNextSibling; nsIWidget* mPrevSibling; - bool mNeedsPaint; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsIWidget, NS_IWIDGET_IID)