Skip to content

Commit

Permalink
Scroll background-attachment tests after font loads complete.
Browse files Browse the repository at this point in the history
This scrolls these tests in response to the TestRendered event rather
than the load event so that the scroll happens after Ahem webfont loads
have completed.

It's not completely clear to me why the font load changes layout, but
despite that this seems like the most likely cause for the tests flaky
failures due to slightly incorrect scroll position.

Bug: 1515071
Change-Id: I4d9114e9dceeac82dbd5f897a0c455e7fe61da9a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5241084
Reviewed-by: Traian Captan <[email protected]>
Auto-Submit: David Baron <[email protected]>
Commit-Queue: Traian Captan <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1252696}
  • Loading branch information
dbaron authored and chromium-wpt-export-bot committed Jan 26, 2024
1 parent 3c357d5 commit 59655cf
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,14 @@
}
</style>

<body onload="window.scroll(0, document.body.offsetHeight); document.documentElement.classList.remove('reftest-wait');">
<script>

document.documentElement.addEventListener("TestRendered", () => {
window.scroll(0, document.body.offsetHeight);
document.documentElement.classList.remove('reftest-wait');
});

</script>

<div>F</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,14 @@
}
</style>

<body onload="window.scroll(0, document.body.offsetHeight); document.documentElement.classList.remove('reftest-wait');">
<script>

document.documentElement.addEventListener("TestRendered", () => {
window.scroll(0, document.body.offsetHeight);
document.documentElement.classList.remove('reftest-wait');
});

</script>

<div>F</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,14 @@
}
</style>

<body onload="window.scroll(0, document.body.offsetHeight); document.documentElement.classList.remove('reftest-wait');">
<script>

document.documentElement.addEventListener("TestRendered", () => {
window.scroll(0, document.body.offsetHeight);
document.documentElement.classList.remove('reftest-wait');
});

</script>

<div>F</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,14 @@
}
</style>

<body onload="window.scroll(0, document.body.offsetHeight); document.documentElement.classList.remove('reftest-wait');">
<script>

document.documentElement.addEventListener("TestRendered", () => {
window.scroll(0, document.body.offsetHeight);
document.documentElement.classList.remove('reftest-wait');
});

</script>

<div>F</div>

Expand Down

0 comments on commit 59655cf

Please sign in to comment.