| 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 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Creates a Margins object that holds four margin values. The units in which | 9 * Creates a Margins object that holds four margin values. The units in which |
| 10 * the values are expressed can be any numeric value. | 10 * the values are expressed can be any numeric value. |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 172 |
| 173 /** | 173 /** |
| 174 * @return {number} The value of the selected margin option. | 174 * @return {number} The value of the selected margin option. |
| 175 * @private | 175 * @private |
| 176 */ | 176 */ |
| 177 get selectedMarginsValue_() { | 177 get selectedMarginsValue_() { |
| 178 return this.marginList_.options[this.marginList_.selectedIndex].value; | 178 return this.marginList_.options[this.marginList_.selectedIndex].value; |
| 179 }, | 179 }, |
| 180 | 180 |
| 181 /** | 181 /** |
| 182 * Gets the string representation of the margin type selected. |
| 183 * |
| 184 * @return {string} |
| 185 */ |
| 186 get selectedMarginsAsString() { |
| 187 if (this.isNoMarginsSelected()) |
| 188 return "noMargins"; |
| 189 else if (this.isCustomMarginsSelected()) |
| 190 return "customMargins"; |
| 191 else |
| 192 return "defaultMargins"; |
| 193 }, |
| 194 |
| 195 /** |
| 182 * @return {boolean} True if default margins are selected. | 196 * @return {boolean} True if default margins are selected. |
| 183 */ | 197 */ |
| 184 isDefaultMarginsSelected: function() { | 198 isDefaultMarginsSelected: function() { |
| 185 return this.selectedMarginsValue_ == MarginSettings.MARGINS_VALUE_DEFAULT; | 199 return this.selectedMarginsValue_ == MarginSettings.MARGINS_VALUE_DEFAULT; |
| 186 }, | 200 }, |
| 187 | 201 |
| 188 /** | 202 /** |
| 189 * @return {boolean} True if no margins are selected. | 203 * @return {boolean} True if no margins are selected. |
| 190 */ | 204 */ |
| 191 isNoMarginsSelected: function() { | 205 isNoMarginsSelected: function() { |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 if (!previewModifiable) | 480 if (!previewModifiable) |
| 467 fadeOutElement(this.marginsOption_); | 481 fadeOutElement(this.marginsOption_); |
| 468 } | 482 } |
| 469 }; | 483 }; |
| 470 | 484 |
| 471 return { | 485 return { |
| 472 MarginSettings: MarginSettings, | 486 MarginSettings: MarginSettings, |
| 473 PageLayout: PageLayout, | 487 PageLayout: PageLayout, |
| 474 }; | 488 }; |
| 475 }); | 489 }); |
| OLD | NEW |