mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-28 21:28:55 +00:00
Backed out changeset 8739b71b8bd9 (bug 1740499) as requested by smaug
This commit is contained in:
parent
68b1d2eebb
commit
d795783f6e
@ -3924,46 +3924,21 @@ void PresShell::UnsuppressAndInvalidate() {
|
||||
PROFILER_MARKER_UNTYPED("UnsuppressAndInvalidate", GRAPHICS);
|
||||
|
||||
mPaintingSuppressed = false;
|
||||
|
||||
if (mPresContext->IsRootContentDocumentCrossProcess()) {
|
||||
nsWeakPtr weakDoc = do_GetWeakReference(mDocument);
|
||||
// Tell the parent process about the unsuppression, but make sure to have
|
||||
// done a refresh driver tick first at least. That should improve the
|
||||
// chances that we have something meaningful to display.
|
||||
mPresContext->RegisterManagedPostRefreshObserver(
|
||||
new ManagedPostRefreshObserver(
|
||||
mPresContext, [weakDoc](bool aWasCanceled) {
|
||||
if (aWasCanceled) {
|
||||
return ManagedPostRefreshObserver::Unregister::Yes;
|
||||
}
|
||||
|
||||
nsCOMPtr<Document> doc = do_QueryReferent(weakDoc);
|
||||
if (!doc) {
|
||||
return ManagedPostRefreshObserver::Unregister::Yes;
|
||||
}
|
||||
nsPresContext* pctx = doc->GetPresContext();
|
||||
if (!pctx) {
|
||||
return ManagedPostRefreshObserver::Unregister::Yes;
|
||||
}
|
||||
|
||||
if (auto* bc = BrowserChild::GetFrom(doc->GetDocShell())) {
|
||||
if (doc->IsInitialDocument()) {
|
||||
bc->SendDidUnsuppressPaintingNormalPriority();
|
||||
} else {
|
||||
bc->SendDidUnsuppressPainting();
|
||||
}
|
||||
}
|
||||
|
||||
return ManagedPostRefreshObserver::Unregister::Yes;
|
||||
}));
|
||||
mPresContext->SetWantsExtraTick();
|
||||
}
|
||||
|
||||
if (nsIFrame* rootFrame = mFrameConstructor->GetRootFrame()) {
|
||||
// let's assume that outline on a root frame is not supported
|
||||
rootFrame->InvalidateFrame();
|
||||
}
|
||||
|
||||
if (mPresContext->IsRootContentDocumentCrossProcess()) {
|
||||
if (auto* bc = BrowserChild::GetFrom(mDocument->GetDocShell())) {
|
||||
if (mDocument->IsInitialDocument()) {
|
||||
bc->SendDidUnsuppressPaintingNormalPriority();
|
||||
} else {
|
||||
bc->SendDidUnsuppressPainting();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// now that painting is unsuppressed, focus may be set on the document
|
||||
if (nsPIDOMWindowOuter* win = mDocument->GetWindow()) {
|
||||
win->SetReadyForFocus();
|
||||
|
@ -282,7 +282,6 @@ nsPresContext::nsPresContext(dom::Document* aDocument, nsPresContextType aType)
|
||||
mHadContentfulPaint(false),
|
||||
mHadNonTickContentfulPaint(false),
|
||||
mHadContentfulPaintComposite(false),
|
||||
mWantsExtraTick(false),
|
||||
#ifdef DEBUG
|
||||
mInitialized(false),
|
||||
#endif
|
||||
@ -410,7 +409,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsPresContext)
|
||||
tmp->Destroy();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
|
||||
bool nsPresContext::IsChrome() const {
|
||||
return Document()->IsInChromeDocShell();
|
||||
}
|
||||
|
@ -1086,14 +1086,6 @@ class nsPresContext : public nsISupports, public mozilla::SupportsWeakPtr {
|
||||
return mFontFeatureValuesLookup;
|
||||
}
|
||||
|
||||
void SetWantsExtraTick() { mWantsExtraTick = true; }
|
||||
|
||||
bool TakeWantsExtraTick() {
|
||||
bool retVal = mWantsExtraTick;
|
||||
mWantsExtraTick = false;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
protected:
|
||||
friend class nsRunnableMethod<nsPresContext>;
|
||||
void ThemeChangedInternal();
|
||||
@ -1378,8 +1370,6 @@ class nsPresContext : public nsISupports, public mozilla::SupportsWeakPtr {
|
||||
// Has NotifyDidPaintForSubtree been called for a contentful paint?
|
||||
unsigned mHadContentfulPaintComposite : 1;
|
||||
|
||||
unsigned mWantsExtraTick : 1;
|
||||
|
||||
#ifdef DEBUG
|
||||
unsigned mInitialized : 1;
|
||||
#endif
|
||||
|
@ -1529,19 +1529,12 @@ void nsRefreshDriver::EnsureTimerStarted(EnsureTimerStartedFlags aFlags) {
|
||||
mRefreshTimerStartedCause = profiler_capture_backtrace();
|
||||
}
|
||||
|
||||
if (IsFrozen() || !mPresContext) {
|
||||
// If we don't want to start it now, or we've been disconnected.
|
||||
StopTimer();
|
||||
return;
|
||||
}
|
||||
|
||||
// will it already fire, and no other changes needed?
|
||||
if (mActiveTimer && !(aFlags & eForceAdjustTimer)) {
|
||||
// If we're being called from within a user input handler or someone
|
||||
// explicitly asked for an extra tick, and we think there's time to rush an
|
||||
// extra tick immediately, then schedule a runnable to run the extra tick.
|
||||
if ((mPresContext->TakeWantsExtraTick() || mUserInputProcessingCount) &&
|
||||
CanDoExtraTick()) {
|
||||
// If we're being called from within a user input handler, and we think
|
||||
// there's time to rush an extra tick immediately, then schedule a runnable
|
||||
// to run the extra tick.
|
||||
if (mUserInputProcessingCount && CanDoExtraTick()) {
|
||||
RefPtr<nsRefreshDriver> self = this;
|
||||
NS_DispatchToCurrentThreadQueue(
|
||||
NS_NewRunnableFunction(
|
||||
@ -1563,6 +1556,12 @@ void nsRefreshDriver::EnsureTimerStarted(EnsureTimerStartedFlags aFlags) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsFrozen() || !mPresContext) {
|
||||
// If we don't want to start it now, or we've been disconnected.
|
||||
StopTimer();
|
||||
return;
|
||||
}
|
||||
|
||||
if (mPresContext->Document()->IsBeingUsedAsImage()) {
|
||||
// Image documents receive ticks from clients' refresh drivers.
|
||||
// XXXdholbert Exclude SVG-in-opentype fonts from this optimization, until
|
||||
|
Loading…
x
Reference in New Issue
Block a user