static void RecenterDisplayPort(mozilla::layers::FrameMetrics& aFrameMetrics) { ScreenMargin margins = aFrameMetrics.GetDisplayPortMargins(); margins.right = margins.left = margins.LeftRight() / 2; margins.top = margins.bottom = margins.TopBottom() / 2; aFrameMetrics.SetDisplayPortMargins(margins); }
void MobileViewportManager::UpdateSPCSPS(const ScreenIntSize& aDisplaySize, const CSSToScreenScale& aZoom) { ScreenSize compositionSize(aDisplaySize); ScreenMargin scrollbars = CSSMargin::FromAppUnits( nsLayoutUtils::ScrollbarAreaToExcludeFromCompositionBoundsFor( mPresShell->GetRootScrollFrame())) * CSSToScreenScale(1.0f); // Scrollbars are not subject to scaling, so // CSS pixels = layer pixels for them (modulo bug 1168487). compositionSize.width -= scrollbars.LeftRight(); compositionSize.height -= scrollbars.TopBottom(); CSSSize compSize = compositionSize / aZoom; MVM_LOG("%p: Setting SPCSPS %s\n", this, Stringify(compSize).c_str()); nsLayoutUtils::SetScrollPositionClampingScrollPortSize(mPresShell, compSize); }
void MobileViewportManager::UpdateSPCSPS(const ScreenIntSize& aDisplaySize, const CSSToScreenScale& aZoom) { ScreenSize compositionSize(aDisplaySize); ScreenMargin scrollbars = LayoutDeviceMargin::FromAppUnits( nsLayoutUtils::ScrollbarAreaToExcludeFromCompositionBoundsFor( mPresShell->GetRootScrollFrame()), mPresShell->GetPresContext()->AppUnitsPerDevPixel()) // Scrollbars are not subject to resolution scaling, so LD pixels = // Screen pixels for them. * LayoutDeviceToScreenScale(1.0f); compositionSize.width -= scrollbars.LeftRight(); compositionSize.height -= scrollbars.TopBottom(); CSSSize compSize = compositionSize / aZoom; MVM_LOG("%p: Setting SPCSPS %s\n", this, Stringify(compSize).c_str()); nsLayoutUtils::SetScrollPositionClampingScrollPortSize(mPresShell, compSize); }