| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 'strict'; | 6 'strict'; |
| 7 | 7 |
| 8 function MarginsUI() { | 8 function MarginsUI() { |
| 9 var marginsUI = document.createElement('div'); | 9 var marginsUI = document.createElement('div'); |
| 10 marginsUI.__proto__ = MarginsUI.prototype; | 10 marginsUI.__proto__ = MarginsUI.prototype; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 draw: function() { | 100 draw: function() { |
| 101 this.applyClippingMask_(); | 101 this.applyClippingMask_(); |
| 102 this.pairsAsList.forEach(function(pair) { pair.draw(); }); | 102 this.pairsAsList.forEach(function(pair) { pair.draw(); }); |
| 103 }, | 103 }, |
| 104 | 104 |
| 105 /** | 105 /** |
| 106 * Shows the margins UI. | 106 * Shows the margins UI. |
| 107 */ | 107 */ |
| 108 show: function() { | 108 show: function() { |
| 109 this.hidden = false; | 109 this.hidden = false; |
| 110 this.classList.remove('invisible'); |
| 110 }, | 111 }, |
| 111 | 112 |
| 112 /** | 113 /** |
| 113 * Hides the margins UI. | 114 * Hides the margins UI and removes from the rendering flow if requested. |
| 115 * @param {boolean} removeFromFlow True if |this| should also be removed |
| 116 * from the rendering flow (in order to not interfere with the tab |
| 117 * order). |
| 114 */ | 118 */ |
| 115 hide: function() { | 119 hide: function(removeFromFlow) { |
| 116 this.hidden = true; | 120 removeFromFlow ? this.hidden = true : this.classList.add('invisible'); |
| 117 }, | 121 }, |
| 118 | 122 |
| 119 /** | 123 /** |
| 120 * Applies a clipping mask on |this| so that it does not paint on top of the | 124 * Applies a clipping mask on |this| so that it does not paint on top of the |
| 121 * scrollbars (if any). | 125 * scrollbars (if any). |
| 122 */ | 126 */ |
| 123 applyClippingMask_: function() { | 127 applyClippingMask_: function() { |
| 124 var bottom = previewArea.height; | 128 var bottom = previewArea.height; |
| 125 var right = previewArea.width; | 129 var right = previewArea.width; |
| 126 this.style.clip = "rect(0, " + right + "px, " + bottom + "px, 0)"; | 130 this.style.clip = "rect(0, " + right + "px, " + bottom + "px, 0)"; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 this.lastClickedMarginsUIPair.getDragDisplacementFrom(point); | 196 this.lastClickedMarginsUIPair.getDragDisplacementFrom(point); |
| 193 dragEvent.destinationPoint = point; | 197 dragEvent.destinationPoint = point; |
| 194 this.dispatchEvent(dragEvent); | 198 this.dispatchEvent(dragEvent); |
| 195 }, | 199 }, |
| 196 }; | 200 }; |
| 197 | 201 |
| 198 return { | 202 return { |
| 199 MarginsUI: MarginsUI | 203 MarginsUI: MarginsUI |
| 200 }; | 204 }; |
| 201 }); | 205 }); |
| OLD | NEW |