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

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

Issue 1456753002: Compute the popup location/size correctly when use-zoom-for-dsf is enabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update TestExpectations Created 5 years 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
Index: third_party/WebKit/Source/web/resources/listPicker.js
diff --git a/third_party/WebKit/Source/web/resources/listPicker.js b/third_party/WebKit/Source/web/resources/listPicker.js
index 54e79cec02929ebeffadfc7a91ba457c1d8adf20..3d866021e3f2458c20446f86a0ef8bd37c07cc91 100644
--- a/third_party/WebKit/Source/web/resources/listPicker.js
+++ b/third_party/WebKit/Source/web/resources/listPicker.js
@@ -211,24 +211,26 @@ ListPicker.prototype._handleKeyDown = function(event) {
ListPicker.prototype._fixWindowSize = function() {
this._selectElement.style.height = "";
- var maxHeight = this._selectElement.offsetHeight;
- var noScrollHeight = this._calculateScrollHeight() + ListPicker.ListboxSelectBorder * 2;
+ var zoom = this._config.zoomFactor;
+ var maxHeight = this._selectElement.offsetHeight * zoom;
+ var noScrollHeight = (this._calculateScrollHeight() + ListPicker.ListboxSelectBorder * 2) * zoom;
+ var scrollbarWidth = getScrollbarWidth() * zoom;
+ var elementOffsetWidth = this._selectElement.offsetWidth * zoom;
var desiredWindowHeight = noScrollHeight;
- var desiredWindowWidth = this._selectElement.offsetWidth;
+ var desiredWindowWidth = elementOffsetWidth;
var expectingScrollbar = false;
if (desiredWindowHeight > maxHeight) {
desiredWindowHeight = maxHeight;
// Setting overflow to auto does not increase width for the scrollbar
// so we need to do it manually.
- desiredWindowWidth += getScrollbarWidth();
+ desiredWindowWidth += scrollbarWidth;
expectingScrollbar = true;
}
- var zoom = this._config.zoomFactor;
- desiredWindowWidth = Math.max(this._config.anchorRectInScreen.width / zoom, desiredWindowWidth);
- var windowRect = adjustWindowRect(desiredWindowWidth * zoom, desiredWindowHeight * zoom, this._selectElement.offsetWidth * zoom, 0);
+ desiredWindowWidth = Math.max(this._config.anchorRectInScreen.width, desiredWindowWidth);
+ var windowRect = adjustWindowRect(desiredWindowWidth, desiredWindowHeight, elementOffsetWidth, 0);
// If the available screen space is smaller than maxHeight, we will get an unexpected scrollbar.
- if (!expectingScrollbar && windowRect.height < noScrollHeight * zoom) {
- desiredWindowWidth = windowRect.width + getScrollbarWidth() * zoom;
+ if (!expectingScrollbar && windowRect.height < noScrollHeight) {
+ desiredWindowWidth = windowRect.width + scrollbarWidth;
windowRect = adjustWindowRect(desiredWindowWidth, windowRect.height, windowRect.width, windowRect.height);
}
this._selectElement.style.width = (windowRect.width / zoom) + "px";
« no previous file with comments | « third_party/WebKit/Source/web/WebPagePopupImpl.cpp ('k') | third_party/WebKit/Source/web/resources/suggestionPicker.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698