| OLD | NEW |
| (Empty) | |
| 1 <script src="../../../resources/testharness.js"></script> |
| 2 <script src="../../../resources/testharnessreport.js"></script> |
| 3 <style> |
| 4 body { |
| 5 margin: 0px; |
| 6 height: 2000px; |
| 7 width: 2000px; |
| 8 } |
| 9 |
| 10 #first { |
| 11 height: 1000px; |
| 12 background-color: #FFA5D2; |
| 13 } |
| 14 |
| 15 #anchor { |
| 16 position: absolute; |
| 17 background-color: #84BE6A; |
| 18 height: 600px; |
| 19 width: 100%; |
| 20 } |
| 21 |
| 22 #fragment { |
| 23 position: relative; |
| 24 background-color: orange; |
| 25 height: 200px; |
| 26 width: 200px; |
| 27 margin: 10px; |
| 28 } |
| 29 </style> |
| 30 |
| 31 <div id="first"></div> |
| 32 <div id="changer"></div> |
| 33 <div id="anchor"> |
| 34 <div id="fragment" name="fragment"></div> |
| 35 </div> |
| 36 |
| 37 <script> |
| 38 test(function(t) { |
| 39 // TODO(ymalik): Remove reference to internals when scroll anchoring is |
| 40 // enabled by default. |
| 41 assert_false(!window.internals, 'This test requires internals'); |
| 42 internals.runtimeFlags.setScrollAnchoringEnabled(true); |
| 43 |
| 44 window.location.hash = 'fragment'; |
| 45 // Height of first + fragment margin-top. |
| 46 assert_equals(window.scrollY, 1010); |
| 47 |
| 48 // Change height of content above fragment. |
| 49 var ch = document.getElementById('changer'); |
| 50 ch.style.height = 100; |
| 51 |
| 52 // Height of first + height changer + fragment margin-top. |
| 53 assert_equals(window.scrollY, 1110); |
| 54 }, 'Verify scroll anchoring interaction with fragment scrolls'); |
| 55 </script> |
| OLD | NEW |