Bug 987030 - Fix compressed paint timer scheduling. r=roc

This commit is contained in:
Markus Stange 2014-08-08 12:46:50 +02:00
parent 57f568303e
commit f425c9e3e7
3 changed files with 17 additions and 13 deletions

View File

@ -3744,9 +3744,7 @@ public:
NS_IMETHODIMP Notify(nsITimer* aTimer) MOZ_FINAL
{
mShell->SetNextPaintCompressed();
mShell->AddInvalidateHiddenPresShellObserver(mShell->GetPresContext()->RefreshDriver());
mShell->ScheduleViewManagerFlush();
mShell->DelayedPaintTimerFired();
return NS_OK;
}
@ -3766,8 +3764,11 @@ PresShell::ScheduleViewManagerFlush(PaintType aType)
static const uint32_t kPaintDelayPeriod = 1000;
if (!mDelayedPaintTimer) {
mDelayedPaintTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
}
if (mDelayedPaintTimer && !mDelayedPaintTimerActive) {
nsRefPtr<PaintTimerCallBack> cb = new PaintTimerCallBack(this);
mDelayedPaintTimer->InitWithCallback(cb, kPaintDelayPeriod, nsITimer::TYPE_ONE_SHOT);
mDelayedPaintTimerActive = true;
}
return;
}
@ -3775,12 +3776,21 @@ PresShell::ScheduleViewManagerFlush(PaintType aType)
nsPresContext* presContext = GetPresContext();
if (presContext) {
presContext->RefreshDriver()->ScheduleViewManagerFlush();
AddInvalidateHiddenPresShellObserver(presContext->RefreshDriver());
}
if (mDocument) {
mDocument->SetNeedLayoutFlush();
}
}
void
PresShell::DelayedPaintTimerFired()
{
mDelayedPaintTimerActive = false;
mNextPaintCompressed = true;
ScheduleViewManagerFlush();
}
void
PresShell::DispatchSynthMouseMove(WidgetGUIEvent* aEvent,
bool aFlushOnHoverChange)

View File

@ -372,8 +372,6 @@ public:
virtual void RecordShadowStyleChange(mozilla::dom::ShadowRoot* aShadowRoot);
void SetNextPaintCompressed() { mNextPaintCompressed = true; }
protected:
virtual ~PresShell();
@ -720,6 +718,9 @@ protected:
virtual void PausePainting() MOZ_OVERRIDE;
virtual void ResumePainting() MOZ_OVERRIDE;
friend class PaintTimerCallBack;
void DelayedPaintTimerFired();
void UpdateImageVisibility();
void UpdateActivePointerState(mozilla::WidgetGUIEvent* aEvent);
@ -840,6 +841,7 @@ protected:
bool mImageVisibilityVisited : 1;
bool mNextPaintCompressed : 1;
bool mDelayedPaintTimerActive : 1;
static bool sDisableNonTestMouseEvents;
};

View File

@ -5020,17 +5020,9 @@ nsIFrame::SchedulePaint(PaintType aType)
nsIPresShell::PAINT_DELAYED_COMPRESS :
nsIPresShell::PAINT_DEFAULT);
if (aType == PAINT_DELAYED_COMPRESS) {
return;
}
if (aType == PAINT_DEFAULT) {
displayRoot->AddStateBits(NS_FRAME_UPDATE_LAYER_TREE);
}
nsIPresShell* shell = PresContext()->PresShell();
if (shell) {
shell->AddInvalidateHiddenPresShellObserver(pres->RefreshDriver());
}
}
Layer*