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 * Creates a Margins object that holds four margin values in points. | |
10 * @param {number} top The top margin in pts. | |
11 * @param {number} right The right margin in pts. | |
12 * @param {number} bottom The bottom margin in pts. | |
13 * @param {number} left The left margin in pts. | |
14 * @constructor | |
15 */ | |
16 function Margins(top, right, bottom, left) { | |
17 this.top_ = top; | |
18 this.right_ = right; | |
19 this.bottom_ = bottom; | |
20 this.left_ = left; | |
21 }; | |
22 | |
23 /** | |
24 * Enumeration of margin types. Matches enum MarginType in | |
25 * printing/print_job_constants.h. | |
26 * @enum {number} | |
27 */ | |
28 Margins.Type = { | |
29 DEFAULT: 0, | |
30 NO_MARGINS: 1, | |
31 MINIMUM: 2, | |
32 CUSTOM: 3 | |
33 }, | |
34 | |
35 Margins.prototype = { | |
36 get top() { | |
37 return this.top_; | |
38 }, | |
39 | |
40 get right() { | |
41 return this.right_; | |
42 }, | |
43 | |
44 get bottom() { | |
45 return this.bottom_; | |
46 }, | |
47 | |
48 get left() { | |
49 return this.left_; | |
50 }, | |
51 | |
52 /** | |
53 * Checks if this margins object is equivalent to another. | |
54 * @param {print_preview.Margins} other The other margins object to compare | |
55 * against. | |
56 * @return {boolean} Whether this margins object is equivalent to another. | |
dpapad1
2012/04/19 22:45:01
Nit: s/equivalent/equal
Robert Toscano
2012/04/23 23:00:09
Done.
| |
57 */ | |
58 equals: function(other) { | |
59 return other != null && | |
60 this.top_ == other.top_ && | |
61 this.right_ == other.right_ && | |
62 this.bottom_ == other.bottom_ && | |
63 this.left_ == other.left_; | |
64 } | |
65 }; | |
66 | |
67 // Export | |
68 return { | |
69 Margins: Margins | |
70 }; | |
71 }); | |
OLD | NEW |