Bug 1477007 - Ensure the visual viewport can be scrolled within the layout viewport even if a page is not zoomable. r=kats

A meta viewport tag can simultaneously specify user-scalable=no, and a
layout viewport size and initial zoom level that make the visual viewport
smaller than the layout viewport.

Differential Revision: https://phabricator.services.mozilla.com/D2584

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Botond Ballo 2018-07-31 23:19:27 +00:00
parent 7ce9c79256
commit a0fa30904d

View File

@ -1358,6 +1358,15 @@ ScrollFrameHelper::WantAsyncScroll() const
ScrollStyles styles = GetScrollStylesFromFrame();
nscoord oneDevPixel = GetScrolledFrame()->PresContext()->AppUnitsPerDevPixel();
nsRect scrollRange = GetScrollRange();
// If the page has a visual viewport size that's different from
// the layout viewport size at the current zoom level, we need to be
// able to scroll the visual viewport inside the layout viewport
// even if the page is not zoomable.
if (!GetScrollRangeForClamping().IsEqualInterior(scrollRange)) {
return true;
}
bool isVScrollable = (scrollRange.height >= oneDevPixel) &&
(styles.mVertical != NS_STYLE_OVERFLOW_HIDDEN);
bool isHScrollable = (scrollRange.width >= oneDevPixel) &&