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

Unified Diff: chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js

Issue 1996233002: [Media Router WebUI] Update element positioning after delayed imports. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js
diff --git a/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js b/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js
index 10655d7d85da075900929b6b2f0de33568841572..9b59b408a72772f03ae2aa15e59b6bd79877ee1c 100644
--- a/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js
+++ b/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js
@@ -417,15 +417,25 @@ Polymer({
Polymer.RenderStatus.afterNextRender(this, function() {
// Import the elements that aren't needed at startup. This reduces
- // initial load time.
- this.importHref(this.resolveUrl(
- 'chrome://resources/polymer/v1_0/neon-animation/' +
- 'web-animations.html'));
+ // initial load time. Delayed loading interferes with getting the
+ // offsetHeight of the first-run-flow element in updateElementPositioning_
+ // though, so we also make sure it is called after the last load.
+ var that = this;
+ var loadsRemaining = 3;
+ var onload = function() {
+ loadsRemaining--;
+ if (loadsRemaining > 0) {
+ return;
+ }
+ that.updateElementPositioning_();
+ };
+ this.importHref('chrome://resources/polymer/v1_0/neon-animation/' +
+ 'web-animations.html', onload);
this.importHref(this.resolveUrl(
- '../issue_banner/issue_banner.html'));
+ '../issue_banner/issue_banner.html'), onload);
this.importHref(this.resolveUrl(
'../media_router_search_highlighter/' +
- 'media_router_search_highlighter.html'));
+ 'media_router_search_highlighter.html'), onload);
// If this is not on a Mac platform, remove the placeholder. See
// onFocus_() for more details. ready() is only called once, so no need
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698