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

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

Issue 2277403003: Make cr.icon.getSupportedScaleFactors slightly closer to the .cc version. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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/icon.js
diff --git a/ui/webui/resources/js/icon.js b/ui/webui/resources/js/icon.js
index 122b707fd645e24959d1389717d980d281c23715..c188bb7b1f9a7e2e20c570c4b7cd890a24890146 100644
--- a/ui/webui/resources/js/icon.js
+++ b/ui/webui/resources/js/icon.js
@@ -9,18 +9,22 @@ cr.define('cr.icon', function() {
*/
function getSupportedScaleFactors() {
var supportedScaleFactors = [];
- 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.
+ if (!cr.isIOS) {
+ // This matches the code in ResourceBundle::InitSharedInstance() that
+ // supports SCALE_FACTOR_100P on all non-iOS platforms.
supportedScaleFactors.push(1);
+ }
+ 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 have
+ // high DPI assets for 2x. Let the renderer pick the closest image for
+ // the current device scale factor.
supportedScaleFactors.push(2);
} else {
// 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.
+ // TODO(oshima): Investigate corresponding to
+ // ResourceBundle::InitSharedInstance() more closely.
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