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

Side by Side Diff: chrome/browser/resources/pdf/pdf.js

Issue 431303002: PDF: Handle the space bar key like page down. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | pdf/instance.cc » ('j') | pdf/instance.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 'use strict'; 5 'use strict';
6 6
7 <include src="../../../../ui/webui/resources/js/util.js"> 7 <include src="../../../../ui/webui/resources/js/util.js">
8 <include src="pdf_scripting_api.js"> 8 <include src="pdf_scripting_api.js">
9 <include src="viewport.js"> 9 <include src="viewport.js">
10 10
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 // Go to the previous page if we are fit-to-page. 169 // Go to the previous page if we are fit-to-page.
170 if (this.viewport_.fittingType == Viewport.FittingType.FIT_TO_PAGE) { 170 if (this.viewport_.fittingType == Viewport.FittingType.FIT_TO_PAGE) {
171 this.viewport_.goToPage(this.viewport_.getMostVisiblePage() - 1); 171 this.viewport_.goToPage(this.viewport_.getMostVisiblePage() - 1);
172 // Since we do the movement of the page. 172 // Since we do the movement of the page.
173 e.preventDefault(); 173 e.preventDefault();
174 } else if (fromScriptingAPI) { 174 } else if (fromScriptingAPI) {
175 position.y -= this.viewport.size.height; 175 position.y -= this.viewport.size.height;
176 this.viewport.position = position; 176 this.viewport.position = position;
177 } 177 }
178 return; 178 return;
179 case 32: // Space key.
179 case 34: // Page down key. 180 case 34: // Page down key.
180 // Go to the next page if we are fit-to-page. 181 // Go to the next page if we are fit-to-page.
181 if (this.viewport_.fittingType == Viewport.FittingType.FIT_TO_PAGE) { 182 if (this.viewport_.fittingType == Viewport.FittingType.FIT_TO_PAGE) {
182 this.viewport_.goToPage(this.viewport_.getMostVisiblePage() + 1); 183 this.viewport_.goToPage(this.viewport_.getMostVisiblePage() + 1);
183 // Since we do the movement of the page. 184 // Since we do the movement of the page.
184 e.preventDefault(); 185 e.preventDefault();
185 } else if (fromScriptingAPI) { 186 } else if (fromScriptingAPI) {
186 position.y += this.viewport.size.height; 187 position.y += this.viewport.size.height;
187 this.viewport.position = position; 188 this.viewport.position = position;
188 } 189 }
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 527
527 /** 528 /**
528 * @type {Viewport} the viewport of the PDF viewer. 529 * @type {Viewport} the viewport of the PDF viewer.
529 */ 530 */
530 get viewport() { 531 get viewport() {
531 return this.viewport_; 532 return this.viewport_;
532 } 533 }
533 }; 534 };
534 535
535 var viewer = new PDFViewer(); 536 var viewer = new PDFViewer();
OLDNEW
« no previous file with comments | « no previous file | pdf/instance.cc » ('j') | pdf/instance.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698