Commit d9d3c067 authored by Nicolás Peña Moreno's avatar Nicolás Peña Moreno Committed by Commit Bot

[LayoutInstability] Fix failures in tests shifting in/out of viewport

Currently, some tests work under the assumption that the height of the
viewport is exactly 600px. While this is true for tests running on our
bots, it's not true for tests running on WPT.fyi. Thus, this assumption
is removed from those tests.

Bug: 1036013
Change-Id: I34b057730e22bc208cbb958d179195445def8b77
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1984678Reviewed-by: default avatarAnnie Sullivan <sullivan@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#728280}
parent 0a08da31
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<style> <style>
body { margin: 0; } body { margin: 0; }
#j { position: relative; width: 600px; height: 200px; top: 600px; } #j { position: absolute; width: 600px; height: 200px; top: 100%; }
</style> </style>
<div id='j'></div> <div id='j'></div>
...@@ -19,7 +19,9 @@ promise_test(async () => { ...@@ -19,7 +19,9 @@ promise_test(async () => {
// Wait for the initial render to complete. // Wait for the initial render to complete.
await waitForAnimationFrames(2); await waitForAnimationFrames(2);
document.querySelector("#j").style.top = "400px"; // Move div partially into viewport.
document.querySelector("#j").style.top =
document.documentElement.clientHeight - 200 + "px";
// The element moves from outside the viewport to within the viewport, which // The element moves from outside the viewport to within the viewport, which
// should generate a shift. // should generate a shift.
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<style> <style>
body { margin: 0; } body { margin: 0; }
#j { position: relative; width: 600px; height: 200px; top: 600px; } #j { position: absolute; width: 600px; height: 200px; top: 100%; }
</style> </style>
<div id='j'></div> <div id='j'></div>
...@@ -19,7 +19,9 @@ promise_test(async () => { ...@@ -19,7 +19,9 @@ promise_test(async () => {
// Wait for the initial render to complete. // Wait for the initial render to complete.
await waitForAnimationFrames(2); await waitForAnimationFrames(2);
document.querySelector("#j").style.top = "800px"; // Move div even further out of viewport.
document.querySelector("#j").style.top =
document.documentElement.clientHeight + 200 + "px";
// Since the element moves entirely outside of the viewport, it shouldn't // Since the element moves entirely outside of the viewport, it shouldn't
// generate a score. // generate a score.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment