| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 cr.define('print_preview', function() { | 5 cr.define('print_preview', function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Modal dialog base component. | 9 * Modal dialog base component. |
| 10 * @param {!print_preview.MetricsContext} metricsContext Metrics | 10 * @param {!print_preview.MetricsContext} metricsContext Metrics |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 this.getElement().addEventListener('webkitTransitionEnd', function f(e) { | 34 this.getElement().addEventListener('webkitTransitionEnd', function f(e) { |
| 35 if (e.target == e.currentTarget && e.propertyName == 'opacity' && | 35 if (e.target == e.currentTarget && e.propertyName == 'opacity' && |
| 36 e.target.classList.contains('transparent')) { | 36 e.target.classList.contains('transparent')) { |
| 37 setIsVisible(e.target, false); | 37 setIsVisible(e.target, false); |
| 38 } | 38 } |
| 39 }); | 39 }); |
| 40 | 40 |
| 41 this.getElement().addEventListener('keydown', function f(e) { | 41 this.getElement().addEventListener('keydown', function f(e) { |
| 42 // Escape pressed -> cancel the dialog. | 42 // Escape pressed -> cancel the dialog. |
| 43 if (!e.shiftKey && !e.ctrlKey && !e.altKey && !e.metaKey) { | 43 if (!hasKeyModifiers(e)) { |
| 44 if (e.keyCode == 27) { | 44 if (e.keyCode == 27) { |
| 45 e.stopPropagation(); | 45 e.stopPropagation(); |
| 46 e.preventDefault(); | 46 e.preventDefault(); |
| 47 this.cancel(); | 47 this.cancel(); |
| 48 } else if (e.keyCode == 13) { | 48 } else if (e.keyCode == 13) { |
| 49 var activeElementTag = document.activeElement ? | 49 var activeElementTag = document.activeElement ? |
| 50 document.activeElement.tagName.toUpperCase() : ''; | 50 document.activeElement.tagName.toUpperCase() : ''; |
| 51 if (activeElementTag != 'BUTTON' && activeElementTag != 'SELECT') { | 51 if (activeElementTag != 'BUTTON' && activeElementTag != 'SELECT') { |
| 52 if (this.onEnterPressedInternal()) { | 52 if (this.onEnterPressedInternal()) { |
| 53 e.stopPropagation(); | 53 e.stopPropagation(); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 if (e.target && e.animationName == 'pulse') | 133 if (e.target && e.animationName == 'pulse') |
| 134 e.target.classList.remove('pulse'); | 134 e.target.classList.remove('pulse'); |
| 135 } | 135 } |
| 136 }; | 136 }; |
| 137 | 137 |
| 138 // Export | 138 // Export |
| 139 return { | 139 return { |
| 140 Overlay: Overlay | 140 Overlay: Overlay |
| 141 }; | 141 }; |
| 142 }); | 142 }); |
| OLD | NEW |