Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/fast/layout/scroll-anchoring/history-restore-anchors.html |
| diff --git a/third_party/WebKit/LayoutTests/fast/layout/scroll-anchoring/history-restore-anchors.html b/third_party/WebKit/LayoutTests/fast/layout/scroll-anchoring/history-restore-anchors.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..72d77296ca5a8f205d7c31eacb08d1a13b37de57 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/fast/layout/scroll-anchoring/history-restore-anchors.html |
| @@ -0,0 +1,64 @@ |
| +<script src="../../../resources/js-test.js"></script> |
| +<style> |
| + body { |
| + margin: 0px; height: 2000px; width: 2000px; |
| + } |
| + |
| + #first { |
| + height: 1000px; background-color: #FFA5D2; |
| + } |
| + |
| + #anchor { |
| + position: absolute; background-color: #84BE6A; |
| + height: 600px; width: 100%; |
| + } |
| +</style> |
| + |
| +<script> |
| +window.jsTestIsAsync = true; |
| +setPrintTestResultsLazily(); |
| + |
| +description("This test ensures that scroll anchoring interacts correctly with\ |
| + history restoration."); |
| + |
| +// Navigation steps: |
| +// 1- page gets loaded and anchor element gets scrolled into view. |
| +// 2- loaded page away and then 'back'. |
| + |
| +onload = function() { |
| + if (!window.internals) { |
| + finishJSTest(); |
| + return; |
| + } |
| + |
| + internals.settings.setScrollAnchoringEnabled(true); |
| + |
| + if (window.name == 'second/load') { |
| + shouldBe('document.scrollingElement.scrollTop', '1000'); |
| + |
| + // Change height of content above anchor. |
| + var ch = document.getElementById('changer'); |
| + ch.style.height = 100; |
| + // Height of first + height changer. |
| + shouldBe('document.scrollingElement.scrollTop', '1100'); |
| + finishJSTest(); |
| + } else { |
| + var anchor = document.getElementById('anchor'); |
| + anchor.scrollIntoView(); |
| + |
| + requestAnimationFrame(function() { |
| + if (document.scrollingElement.scrollTop != 1000) { |
| + debug('Failed to scroll anchor into view.'); |
| + finishJSTest(); |
| + } |
| + |
| + window.name = "second/load"; |
| + window.location = "data:text/html,<script>history.back();</scr" + "ipt>"; |
|
ojan
2016/04/19 21:34:24
I think you can just do window.location.reload().
ymalik
2016/04/22 20:41:05
Done.
|
| + }); |
| + } |
| +} |
| +</script> |
| + |
| +<div id="first"></div> |
| +<div id="changer"></div> |
| +<div id="anchor"></div> |