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

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

Issue 1454613002: Page popups should respect zoom factor of the anchor element. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add 1.25 zoom tests 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/pickerCommon.js
diff --git a/third_party/WebKit/Source/web/resources/pickerCommon.js b/third_party/WebKit/Source/web/resources/pickerCommon.js
index f0051ee9b5e05b5d7e5c334ebfe3ac2f196d49ff..205c8455b0aee6a1e3ea187a63f74cbab22dede0 100644
--- a/third_party/WebKit/Source/web/resources/pickerCommon.js
+++ b/third_party/WebKit/Source/web/resources/pickerCommon.js
@@ -89,19 +89,20 @@ Rectangle.intersection = function(rect1, rect2) {
};
/**
- * @param {!number} width
- * @param {!number} height
+ * @param {!number} width in CSS pixel
+ * @param {!number} height in CSS pixel
*/
function resizeWindow(width, height) {
- setWindowRect(adjustWindowRect(width, height, width, height));
+ var zoom = global.params.zoomFactor ? global.params.zoomFactor : 1;
+ setWindowRect(adjustWindowRect(width * zoom, height * zoom, width * zoom, height * zoom));
}
/**
- * @param {!number} width
- * @param {!number} height
- * @param {?number} minWidth
- * @param {?number} minHeight
- * @return {!Rectangle}
+ * @param {!number} width in physical pixel
+ * @param {!number} height in physical pixel
+ * @param {?number} minWidth in physical pixel
+ * @param {?number} minHeight in physical pixel
+ * @return {!Rectangle} Adjusted rectangle with physical pixels
*/
function adjustWindowRect(width, height, minWidth, minHeight) {
if (typeof minWidth !== "number")
@@ -123,6 +124,9 @@ function adjustWindowRect(width, height, minWidth, minHeight) {
return windowRect;
}
+/**
+ * Arguments are physical pixels.
+ */
function _adjustWindowRectVertically(windowRect, availRect, anchorRect, minHeight) {
var availableSpaceAbove = anchorRect.y - availRect.y;
availableSpaceAbove = Math.max(0, Math.min(availRect.height, availableSpaceAbove));
@@ -140,6 +144,9 @@ function _adjustWindowRectVertically(windowRect, availRect, anchorRect, minHeigh
}
}
+/**
+ * Arguments are physical pixels.
+ */
function _adjustWindowRectHorizontally(windowRect, availRect, anchorRect, minWidth) {
windowRect.width = Math.min(windowRect.width, availRect.width);
windowRect.width = Math.max(windowRect.width, minWidth);
@@ -152,7 +159,7 @@ function _adjustWindowRectHorizontally(windowRect, availRect, anchorRect, minWid
}
/**
- * @param {!Rectangle} rect
+ * @param {!Rectangle} rect Window position and size with physical pixels.
*/
function setWindowRect(rect) {
if (window.frameElement) {
« no previous file with comments | « third_party/WebKit/Source/web/resources/listPicker.js ('k') | third_party/WebKit/Source/web/resources/suggestionPicker.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698