| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 cr.define('print_preview', function() { | 5 cr.define('print_preview', function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Interface to the Chromium print preview generator. | 9 * Interface to the Chromium print preview generator. |
| 10 * @param {!print_preview.DestinationStore} destinationStore Used to get the | 10 * @param {!print_preview.DestinationStore} destinationStore Used to get the |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 var size = new print_preview.Size( | 320 var size = new print_preview.Size( |
| 321 event.pageLayout.printableAreaWidth, | 321 event.pageLayout.printableAreaWidth, |
| 322 event.pageLayout.printableAreaHeight); | 322 event.pageLayout.printableAreaHeight); |
| 323 | 323 |
| 324 var margins = new print_preview.Margins( | 324 var margins = new print_preview.Margins( |
| 325 Math.round(event.pageLayout.marginTop), | 325 Math.round(event.pageLayout.marginTop), |
| 326 Math.round(event.pageLayout.marginRight), | 326 Math.round(event.pageLayout.marginRight), |
| 327 Math.round(event.pageLayout.marginBottom), | 327 Math.round(event.pageLayout.marginBottom), |
| 328 Math.round(event.pageLayout.marginLeft)); | 328 Math.round(event.pageLayout.marginLeft)); |
| 329 | 329 |
| 330 var o = print_preview.ticket_items.CustomMargins.Orientation; | 330 var o = print_preview.ticket_items.CustomMarginsOrientation; |
| 331 var pageSize = new print_preview.Size( | 331 var pageSize = new print_preview.Size( |
| 332 event.pageLayout.contentWidth + | 332 event.pageLayout.contentWidth + |
| 333 margins.get(o.LEFT) + margins.get(o.RIGHT), | 333 margins.get(o.LEFT) + margins.get(o.RIGHT), |
| 334 event.pageLayout.contentHeight + | 334 event.pageLayout.contentHeight + |
| 335 margins.get(o.TOP) + margins.get(o.BOTTOM)); | 335 margins.get(o.TOP) + margins.get(o.BOTTOM)); |
| 336 | 336 |
| 337 this.documentInfo_.updatePageInfo( | 337 this.documentInfo_.updatePageInfo( |
| 338 new print_preview.PrintableArea(origin, size), | 338 new print_preview.PrintableArea(origin, size), |
| 339 pageSize, | 339 pageSize, |
| 340 event.hasCustomPageSizeStyle, | 340 event.hasCustomPageSizeStyle, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 // current one. | 404 // current one. |
| 405 cr.dispatchSimpleEvent(this, PreviewGenerator.EventType.FAIL); | 405 cr.dispatchSimpleEvent(this, PreviewGenerator.EventType.FAIL); |
| 406 } | 406 } |
| 407 }; | 407 }; |
| 408 | 408 |
| 409 // Export | 409 // Export |
| 410 return { | 410 return { |
| 411 PreviewGenerator: PreviewGenerator | 411 PreviewGenerator: PreviewGenerator |
| 412 }; | 412 }; |
| 413 }); | 413 }); |
| OLD | NEW |