зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1442020 - Ensure neither style nor layout flushes are required when running promiseDocumentFlushed callbacks. r=bz
MozReview-Commit-ID: INGpltVvNmZ --HG-- extra : rebase_source : 75f51378401f0ca63384a9df52a5e5f04e00bb9d
This commit is contained in:
Родитель
a64b1b9f8a
Коммит
106d68a34a
|
@ -7425,7 +7425,7 @@ nsGlobalWindowInner::PromiseDocumentFlushed(PromiseDocumentFlushedCallback& aCal
|
|||
UniquePtr<PromiseDocumentFlushedResolver> flushResolver(
|
||||
new PromiseDocumentFlushedResolver(resultPromise, aCallback));
|
||||
|
||||
if (!shell->NeedFlush(FlushType::Style)) {
|
||||
if (!shell->NeedStyleFlush() && !shell->NeedLayoutFlush()) {
|
||||
flushResolver->Call();
|
||||
return resultPromise.forget();
|
||||
}
|
||||
|
@ -7520,10 +7520,11 @@ nsGlobalWindowInner::DidRefresh()
|
|||
nsIPresShell* shell = mDoc->GetShell();
|
||||
MOZ_ASSERT(shell);
|
||||
|
||||
if (shell->NeedStyleFlush() || shell->HasPendingReflow()) {
|
||||
if (shell->NeedStyleFlush() || shell->NeedLayoutFlush()) {
|
||||
// By the time our observer fired, something has already invalidated
|
||||
// style and maybe layout. We'll wait until the next refresh driver
|
||||
// tick instead.
|
||||
// style or layout - or perhaps we're still in the middle of a flush that
|
||||
// was interrupted. In either case, we'll wait until the next refresh driver
|
||||
// tick instead and try again.
|
||||
rejectionGuard.release();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,9 @@ const gWindowUtils = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
|||
*/
|
||||
function assertNoFlushesRequired() {
|
||||
Assert.ok(!gWindowUtils.needsFlush(Ci.nsIDOMWindowUtils.FLUSH_STYLE),
|
||||
"No flushes are required.");
|
||||
"No style flushes are required.");
|
||||
Assert.ok(!gWindowUtils.needsFlush(Ci.nsIDOMWindowUtils.FLUSH_LAYOUT),
|
||||
"No layout flushes are required.");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -39,8 +41,10 @@ function assertNoFlushesRequired() {
|
|||
* are required.
|
||||
*/
|
||||
function assertFlushesRequired() {
|
||||
Assert.ok(gWindowUtils.needsFlush(Ci.nsIDOMWindowUtils.FLUSH_STYLE),
|
||||
"Style flush required.");
|
||||
Assert.ok(gWindowUtils.needsFlush(Ci.nsIDOMWindowUtils.FLUSH_LAYOUT),
|
||||
"Style and layout flushes are required.");
|
||||
"Layout flush required.");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -620,6 +620,12 @@ public:
|
|||
}
|
||||
|
||||
bool NeedStyleFlush() const { return mNeedStyleFlush; }
|
||||
/**
|
||||
* Returns true if we might need to flush layout, even if we haven't scheduled
|
||||
* one yet (as opposed to HasPendingReflow, which returns true if a flush is
|
||||
* scheduled or will soon be scheduled).
|
||||
*/
|
||||
bool NeedLayoutFlush() const { return mNeedLayoutFlush; }
|
||||
|
||||
/**
|
||||
* Callbacks will be called even if reflow itself fails for
|
||||
|
@ -1638,6 +1644,10 @@ public:
|
|||
mIsNeverPainting = aNeverPainting;
|
||||
}
|
||||
|
||||
/**
|
||||
* True if a reflow event has been scheduled, or is going to be scheduled
|
||||
* to run in the future.
|
||||
*/
|
||||
bool HasPendingReflow() const
|
||||
{ return mObservingLayoutFlushes || mReflowContinueTimer; }
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче