| 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 cr.define('print_preview', function() { | 5 cr.define('print_preview', function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Draggable control for setting a page margin. | 9 * Draggable control for setting a page margin. |
| 10 * @param {!print_preview.ticket_items.CustomMargins.Orientation} orientation | 10 * @param {!print_preview.ticket_items.CustomMargins.Orientation} orientation |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 * Called when a key down event occurs on the textbox. Dispatches a | 414 * Called when a key down event occurs on the textbox. Dispatches a |
| 415 * TEXT_CHANGE event if the "Enter" key was pressed. | 415 * TEXT_CHANGE event if the "Enter" key was pressed. |
| 416 * @param {Event} event Contains the key that was pressed. | 416 * @param {Event} event Contains the key that was pressed. |
| 417 * @private | 417 * @private |
| 418 */ | 418 */ |
| 419 onTextboxKeyDown_: function(event) { | 419 onTextboxKeyDown_: function(event) { |
| 420 if (this.textTimeout_) { | 420 if (this.textTimeout_) { |
| 421 clearTimeout(this.textTimeout_); | 421 clearTimeout(this.textTimeout_); |
| 422 this.textTimeout_ = null; | 422 this.textTimeout_ = null; |
| 423 } | 423 } |
| 424 if (event.keyIdentifier == 'Enter') { | 424 if (event.keyCode == 13 /*enter*/) { |
| 425 this.preTimeoutValue_ = null; | 425 this.preTimeoutValue_ = null; |
| 426 cr.dispatchSimpleEvent(this, MarginControl.EventType.TEXT_CHANGE); | 426 cr.dispatchSimpleEvent(this, MarginControl.EventType.TEXT_CHANGE); |
| 427 } else { | 427 } else { |
| 428 if (this.preTimeoutValue_ == null) { | 428 if (this.preTimeoutValue_ == null) { |
| 429 this.preTimeoutValue_ = this.textbox_.value; | 429 this.preTimeoutValue_ = this.textbox_.value; |
| 430 } | 430 } |
| 431 this.textTimeout_ = setTimeout( | 431 this.textTimeout_ = setTimeout( |
| 432 this.onTextboxTimeout_.bind(this), MarginControl.TEXTBOX_TIMEOUT_); | 432 this.onTextboxTimeout_.bind(this), MarginControl.TEXTBOX_TIMEOUT_); |
| 433 } | 433 } |
| 434 }, | 434 }, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 458 this.setIsFocused_(false); | 458 this.setIsFocused_(false); |
| 459 cr.dispatchSimpleEvent(this, MarginControl.EventType.TEXT_CHANGE); | 459 cr.dispatchSimpleEvent(this, MarginControl.EventType.TEXT_CHANGE); |
| 460 } | 460 } |
| 461 }; | 461 }; |
| 462 | 462 |
| 463 // Export | 463 // Export |
| 464 return { | 464 return { |
| 465 MarginControl: MarginControl | 465 MarginControl: MarginControl |
| 466 }; | 466 }; |
| 467 }); | 467 }); |
| OLD | NEW |