Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / scrolling / keyboard-scroll-page-scale.html
blob3e9db3e40772595bbb05d3e04623e9e43c08ceac
1 <!DOCTYPE html>
2 <script src="../../resources/js-test.js"></script>
3 <script>
4 var numScrolls;
5 var pageHeight = 2000;
6 var pageWidth = 2000;
8 function reset()
10 window.scrollTo(0, 0);
11 internals.setPageScaleFactor(2);
14 function testArrowKeys()
16 // Test up and down.
17 window.eventSender.keyDown('downArrow');
18 shouldBeGreaterThan('window.scrollY', '0');
20 numScrolls = Math.ceil((pageHeight - window.innerHeight) / window.scrollY);
22 for(var i = 0; i < numScrolls - 1; ++i) {
23 window.eventSender.keyDown('downArrow');
26 shouldBe('window.scrollY', 'pageHeight - window.innerHeight');
28 for(var i = 0; i < numScrolls; ++i) {
29 window.eventSender.keyDown('upArrow');
32 shouldBe('window.scrollY', '0');
34 // Now test left and right.
36 reset();
37 window.eventSender.keyDown('rightArrow');
38 numScrolls = Math.ceil((pageWidth - window.innerWidth) / window.scrollX);
40 for(var i = 0; i < numScrolls - 1; ++i) {
41 window.eventSender.keyDown('rightArrow');
44 shouldBe('window.scrollX', 'pageWidth - window.innerWidth');
46 for(var i = 0; i < numScrolls; ++i) {
47 window.eventSender.keyDown('leftArrow');
50 shouldBe('window.scrollX', '0');
53 function testHomeEnd()
55 window.eventSender.keyDown('end');
56 shouldBe('window.scrollY', 'pageHeight - window.innerHeight');
57 window.eventSender.keyDown('home');
58 shouldBe('window.scrollY', '0');
61 function testPageUpDown()
63 window.eventSender.keyDown('pageDown');
64 shouldBeGreaterThan('window.scrollY', '0');
66 numScrolls = Math.ceil((pageHeight - window.innerHeight) / window.scrollY);
68 for(var i = 0; i < numScrolls - 1; ++i) {
69 window.eventSender.keyDown('pageDown');
72 shouldBe('window.scrollY', 'pageHeight - window.innerHeight');
74 for(var i = 0; i < numScrolls; ++i) {
75 window.eventSender.keyDown('pageUp');
78 shouldBe('window.scrollY', '0');
81 function testSpacebar()
83 window.eventSender.keyDown(' ');
84 shouldBeGreaterThan('window.scrollY', '0');
86 numScrolls = Math.ceil((pageHeight - window.innerHeight) / window.scrollY);
88 for(var i = 0; i < numScrolls - 1; ++i) {
89 window.eventSender.keyDown(' ');
92 shouldBe('window.scrollY', 'pageHeight - window.innerHeight');
94 for(var i = 0; i < numScrolls; ++i) {
95 window.eventSender.keyDown(' ', 'shiftKey');
98 shouldBe('window.scrollY', '0');
101 function runTest()
103 description(
104 'Test that keyboard scrolling while the page is scaled scrolls ' +
105 'both viewports. To test manually, pinch zoom into the page and ' +
106 'use the arrow keys, page up/down, home/end to scroll the page. ' +
107 'You should be able to reach the end of the page bounds (i.e. ' +
108 'scroll to see the divs at the bounds.)');
110 if (window.eventSender && window.internals) {
111 reset();
112 debug('Testing arrow keys:');
113 testArrowKeys();
115 reset();
116 debug('');
117 debug('Testing home and end keys:');
118 testHomeEnd();
120 reset();
121 debug('');
122 debug('Testing page up and page down keys:');
123 testPageUpDown();
125 reset();
126 debug('');
127 debug('Testing spacebar:');
128 testSpacebar();
132 addEventListener('load', runTest);
133 </script>
134 <style>
135 ::-webkit-scrollbar {
136 width: 0px;
137 height: 0px;
140 div {
141 width: 200px;
142 height: 20px;
143 background-color: red;
146 html{
147 padding: 0px;
148 margin: 0px;
149 width: 2000px;
150 height: 2000px;
153 .top {
154 position: absolute;
155 top: 0px;
156 left: 300px;
159 .middle{
160 position: absolute;
161 top: 975px;
162 left: 300px;
165 .bottom {
166 position: absolute;
167 top: 1980px;
168 left: 300px;
172 .left {
173 position: absolute;
174 top: 275px;
175 left: 0px;
178 .right {
179 position: absolute;
180 top: 275px;
181 left: 1800px;
183 </style>
184 <p id="description" style="width: 800px"></p>
185 <p id="console" style="width: 800px"></p>
186 <div class="top">Top of page</div>
187 <div class="bottom">Bottom of page</div>
188 <div class="left">Left of page</div>
189 <div class="right">Right of page</div>
190 <div class="middle">Middle of page</div>