Index: chrome/browser/resources/print_preview/data/page_layout.js |
diff --git a/chrome/browser/resources/print_preview/data/page_layout.js b/chrome/browser/resources/print_preview/data/page_layout.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..496bb16be988019ba71ae4273a92aaefb3956a7a |
--- /dev/null |
+++ b/chrome/browser/resources/print_preview/data/page_layout.js |
@@ -0,0 +1,36 @@ |
+// 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'; |
+ |
+ /** |
+ * Class describing the layout of the page. |
+ * |
+ * @constructor |
+ */ |
+ function PageLayout(width, height, left, top, right, bottom) { |
+ this.contentWidth_ = width; |
+ this.contentHeight_ = height; |
+ this.margins_ = new Margins(left, top, right, bottom); |
+ this.margins_.roundToLocaleUnits(); |
+ }; |
+ |
+ PageLayout.prototype = { |
+ /** @return {number} The width of the page. */ |
+ get pageWidth() { |
+ return this.margins_.left + this.margins_.right + this.contentWidth_; |
+ }, |
+ |
+ /** @return {number} The height of the page. */ |
+ get pageHeight() { |
+ return this.margins_.top + this.margins_.bottom + this.contentHeight_; |
+ } |
+ }; |
+ |
+ // Export |
+ return { |
+ PageLayout: PageLayout |
+ }; |
+}); |