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 * Immutable two-dimensional size. | 9 * Immutable two-dimensional size. |
10 * @param {number} width Width of the size. | 10 * @param {number} width Width of the size. |
11 * @param {number} height Height of the size. | 11 * @param {number} height Height of the size. |
12 * @constructor | 12 * @constructor |
13 */ | 13 */ |
14 function Size(width, height) { | 14 function Size(width, height) { |
15 /** | 15 /** |
16 * Width of the size. | 16 * Width of the size. |
17 * @type {number} | 17 * @type {number} |
18 * @private | 18 * @private |
19 */ | 19 */ |
20 this.width_ = width; | 20 this.width_ = width; |
21 | 21 |
22 /** | 22 /** |
23 * Height of the size. | 23 * Height of the size. |
24 * @type {number} | 24 * @type {number} |
25 * @private | 25 * @private |
26 */ | 26 */ |
27 this.height_ = height; | 27 this.height_ = height; |
28 }; | 28 } |
29 | 29 |
30 Size.prototype = { | 30 Size.prototype = { |
31 /** @return {number} Width of the size. */ | 31 /** @return {number} Width of the size. */ |
32 get width() { | 32 get width() { |
33 return this.width_; | 33 return this.width_; |
34 }, | 34 }, |
35 | 35 |
36 /** @return {number} Height of the size. */ | 36 /** @return {number} Height of the size. */ |
37 get height() { | 37 get height() { |
38 return this.height_; | 38 return this.height_; |
39 }, | 39 }, |
40 | 40 |
41 /** | 41 /** |
42 * @param {print_preview.Size} other Other size object to compare against. | 42 * @param {print_preview.Size} other Other size object to compare against. |
43 * @return {boolean} Whether this size object is equal to another. | 43 * @return {boolean} Whether this size object is equal to another. |
44 */ | 44 */ |
45 equals: function(other) { | 45 equals: function(other) { |
46 return other != null && | 46 return other != null && |
47 this.width_ == other.width_ && | 47 this.width_ == other.width_ && |
48 this.height_ == other.height_; | 48 this.height_ == other.height_; |
49 } | 49 } |
50 }; | 50 }; |
51 | 51 |
52 // Export | 52 // Export |
53 return { | 53 return { |
54 Size: Size | 54 Size: Size |
55 }; | 55 }; |
56 }); | 56 }); |
OLD | NEW |