OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 /** | 5 /** |
6 * @typedef {{accessibility: Function, | 6 * @typedef {{accessibility: Function, |
7 * documentLoadComplete: Function, | 7 * documentLoadComplete: Function, |
8 * getHeight: Function, | 8 * getHeight: Function, |
9 * getHorizontalScrollbarThickness: Function, | 9 * getHorizontalScrollbarThickness: Function, |
10 * getPageLocationNormalized: Function, | 10 * getPageLocationNormalized: Function, |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 * Processes a keyboard event that could possibly be used to change state of | 253 * Processes a keyboard event that could possibly be used to change state of |
254 * the preview plugin. | 254 * the preview plugin. |
255 * @param {KeyboardEvent} e Keyboard event to process. | 255 * @param {KeyboardEvent} e Keyboard event to process. |
256 */ | 256 */ |
257 handleDirectionalKeyEvent: function(e) { | 257 handleDirectionalKeyEvent: function(e) { |
258 // Make sure the PDF plugin is there. | 258 // Make sure the PDF plugin is there. |
259 // We only care about: PageUp, PageDown, Left, Up, Right, Down. | 259 // We only care about: PageUp, PageDown, Left, Up, Right, Down. |
260 // If the user is holding a modifier key, ignore. | 260 // If the user is holding a modifier key, ignore. |
261 if (!this.plugin_ || | 261 if (!this.plugin_ || |
262 !arrayContains([33, 34, 37, 38, 39, 40], e.keyCode) || | 262 !arrayContains([33, 34, 37, 38, 39, 40], e.keyCode) || |
263 e.metaKey || e.altKey || e.shiftKey || e.ctrlKey) { | 263 hasKeyModifiers(e)) { |
264 return; | 264 return; |
265 } | 265 } |
266 | 266 |
267 // Don't handle the key event for these elements. | 267 // Don't handle the key event for these elements. |
268 var tagName = document.activeElement.tagName; | 268 var tagName = document.activeElement.tagName; |
269 if (arrayContains(['INPUT', 'SELECT', 'EMBED'], tagName)) { | 269 if (arrayContains(['INPUT', 'SELECT', 'EMBED'], tagName)) { |
270 return; | 270 return; |
271 } | 271 } |
272 | 272 |
273 // For the most part, if any div of header was the last clicked element, | 273 // For the most part, if any div of header was the last clicked element, |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 // being draggable. | 665 // being draggable. |
666 this.plugin_.style.pointerEvents = isDragging ? 'none' : 'auto'; | 666 this.plugin_.style.pointerEvents = isDragging ? 'none' : 'auto'; |
667 } | 667 } |
668 }; | 668 }; |
669 | 669 |
670 // Export | 670 // Export |
671 return { | 671 return { |
672 PreviewArea: PreviewArea | 672 PreviewArea: PreviewArea |
673 }; | 673 }; |
674 }); | 674 }); |
OLD | NEW |