diff options
author | arv@chromium.org <arv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-13 21:10:22 +0000 |
---|---|---|
committer | arv@chromium.org <arv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-13 21:10:22 +0000 |
commit | 56b6828771d7bfac966ab6a64328ef3f8161f7cc (patch) | |
tree | 115619e88d1d19169b417c45dfa46277a8474398 /chrome/browser/resources | |
parent | 338216a5881f864ed4ef9d9e672baa5fd58bba4a (diff) | |
download | chromium_src-56b6828771d7bfac966ab6a64328ef3f8161f7cc.zip chromium_src-56b6828771d7bfac966ab6a64328ef3f8161f7cc.tar.gz chromium_src-56b6828771d7bfac966ab6a64328ef3f8161f7cc.tar.bz2 |
Bookmark manager: Workaround for invalid flex box layout which caused the width to be incorrect.
BUG=40902
TEST=Switch between two folders. One that has enough items to show a scrollbar and one that does not show
Review URL: http://codereview.chromium.org/1549040
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44395 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/resources')
-rw-r--r-- | chrome/browser/resources/bookmark_manager/js/bmm/bookmarklist.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/chrome/browser/resources/bookmark_manager/js/bmm/bookmarklist.js b/chrome/browser/resources/bookmark_manager/js/bmm/bookmarklist.js index 68c7135..db884b0 100644 --- a/chrome/browser/resources/bookmark_manager/js/bmm/bookmarklist.js +++ b/chrome/browser/resources/bookmark_manager/js/bmm/bookmarklist.js @@ -89,6 +89,8 @@ cr.define('bmm', function() { } finally { this.finishBatchAdd(); } + + fixListWidth(this); cr.dispatchSimpleEvent(this, 'load'); }, @@ -417,6 +419,25 @@ cr.define('bmm', function() { return div; })(); + + /** + * Workaround for http://crbug.com/40902 + * @param {!HTMLElement} list The element to fix the width for. + */ + function fixListWidth(list) { + // The width of the list is wrong after its content has changed. Fortunately + // the reported offsetWidth is correct so we can detect the incorrect width. + if (list.offsetWidth != list.parentNode.clientWidth - list.offsetLeft) { + // Set the width to the correct size. This causes the relayout. + list.style.width = list.parentNode.clientWidth - list.offsetLeft + 'px'; + // Remove the temporary style.width in a timeout. Once the timer fires the + // size should not change since we already fixed the width. + window.setTimeout(function() { + list.style.width = ''; + }, 0); + } + } + return { createListItem: createListItem, BookmarkList: BookmarkList, |