Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: ui/login/resource_loader.js

Issue 2027683003: Pin keyboard moved to under the user profile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Added a comment. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/login/account_picker/user_pod_template.html ('k') | ui/login/screen_container.css » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 * @fileoverview Deferred resource loader for OOBE/Login screens. 6 * @fileoverview Deferred resource loader for OOBE/Login screens.
7 */ 7 */
8 8
9 cr.define('cr.ui.login.ResourceLoader', function() { 9 cr.define('cr.ui.login.ResourceLoader', function() {
10 'use strict'; 10 'use strict';
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 } else { 206 } else {
207 // DOMContentLoaded has already been called if document.readyState is 207 // DOMContentLoaded has already been called if document.readyState is
208 // 'interactive' or 'complete', so invoke the callback immediately. 208 // 'interactive' or 'complete', so invoke the callback immediately.
209 loadOnIdle(); 209 loadOnIdle();
210 } 210 }
211 } 211 }
212 212
213 /** 213 /**
214 * Wait until the element with the given |id| has finished its layout, 214 * Wait until the element with the given |id| has finished its layout,
215 * specifically, after it has an offsetHeight > 0. 215 * specifically, after it has an offsetHeight > 0.
216 * @param {string} id Identifier of the element to wait for. 216 * @param {string|function()} selector Identifier of the element to wait
217 * or a callback function to obtain element to wait for.
217 * @param {function()} callback Function to invoke when done loading. 218 * @param {function()} callback Function to invoke when done loading.
218 */ 219 */
219 function waitUntilLayoutComplete(id, callback) { 220 function waitUntilLayoutComplete(selector, callback) {
221 if (typeof selector == 'string') {
222 var id = selector;
223 selector = function() { return $(id) };
224 }
225
220 var doWait = function() { 226 var doWait = function() {
221 var element = $(id); 227 var element = selector();
228
222 if (!element || !element.offsetHeight) { 229 if (!element || !element.offsetHeight) {
223 requestAnimationFrame(doWait); 230 requestAnimationFrame(doWait);
224 return; 231 return;
225 } 232 }
226 233
227 callback(element); 234 callback(element);
228 }; 235 };
229 236
230 requestAnimationFrame(doWait); 237 requestAnimationFrame(doWait);
231 } 238 }
232 239
233 return { 240 return {
234 alreadyLoadedAssets: alreadyLoadedAssets, 241 alreadyLoadedAssets: alreadyLoadedAssets,
235 hasDeferredAssets: hasDeferredAssets, 242 hasDeferredAssets: hasDeferredAssets,
236 loadAssets: loadAssets, 243 loadAssets: loadAssets,
237 loadAssetsOnIdle: loadAssetsOnIdle, 244 loadAssetsOnIdle: loadAssetsOnIdle,
238 waitUntilLayoutComplete: waitUntilLayoutComplete, 245 waitUntilLayoutComplete: waitUntilLayoutComplete,
239 registerAssets: registerAssets 246 registerAssets: registerAssets
240 }; 247 };
241 }); 248 });
OLDNEW
« no previous file with comments | « ui/login/account_picker/user_pod_template.html ('k') | ui/login/screen_container.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698