| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 127 |
| 128 /** | 128 /** |
| 129 * Adds event listeners for various events. | 129 * Adds event listeners for various events. |
| 130 * @private | 130 * @private |
| 131 */ | 131 */ |
| 132 addEventListeners_: function() { | 132 addEventListeners_: function() { |
| 133 this.oninput = this.resetTimer_.bind(this); | 133 this.oninput = this.resetTimer_.bind(this); |
| 134 this.onblur = this.onBlur_.bind(this); | 134 this.onblur = this.onBlur_.bind(this); |
| 135 this.onkeypress = this.onKeyPressed_.bind(this); | 135 this.onkeypress = this.onKeyPressed_.bind(this); |
| 136 this.onkeyup = this.onKeyUp_.bind(this); | 136 this.onkeyup = this.onKeyUp_.bind(this); |
| 137 this.onfocus = function() { |
| 138 cr.dispatchSimpleEvent(document, 'marginTextboxFocused'); |
| 139 }; |
| 137 }, | 140 }, |
| 138 | 141 |
| 139 /** | 142 /** |
| 140 * Executes whenever a blur event occurs. | 143 * Executes whenever a blur event occurs. |
| 141 * @private | 144 * @private |
| 142 */ | 145 */ |
| 143 onBlur_: function() { | 146 onBlur_: function() { |
| 144 clearTimeout(this.timerId_); | 147 clearTimeout(this.timerId_); |
| 145 this.validate(); | 148 this.validate(); |
| 146 if (!this.isValid) { | 149 if (!this.isValid) { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 return; | 210 return; |
| 208 cr.dispatchSimpleEvent(this, 'MarginsMayHaveChanged'); | 211 cr.dispatchSimpleEvent(this, 'MarginsMayHaveChanged'); |
| 209 } | 212 } |
| 210 | 213 |
| 211 }; | 214 }; |
| 212 | 215 |
| 213 return { | 216 return { |
| 214 MarginTextbox: MarginTextbox | 217 MarginTextbox: MarginTextbox |
| 215 }; | 218 }; |
| 216 }); | 219 }); |
| OLD | NEW |