mirror of
https://github.com/servo/servo.git
synced 2025-09-11 07:28:19 +01:00
Update web-platform-tests to revision 138d2e938d493a5c8435025162759c2e34b3b1d1
This commit is contained in:
parent
ce37d5ebf2
commit
732399d5d9
1754 changed files with 6528 additions and 3662 deletions
|
@ -0,0 +1,47 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Viewport: Resize Event On Load Overflowing Page</title>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, minimum-scale=1">
|
||||
<script>
|
||||
var opener = window.opener;
|
||||
var numViewResizes = 0;
|
||||
window.visualViewport.addEventListener('resize', function() {
|
||||
numViewResizes++;
|
||||
});
|
||||
|
||||
window.addEventListener('load', function() {
|
||||
requestAnimationFrame(function() {
|
||||
requestAnimationFrame(
|
||||
opener.t.step_func_done(function() {
|
||||
var isOverlay = opener.calculateScrollbarThickness() == 0;
|
||||
opener.assert_equals(numViewResizes, isOverlay ? 0 : 1);
|
||||
}));
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
html {
|
||||
height: 100%;
|
||||
}
|
||||
body {
|
||||
/* Ensure overflow */
|
||||
height: 200%;
|
||||
}
|
||||
#log {
|
||||
overflow: auto;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Viewport: Resize Event On Load Overflowing Page</h1>
|
||||
<h4>
|
||||
Test Description: This test ensures that we fire a resize event against
|
||||
window.visualViewport if the page has overflow (since this creates a scrollbar
|
||||
and thus changes the viewport size).
|
||||
</h4>
|
||||
<div id="log"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -8,46 +8,16 @@
|
|||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="viewport_support.js"></script>
|
||||
<script>
|
||||
// This first case ensures that we load into the same kind of
|
||||
// viewport. If the previous test had a page-scale factor set or a
|
||||
// different viewport <meta> we might get a resize because of that.
|
||||
if (location.search === "") {
|
||||
window.addEventListener('load', function() {
|
||||
var url = window.location.href + "?reloaded";
|
||||
window.location.href = url;
|
||||
});
|
||||
} else {
|
||||
var t = async_test(
|
||||
"Resize event fired exactly once against window.visualViewport if " +
|
||||
"scrollbars affect layout.");
|
||||
var numViewResizes = 0;
|
||||
window.visualViewport.addEventListener('resize', function() {
|
||||
numViewResizes++;
|
||||
});
|
||||
|
||||
window.addEventListener('load', function() {
|
||||
requestAnimationFrame(function() {
|
||||
requestAnimationFrame(
|
||||
t.step_func_done(function() {
|
||||
var isOverlay = calculateScrollbarThickness() == 0;
|
||||
assert_equals(numViewResizes, isOverlay ? 0 : 1);
|
||||
}));
|
||||
});
|
||||
});
|
||||
}
|
||||
var t = async_test(
|
||||
"Resize event fired exactly once against window.visualViewport if " +
|
||||
"scrollbars affect layout.");
|
||||
t.step(() => {
|
||||
// Run the test in a new window to make sure we don't pick up
|
||||
// a resize event due to a previous page having a different scale.
|
||||
var win = window.open("helper-resize-event-on-load-overflowing-page.html");
|
||||
t.add_cleanup(() => win.close());
|
||||
});
|
||||
</script>
|
||||
<style>
|
||||
html {
|
||||
height: 100%;
|
||||
}
|
||||
body {
|
||||
/* Ensure overflow */
|
||||
height: 200%;
|
||||
}
|
||||
#log {
|
||||
overflow: auto;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Viewport: Resize Event On Load Overflowing Page</h1>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue