| 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 * Component that displays a list of destinations with a heading, action link, | 9 * Component that displays a list of destinations with a heading, action link, |
| 10 * and "Show All..." button. An event is dispatched when the action link is | 10 * and "Show All..." button. An event is dispatched when the action link is |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 /** | 121 /** |
| 122 * Gets estimated height of the destination list for the given number of | 122 * Gets estimated height of the destination list for the given number of |
| 123 * items. | 123 * items. |
| 124 * @param {number} Number of items to render in the destination list. | 124 * @param {number} Number of items to render in the destination list. |
| 125 * @return {number} Height (in pixels) of the destination list. | 125 * @return {number} Height (in pixels) of the destination list. |
| 126 */ | 126 */ |
| 127 getEstimatedHeightInPixels: function(numItems) { | 127 getEstimatedHeightInPixels: function(numItems) { |
| 128 numItems = Math.min(numItems, this.destinations_.length); | 128 numItems = Math.min(numItems, this.destinations_.length); |
| 129 var headerHeight = | 129 var headerHeight = |
| 130 this.getChildElement('.destination-list > header').offsetHeight; | 130 this.getChildElement('.destination-list > header').offsetHeight; |
| 131 var throbberHeight = | 131 return headerHeight + numItems * DestinationList.HEIGHT_OF_ITEM_; |
| 132 getIsVisible(this.getChildElement('.throbber-container')) ? | |
| 133 DestinationList.HEIGHT_OF_ITEM_ : 0; | |
| 134 return headerHeight + numItems * DestinationList.HEIGHT_OF_ITEM_ + | |
| 135 throbberHeight; | |
| 136 }, | 132 }, |
| 137 | 133 |
| 138 /** @param {boolean} isVisible Whether the throbber is visible. */ | 134 /** @param {boolean} isVisible Whether the throbber is visible. */ |
| 139 setIsThrobberVisible: function(isVisible) { | 135 setIsThrobberVisible: function(isVisible) { |
| 140 setIsVisible(this.getChildElement('.throbber-container'), isVisible); | 136 setIsVisible(this.getChildElement('.throbber-container'), isVisible); |
| 141 }, | 137 }, |
| 142 | 138 |
| 143 /** | 139 /** |
| 144 * @param {number} size Size of list when destination list is in collapsed | 140 * @param {number} size Size of list when destination list is in collapsed |
| 145 * mode (a.k.a non-show-all mode). | 141 * mode (a.k.a non-show-all mode). |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 cr.dispatchSimpleEvent(this, | 268 cr.dispatchSimpleEvent(this, |
| 273 DestinationList.EventType.ACTION_LINK_ACTIVATED); | 269 DestinationList.EventType.ACTION_LINK_ACTIVATED); |
| 274 } | 270 } |
| 275 }; | 271 }; |
| 276 | 272 |
| 277 // Export | 273 // Export |
| 278 return { | 274 return { |
| 279 DestinationList: DestinationList | 275 DestinationList: DestinationList |
| 280 }; | 276 }; |
| 281 }); | 277 }); |
| OLD | NEW |