Chromium Code Reviews| Index: ui/webui/resources/cr_elements/cr_scrollable_behavior.js |
| diff --git a/ui/webui/resources/cr_elements/cr_scrollable_behavior.js b/ui/webui/resources/cr_elements/cr_scrollable_behavior.js |
| index 407fb396a8ac2e85c545f62ad4ce9b437ce16bc2..491ec506cff0049d139387c7614ca9bfc4138f9f 100644 |
| --- a/ui/webui/resources/cr_elements/cr_scrollable_behavior.js |
| +++ b/ui/webui/resources/cr_elements/cr_scrollable_behavior.js |
| @@ -65,23 +65,11 @@ var CrScrollableBehavior = { |
| * containers are resized correctly. |
| */ |
| updateScrollableContents() { |
| - let nodeList = this.root.querySelectorAll('[scrollable] iron-list'); |
| - // Use setTimeout to avoid initial render / sizing issues. |
| - let intervalId = setInterval(function() { |
| - let unreadyNodes = []; |
| - for (let node of nodeList) { |
| - if (node.parentNode.scrollHeight == 0) { |
| - unreadyNodes.push(node); |
| - continue; |
| - } |
| - let ironList = /** @type {!IronListElement} */ (node); |
| - ironList.notifyResize(); |
| - } |
| - if (unreadyNodes.length == 0) |
| - clearInterval(intervalId); |
| - else |
| - nodeList = unreadyNodes; |
| - }, 10); |
| + this.async(function() { |
| + let lists = this.root.querySelectorAll('[scrollable] iron-list'); |
| + for (list of lists) |
| + list.fire('iron-resize'); |
| + }.bind(this)); |
|
stevenjb
2016/10/24 21:35:35
Assuming this works, then sweet, lgtm! See comment
dpapad
2016/10/24 22:24:34
Yes, the bind() call works as expected.
|
| }, |
| /** |