Bug 1424714 - Prevent the displayport clip from clipping sticky items. r=mstange

The displayport clip that is applied to sticky items from the enclosing
scrollframe can cause sticky items to checkerboard even when they might
reasonably be left visible. This is because the displayport clip moves as
the enclosing scrollframe is scrolled, but sticky items may remain fixed
during such scrolling. The displayport clip can therefore clip out sticky
items even if they are "stuck" and should be user-visible.

This patch sets a flag to identify when a sticky item is being clipped by
the displayport clip, and ensures that it doesn't actually get clipped. In
the case where other clips are being applied to the sticky item, we leave the
clips unaffected. This allows for other enclosing elements to clip the sticky
item as before.

Differential Revision: https://phabricator.services.mozilla.com/D68582
This commit is contained in:
Kartikaya Gupta
2020-04-08 04:59:14 +00:00
parent 091867cb8c
commit ce06964442
8 changed files with 61 additions and 8 deletions

View File

@@ -147,7 +147,16 @@ wr::WrSpaceAndClipChain ClipManager::SwitchItem(nsDisplayItem* aItem) {
// purposes we always want to use the ASR that would have been used if it
// didn't have fixed descendants, which is stored as the "container ASR" on
// the sticky item.
asr = static_cast<nsDisplayStickyPosition*>(aItem)->GetContainerASR();
nsDisplayStickyPosition* sticky =
static_cast<nsDisplayStickyPosition*>(aItem);
asr = sticky->GetContainerASR();
// If the leafmost clip for the sticky item is just the displayport clip,
// then skip it. This allows sticky items to remain visible even if the
// rest of the content in the enclosing scrollframe is checkerboarding.
if (sticky->IsClippedToDisplayPort() && clip && clip->mASR == asr) {
clip = clip->mParent;
}
}
// In most cases we can combine the leaf of the clip chain with the clip rect