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 * Object describing the printable area of a page in the document. |
| 10 * @param {!print_preview.Coordinate2d} origin Top left corner of the |
| 11 * printable area of the document. |
| 12 * @param {!print_preview.Size} size Size of the printable area of the |
| 13 * document. |
| 14 * @constructor |
| 15 */ |
| 16 function PrintableArea(origin, size) { |
| 17 /** |
| 18 * Top left corner of the printable area of the document. |
| 19 * @type {!print_preview.Coordinate2d} |
| 20 * @private |
| 21 */ |
| 22 this.origin_ = origin; |
| 23 |
| 24 /** |
| 25 * Size of the printable area of the document. |
| 26 * @type {!print_preview.Size} |
| 27 * @private |
| 28 */ |
| 29 this.size_ = size; |
| 30 }; |
| 31 |
| 32 PrintableArea.prototype = { |
| 33 /** |
| 34 * @return {!print_preview.Coordinate2d} Top left corner of the printable |
| 35 * area of the document. |
| 36 */ |
| 37 get origin() { |
| 38 return this.origin_; |
| 39 }, |
| 40 |
| 41 /** |
| 42 * @return {!print_preview.Size} Size of the printable area of the document. |
| 43 */ |
| 44 get size() { |
| 45 return this.size_; |
| 46 }, |
| 47 |
| 48 /** |
| 49 * @param {print_preview.PrintableArea} other Other printable area to check |
| 50 * for equality. |
| 51 * @return {boolean} Whether another printable area is equal to this one. |
| 52 */ |
| 53 equals: function(other) { |
| 54 return other != null && |
| 55 this.origin_.equals(other.origin_) && |
| 56 this.size_.equals(other.size_); |
| 57 } |
| 58 }; |
| 59 |
| 60 // Export |
| 61 return { |
| 62 PrintableArea: PrintableArea |
| 63 }; |
| 64 }); |
OLD | NEW |