From cf811ba8b1ec9cdd82d84a2f16738106c63410fa Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Thu, 4 Feb 2021 11:17:16 +0000 Subject: [PATCH] Bug 1690433. Update display port expiry to handle minimal display ports. r=botond If the activate_all_scroll_frames pref is on we want to never remove a minimal display port, and when a regular display port expires we want to downgrade it to minimal. If the pref is off it's the same as before except we want to also remove the minimal property when on expiry. Differential Revision: https://phabricator.services.mozilla.com/D103859 --- layout/generic/nsGfxScrollFrame.cpp | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index e532d714905f..07539488926e 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -2606,12 +2606,26 @@ static void RemoveDisplayPortCallback(nsITimer* aTimer, void* aClosure) { // happens between actual painting. If the displayport is reset to a // different position that's ok; this scrollframe hasn't been scrolled // recently and so the reset should be correct. - DisplayPortUtils::RemoveDisplayPort(helper->mOuter->GetContent()); + + nsIContent* content = helper->mOuter->GetContent(); + + if (ScrollFrameHelper::ShouldActivateAllScrollFrames()) { + // If we are activating all scroll frames then we only want to remove the + // regular display port and downgrade to a minimal display port. + MOZ_ASSERT(!content->GetProperty(nsGkAtoms::MinimalDisplayPort)); + content->SetProperty(nsGkAtoms::MinimalDisplayPort, + reinterpret_cast(true)); + } else { + content->RemoveProperty(nsGkAtoms::MinimalDisplayPort); + DisplayPortUtils::RemoveDisplayPort(content); + // Be conservative and unflag this this scrollframe as being scrollable by + // APZ. If it is still scrollable this will get flipped back soon enough. + helper->mScrollableByAPZ = false; + } + DisplayPortUtils::ExpireDisplayPortOnAsyncScrollableAncestor(helper->mOuter); + helper->mOuter->SchedulePaint(); - // Be conservative and unflag this this scrollframe as being scrollable by - // APZ. If it is still scrollable this will get flipped back soon enough. - helper->mScrollableByAPZ = false; } void ScrollFrameHelper::MarkEverScrolled() { @@ -2666,6 +2680,10 @@ bool ScrollFrameHelper::AllowDisplayPortExpiration() { if (mIsRoot && mOuter->PresContext()->IsRoot()) { return false; } + if (ShouldActivateAllScrollFrames() && + mOuter->GetContent()->GetProperty(nsGkAtoms::MinimalDisplayPort)) { + return false; + } return true; }