mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-05 00:02:37 +00:00
Backed out changeset 07e257b46b6f (bug 1342863)
This commit is contained in:
parent
bdcef21037
commit
c1e924f7d0
@ -1859,8 +1859,6 @@ PresShell::Initialize(nscoord aWidth, nscoord aHeight)
|
||||
Preferences::GetInt("nglayout.initialpaint.delay",
|
||||
PAINTLOCK_EVENT_DELAY);
|
||||
|
||||
mPaintSuppressionTimer->SetTarget(
|
||||
mDocument->EventTargetFor(TaskCategory::Other));
|
||||
mPaintSuppressionTimer->InitWithNamedFuncCallback(
|
||||
sPaintSuppressionCallback, this, delay, nsITimer::TYPE_ONE_SHOT,
|
||||
"PresShell::sPaintSuppressionCallback");
|
||||
@ -2007,12 +2005,9 @@ PresShell::ResizeReflowIgnoreOverride(nscoord aWidth, nscoord aHeight, nscoord a
|
||||
}
|
||||
if (mAsyncResizeEventTimer) {
|
||||
mAsyncResizeTimerIsActive = true;
|
||||
mAsyncResizeEventTimer->SetTarget(
|
||||
mDocument->EventTargetFor(TaskCategory::Other));
|
||||
mAsyncResizeEventTimer->InitWithNamedFuncCallback(AsyncResizeEventCallback,
|
||||
this, 15,
|
||||
nsITimer::TYPE_ONE_SHOT,
|
||||
"AsyncResizeEventCallback");
|
||||
mAsyncResizeEventTimer->InitWithFuncCallback(AsyncResizeEventCallback,
|
||||
this, 15,
|
||||
nsITimer::TYPE_ONE_SHOT);
|
||||
}
|
||||
} else {
|
||||
RefPtr<nsRunnableMethod<PresShell>> event =
|
||||
@ -3694,6 +3689,28 @@ PresShell::GetRectVisibility(nsIFrame* aFrame,
|
||||
return nsRectVisibility_kVisible;
|
||||
}
|
||||
|
||||
class PaintTimerCallBack final : public nsITimerCallback
|
||||
{
|
||||
public:
|
||||
explicit PaintTimerCallBack(PresShell* aShell) : mShell(aShell) {}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD Notify(nsITimer* aTimer) final
|
||||
{
|
||||
mShell->SetNextPaintCompressed();
|
||||
mShell->ScheduleViewManagerFlush();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
~PaintTimerCallBack() {}
|
||||
|
||||
PresShell* mShell;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS(PaintTimerCallBack, nsITimerCallback)
|
||||
|
||||
void
|
||||
PresShell::ScheduleViewManagerFlush(PaintType aType)
|
||||
{
|
||||
@ -3701,24 +3718,9 @@ PresShell::ScheduleViewManagerFlush(PaintType aType)
|
||||
// Delay paint for 1 second.
|
||||
static const uint32_t kPaintDelayPeriod = 1000;
|
||||
if (!mDelayedPaintTimer) {
|
||||
nsTimerCallbackFunc
|
||||
PaintTimerCallBack = [](nsITimer* aTimer, void* aClosure) {
|
||||
// The passed-in PresShell is always alive here. Because if PresShell
|
||||
// died, mDelayedPaintTimer->Cancel() would be called during the
|
||||
// destruction and this callback would never be invoked.
|
||||
auto self = static_cast<PresShell*>(aClosure);
|
||||
self->SetNextPaintCompressed();
|
||||
self->ScheduleViewManagerFlush();
|
||||
};
|
||||
|
||||
mDelayedPaintTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
|
||||
mDelayedPaintTimer->SetTarget(
|
||||
mDocument->EventTargetFor(TaskCategory::Other));
|
||||
mDelayedPaintTimer->InitWithNamedFuncCallback(PaintTimerCallBack,
|
||||
this,
|
||||
kPaintDelayPeriod,
|
||||
nsITimer::TYPE_ONE_SHOT,
|
||||
"PaintTimerCallBack");
|
||||
RefPtr<PaintTimerCallBack> cb = new PaintTimerCallBack(this);
|
||||
mDelayedPaintTimer->InitWithCallback(cb, kPaintDelayPeriod, nsITimer::TYPE_ONE_SHOT);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -9150,13 +9152,10 @@ PresShell::ScheduleReflowOffTimer()
|
||||
|
||||
if (!mReflowContinueTimer) {
|
||||
mReflowContinueTimer = do_CreateInstance("@mozilla.org/timer;1");
|
||||
mReflowContinueTimer->SetTarget(
|
||||
mDocument->EventTargetFor(TaskCategory::Other));
|
||||
if (!mReflowContinueTimer ||
|
||||
NS_FAILED(mReflowContinueTimer->
|
||||
InitWithNamedFuncCallback(sReflowContinueCallback, this, 30,
|
||||
nsITimer::TYPE_ONE_SHOT,
|
||||
"sReflowContinueCallback"))) {
|
||||
InitWithFuncCallback(sReflowContinueCallback, this, 30,
|
||||
nsITimer::TYPE_ONE_SHOT))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user