OLD | NEW |
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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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; | 224 var scrollbarWidth = getScrollbarWidth() * zoom; |
225 var elementOffsetWidth = this._selectElement.offsetWidth * zoom; | 225 var elementOffsetWidth = this._selectElement.offsetWidth * zoom; |
226 var desiredWindowHeight = noScrollHeight; | 226 var desiredWindowHeight = noScrollHeight; |
227 var desiredWindowWidth = elementOffsetWidth; | 227 var desiredWindowWidth = elementOffsetWidth; |
| 228 // If we already have a vertical scrollbar, subtract it out, it will get re-
added below. |
| 229 if (this._selectElement.scrollHeight > this._selectElement.clientHeight) |
| 230 desiredWindowWidth -= scrollbarWidth; |
228 var expectingScrollbar = false; | 231 var expectingScrollbar = false; |
229 if (desiredWindowHeight > maxHeight) { | 232 if (desiredWindowHeight > maxHeight) { |
230 desiredWindowHeight = maxHeight; | 233 desiredWindowHeight = maxHeight; |
231 // Setting overflow to auto does not increase width for the scrollbar | 234 // Setting overflow to auto does not increase width for the scrollbar |
232 // so we need to do it manually. | 235 // so we need to do it manually. |
233 desiredWindowWidth += scrollbarWidth; | 236 desiredWindowWidth += scrollbarWidth; |
234 expectingScrollbar = true; | 237 expectingScrollbar = true; |
235 } | 238 } |
236 desiredWindowWidth = Math.max(this._config.anchorRectInScreen.width, desired
WindowWidth); | 239 desiredWindowWidth = Math.max(this._config.anchorRectInScreen.width, desired
WindowWidth); |
237 var windowRect = adjustWindowRect(desiredWindowWidth, desiredWindowHeight, e
lementOffsetWidth, 0); | 240 var windowRect = adjustWindowRect(desiredWindowWidth, desiredWindowHeight, e
lementOffsetWidth, 0); |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 } | 449 } |
447 this._applyItemStyle(element, config.style); | 450 this._applyItemStyle(element, config.style); |
448 }; | 451 }; |
449 | 452 |
450 if (window.dialogArguments) { | 453 if (window.dialogArguments) { |
451 initialize(dialogArguments); | 454 initialize(dialogArguments); |
452 } else { | 455 } else { |
453 window.addEventListener("message", handleMessage, false); | 456 window.addEventListener("message", handleMessage, false); |
454 window.setTimeout(handleArgumentsTimeout, 1000); | 457 window.setTimeout(handleArgumentsTimeout, 1000); |
455 } | 458 } |
OLD | NEW |