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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/scroll-behavior/smooth-scroll/keyboard-scroll.html

Issue 1534813004: Run smooth scroll animations on the compositor when possible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 5 years 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 <script src="../../../resources/js-test.js"></script>
3 <script>
4 window.jsTestIsAsync = true;
5 var pageHeight = 1200;
6 var pageWidth = 1000;
7
8 var testScrolls = [
9 {key: 'downArrow', expectedX: 0, expectedY: pageHeight - window.innerHei ght},
10 {key: 'upArrow', expectedX: 0, expectedY: 0},
11 {key: 'rightArrow', expectedX: pageWidth - window.innerWidth, expectedY: 0},
12 {key: 'leftArrow', expectedX: 0, expectedY: 0},
13 {key: 'end', expectedX: 0, expectedY: pageHeight - window.innerHeight},
14 {key: 'home', expectedX: 0, expectedY: 0},
15 {key: 'pageDown', expectedX: 0, expectedY: pageHeight - window.innerHeig ht},
16 {key: 'pageUp', expectedX: 0, expectedY: 0},
17 {key: ' ', expectedX: 0, expectedY: pageHeight - window.innerHeight},
18 ];
19 var currentTest = -1;
20
21 description("Test keyboard smooth scroll. The main purpose of this\
22 test is to ensure that smooth scrolling on the compositor\
23 works as intended (tested via virtual suite virtual/threaded/).");
24
25 function runTestCase(testCase) {
26 window.eventSender.keyDown(testCase.key);
27 if (window.scrollX == testCase.expectedX && window.scrollY == testCase.e xpectedY) {
28 testPassed(testCase.key + ' reached target');
29 startNextTestCase();
30 } else {
31 requestAnimationFrame(function() {
32 runTestCase(testCase);
33 });
34 }
35 }
36
37 function startNextTestCase() {
38 currentTest++;
39 if (currentTest >= testScrolls.length) {
40 finishJSTest();
41 return;
42 }
43 runTestCase(testScrolls[currentTest]);
44 }
45
46 function runTest() {
47 if (!window.eventSender || !window.internals) {
48 finishJSTest();
49 return;
50 }
51 // Turn on smooth scrolling.
52 internals.settings.setScrollAnimatorEnabled(true);
53
54 startNextTestCase();
55 }
56 addEventListener('load', runTest);
57 </script>
58
59 <style>
60 ::-webkit-scrollbar {
61 width: 0px;
62 height: 0px;
63 }
64
65 div {
66 width: 200px;
67 height: 20px;
68 background-color: red;
69 }
70
71 html{
72 padding: 0px;
73 margin: 0px;
74 width: 1000px;
75 height: 1200px;
76 }
77
78 .top {
79 position: absolute;
80 top: 0px;
81 left: 300px;
82 }
83
84 .middle{
85 position: absolute;
86 top: 575px;
87 left: 300px;
88 }
89
90 .bottom {
91 position: absolute;
92 top: 1180px;
93 left: 300px;
94 }
95
96 .left {
97 position: absolute;
98 top: 275px;
99 left: 0px;
100 }
101
102 .right {
103 position: absolute;
104 top: 275px;
105 left: 800px;
106 }
107 </style>
108 <p id="description" style="width: 800px"></p>
109 <p id="console" style="width: 800px"></p>
110 <div class="top">Top of page</div>
111 <div class="bottom">Bottom of page</div>
112 <div class="left">Left of page</div>
113 <div class="right">Right of page</div>
114 <div class="middle">Middle of page</div>
OLDNEW
« no previous file with comments | « cc/layers/layer.cc ('k') | third_party/WebKit/LayoutTests/fast/scroll-behavior/smooth-scroll/keyboard-scroll-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698