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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/loader/scroll-restore-should-happen-during-load.html

Issue 1561573004: Fix bug where scroll position was being restored after navigation completes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restore to previous type Created 4 years, 11 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 | third_party/WebKit/LayoutTests/fast/loader/scroll-restore-should-happen-during-load-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <style>
3 #content {
4 height: 2000px;
5 width: 2000px;
6 }
7 </style>
8
9 <div id='console'></div>
10 <div id='content'></div>
11
12 <script src="../../resources/js-test.js"></script>
13 <script>
14 jsTestIsAsync = true;
15 setPrintTestResultsLazily();
16 description('Test ensures that frame scroll position is only restored during ' +
17 'the navigation process but does not occur after navigation is ' +
18 'complete for same document navigations.');
19
20 window.scrollTo(100, 100);
21 history.pushState(null, null, '#test');
22
23 window.addEventListener('hashchange', _ => {
24 // after back navigation scroll position should be restored to 100,100.
25 debug('Verify that scroll position restored correctly during navigation.');
26 shouldBe('document.scrollingElement.scrollLeft', '100');
27 shouldBe('document.scrollingElement.scrollTop', '100');
28
29 // trigger a content size change that should cause the scroll position
30 // to get clamped to 0,0.
31 document.getElementById('content').style.display = 'none';
32 shouldBe('document.scrollingElement.scrollLeft', '0');
33 shouldBe('document.scrollingElement.scrollTop', '0');
34
35 // trigger another content size change and verify that scroll position is
36 // not restored.
37 debug('Verify that scroll position is not restored again after navigation is c omplete.');
38 document.getElementById('content').style.display = 'block';
39 shouldBe('document.scrollingElement.scrollLeft', '0');
40 shouldBe('document.scrollingElement.scrollTop', '0');
41
42 finishJSTest();
43 });
44
45 setTimeout(_ => {
46 window.scrollTo(0, 0);
47 shouldBe('document.scrollingElement.scrollLeft', '0');
48 shouldBe('document.scrollingElement.scrollTop', '0');
49 history.back();
50 }, 0);
51 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/loader/scroll-restore-should-happen-during-load-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698