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