Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/fast/css/sticky/sticky-style-change.html |
| diff --git a/third_party/WebKit/LayoutTests/fast/css/sticky/sticky-style-change.html b/third_party/WebKit/LayoutTests/fast/css/sticky/sticky-style-change.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..56b5cbe7a95eb91a6ec217fd60ed4c24edced629 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/fast/css/sticky/sticky-style-change.html |
| @@ -0,0 +1,68 @@ |
| +<!DOCTYPE html> |
| +<script> |
| +if (window.internals) { |
| + internals.settings.setCSSStickyPositionEnabled(true); |
| +} |
| +</script> |
| + |
| +<html> |
| +<head> |
| +<style> |
| + body { |
| + margin: 0; |
| + overflow: hidden; /* hide scrollbars */ |
|
flackr
2017/02/22 15:43:02
I just noticed this, isn't this making the body an
smcgruer
2017/02/22 16:14:22
As per discussion, this is actually ok because the
|
| + } |
| + |
| + .container { |
| + height: 2000px; |
| + } |
| + |
| + .box { |
| + height: 50px; |
| + } |
| + |
| + .sticky { |
| + position: sticky; |
| + top: 50px; |
| + background-color: green; |
| + } |
| +</style> |
| +<script> |
| + if (window.testRunner) |
| + testRunner.waitUntilDone() |
| + |
| + function doTest() |
| + { |
| + const sticky = document.querySelector('.sticky'); |
| + sticky.style.position = 'relative'; |
| + |
| + // Force layout. |
| + sticky.offsetTop; |
| + |
| + sticky.style.position = 'sticky'; |
| + |
| + window.requestAnimationFrame(function() { |
| + window.scrollTo(0, 100); |
| + if (window.testRunner) |
| + testRunner.notifyDone(); |
| + }); |
| + } |
| + |
| + window.addEventListener('load', function() { |
| + // We require the compositings inputs to be clean (and thus the initial |
| + // sticky position to be calculated) before we stat changing things. |
| + // Force this by waiting for a double rAF. |
| + window.requestAnimationFrame(function() { |
| + window.requestAnimationFrame(function() { |
| + doTest(); |
|
flackr
2017/02/22 15:43:01
nit: just requestAnimationFrame(doTest); for the i
smcgruer
2017/02/22 16:14:22
Done.
|
| + }); |
| + }); |
| + }); |
| +</script> |
| +</head> |
| +<body> |
| + <div class="container"> |
| + <div class="sticky box"></div> |
| + </div> |
| +</body> |
| +</html> |