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 * Class describing the layout of the page. |
| 10 * |
| 11 * @constructor |
| 12 */ |
| 13 function PageLayout(width, height, left, top, right, bottom) { |
| 14 this.contentWidth_ = width; |
| 15 this.contentHeight_ = height; |
| 16 this.margins_ = new Margins(left, top, right, bottom); |
| 17 this.margins_.roundToLocaleUnits(); |
| 18 }; |
| 19 |
| 20 PageLayout.prototype = { |
| 21 /** @return {number} The width of the page. */ |
| 22 get pageWidth() { |
| 23 return this.margins_.left + this.margins_.right + this.contentWidth_; |
| 24 }, |
| 25 |
| 26 /** @return {number} The height of the page. */ |
| 27 get pageHeight() { |
| 28 return this.margins_.top + this.margins_.bottom + this.contentHeight_; |
| 29 } |
| 30 }; |
| 31 |
| 32 // Export |
| 33 return { |
| 34 PageLayout: PageLayout |
| 35 }; |
| 36 }); |
OLD | NEW |