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
This commit is contained in:
Timothy Nikkel 2021-02-04 11:17:16 +00:00
Родитель 39d4570796
Коммит cf811ba8b1
1 изменённых файлов: 22 добавлений и 4 удалений

Просмотреть файл

@ -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<void*>(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;
}