Bug 1465616 - Use layout viewport size to compute visible rect for fixed position elements. r=mstange

Since fixed position elements are now scrollable, we need to ensure that they're
drawn using the layout viewport size instead of only the SPC-SPS, since
otherwise they'd be inaccurately clipped when scrolled.

MozReview-Commit-ID: 4p3pWnwluvz

--HG--
extra : rebase_source : f5bc1eae9bf2c8f4b9f78675e9da071de012160e
This commit is contained in:
Kashav Madan 2018-07-04 16:10:04 -04:00
Родитель bf18fe089c
Коммит 0c865cee42
1 изменённых файлов: 4 добавлений и 10 удалений

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

@ -1462,24 +1462,18 @@ public:
nsRect visible = aVisibleRect;
nsRect dirtyRectRelativeToDirtyFrame = aDirtyRect;
#ifdef MOZ_WIDGET_ANDROID
if (nsLayoutUtils::IsFixedPosFrameInDisplayPort(aFrame) &&
aBuilder->IsPaintingToWindow()) {
// position: fixed items are reflowed into and only drawn inside the
// viewport, or the scroll position clamping scrollport size, if one is
// set.
nsIPresShell* ps = aFrame->PresShell();
if (ps->IsScrollPositionClampingScrollPortSizeSet()) {
dirtyRectRelativeToDirtyFrame =
nsRect(nsPoint(0, 0), ps->GetScrollPositionClampingScrollPortSize());
visible = dirtyRectRelativeToDirtyFrame;
#ifdef MOZ_WIDGET_ANDROID
} else {
if (!ps->IsScrollPositionClampingScrollPortSizeSet()) {
dirtyRectRelativeToDirtyFrame =
nsRect(nsPoint(0, 0), aFrame->GetParent()->GetSize());
visible = dirtyRectRelativeToDirtyFrame;
#endif
}
}
#endif
*aOutDirtyRect = dirtyRectRelativeToDirtyFrame - aFrame->GetPosition();
visible -= aFrame->GetPosition();