Bug 980256. nsDisplayZoom items need some adjustments if they are going to generate a scrollable layer. r=roc

Specifically GetBounds should use nsDisplaySubDocument::GetBounds (and not nsDisplayWrapList::GetBounds) before converting it to the right app units.

Similarly for ComputeVisibility except with the added wrinkle that nsDisplaySubDocument::ComputeVisibility won't properly handle coordinates if we are not generating a scroll layer. Namely it calls nsDisplayWrapList::ComputeVisibility which uses mVisibleRect (which is the visible rect of the scroll frame), when it needs to be using the visible rect of the contained list, which is for the scrolled content inside.
This commit is contained in:
Timothy Nikkel 2014-03-06 17:40:31 -06:00
parent 673d3400b4
commit 089a441c60

View File

@ -4082,7 +4082,7 @@ nsDisplayZoom::~nsDisplayZoom() {
nsRect nsDisplayZoom::GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap)
{
nsRect bounds = nsDisplayWrapList::GetBounds(aBuilder, aSnap);
nsRect bounds = nsDisplaySubDocument::GetBounds(aBuilder, aSnap);
*aSnap = false;
return bounds.ConvertAppUnitsRoundOut(mAPD, mParentAPD);
}
@ -4125,10 +4125,22 @@ bool nsDisplayZoom::ComputeVisibility(nsDisplayListBuilder *aBuilder,
mVisibleRect.ConvertAppUnitsRoundOut(mParentAPD, mAPD);
nsRect allowExpansion =
aAllowVisibleRegionExpansion.ConvertAppUnitsRoundIn(mParentAPD, mAPD);
bool retval =
bool retval;
// If we are to generate a scrollable layer we call
// nsDisplaySubDocument::ComputeVisibility to make the necessary adjustments
// for ComputeVisibility, it does all it's calculations in the child APD.
bool usingDisplayPort =
nsLayoutUtils::ViewportHasDisplayPort(mFrame->PresContext());
if (!(mFlags & GENERATE_SCROLLABLE_LAYER) || !usingDisplayPort) {
retval =
mList.ComputeVisibilityForSublist(aBuilder, &visibleRegion,
transformedVisibleRect,
allowExpansion);
} else {
retval =
nsDisplaySubDocument::ComputeVisibility(aBuilder, &visibleRegion,
allowExpansion);
}
nsRegion removed;
// removed = originalVisibleRegion - visibleRegion