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

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

Issue 830853003: Fix for moving to previous url from PDF page in OOP case. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
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 /** 7 /**
8 * @return {number} Width of a scrollbar in pixels 8 * @return {number} Width of a scrollbar in pixels
9 */ 9 */
10 function getScrollbarWidth() { 10 function getScrollbarWidth() {
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 else 198 else
199 pageDownHandler(); 199 pageDownHandler();
200 return; 200 return;
201 case 33: // Page up key. 201 case 33: // Page up key.
202 pageUpHandler(); 202 pageUpHandler();
203 return; 203 return;
204 case 34: // Page down key. 204 case 34: // Page down key.
205 pageDownHandler(); 205 pageDownHandler();
206 return; 206 return;
207 case 37: // Left arrow key. 207 case 37: // Left arrow key.
208 // Go to the previous page if there are no horizontal scrollbars. 208 if (!(e.altKey || e.ctrlKey || e.metaKey || e.shiftKey)) {
209 if (!this.viewport_.documentHasScrollbars().x) { 209 // Go to the previous page if there are no horizontal scrollbars.
210 this.viewport_.goToPage(this.viewport_.getMostVisiblePage() - 1); 210 if (!this.viewport_.documentHasScrollbars().x) {
211 // Since we do the movement of the page. 211 this.viewport_.goToPage(this.viewport_.getMostVisiblePage() - 1);
212 e.preventDefault(); 212 // Since we do the movement of the page.
213 } else if (fromScriptingAPI) { 213 e.preventDefault();
214 position.x -= Viewport.SCROLL_INCREMENT; 214 } else if (fromScriptingAPI) {
215 this.viewport.position = position; 215 position.x -= Viewport.SCROLL_INCREMENT;
216 this.viewport.position = position;
217 }
216 } 218 }
217 return; 219 return;
218 case 38: // Up arrow key. 220 case 38: // Up arrow key.
219 if (fromScriptingAPI) { 221 if (fromScriptingAPI) {
220 position.y -= Viewport.SCROLL_INCREMENT; 222 position.y -= Viewport.SCROLL_INCREMENT;
221 this.viewport.position = position; 223 this.viewport.position = position;
222 } 224 }
223 return; 225 return;
224 case 39: // Right arrow key. 226 case 39: // Right arrow key.
225 // Go to the next page if there are no horizontal scrollbars. 227 if (!(e.altKey || e.ctrlKey || e.metaKey || e.shiftKey)) {
226 if (!this.viewport_.documentHasScrollbars().x) { 228 // Go to the next page if there are no horizontal scrollbars.
227 this.viewport_.goToPage(this.viewport_.getMostVisiblePage() + 1); 229 if (!this.viewport_.documentHasScrollbars().x) {
228 // Since we do the movement of the page. 230 this.viewport_.goToPage(this.viewport_.getMostVisiblePage() + 1);
229 e.preventDefault(); 231 // Since we do the movement of the page.
230 } else if (fromScriptingAPI) { 232 e.preventDefault();
231 position.x += Viewport.SCROLL_INCREMENT; 233 } else if (fromScriptingAPI) {
232 this.viewport.position = position; 234 position.x += Viewport.SCROLL_INCREMENT;
235 this.viewport.position = position;
236 }
233 } 237 }
234 return; 238 return;
235 case 40: // Down arrow key. 239 case 40: // Down arrow key.
236 if (fromScriptingAPI) { 240 if (fromScriptingAPI) {
237 position.y += Viewport.SCROLL_INCREMENT; 241 position.y += Viewport.SCROLL_INCREMENT;
238 this.viewport.position = position; 242 this.viewport.position = position;
239 } 243 }
240 return; 244 return;
241 case 65: // a key. 245 case 65: // a key.
242 if (e.ctrlKey || e.metaKey) { 246 if (e.ctrlKey || e.metaKey) {
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 this.streamDetails.tabId != -1); 607 this.streamDetails.tabId != -1);
604 }, 608 },
605 609
606 /** 610 /**
607 * @type {Viewport} the viewport of the PDF viewer. 611 * @type {Viewport} the viewport of the PDF viewer.
608 */ 612 */
609 get viewport() { 613 get viewport() {
610 return this.viewport_; 614 return this.viewport_;
611 } 615 }
612 }; 616 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698