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
This commit is contained in:
Matt Woodrow 2012-08-13 22:10:10 +12:00
Родитель 77b0977198
Коммит b692b60d20
1 изменённых файлов: 7 добавлений и 3 удалений

Просмотреть файл

@ -409,7 +409,6 @@ class nsIWidget : public nsISupports {
nsIWidget() nsIWidget()
: mLastChild(nullptr) : mLastChild(nullptr)
, mPrevSibling(nullptr) , mPrevSibling(nullptr)
, mNeedsPaint(false)
{} {}
@ -1595,7 +1594,13 @@ class nsIWidget : public nsISupports {
virtual bool WidgetPaintsBackground() { return false; } virtual bool WidgetPaintsBackground() { return false; }
bool NeedsPaint() { 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 * Get the natural bounds of this widget. This method is only
@ -1647,7 +1652,6 @@ protected:
nsIWidget* mLastChild; nsIWidget* mLastChild;
nsCOMPtr<nsIWidget> mNextSibling; nsCOMPtr<nsIWidget> mNextSibling;
nsIWidget* mPrevSibling; nsIWidget* mPrevSibling;
bool mNeedsPaint;
}; };
NS_DEFINE_STATIC_IID_ACCESSOR(nsIWidget, NS_IWIDGET_IID) NS_DEFINE_STATIC_IID_ACCESSOR(nsIWidget, NS_IWIDGET_IID)