Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(347)

Side by Side Diff: LayoutTests/fast/history/scroll-restoration/scroll-restoration-push-replace.html

Issue 1277583003: Restore scale even if scroll is not restored (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use window.scroll{X,y} Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/history/scroll-restoration/scroll-restoration-scale-not-impacted.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <style> 2 <style>
3 body { 3 body {
4 height: 2000px; 4 height: 10000px;
5 width: 2000px; 5 width: 10000px;
6 } 6 }
7 </style> 7 </style>
8 8
9 <body></body> 9 <body></body>
10 <script src="../../../resources/testharness.js"></script> 10 <script src="../../../resources/testharness.js"></script>
11 <script src="../../../resources/testharnessreport.js"></script> 11 <script src="../../../resources/testharnessreport.js"></script>
12 <script type="text/javascript"> 12 <script type="text/javascript">
13 'use strict'; 13 'use strict';
14 14
15 async_test(function(t) { 15 async_test(function(t) {
(...skipping 22 matching lines...) Expand all
38 history.pushState.apply(history, args); 38 history.pushState.apply(history, args);
39 } else { 39 } else {
40 history.pushState(null, '', key); 40 history.pushState(null, '', key);
41 history.replaceState.apply(history, args); 41 history.replaceState.apply(history, args);
42 } 42 }
43 assert_equals(history.scrollRestoration, beforeValue, `${entry.type} retai n current history.scrollRestoration value`); 43 assert_equals(history.scrollRestoration, beforeValue, `${entry.type} retai n current history.scrollRestoration value`);
44 history.scrollRestoration = newValue; 44 history.scrollRestoration = newValue;
45 assert_equals(history.scrollRestoration, newValue, `Setting scrollRestorat ion to ${newValue} does expected`); 45 assert_equals(history.scrollRestoration, newValue, `Setting scrollRestorat ion to ${newValue} does expected`);
46 window.scrollBy(50, 100); 46 window.scrollBy(50, 100);
47 } 47 }
48 assert_equals(history.length, 5, 'history entries match expectation');
49 48
50 // setup verification 49 // setup verification
51 window.addEventListener('hashchange', t.step_func(function() { 50 window.addEventListener('hashchange', t.step_func(function() {
52 var key = location.hash, 51 var key = location.hash,
53 entry = entries[key]; 52 entry = entries[key];
54 53
55 if (key === '') { 54 if (key === '') {
56 t.done(); 55 t.done();
57 return; 56 return;
58 } 57 }
59 console.log(`verifying ${key}`); 58 console.log(`verifying ${key}`);
60 assert_equals(history.state.key, key, `state should have key: ${key}`); 59 assert_equals(history.state.key, key, `state should have key: ${key}`);
61 assert_equals(document.body.scrollLeft, entry.expectedScroll[0], `scrollLe ft is correct for ${key}`); 60 assert_equals(document.body.scrollLeft, entry.expectedScroll[0], `scrollLe ft is correct for ${key}`);
62 assert_equals(document.body.scrollTop, entry.expectedScroll[1], `scrollTop is correct ${key}`); 61 assert_equals(document.body.scrollTop, entry.expectedScroll[1], `scrollTop is correct ${key}`);
63 62
64 window.history.back(); 63 window.history.back();
65 })); 64 }));
66 65
67 // Reset the scroll and kick off the verification 66 // reset the scroll and kick off the verification
68 setTimeout(function() { 67 setTimeout(function() {
69 history.pushState(null, null, '#done'); 68 history.pushState(null, null, '#done');
70 window.scrollTo(555, 555); 69 window.scrollTo(555, 555);
71 window.history.back(); 70 window.history.back();
72 }, 0); 71 }, 0);
73 72
74 }, 'history.{push,replace}State retain and respect history.scrollRestoration') ; 73 }, 'history.{push,replace}State retain and respect history.scrollRestoration') ;
75 </script> 74 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/history/scroll-restoration/scroll-restoration-scale-not-impacted.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698