Bug 988511 - Allow fixed position items to fully occlude displayport items. r=tn

We don't allow fixed position items to occlude display-ports, but we should if
they fully occlude the scroll-position scroll clamping port of the displayport
frame.
This commit is contained in:
Chris Lord 2014-06-06 12:00:34 +01:00
parent cb3a49ad4e
commit 232c0e9e10

View File

@ -1181,16 +1181,30 @@ nsDisplayList::ComputeVisibilityForSublist(nsDisplayListBuilder* aBuilder,
// is that the fixed pos content is in a child document, in which it
// would scroll with the rest of the content.
bool occlude = true;
nsIPresShell* presShell = nullptr;
if (aDisplayPortFrame && item->IsInFixedPos()) {
if (item->Frame()->PresContext() == aDisplayPortFrame->PresContext()) {
occlude = false;
presShell = aDisplayPortFrame->PresContext()->PresShell();
}
}
nsRegion opaque = TreatAsOpaque(item, aBuilder);
if (occlude) {
nsRegion opaque = TreatAsOpaque(item, aBuilder);
// Subtract opaque item from the visible region
aBuilder->SubtractFromVisibleRegion(aVisibleRegion, opaque);
} else if (presShell &&
presShell->IsScrollPositionClampingScrollPortSizeSet() &&
!opaque.IsEmpty()) {
// We make an exception if the fixed position item would fully occlude
// the scroll position clamping scroll-port. In that case, it's very
// unlikely that it will become visible via async scrolling, so we let
// it occlude.
nsRect scrollClampingScrollPort(nsPoint(0, 0),
presShell->GetScrollPositionClampingScrollPortSize());
if (opaque.Contains(scrollClampingScrollPort)) {
aVisibleRegion->SetEmpty();
}
}
if (aBuilder->NeedToForceTransparentSurfaceForItem(item) ||