mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 07:13:20 +00:00
Bug 539356 - Part 13 - Only repaint widgets that have had changes since the last paint. r=roc
This commit is contained in:
parent
2ebb996f8c
commit
77b0977198
@ -23,6 +23,7 @@
|
||||
#include "nsEventStateManager.h"
|
||||
#include "mozilla/StartupTimeline.h"
|
||||
#include "sampler.h"
|
||||
#include "nsRefreshDriver.h"
|
||||
|
||||
/**
|
||||
XXX TODO XXX
|
||||
@ -377,7 +378,9 @@ void nsViewManager::ProcessPendingUpdatesForView(nsView* aView,
|
||||
// damage is applied based on the final widget geometry
|
||||
if (aFlushDirtyRegion) {
|
||||
nsIWidget *widget = aView->GetWidget();
|
||||
if (widget) {
|
||||
if (widget && widget->NeedsPaint() && aView->HasNonEmptyDirtyRegion()) {
|
||||
FlushDirtyRegionToWidget(aView);
|
||||
SetPainting(true);
|
||||
#ifdef DEBUG_INVALIDATIONS
|
||||
printf("---- PAINT START ----PresShell(%p), nsView(%p), nsIWidget(%p)\n", mPresShell, aView, widget);
|
||||
#endif
|
||||
@ -386,8 +389,8 @@ void nsViewManager::ProcessPendingUpdatesForView(nsView* aView,
|
||||
#ifdef DEBUG_INVALIDATIONS
|
||||
printf("---- PAINT END ----\n");
|
||||
#endif
|
||||
SetPainting(false);
|
||||
}
|
||||
FlushDirtyRegionToWidget(aView);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -409,6 +409,7 @@ class nsIWidget : public nsISupports {
|
||||
nsIWidget()
|
||||
: mLastChild(nullptr)
|
||||
, mPrevSibling(nullptr)
|
||||
, mNeedsPaint(false)
|
||||
{}
|
||||
|
||||
|
||||
@ -1593,6 +1594,9 @@ class nsIWidget : public nsISupports {
|
||||
*/
|
||||
virtual bool WidgetPaintsBackground() { return false; }
|
||||
|
||||
bool NeedsPaint() {
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Get the natural bounds of this widget. This method is only
|
||||
* meaningful for widgets for which Gecko implements screen
|
||||
@ -1643,6 +1647,7 @@ protected:
|
||||
nsIWidget* mLastChild;
|
||||
nsCOMPtr<nsIWidget> mNextSibling;
|
||||
nsIWidget* mPrevSibling;
|
||||
bool mNeedsPaint;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIWidget, NS_IWIDGET_IID)
|
||||
|
Loading…
Reference in New Issue
Block a user