Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(789)

Side by Side Diff: chrome/browser/resources/print_preview/previewarea/margin_control_container.js

Issue 308943002: Reset margin input controls error state when error is cleared. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 * UI component used for setting custom print margins. 9 * UI component used for setting custom print margins.
10 * @param {!print_preview.DocumentInfo} documentInfo Document data model. 10 * @param {!print_preview.DocumentInfo} documentInfo Document data model.
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 * textbox loses focus. 424 * textbox loses focus.
425 * Updates the print ticket store. 425 * Updates the print ticket store.
426 * @param {!print_preview.MarginControl} control Updated control. 426 * @param {!print_preview.MarginControl} control Updated control.
427 * @private 427 * @private
428 */ 428 */
429 onControlTextChange_: function(control) { 429 onControlTextChange_: function(control) {
430 var marginValue = this.parseValueToPts_(control.getTextboxValue()); 430 var marginValue = this.parseValueToPts_(control.getTextboxValue());
431 if (marginValue != null) { 431 if (marginValue != null) {
432 this.customMarginsTicketItem_.updateMargin( 432 this.customMarginsTicketItem_.updateMargin(
433 control.getOrientation(), marginValue); 433 control.getOrientation(), marginValue);
434 // Enable all controls.
435 for (var o in this.controls_) {
436 this.controls_[o].setIsEnabled(true);
437 }
438 control.setIsInError(false);
434 } else { 439 } else {
435 var enableOtherControls; 440 var enableOtherControls;
436 if (!control.getIsFocused()) { 441 if (!control.getIsFocused()) {
437 // If control no longer in focus, revert to previous valid value. 442 // If control no longer in focus, revert to previous valid value.
438 control.setTextboxValue( 443 control.setTextboxValue(
439 this.serializeValueFromPts_(control.getPositionInPts())); 444 this.serializeValueFromPts_(control.getPositionInPts()));
440 control.setIsInError(false); 445 control.setIsInError(false);
441 enableOtherControls = true; 446 enableOtherControls = true;
442 } else { 447 } else {
443 control.setIsInError(true); 448 control.setIsInError(true);
444 enableOtherControls = false; 449 enableOtherControls = false;
445 } 450 }
446 // Enable other controls. 451 // Enable other controls.
447 for (var o in this.controls_) { 452 for (var o in this.controls_) {
448 if (control.getOrientation() != o) { 453 if (control.getOrientation() != o) {
449 this.controls_[o].setIsEnabled(enableOtherControls); 454 this.controls_[o].setIsEnabled(enableOtherControls);
450 } 455 }
451 } 456 }
452 } 457 }
453 } 458 }
454 }; 459 };
455 460
456 // Export 461 // Export
457 return { 462 return {
458 MarginControlContainer: MarginControlContainer 463 MarginControlContainer: MarginControlContainer
459 }; 464 };
460 }); 465 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/print_preview/previewarea/margin_control.js ('k') | chrome/test/data/webui/print_preview.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698