Bug 1689371 - Use nsLayoutUtils::GetContentViewerSize to query the device display size if there is no MobileViewportManager. r=botond

Depends on D103611

Differential Revision: https://phabricator.services.mozilla.com/D103612
This commit is contained in:
Hiroyuki Ikezoe 2021-02-01 23:54:08 +00:00
parent c9712128ee
commit 643a59ce4e
3 changed files with 17 additions and 4 deletions

View File

@ -0,0 +1,5 @@
<!DOCTYPE html>
<html>
<meta charset="UTF-8">
<div style="height: 200vh;"></div>
</html>

View File

@ -555,4 +555,5 @@ load 1599518.html
load 1599532.html
pref(layout.accessiblecaret.enabled,true) load 1606492.html
load 1676301-1.html
pref(apz.mvm.force-enabled,false) pref(dom.meta-viewport.enabled,false) pref(apz.allow_zooming,false) pref(layout.dynamic-toolbar-max-height,100) load 1689371.html
load 1689912.html

View File

@ -9488,13 +9488,20 @@ nsSize nsLayoutUtils::ExpandHeightForViewportUnits(nsPresContext* aPresContext,
template <typename SizeType>
/* static */ SizeType ExpandHeightForDynamicToolbarImpl(
const nsPresContext* aPresContext, const SizeType& aSize) {
RefPtr<MobileViewportManager> MVM =
aPresContext->PresShell()->GetMobileViewportManager();
MOZ_ASSERT(MVM);
MOZ_ASSERT(aPresContext);
LayoutDeviceIntSize displaySize;
if (RefPtr<MobileViewportManager> MVM =
aPresContext->PresShell()->GetMobileViewportManager()) {
displaySize = MVM->DisplaySize();
} else if (!nsLayoutUtils::GetContentViewerSize(aPresContext, displaySize)) {
return aSize;
}
float toolbarHeightRatio =
mozilla::ScreenCoord(aPresContext->GetDynamicToolbarMaxHeight()) /
mozilla::ViewAs<mozilla::ScreenPixel>(
MVM->DisplaySize(),
displaySize,
mozilla::PixelCastJustification::LayoutDeviceIsScreenForBounds)
.height;