| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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(); |
| OLD | NEW |