| 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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 MarginControl.Classes_.LINE)[0]; | 318 MarginControl.Classes_.LINE)[0]; |
| 319 }, | 319 }, |
| 320 | 320 |
| 321 /** @override */ | 321 /** @override */ |
| 322 enterDocument: function() { | 322 enterDocument: function() { |
| 323 print_preview.Component.prototype.enterDocument.call(this); | 323 print_preview.Component.prototype.enterDocument.call(this); |
| 324 this.tracker.add( | 324 this.tracker.add( |
| 325 this.getElement(), 'mousedown', this.onMouseDown_.bind(this)); | 325 this.getElement(), 'mousedown', this.onMouseDown_.bind(this)); |
| 326 this.tracker.add( | 326 this.tracker.add( |
| 327 this.getElement(), | 327 this.getElement(), |
| 328 'webkitTransitionEnd', | 328 'transitionend', |
| 329 this.onWebkitTransitionEnd_.bind(this)); | 329 this.onTransitionEnd_.bind(this)); |
| 330 this.tracker.add( | 330 this.tracker.add( |
| 331 this.textbox_, 'input', this.onTextboxInput_.bind(this)); | 331 this.textbox_, 'input', this.onTextboxInput_.bind(this)); |
| 332 this.tracker.add( | 332 this.tracker.add( |
| 333 this.textbox_, 'keydown', this.onTextboxKeyDown_.bind(this)); | 333 this.textbox_, 'keydown', this.onTextboxKeyDown_.bind(this)); |
| 334 this.tracker.add( | 334 this.tracker.add( |
| 335 this.textbox_, 'focus', this.setIsFocused_.bind(this, true)); | 335 this.textbox_, 'focus', this.setIsFocused_.bind(this, true)); |
| 336 this.tracker.add(this.textbox_, 'blur', this.onTexboxBlur_.bind(this)); | 336 this.tracker.add(this.textbox_, 'blur', this.onTexboxBlur_.bind(this)); |
| 337 }, | 337 }, |
| 338 | 338 |
| 339 /** @override */ | 339 /** @override */ |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 new print_preview.Coordinate2d(event.x, event.y); | 376 new print_preview.Coordinate2d(event.x, event.y); |
| 377 this.marginStartPositionInPixels_ = new print_preview.Coordinate2d( | 377 this.marginStartPositionInPixels_ = new print_preview.Coordinate2d( |
| 378 this.getElement().offsetLeft, this.getElement().offsetTop); | 378 this.getElement().offsetLeft, this.getElement().offsetTop); |
| 379 this.setIsInError(false); | 379 this.setIsInError(false); |
| 380 cr.dispatchSimpleEvent(this, MarginControl.EventType.DRAG_START); | 380 cr.dispatchSimpleEvent(this, MarginControl.EventType.DRAG_START); |
| 381 } | 381 } |
| 382 }, | 382 }, |
| 383 | 383 |
| 384 /** | 384 /** |
| 385 * Called when opacity CSS transition ends. | 385 * Called when opacity CSS transition ends. |
| 386 * @param {Event} event The event that triggered this listener. |
| 386 * @private | 387 * @private |
| 387 */ | 388 */ |
| 388 onWebkitTransitionEnd_: function(event) { | 389 onTransitionEnd_: function(event) { |
| 389 if (event.propertyName != 'opacity') | 390 if (event.propertyName != 'opacity') |
| 390 return; | 391 return; |
| 391 var elStyle = window.getComputedStyle(this.getElement()); | 392 var elStyle = window.getComputedStyle(this.getElement()); |
| 392 var disabled = parseInt(elStyle.getPropertyValue('opacity'), 10) == 0; | 393 var disabled = parseInt(elStyle.getPropertyValue('opacity'), 10) == 0; |
| 393 this.textbox_.setAttribute('aria-hidden', disabled); | 394 this.textbox_.setAttribute('aria-hidden', disabled); |
| 394 this.textbox_.disabled = disabled; | 395 this.textbox_.disabled = disabled; |
| 395 }, | 396 }, |
| 396 | 397 |
| 397 /** | 398 /** |
| 398 * Called when textbox content changes. Starts text change timeout. | 399 * Called when textbox content changes. Starts text change timeout. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 this.setIsFocused_(false); | 445 this.setIsFocused_(false); |
| 445 cr.dispatchSimpleEvent(this, MarginControl.EventType.TEXT_CHANGE); | 446 cr.dispatchSimpleEvent(this, MarginControl.EventType.TEXT_CHANGE); |
| 446 } | 447 } |
| 447 }; | 448 }; |
| 448 | 449 |
| 449 // Export | 450 // Export |
| 450 return { | 451 return { |
| 451 MarginControl: MarginControl | 452 MarginControl: MarginControl |
| 452 }; | 453 }; |
| 453 }); | 454 }); |
| OLD | NEW |