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

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

Issue 10450022: Print Preview Print Destination Search Widget (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Set --bary flag Created 8 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
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 * Creates a Margins object that holds four margin values in points. 9 * Creates a Margins object that holds four margin values in points.
10 * @param {number} top The top margin in pts. 10 * @param {number} top The top margin in pts.
11 * @param {number} right The right margin in pts. 11 * @param {number} right The right margin in pts.
12 * @param {number} bottom The bottom margin in pts. 12 * @param {number} bottom The bottom margin in pts.
13 * @param {number} left The left margin in pts. 13 * @param {number} left The left margin in pts.
14 * @constructor 14 * @constructor
15 */ 15 */
16 function Margins(top, right, bottom, left) { 16 function Margins(top, right, bottom, left) {
17 /** 17 /**
18 * Backing store for the margin values in points. 18 * Backing store for the margin values in points.
19 * @type {Object.< 19 * @type {!Object.<
20 * print_preview.ticket_items.CustomMargins.Orientation, 20 * !print_preview.ticket_items.CustomMargins.Orientation, number>}
21 * number>}
22 * @private 21 * @private
23 */ 22 */
24 this.value_ = {}; 23 this.value_ = {};
25 this.value_[print_preview.ticket_items.CustomMargins.Orientation.TOP] = top; 24 this.value_[print_preview.ticket_items.CustomMargins.Orientation.TOP] = top;
26 this.value_[print_preview.ticket_items.CustomMargins.Orientation.RIGHT] = 25 this.value_[print_preview.ticket_items.CustomMargins.Orientation.RIGHT] =
27 right; 26 right;
28 this.value_[print_preview.ticket_items.CustomMargins.Orientation.BOTTOM] = 27 this.value_[print_preview.ticket_items.CustomMargins.Orientation.BOTTOM] =
29 bottom; 28 bottom;
30 this.value_[print_preview.ticket_items.CustomMargins.Orientation.LEFT] = 29 this.value_[print_preview.ticket_items.CustomMargins.Orientation.LEFT] =
31 left; 30 left;
32 }; 31 };
33 32
34 Margins.prototype = { 33 Margins.prototype = {
35 /** 34 /**
36 * @param {print_preview.ticket_items.CustomMargins.Orientation} orientation 35 * @param {!print_preview.ticket_items.CustomMargins.Orientation}
37 * Specifies the margin value to get. 36 * orientation Specifies the margin value to get.
38 * @return {number} Value of the margin of the given orientation. 37 * @return {number} Value of the margin of the given orientation.
39 */ 38 */
40 get: function(orientation) { 39 get: function(orientation) {
41 return this.value_[orientation]; 40 return this.value_[orientation];
42 }, 41 },
43 42
44 /** 43 /**
45 * @param {print_preview.ticket_items.CustomMargins.Orientation} orientation 44 * @param {!print_preview.ticket_items.CustomMargins.Orientation}
46 * Specifies the margin to set. 45 * orientation Specifies the margin to set.
47 * @param {number} value Updated value of the margin in points to modify. 46 * @param {number} value Updated value of the margin in points to modify.
48 * @return {!print_preview.Margins} A new copy of |this| with the 47 * @return {!print_preview.Margins} A new copy of |this| with the
49 * modification made to the specified margin. 48 * modification made to the specified margin.
50 */ 49 */
51 set: function(orientation, value) { 50 set: function(orientation, value) {
52 var newValue = {}; 51 var newValue = {};
53 for (var o in this.value_) { 52 for (var o in this.value_) {
54 newValue[o] = this.value_[o]; 53 newValue[o] = this.value_[o];
55 } 54 }
56 newValue[orientation] = value; 55 newValue[orientation] = value;
(...skipping 20 matching lines...) Expand all
77 } 76 }
78 return true; 77 return true;
79 } 78 }
80 }; 79 };
81 80
82 // Export 81 // Export
83 return { 82 return {
84 Margins: Margins 83 Margins: Margins
85 }; 84 };
86 }); 85 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698