Bug 1520081 - Use the minimum scale size even if the minimum-scale in viewport meta tag is greater than 1.0. r=botond

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Hiroyuki Ikezoe 2019-01-25 07:01:45 +00:00
Родитель becd2488d6
Коммит 465dbfe030
4 изменённых файлов: 108 добавлений и 7 удалений

Просмотреть файл

@ -0,0 +1,44 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=200, minimum-scale=1.0, initial-scale=2.0">
<title>Tests that the layout viewport is expanted to the minimum scale size (minimim-scale >= 1.0)</title>
<script type="application/javascript" src="apz_test_utils.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/paint_listener.js"></script>
<style>
html,body {
overflow-x: hidden;
margin: 0;
}
div {
position: absolute;
}
</style>
</head>
<body>
<div style="width: 200%; height: 200%; background-color: green"></div>
<div style="width: 100%; height: 100%; background-color: blue"></div>
<script type="application/javascript">
async function test(testDriver) {
SpecialPowers.getDOMWindowUtils(window).scrollToVisual(100, 0);
const promiseForVisualViewportScroll = new Promise(resolve => {
window.visualViewport.addEventListener("scroll", () => {
resolve();
}, { once: true });
});
await waitUntilApzStable();
await promiseForVisualViewportScroll;
is(visualViewport.offsetLeft, 100,
"The visual viewport offset should be moved");
}
waitUntilApzStable().then(test).then(subtestDone);
</script>
</body>
</html>

Просмотреть файл

@ -18,6 +18,8 @@
[test_frame_reconstruction.html]
[test_fullscreen.html]
run-if = (os == 'android')
[test_group_minimum_scale_size.html]
run-if = (os == 'android')
[test_group_mouseevents.html]
skip-if = (toolkit == 'android') # mouse events not supported on mobile
[test_group_pointerevents.html]

Просмотреть файл

@ -0,0 +1,62 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="apz_test_utils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
const prefs = [
// We need the APZ paint logging information
["apz.test.logging_enabled", true],
// Dropping the touch slop to 0 makes the tests easier to write because
// we can just do a one-pixel drag to get over the pan threshold rather
// than having to hard-code some larger value.
["apz.touch_start_tolerance", "0.0"],
// The subtests in this test do touch-drags to pan the page, but we don't
// want those pans to turn into fling animations, so we increase the
// fling-min threshold velocity to an arbitrarily large value.
["apz.fling_min_velocity_threshold", "10000"],
// The helper_bug1280013's div gets a displayport on scroll, but if the
// test takes too long the displayport can expire before we read the value
// out of the test. So we disable displayport expiry for these tests.
["apz.displayport_expiry_ms", 0],
// Prevent the dynamic toolbar from interfering with main-thread scroll
// offset values.
["browser.chrome.dynamictoolbar", false],
// Explicitly enable pinch-zooming, so this test can run on desktop
// even though zooming isn't enabled by default on desktop yet.
["apz.allow_zooming", true],
// Pinch-zooming currently requires meta viewport support (this requirement
// will eventually be removed).
["dom.meta-viewport.enabled", true],
// Pinch-zooming currently requires container scrolling (this requirement
// will eventually be removed).
["layout.scroll.root-frame-containers", 1],
// Retained displaylists don't work well with container scrolling, so
// they too need to be disabled for now.
["layout.display-list.retain", false],
["layout.display-list.retain.chrome", false],
// We use the Visual Viewport API to tell the visual viewport offset.
["dom.visualviewport.enabled", true],
];
const subtests = [
{ file: "helper_minimum_scale_1_0.html", prefs },
];
if (isApzEnabled()) {
SimpleTest.waitForExplicitFinish();
// Run the actual test in its own window, because it requires that the
// root APZC be scrollable. Mochitest pages themselves often run
// inside an iframe which means we have no control over the root APZC.
window.onload = () => {
runSubtestsSeriallyInFreshWindows(subtests)
.then(SimpleTest.finish, SimpleTest.finish);
};
}
</script>
</head>
<body>
</body>
</html>

Просмотреть файл

@ -5511,13 +5511,6 @@ void ScrollFrameHelper::UpdateMinimumScaleSize(
}
nsViewportInfo viewportInfo = doc->GetViewportInfo(displaySize);
// FIXME: Bug 1520081 - Drop this check. We should use the minimum-scale size
// even if the minimum-scale size is greater than 1.0.
if (viewportInfo.GetMinZoom() >=
pc->CSSToDevPixelScale() * LayoutDeviceToScreenScale(1.0f)) {
return;
}
nsSize maximumPossibleSize =
CSSSize::ToAppUnits(ScreenSize(displaySize) / viewportInfo.GetMinZoom());