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

Unified Diff: Source/web/resources/listPicker.js

Issue 1075073004: New SELECT Popup: Fix window width to include scrollbar width (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 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 | « LayoutTests/fast/forms/select/popup-menu-appearance-long.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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";
« no previous file with comments | « LayoutTests/fast/forms/select/popup-menu-appearance-long.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698