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

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: Created 5 years, 1 month 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 167ad3cd77cc1ceb90b253edb6253f6541488ac0..2ac316dce7135210f1abdc8b176538ade3a583a1 100644
--- a/third_party/WebKit/Source/web/resources/listPicker.js
+++ b/third_party/WebKit/Source/web/resources/listPicker.js
@@ -193,31 +193,37 @@ ListPicker.prototype._handleKeyDown = function(event) {
ListPicker.prototype._fixWindowSize = function() {
this._selectElement.style.height = "";
- var maxHeight = this._selectElement.offsetHeight;
+ var scale = global.params.scaleFactor;
+ var maxHeight = this._selectElement.offsetHeight / scale;
+
// heightOutsideOfContent should be matched to border widths of the listbox
// SELECT. See listPicker.css and html.css.
var heightOutsideOfContent = 2;
- var noScrollHeight = Math.round(this._calculateScrollHeight() + heightOutsideOfContent);
+ var noScrollHeight = Math.round(this._calculateScrollHeight() + heightOutsideOfContent) / scale;
var desiredWindowHeight = noScrollHeight;
- var desiredWindowWidth = this._selectElement.offsetWidth;
+ var offsetWidth = this._selectElement.offsetWidth / scale;
+ var desiredWindowWidth = offsetWidth;
+
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 += getScrollbarWidth() / scale;
expectingScrollbar = true;
}
desiredWindowWidth = Math.max(this._config.anchorRectInScreen.width, desiredWindowWidth);
- var windowRect = adjustWindowRect(desiredWindowWidth, desiredWindowHeight, this._selectElement.offsetWidth, 0);
+ var windowRect = adjustWindowRect(desiredWindowWidth, desiredWindowHeight, offsetWidth, 0);
+
// If the available screen space is smaller than maxHeight, we will get an unexpected scrollbar.
if (!expectingScrollbar && windowRect.height < noScrollHeight) {
- desiredWindowWidth = windowRect.width + getScrollbarWidth();
+ desiredWindowWidth = windowRect.width + getScrollbarWidth() / scale;
windowRect = adjustWindowRect(desiredWindowWidth, windowRect.height, windowRect.width, windowRect.height);
}
- this._selectElement.style.width = windowRect.width + "px";
- this._selectElement.style.height = windowRect.height + "px";
- this._element.style.height = windowRect.height + "px";
+
+ this._selectElement.style.width = Math.round(windowRect.width * scale) + "px";
+ this._selectElement.style.height = Math.round(windowRect.height * scale) + "px";
+ this._element.style.height = Math.round(windowRect.height * scale) + "px";
setWindowRect(windowRect);
};

Powered by Google App Engine
This is Rietveld 408576698