Bug 1577058 - part 3: Make test_scroll_per_page.html compute editing host height which needs to be too tall than the viewport with actual documentElement height r=smaug

On Android, window size depends on the screen size even though the window is
created with its size being specified.  The last test of
`test_scroll_per_page.html` needs to test of scroll position of
`documentElement`.  Previously, it was specified as a fixed value computed from
the specified window size, but for Anrdoid, it should be computed with the
window height at runtime.

Depends on D50178

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Masayuki Nakano 2019-10-28 11:37:12 +00:00
parent a434f646f8
commit a692547bd1

View File

@ -207,7 +207,9 @@ async function doTests(aWindow) {
`PageUp in scrollable editing host after scrolled down 3 pages: should be scrolled up to show caret (got:${container.scrollTop}`);
// Shouldn't scroll to caret position after pagedown scrolls outside of editing host.
body.innerHTML = '<div id="editor" contenteditable style="height: 1500px">abc<br>def<br></div>';
// NOTE: We've set the window height is 500px above, but on Android, the viewport size depends on the screen size.
// Therefore, we need to compute enough height to test below with actual height of the window.
body.innerHTML = `<div id="editor" contenteditable style="height: ${aWindow.innerHeight * 3}px">abc<br>def<br></div>`;
editor = doc.getElementById("editor");
container = doc.documentElement;
editor.focus();