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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/scrolling/set-root-scroller.html

Issue 1913843004: Implementing document.setRootScroller API for main thread scrolling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@overscrollController
Patch Set: Created 4 years, 8 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
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <style>
3 ::-webkit-scrollbar {
4 width: 0px;
5 height: 0px;
6 }
7
8 body, html {
9 width: 100%;
10 height: 100%;
11 }
12
13 body {
14 margin: 0px;
15 }
16
17 #container {
18 width: 1000px;
19 height: 1000px;
20 overflow: auto;
21 }
22
23 #spacer {
24 width: 2000px;
25 height: 1900px;
26 }
27 </style>
28
29 <div id="container">
30 <div id="spacer">
31 <span id="spanner">TEST</span>
32 </div>
33 </div>
34
35 <script src="../../resources/testharness.js"></script>
36 <script src="../../resources/testharnessreport.js"></script>
37
38 <script>
39 test(function() {
40 assert_false(typeof document.setRootScroller === 'undefined');
41 }, 'setRootScroller API enabled');
42 test(function() {
43 // Setting the container object should succeed.
44 assert_equals(document.rootScroller, document.documentElement);
45 var container = document.querySelector('#container');
46 document.setRootScroller(container);
47 assert_equals(document.rootScroller, container);
48
49 // Trying to set the <span> should fail with an exception thrown since a
50 // span is not a valid scroller.
51 assert_throws(
52 'InvalidStateError',
53 function() {
54 document.setRootScroller(document.querySelector('#spanner'));
55 },
56 'Trying to set a non-block flow element should throw');
57 assert_equals(document.rootScroller, container);
58
59 // Scroll the container <div> past the end. The scrolls should not chain
60 // past the rootScroller to the scrollingElement.
61 if (typeof eventSender !== 'undefined') {
62 eventSender.gestureScrollBegin(500, 500);
63 eventSender.gestureScrollUpdate(-300, -300);
64 eventSender.gestureScrollUpdate(-300, -300);
65 eventSender.gestureScrollUpdate(-300, -300);
66 eventSender.gestureScrollUpdate(-300, -300);
67 eventSender.gestureScrollEnd(0, 0);
tdresser 2016/04/26 20:43:49 This should probably do multiple short scrolls, to
bokan 2016/04/26 23:06:23 Done.
68
69 assert_equals(container.scrollTop, 900);
70 assert_equals(container.scrollLeft, 1000);
71 assert_equals(document.scrollingElement.scrollTop, 0);
72 assert_equals(document.scrollingElement.scrollLeft, 0);
73 }
74
75 // Making the current rootScroller an invalid scroller should reset the
76 // rootScroller to the default, the documentElement.
77 container.style.display = "none";
78 newRootScroller = document.rootScroller;
79 assert_equals(newRootScroller, document.documentElement);
80
81 container.style.display = "block";
82 assert_equals(newRootScroller, document.documentElement);
83
84 // Now scrolling over the <div> should scroll the scrollingElement.
85 if (typeof eventSender !== 'undefined') {
86 eventSender.gestureScrollBegin(500, 500);
87 eventSender.gestureScrollUpdate(-300, -300);
88 eventSender.gestureScrollUpdate(-300, -300);
89 eventSender.gestureScrollUpdate(-300, -300);
90 eventSender.gestureScrollUpdate(-300, -300);
91 eventSender.gestureScrollEnd(0, 0);
92
93 assert_equals(document.scrollingElement.scrollTop, 400);
94 assert_equals(document.scrollingElement.scrollLeft, 200);
95 }
96
97 // Don't output the text in spanner.
98 document.querySelector('#spanner').style.display = 'none';
99
100 }, 'Test the setRootScroller API basic functionality');
101 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/core.gypi » ('j') | third_party/WebKit/Source/core/dom/Document.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698