| 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 /** | 5 /** |
| 6 * Sets the width (in pixels) on a DOM node. | 6 * Sets the width (in pixels) on a DOM node. |
| 7 * @param {!HtmlNode} node The node whose width is being set. | 7 * @param {!HtmlNode} node The node whose width is being set. |
| 8 * @param {number} widthPx The width in pixels. | 8 * @param {number} widthPx The width in pixels. |
| 9 */ | 9 */ |
| 10 function setNodeWidth(node, widthPx) { | 10 function setNodeWidth(node, widthPx) { |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 return copy; | 157 return copy; |
| 158 } | 158 } |
| 159 | 159 |
| 160 /** | 160 /** |
| 161 * Helper to make sure singleton classes are not instantiated more than once. | 161 * Helper to make sure singleton classes are not instantiated more than once. |
| 162 * @param {Function} ctor The constructor function being checked. | 162 * @param {Function} ctor The constructor function being checked. |
| 163 */ | 163 */ |
| 164 function assertFirstConstructorCall(ctor) { | 164 function assertFirstConstructorCall(ctor) { |
| 165 // This is the variable which is set by cr.addSingletonGetter(). | 165 // This is the variable which is set by cr.addSingletonGetter(). |
| 166 if (ctor.hasCreateFirstInstance_) { | 166 if (ctor.hasCreateFirstInstance_) { |
| 167 throw Error('The class ' + ctor.name + ' is a singleton, and should ' + | 167 throw Error( |
| 168 'only be accessed using ' + ctor.name + '.getInstance().'); | 168 'The class ' + ctor.name + ' is a singleton, and should ' + |
| 169 'only be accessed using ' + ctor.name + '.getInstance().'); |
| 169 } | 170 } |
| 170 ctor.hasCreateFirstInstance_ = true; | 171 ctor.hasCreateFirstInstance_ = true; |
| 171 } | 172 } |
| 172 | 173 |
| 173 function hasTouchScreen() { | 174 function hasTouchScreen() { |
| 174 return 'ontouchstart' in window; | 175 return 'ontouchstart' in window; |
| 175 } | 176 } |
| OLD | NEW |