| 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 * Namespace for utility functions. | 6 * Namespace for utility functions. |
| 7 */ | 7 */ |
| 8 var util = {}; | 8 var util = {}; |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 * }} | 252 * }} |
| 253 */ | 253 */ |
| 254 util.Transform; | 254 util.Transform; |
| 255 | 255 |
| 256 /** | 256 /** |
| 257 * @param {Element} element Element to transform. | 257 * @param {Element} element Element to transform. |
| 258 * @param {util.Transform} transform Transform object, | 258 * @param {util.Transform} transform Transform object, |
| 259 * contains scaleX, scaleY and rotate90 properties. | 259 * contains scaleX, scaleY and rotate90 properties. |
| 260 */ | 260 */ |
| 261 util.applyTransform = function(element, transform) { | 261 util.applyTransform = function(element, transform) { |
| 262 element.style.webkitTransform = | 262 element.style.transform = |
| 263 transform ? 'scaleX(' + transform.scaleX + ') ' + | 263 transform ? 'scaleX(' + transform.scaleX + ') ' + |
| 264 'scaleY(' + transform.scaleY + ') ' + | 264 'scaleY(' + transform.scaleY + ') ' + |
| 265 'rotate(' + transform.rotate90 * 90 + 'deg)' : | 265 'rotate(' + transform.rotate90 * 90 + 'deg)' : |
| 266 ''; | 266 ''; |
| 267 }; | 267 }; |
| 268 | 268 |
| 269 /** | 269 /** |
| 270 * Extracts path from filesystem: URL. | 270 * Extracts path from filesystem: URL. |
| 271 * @param {string} url Filesystem URL. | 271 * @param {string} url Filesystem URL. |
| 272 * @return {?string} The path. | 272 * @return {?string} The path. |
| (...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1099 * @return {!Promise} A promise which can be rejected by timeout. | 1099 * @return {!Promise} A promise which can be rejected by timeout. |
| 1100 */ | 1100 */ |
| 1101 util.timeoutPromise = function(promise, ms, opt_message) { | 1101 util.timeoutPromise = function(promise, ms, opt_message) { |
| 1102 return Promise.race([ | 1102 return Promise.race([ |
| 1103 promise, | 1103 promise, |
| 1104 util.delay(ms).then(function() { | 1104 util.delay(ms).then(function() { |
| 1105 throw new Error(opt_message || 'Operation timed out.'); | 1105 throw new Error(opt_message || 'Operation timed out.'); |
| 1106 }) | 1106 }) |
| 1107 ]); | 1107 ]); |
| 1108 }; | 1108 }; |
| OLD | NEW |