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

Side by Side Diff: chrome/browser/resources/print_preview/data/ticket_items/custom_margins.js

Issue 10909124: Improves application state persistance. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Updates unit tests. Created 8 years, 3 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
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.ticket_items', function() { 5 cr.define('print_preview.ticket_items', function() {
6 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * Custom page margins ticket item whose value is a 9 * Custom page margins ticket item whose value is a
10 * {@code print_preview.Margins}. 10 * {@code print_preview.Margins}.
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 * @return {number} Maximum value in points of the specified margin. 95 * @return {number} Maximum value in points of the specified margin.
96 */ 96 */
97 getMarginMax: function(orientation) { 97 getMarginMax: function(orientation) {
98 var oppositeOrient = CustomMargins.OppositeOrientation_[orientation]; 98 var oppositeOrient = CustomMargins.OppositeOrientation_[orientation];
99 var margins = /** @type {!print_preview.Margins} */ (this.getValue()); 99 var margins = /** @type {!print_preview.Margins} */ (this.getValue());
100 return this.getMarginMax_(orientation, margins.get(oppositeOrient)); 100 return this.getMarginMax_(orientation, margins.get(oppositeOrient));
101 }, 101 },
102 102
103 /** @override */ 103 /** @override */
104 updateValue: function(value) { 104 updateValue: function(value) {
105 var margins = /** @type {!InputMargins} */ (value); 105 var margins = /** @type {!print_preview.Margins} */ (value);
106 if (margins != null) { 106 if (margins != null) {
107 margins = new print_preview.Margins( 107 margins = new print_preview.Margins(
108 Math.round(margins.get(CustomMargins.Orientation.TOP)), 108 Math.round(margins.get(CustomMargins.Orientation.TOP)),
109 Math.round(margins.get(CustomMargins.Orientation.RIGHT)), 109 Math.round(margins.get(CustomMargins.Orientation.RIGHT)),
110 Math.round(margins.get(CustomMargins.Orientation.BOTTOM)), 110 Math.round(margins.get(CustomMargins.Orientation.BOTTOM)),
111 Math.round(margins.get(CustomMargins.Orientation.LEFT))); 111 Math.round(margins.get(CustomMargins.Orientation.LEFT)));
112 } 112 }
113 print_preview.ticket_items.TicketItem.prototype.updateValue.call( 113 print_preview.ticket_items.TicketItem.prototype.updateValue.call(
114 this, margins); 114 this, margins);
115 }, 115 },
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 } 162 }
163 return Math.round(max); 163 return Math.round(max);
164 } 164 }
165 }; 165 };
166 166
167 // Export 167 // Export
168 return { 168 return {
169 CustomMargins: CustomMargins 169 CustomMargins: CustomMargins
170 }; 170 };
171 }); 171 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/print_preview/data/print_ticket_store.js ('k') | chrome/browser/resources/print_preview/metrics.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698