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