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

Unified Diff: ui/base/layout.cc

Issue 10946019: Don't return unsupported scales frrom GetScaleFactorFromScale() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Simpler change Created 8 years, 3 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
Index: ui/base/layout.cc
diff --git a/ui/base/layout.cc b/ui/base/layout.cc
index 48bdab67de386a4dd7298d0a11ac4bee0f3e3e15..581225b829ca82a0c83129c1a8eff7000d25711e 100644
--- a/ui/base/layout.cc
+++ b/ui/base/layout.cc
@@ -113,13 +113,15 @@ ScaleFactor GetScaleFactorFromScale(float scale) {
size_t closest_match = 0;
float smallest_diff = std::numeric_limits<float>::max();
for (size_t i = 0; i < kScaleFactorScalesLength; ++i) {
+ if (!IsScaleFactorSupported(static_cast<ScaleFactor>(i)))
pkotwicz 2012/09/19 21:05:17 Nit: iterate through the scale factors you get fro
Xianzhu 2012/09/19 21:38:23 Oops I should have made that kind of change :)
+ continue;
float diff = std::abs(kScaleFactorScales[i] - scale);
if (diff < smallest_diff) {
closest_match = i;
smallest_diff = diff;
}
}
- return static_cast<ui::ScaleFactor>(closest_match);
+ return static_cast<ScaleFactor>(closest_match);
}
float GetScaleFactorScale(ScaleFactor scale_factor) {
« no previous file with comments | « ui/base/layout.h ('k') | ui/base/layout_unittest.cc » ('j') | ui/base/layout_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698