| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 'strict'; | 6 'strict'; |
| 7 | 7 |
| 8 function MarginTextbox(groupName) { | 8 function MarginTextbox(groupName) { |
| 9 var box = document.createElement('input'); | 9 var box = document.createElement('input'); |
| 10 box.__proto__ = MarginTextbox.prototype; | 10 box.__proto__ = MarginTextbox.prototype; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 126 |
| 127 /** | 127 /** |
| 128 * Adds event listeners for various events. | 128 * Adds event listeners for various events. |
| 129 * @private | 129 * @private |
| 130 */ | 130 */ |
| 131 addEventListeners_: function() { | 131 addEventListeners_: function() { |
| 132 this.oninput = this.resetTimer_.bind(this); | 132 this.oninput = this.resetTimer_.bind(this); |
| 133 this.onblur = this.onBlur_.bind(this); | 133 this.onblur = this.onBlur_.bind(this); |
| 134 this.onkeypress = this.onKeyPressed_.bind(this); | 134 this.onkeypress = this.onKeyPressed_.bind(this); |
| 135 this.onkeyup = this.onKeyUp_.bind(this); | 135 this.onkeyup = this.onKeyUp_.bind(this); |
| 136 this.onfocus = function() { |
| 137 cr.dispatchSimpleEvent(document, 'marginTextboxFocused'); |
| 138 }; |
| 136 }, | 139 }, |
| 137 | 140 |
| 138 /** | 141 /** |
| 139 * Executes whenever a blur event occurs. | 142 * Executes whenever a blur event occurs. |
| 140 * @private | 143 * @private |
| 141 */ | 144 */ |
| 142 onBlur_: function() { | 145 onBlur_: function() { |
| 143 clearTimeout(this.timerId_); | 146 clearTimeout(this.timerId_); |
| 144 this.validate(); | 147 this.validate(); |
| 145 if (!this.isValid) { | 148 if (!this.isValid) { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 return; | 209 return; |
| 207 cr.dispatchSimpleEvent(this, 'MarginsMayHaveChanged'); | 210 cr.dispatchSimpleEvent(this, 'MarginsMayHaveChanged'); |
| 208 } | 211 } |
| 209 | 212 |
| 210 }; | 213 }; |
| 211 | 214 |
| 212 return { | 215 return { |
| 213 MarginTextbox: MarginTextbox | 216 MarginTextbox: MarginTextbox |
| 214 }; | 217 }; |
| 215 }); | 218 }); |
| OLD | NEW |