mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-11 13:48:23 +02:00
Automatic update from web-platform-tests Add more references to sticky position ref tests This is a follow-up patch of https://chromium-review.googlesource.com/c/chromium/src/+/2105754 This patch adds more reference rectangles to sticky ref-tests to catch when the main thread position is different from the sticky position. Bug: 1059272 Change-Id: Ib3101e58a95db134a427b2852bca4c4bd58f805e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2137828 Reviewed-by: Robert Flack <flackr@chromium.org> Commit-Queue: Hao Sheng <haozhes@chromium.org> Cr-Commit-Position: refs/heads/master@{#761027} -- wpt-commits: 9586cd0785957c1f58c58cc9df9bc7410ffe8aff wpt-pr: 22752
96 lines
2.4 KiB
HTML
96 lines
2.4 KiB
HTML
<!DOCTYPE html>
|
|
<title>position:sticky elements should work correctly with grid layout</title>
|
|
<link rel="match" href="position-sticky-grid-ref.html" />
|
|
<link rel="help" href="https://www.w3.org/TR/css-position-3/#sticky-pos" />
|
|
<meta name="assert" content="This test checks that position:sticky elements interoperate correctly with grid" />
|
|
|
|
<script src="resources/ref-rectangle.js"></script>
|
|
|
|
<style>
|
|
.scroller {
|
|
position: relative;
|
|
overflow-x: scroll;
|
|
overflow-y: hidden;
|
|
width: 300px;
|
|
height: 100px;
|
|
margin-bottom: 15px;
|
|
}
|
|
|
|
.grid-container {
|
|
display: grid;
|
|
grid-template-columns: 25% 25% 25% 25%;
|
|
grid-template-rows: 100%;
|
|
width: 400px;
|
|
height: 90px;
|
|
}
|
|
|
|
.sticky {
|
|
position: sticky;
|
|
left: 50px;
|
|
}
|
|
|
|
.green {
|
|
background-color: green;
|
|
}
|
|
|
|
.grid-item {
|
|
width: 100%;
|
|
height: 100%;
|
|
grid-row: 1;
|
|
}
|
|
|
|
.indicator {
|
|
position: absolute;
|
|
background-color: red;
|
|
width: 100px;
|
|
height: 90px;
|
|
}
|
|
|
|
.padding {
|
|
height: 1px;
|
|
width: 700px;
|
|
}
|
|
|
|
</style>
|
|
|
|
<script>
|
|
window.addEventListener('load', function() {
|
|
document.getElementById('scroller1').scrollLeft = 0;
|
|
document.getElementById('scroller2').scrollLeft = 150;
|
|
document.getElementById('scroller3').scrollLeft = 300;
|
|
createIndicatorForStickyElements(document.querySelectorAll('.sticky'));
|
|
});
|
|
</script>
|
|
|
|
<div id="scroller1" class="scroller">
|
|
<div class="grid-container">
|
|
<div class="indicator" style="left: 100px;"></div>
|
|
<div class="grid-item" style="grid-column: 1;"></div>
|
|
<div class="sticky green grid-item" style="grid-column: 2;"></div>
|
|
<div class="green grid-item" style="grid-column: 3;"></div>
|
|
</div>
|
|
<div class="padding"></div>
|
|
</div>
|
|
|
|
<div id="scroller2" class="scroller">
|
|
<div class="grid-container">
|
|
<div class="indicator" style="left: 200px;"></div>
|
|
<div class="grid-item" style="grid-column: 1;"></div>
|
|
<div class="sticky green grid-item" style="grid-column: 2;"></div>
|
|
<div class="green grid-item" style="grid-column: 3;"></div>
|
|
</div>
|
|
<div class="padding"></div>
|
|
</div>
|
|
|
|
<div id="scroller3" class="scroller">
|
|
<div class="grid-container">
|
|
<div class="indicator" style="left: 300px;"></div>
|
|
<div class="grid-item" style="grid-column: 1;"></div>
|
|
<div class="sticky green grid-item" style="grid-column: 2;"></div>
|
|
<div class="green grid-item" style="grid-column: 3;"></div>
|
|
</div>
|
|
<div class="padding"></div>
|
|
</div>
|
|
|
|
<p>You should see three green boxes of varying size above. There should be no red or blue.</p>
|
|
|