| Index: chrome/browser/resources/print_preview/data/margins.js
|
| diff --git a/chrome/browser/resources/print_preview/data/margins.js b/chrome/browser/resources/print_preview/data/margins.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..f221f2d6113b5c95c0ae8467c5c9552c6ff1f779
|
| --- /dev/null
|
| +++ b/chrome/browser/resources/print_preview/data/margins.js
|
| @@ -0,0 +1,71 @@
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +cr.define('print_preview', function() {
|
| + 'use strict';
|
| +
|
| + /**
|
| + * Creates a Margins object that holds four margin values in points.
|
| + * @param {number} top The top margin in pts.
|
| + * @param {number} right The right margin in pts.
|
| + * @param {number} bottom The bottom margin in pts.
|
| + * @param {number} left The left margin in pts.
|
| + * @constructor
|
| + */
|
| + function Margins(top, right, bottom, left) {
|
| + this.top_ = top;
|
| + this.right_ = right;
|
| + this.bottom_ = bottom;
|
| + this.left_ = left;
|
| + };
|
| +
|
| + /**
|
| + * Enumeration of margin types. Matches enum MarginType in
|
| + * printing/print_job_constants.h.
|
| + * @enum {number}
|
| + */
|
| + Margins.Type = {
|
| + DEFAULT: 0,
|
| + NO_MARGINS: 1,
|
| + MINIMUM: 2,
|
| + CUSTOM: 3
|
| + },
|
| +
|
| + Margins.prototype = {
|
| + get top() {
|
| + return this.top_;
|
| + },
|
| +
|
| + get right() {
|
| + return this.right_;
|
| + },
|
| +
|
| + get bottom() {
|
| + return this.bottom_;
|
| + },
|
| +
|
| + get left() {
|
| + return this.left_;
|
| + },
|
| +
|
| + /**
|
| + * Checks if this margins object is equivalent to another.
|
| + * @param {print_preview.Margins} other The other margins object to compare
|
| + * against.
|
| + * @return {boolean} Whether this margins object is equivalent to another.
|
| + */
|
| + equals: function(other) {
|
| + return other != null &&
|
| + this.top_ == other.top_ &&
|
| + this.right_ == other.right_ &&
|
| + this.bottom_ == other.bottom_ &&
|
| + this.left_ == other.left_;
|
| + }
|
| + };
|
| +
|
| + // Export
|
| + return {
|
| + Margins: Margins
|
| + };
|
| +});
|
|
|