mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-01 05:48:26 +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);
|
PROFILER_MARKER_UNTYPED("UnsuppressAndInvalidate", GRAPHICS);
|
||||||
|
|
||||||
mPaintingSuppressed = false;
|
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()) {
|
if (nsIFrame* rootFrame = mFrameConstructor->GetRootFrame()) {
|
||||||
// let's assume that outline on a root frame is not supported
|
// let's assume that outline on a root frame is not supported
|
||||||
rootFrame->InvalidateFrame();
|
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
|
// now that painting is unsuppressed, focus may be set on the document
|
||||||
if (nsPIDOMWindowOuter* win = mDocument->GetWindow()) {
|
if (nsPIDOMWindowOuter* win = mDocument->GetWindow()) {
|
||||||
win->SetReadyForFocus();
|
win->SetReadyForFocus();
|
||||||
|
@ -282,7 +282,6 @@ nsPresContext::nsPresContext(dom::Document* aDocument, nsPresContextType aType)
|
|||||||
mHadContentfulPaint(false),
|
mHadContentfulPaint(false),
|
||||||
mHadNonTickContentfulPaint(false),
|
mHadNonTickContentfulPaint(false),
|
||||||
mHadContentfulPaintComposite(false),
|
mHadContentfulPaintComposite(false),
|
||||||
mWantsExtraTick(false),
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
mInitialized(false),
|
mInitialized(false),
|
||||||
#endif
|
#endif
|
||||||
@ -410,7 +409,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsPresContext)
|
|||||||
tmp->Destroy();
|
tmp->Destroy();
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||||
|
|
||||||
|
|
||||||
bool nsPresContext::IsChrome() const {
|
bool nsPresContext::IsChrome() const {
|
||||||
return Document()->IsInChromeDocShell();
|
return Document()->IsInChromeDocShell();
|
||||||
}
|
}
|
||||||
|
@ -1086,14 +1086,6 @@ class nsPresContext : public nsISupports, public mozilla::SupportsWeakPtr {
|
|||||||
return mFontFeatureValuesLookup;
|
return mFontFeatureValuesLookup;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetWantsExtraTick() { mWantsExtraTick = true; }
|
|
||||||
|
|
||||||
bool TakeWantsExtraTick() {
|
|
||||||
bool retVal = mWantsExtraTick;
|
|
||||||
mWantsExtraTick = false;
|
|
||||||
return retVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class nsRunnableMethod<nsPresContext>;
|
friend class nsRunnableMethod<nsPresContext>;
|
||||||
void ThemeChangedInternal();
|
void ThemeChangedInternal();
|
||||||
@ -1378,8 +1370,6 @@ class nsPresContext : public nsISupports, public mozilla::SupportsWeakPtr {
|
|||||||
// Has NotifyDidPaintForSubtree been called for a contentful paint?
|
// Has NotifyDidPaintForSubtree been called for a contentful paint?
|
||||||
unsigned mHadContentfulPaintComposite : 1;
|
unsigned mHadContentfulPaintComposite : 1;
|
||||||
|
|
||||||
unsigned mWantsExtraTick : 1;
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
unsigned mInitialized : 1;
|
unsigned mInitialized : 1;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1529,19 +1529,12 @@ void nsRefreshDriver::EnsureTimerStarted(EnsureTimerStartedFlags aFlags) {
|
|||||||
mRefreshTimerStartedCause = profiler_capture_backtrace();
|
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?
|
// will it already fire, and no other changes needed?
|
||||||
if (mActiveTimer && !(aFlags & eForceAdjustTimer)) {
|
if (mActiveTimer && !(aFlags & eForceAdjustTimer)) {
|
||||||
// If we're being called from within a user input handler or someone
|
// If we're being called from within a user input handler, and we think
|
||||||
// explicitly asked for an extra tick, and we think there's time to rush an
|
// there's time to rush an extra tick immediately, then schedule a runnable
|
||||||
// extra tick immediately, then schedule a runnable to run the extra tick.
|
// to run the extra tick.
|
||||||
if ((mPresContext->TakeWantsExtraTick() || mUserInputProcessingCount) &&
|
if (mUserInputProcessingCount && CanDoExtraTick()) {
|
||||||
CanDoExtraTick()) {
|
|
||||||
RefPtr<nsRefreshDriver> self = this;
|
RefPtr<nsRefreshDriver> self = this;
|
||||||
NS_DispatchToCurrentThreadQueue(
|
NS_DispatchToCurrentThreadQueue(
|
||||||
NS_NewRunnableFunction(
|
NS_NewRunnableFunction(
|
||||||
@ -1563,6 +1556,12 @@ void nsRefreshDriver::EnsureTimerStarted(EnsureTimerStartedFlags aFlags) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsFrozen() || !mPresContext) {
|
||||||
|
// If we don't want to start it now, or we've been disconnected.
|
||||||
|
StopTimer();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (mPresContext->Document()->IsBeingUsedAsImage()) {
|
if (mPresContext->Document()->IsBeingUsedAsImage()) {
|
||||||
// Image documents receive ticks from clients' refresh drivers.
|
// Image documents receive ticks from clients' refresh drivers.
|
||||||
// XXXdholbert Exclude SVG-in-opentype fonts from this optimization, until
|
// XXXdholbert Exclude SVG-in-opentype fonts from this optimization, until
|
||||||
|
Loading…
x
Reference in New Issue
Block a user