| 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 var desiredWindowHeight = noScrollHeight; | 216 var desiredWindowHeight = noScrollHeight; |
| 217 var desiredWindowWidth = this._selectElement.offsetWidth; | 217 var desiredWindowWidth = this._selectElement.offsetWidth; |
| 218 var expectingScrollbar = false; | 218 var expectingScrollbar = false; |
| 219 if (desiredWindowHeight > maxHeight) { | 219 if (desiredWindowHeight > maxHeight) { |
| 220 desiredWindowHeight = maxHeight; | 220 desiredWindowHeight = maxHeight; |
| 221 // Setting overflow to auto does not increase width for the scrollbar | 221 // Setting overflow to auto does not increase width for the scrollbar |
| 222 // so we need to do it manually. | 222 // so we need to do it manually. |
| 223 desiredWindowWidth += getScrollbarWidth(); | 223 desiredWindowWidth += getScrollbarWidth(); |
| 224 expectingScrollbar = true; | 224 expectingScrollbar = true; |
| 225 } | 225 } |
| 226 desiredWindowWidth = Math.max(this._config.anchorRectInScreen.width, desired
WindowWidth); | 226 var zoom = this._config.zoomFactor; |
| 227 var windowRect = adjustWindowRect(desiredWindowWidth, desiredWindowHeight, t
his._selectElement.offsetWidth, 0); | 227 desiredWindowWidth = Math.max(this._config.anchorRectInScreen.width / zoom,
desiredWindowWidth); |
| 228 var windowRect = adjustWindowRect(desiredWindowWidth * zoom, desiredWindowHe
ight * zoom, this._selectElement.offsetWidth * zoom, 0); |
| 228 // If the available screen space is smaller than maxHeight, we will get an u
nexpected scrollbar. | 229 // If the available screen space is smaller than maxHeight, we will get an u
nexpected scrollbar. |
| 229 if (!expectingScrollbar && windowRect.height < noScrollHeight) { | 230 if (!expectingScrollbar && windowRect.height < noScrollHeight * zoom) { |
| 230 desiredWindowWidth = windowRect.width + getScrollbarWidth(); | 231 desiredWindowWidth = windowRect.width + getScrollbarWidth() * zoom; |
| 231 windowRect = adjustWindowRect(desiredWindowWidth, windowRect.height, win
dowRect.width, windowRect.height); | 232 windowRect = adjustWindowRect(desiredWindowWidth, windowRect.height, win
dowRect.width, windowRect.height); |
| 232 } | 233 } |
| 233 this._selectElement.style.width = windowRect.width + "px"; | 234 this._selectElement.style.width = (windowRect.width / zoom) + "px"; |
| 234 this._selectElement.style.height = windowRect.height + "px"; | 235 this._selectElement.style.height = (windowRect.height / zoom) + "px"; |
| 235 this._element.style.height = windowRect.height + "px"; | 236 this._element.style.height = (windowRect.height / zoom) + "px"; |
| 236 setWindowRect(windowRect); | 237 setWindowRect(windowRect); |
| 237 }; | 238 }; |
| 238 | 239 |
| 239 ListPicker.prototype._calculateScrollHeight = function() { | 240 ListPicker.prototype._calculateScrollHeight = function() { |
| 240 // Element.scrollHeight returns an integer value but this calculate the | 241 // Element.scrollHeight returns an integer value but this calculate the |
| 241 // actual fractional value. | 242 // actual fractional value. |
| 242 var top = Infinity; | 243 var top = Infinity; |
| 243 var bottom = -Infinity; | 244 var bottom = -Infinity; |
| 244 for (var i = 0; i < this._selectElement.children.length; i++) { | 245 for (var i = 0; i < this._selectElement.children.length; i++) { |
| 245 var rect = this._selectElement.children[i].getBoundingClientRect(); | 246 var rect = this._selectElement.children[i].getBoundingClientRect(); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 } | 437 } |
| 437 this._applyItemStyle(element, config.style); | 438 this._applyItemStyle(element, config.style); |
| 438 }; | 439 }; |
| 439 | 440 |
| 440 if (window.dialogArguments) { | 441 if (window.dialogArguments) { |
| 441 initialize(dialogArguments); | 442 initialize(dialogArguments); |
| 442 } else { | 443 } else { |
| 443 window.addEventListener("message", handleMessage, false); | 444 window.addEventListener("message", handleMessage, false); |
| 444 window.setTimeout(handleArgumentsTimeout, 1000); | 445 window.setTimeout(handleArgumentsTimeout, 1000); |
| 445 } | 446 } |
| OLD | NEW |