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
--- a/layout/painting/nsDisplayList.h
+++ b/layout/painting/nsDisplayList.h
@@ -1457,34 +1457,28 @@ public:
static nsRect ComputeVisibleRectForFrame(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame,
const nsRect& aVisibleRect,
const nsRect& aDirtyRect,
nsRect* aOutDirtyRect) {
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();
nsRect overflowRect = aFrame->GetVisualOverflowRect();
if (aFrame->IsTransformed() &&
mozilla::EffectCompositor::HasAnimationsForCompositor(aFrame,
eCSSProperty_transform)) {