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

Unified Diff: ui/webui/resources/js/util.js

Issue 1056213003: Add 2.0 for win/linux as they now supports high dpi (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/webui/resources/js/util.js
diff --git a/ui/webui/resources/js/util.js b/ui/webui/resources/js/util.js
index a2c2a44eac70b26b6b741a7772dea391aa8f7f31..63ca9bb1fb0d211d9125cc0cf1d00152a31efed2 100644
--- a/ui/webui/resources/js/util.js
+++ b/ui/webui/resources/js/util.js
@@ -52,16 +52,24 @@ function chromeSend(name, params, callbackName, callback) {
}
/**
- * Returns the scale factors supported by this platform.
+ * Returns the scale factors supported by this platform for webui
+ * resources.
* @return {Array} The supported scale factors.
*/
function getSupportedScaleFactors() {
var supportedScaleFactors = [];
- if (cr.isMac || cr.isChromeOS) {
+ if (cr.isMac || cr.isChromeOS || cr.isWindows || cr.isLinux) {
+ // All desktop platforms support zooming which also updates the
+ // renderer's device scale factors (a.k.a devicePixelRatio), and
+ // these platforms has high DPI assets for 2.0x. Use 1x and 2x in
+ // image-set on these platforms so that the renderer can pick the
+ // closest image for the current device scale factor.
supportedScaleFactors.push(1);
supportedScaleFactors.push(2);
} else {
- // Windows must be restarted to display at a different scale factor.
+ // For other platforms that use fixed device scale factor, use
+ // the window's device pixel ratio.
+ // TODO(oshima): Investigate if Android/iOS need to use image-set.
supportedScaleFactors.push(window.devicePixelRatio);
}
return supportedScaleFactors;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698