| Index: ui/webui/resources/js/cr/ui/list.js
|
| diff --git a/ui/webui/resources/js/cr/ui/list.js b/ui/webui/resources/js/cr/ui/list.js
|
| index 99196c6a1a37d87cbf73f0a5afdc2d45ce991418..e3015d5fcc71466f47120931c90de02f9d8b4781 100644
|
| --- a/ui/webui/resources/js/cr/ui/list.js
|
| +++ b/ui/webui/resources/js/cr/ui/list.js
|
| @@ -325,6 +325,7 @@ cr.define('cr.ui', function() {
|
| this.addEventListener('blur', this.handleElementBlur_, true);
|
| this.addEventListener('scroll', this.handleScroll.bind(this));
|
| this.setAttribute('role', 'list');
|
| + this.onClientWidthChangedCallback_ = null;
|
|
|
| // Make list focusable
|
| if (!this.hasAttribute('tabindex'))
|
| @@ -1058,6 +1059,13 @@ cr.define('cr.ui', function() {
|
| return height;
|
| },
|
|
|
| + setClientWidthChangedCallback: function(callback) {
|
| + this.onClientWidthChangedCallback_ = callback;
|
| + },
|
| +
|
| + // Memorize the last clientWidth to trigger onClientWidthChanged callback.
|
| + oldClientWidth: -1,
|
| +
|
| /**
|
| * Redraws the viewport.
|
| */
|
| @@ -1072,6 +1080,11 @@ cr.define('cr.ui', function() {
|
| this.lastIndex_ = 0;
|
| this.remainingSpace_ = this.clientHeight != 0;
|
| this.mergeItems(0, 0);
|
| + if (this.clientWidth != this.oldClientWidth &&
|
| + this.onClientWidthChangedCallback_) {
|
| + this.oldClientWidth = this.clientWidth;
|
| + this.onClientWidthChangedCallback_(this.clientWidth);
|
| + }
|
| return;
|
| }
|
|
|
| @@ -1116,6 +1129,11 @@ cr.define('cr.ui', function() {
|
| }
|
|
|
| this.mergeItems(firstIndex, lastIndex);
|
| + if (this.clientWidth != this.oldClientWidth &&
|
| + this.onClientWidthChangedCallback_) {
|
| + this.oldClientWidth = this.clientWidth;
|
| + this.onClientWidthChangedCallback_(this.clientWidth);
|
| + }
|
|
|
| if (!this.pinnedItem_ && this.cachedItems_[leadIndex] &&
|
| this.cachedItems_[leadIndex].parentNode == this) {
|
|
|