Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # HG changeset patch
- # Parent 91733ae6497c63c7dc5ae11ad6e4221a396c4ed5
- diff --git a/layout/base/MobileViewportManager.cpp b/layout/base/MobileViewportManager.cpp
- --- a/layout/base/MobileViewportManager.cpp
- +++ b/layout/base/MobileViewportManager.cpp
- @@ -103,9 +103,21 @@ float MobileViewportManager::ComputeIntr
- ScreenIntSize displaySize = ViewAs<ScreenPixel>(
- mDisplaySize, PixelCastJustification::LayoutDeviceIsScreenForBounds);
- + CSSSize layoutViewportSize;
- +
- + nsIScrollableFrame* rootScrollableFrame =
- + mPresShell->GetRootScrollFrameAsScrollable();
- + if (!mIsFirstPaint && rootScrollableFrame) {
- + nsRect scrollableRect = nsLayoutUtils::CalculateScrollableRectForFrame(
- + rootScrollableFrame, nullptr);
- + layoutViewportSize = CSSSize::FromAppUnits(scrollableRect.Size());
- + } else {
- + layoutViewportSize = mMobileViewportSize;
- + }
- +
- CSSToScreenScale intrinsicScale =
- ComputeIntrinsicScale(mDocument->GetViewportInfo(displaySize),
- - displaySize, mMobileViewportSize);
- + displaySize, layoutViewportSize);
- CSSToLayoutDeviceScale cssToDev =
- mPresShell->GetPresContext()->CSSToDevPixelScale();
- return (intrinsicScale / cssToDev).scale;
- diff --git a/layout/generic/ViewportFrame.cpp b/layout/generic/ViewportFrame.cpp
- --- a/layout/generic/ViewportFrame.cpp
- +++ b/layout/generic/ViewportFrame.cpp
- @@ -258,15 +258,24 @@ nsRect ViewportFrame::AdjustReflowInputA
- "We don't handle correct positioning of fixed frames with "
- "scrollbars in odd positions");
- - // Layout fixed position elements to the visual viewport size if and only if
- + // Layout fixed position elements to the layout viewport size if and only if
- // it has been set and it is larger than the computed size, otherwise use the
- // computed size.
- nsRect rect(0, 0, aReflowInput->ComputedWidth(),
- aReflowInput->ComputedHeight());
- nsIPresShell* ps = PresShell();
- - if (ps->IsVisualViewportSizeSet() &&
- - rect.Size() < ps->GetVisualViewportSize()) {
- - rect.SizeTo(ps->GetVisualViewportSize());
- + if (ps->IsVisualViewportSizeSet()) {
- + if (rect.Size() < ps->GetVisualViewportSize()) {
- + rect.SizeTo(ps->GetVisualViewportSize());
- + }
- + if (nsIScrollableFrame* rootScrollableFrame =
- + ps->GetRootScrollFrameAsScrollable()) {
- + nsRect layoutViewport = nsLayoutUtils::CalculateScrollableRectForFrame(
- + rootScrollableFrame, nullptr);
- + if (rect.Size() < layoutViewport.Size()) {
- + rect.SizeTo(layoutViewport.Size());
- + }
- + }
- }
- return rect;
- }
- diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp
- --- a/layout/painting/nsDisplayList.cpp
- +++ b/layout/painting/nsDisplayList.cpp
- @@ -965,15 +965,25 @@ nsDisplayListBuilder::OutOfFlowDisplayDa
- // We want to ensure that fixed position elements are visible when
- // being async scrolled, so we paint them at the size of the larger
- // viewport.
- - dirtyRectRelativeToDirtyFrame =
- - nsRect(nsPoint(0, 0), aFrame->GetParent()->GetSize());
- + nsIFrame* parent = aFrame->GetParent();
- + dirtyRectRelativeToDirtyFrame = nsRect(nsPoint(0, 0), parent->GetSize());
- nsIPresShell* ps = aFrame->PresShell();
- - if (ps->IsVisualViewportSizeSet() &&
- - dirtyRectRelativeToDirtyFrame.Size() < ps->GetVisualViewportSize()) {
- - dirtyRectRelativeToDirtyFrame.SizeTo(ps->GetVisualViewportSize());
- - }
- -
- + if (ps->IsVisualViewportSizeSet()) {
- + if (dirtyRectRelativeToDirtyFrame.Size() < ps->GetVisualViewportSize()) {
- + dirtyRectRelativeToDirtyFrame.SizeTo(ps->GetVisualViewportSize());
- + }
- +
- + nsIScrollableFrame* scrollableFrame =
- + ps->GetRootScrollFrameAsScrollable();
- + if (scrollableFrame) {
- + nsRect layoutViewport = nsLayoutUtils::CalculateScrollableRectForFrame(
- + scrollableFrame, nullptr);
- + if (dirtyRectRelativeToDirtyFrame.Size() < layoutViewport.Size()) {
- + dirtyRectRelativeToDirtyFrame.SizeTo(layoutViewport.Size());
- + }
- + }
- + }
- visible = dirtyRectRelativeToDirtyFrame;
- }
- #endif
Add Comment
Please, Sign In to add comment