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

Side by Side Diff: third_party/WebKit/Source/web/resources/listPicker.js

Issue 1980103002: Include auto vertical scrollbar in intrinsicScrollbarLogicalWidth. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 "use strict"; 1 "use strict";
2 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 2 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be 3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file. 4 // found in the LICENSE file.
5 5
6 var global = { 6 var global = {
7 argumentsReceived: false, 7 argumentsReceived: false,
8 params: null, 8 params: null,
9 picker: null 9 picker: null
10 }; 10 };
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 }, 0); 214 }, 0);
215 event.preventDefault(); 215 event.preventDefault();
216 } 216 }
217 }; 217 };
218 218
219 ListPicker.prototype._fixWindowSize = function() { 219 ListPicker.prototype._fixWindowSize = function() {
220 this._selectElement.style.height = ""; 220 this._selectElement.style.height = "";
221 var zoom = this._config.zoomFactor; 221 var zoom = this._config.zoomFactor;
222 var maxHeight = this._selectElement.offsetHeight * zoom; 222 var maxHeight = this._selectElement.offsetHeight * zoom;
223 var noScrollHeight = (this._calculateScrollHeight() + ListPicker.ListboxSele ctBorder * 2) * zoom; 223 var noScrollHeight = (this._calculateScrollHeight() + ListPicker.ListboxSele ctBorder * 2) * zoom;
224 var scrollbarWidth = getScrollbarWidth() * zoom;
225 var elementOffsetWidth = this._selectElement.offsetWidth * zoom; 224 var elementOffsetWidth = this._selectElement.offsetWidth * zoom;
226 var desiredWindowHeight = noScrollHeight; 225 var desiredWindowHeight = noScrollHeight;
227 var desiredWindowWidth = elementOffsetWidth; 226 var desiredWindowWidth = elementOffsetWidth;
228 var expectingScrollbar = false; 227 var expectingScrollbar = false;
229 if (desiredWindowHeight > maxHeight) { 228 if (desiredWindowHeight > maxHeight) {
230 desiredWindowHeight = maxHeight; 229 desiredWindowHeight = maxHeight;
231 // Setting overflow to auto does not increase width for the scrollbar
232 // so we need to do it manually.
233 desiredWindowWidth += scrollbarWidth;
234 expectingScrollbar = true; 230 expectingScrollbar = true;
235 } 231 }
236 desiredWindowWidth = Math.max(this._config.anchorRectInScreen.width, desired WindowWidth); 232 desiredWindowWidth = Math.max(this._config.anchorRectInScreen.width, desired WindowWidth);
237 var windowRect = adjustWindowRect(desiredWindowWidth, desiredWindowHeight, e lementOffsetWidth, 0); 233 var windowRect = adjustWindowRect(desiredWindowWidth, desiredWindowHeight, e lementOffsetWidth, 0);
238 // If the available screen space is smaller than maxHeight, we will get an u nexpected scrollbar. 234 // If the available screen space is smaller than maxHeight, we will get an u nexpected scrollbar.
239 if (!expectingScrollbar && windowRect.height < noScrollHeight) { 235 if (!expectingScrollbar && windowRect.height < noScrollHeight) {
240 desiredWindowWidth = windowRect.width + scrollbarWidth; 236 desiredWindowWidth = windowRect.width;
241 windowRect = adjustWindowRect(desiredWindowWidth, windowRect.height, win dowRect.width, windowRect.height); 237 windowRect = adjustWindowRect(desiredWindowWidth, windowRect.height, win dowRect.width, windowRect.height);
242 } 238 }
243 this._selectElement.style.width = (windowRect.width / zoom) + "px"; 239 this._selectElement.style.width = (windowRect.width / zoom) + "px";
244 this._selectElement.style.height = (windowRect.height / zoom) + "px"; 240 this._selectElement.style.height = (windowRect.height / zoom) + "px";
245 this._element.style.height = (windowRect.height / zoom) + "px"; 241 this._element.style.height = (windowRect.height / zoom) + "px";
246 setWindowRect(windowRect); 242 setWindowRect(windowRect);
247 }; 243 };
248 244
249 ListPicker.prototype._calculateScrollHeight = function() { 245 ListPicker.prototype._calculateScrollHeight = function() {
250 // Element.scrollHeight returns an integer value but this calculate the 246 // Element.scrollHeight returns an integer value but this calculate the
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 } 442 }
447 this._applyItemStyle(element, config.style); 443 this._applyItemStyle(element, config.style);
448 }; 444 };
449 445
450 if (window.dialogArguments) { 446 if (window.dialogArguments) {
451 initialize(dialogArguments); 447 initialize(dialogArguments);
452 } else { 448 } else {
453 window.addEventListener("message", handleMessage, false); 449 window.addEventListener("message", handleMessage, false);
454 window.setTimeout(handleArgumentsTimeout, 1000); 450 window.setTimeout(handleArgumentsTimeout, 1000);
455 } 451 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698