Chromium Code Reviews| Index: Source/web/resources/listPicker.js |
| diff --git a/Source/web/resources/listPicker.js b/Source/web/resources/listPicker.js |
| index dfe5bb835304c9f2a1b98f0e2a104767e6a59431..e64269950bc10e8d0ef4456e2a449359a1a086b8 100644 |
| --- a/Source/web/resources/listPicker.js |
| +++ b/Source/web/resources/listPicker.js |
| @@ -178,11 +178,21 @@ ListPicker.prototype._fixWindowSize = function() { |
| var maxHeight = this._selectElement.offsetHeight; |
| this._selectElement.style.height = "0"; |
| var heightOutsideOfContent = this._selectElement.offsetHeight - this._selectElement.clientHeight; |
| - var desiredWindowHeight = Math.round(this._calculateScrollHeight() + heightOutsideOfContent); |
| - if (desiredWindowHeight > maxHeight) |
| + var noScrollHeight = Math.round(this._calculateScrollHeight() + heightOutsideOfContent); |
| + var desiredWindowHeight = noScrollHeight; |
| + var desiredWindowWidth = this._selectElement.offsetWidth; |
| + var expectingScrollbar = false; |
| + if (desiredWindowHeight > maxHeight) { |
| desiredWindowHeight = maxHeight; |
| - var desiredWindowWidth = Math.max(this._config.anchorRectInScreen.width, this._selectElement.offsetWidth); |
| + desiredWindowWidth += getScrollbarWidth(); |
| + expectingScrollbar = true; |
| + } |
| + desiredWindowWidth = Math.max(this._config.anchorRectInScreen.width, desiredWindowWidth); |
| var windowRect = adjustWindowRect(desiredWindowWidth, desiredWindowHeight, this._selectElement.offsetWidth, 0); |
| + if (!expectingScrollbar && windowRect.height < noScrollHeight) { |
|
tkent
2015/04/13 04:34:16
Can you add a test for this condition?
If it's har
keishi
2015/04/13 04:38:46
Done. LayoutTests/fast/forms/select/popup-menu-app
|
| + desiredWindowWidth = windowRect.width + getScrollbarWidth(); |
| + windowRect = adjustWindowRect(windowRect.width + getScrollbarWidth(), windowRect.height, desiredWindowWidth, windowRect.height); |
| + } |
| this._selectElement.style.width = windowRect.width + "px"; |
| this._selectElement.style.height = windowRect.height + "px"; |
| this._element.style.height = windowRect.height + "px"; |