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

Unified Diff: chrome/browser/chromeos/ui/accessibility_focus_ring_controller.cc

Issue 2789623004: Clamp focus ring opacity to avoid debug-mode failures (Closed)
Patch Set: Use float constants explicitly Created 3 years, 9 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: chrome/browser/chromeos/ui/accessibility_focus_ring_controller.cc
diff --git a/chrome/browser/chromeos/ui/accessibility_focus_ring_controller.cc b/chrome/browser/chromeos/ui/accessibility_focus_ring_controller.cc
index 07cef1b44152e68196f3c458292bacf4a6d911a0..62ac28a0beaadf7d660b3f505000b8aa97d61ec7 100644
--- a/chrome/browser/chromeos/ui/accessibility_focus_ring_controller.cc
+++ b/chrome/browser/chromeos/ui/accessibility_focus_ring_controller.cc
@@ -437,15 +437,14 @@ void AccessibilityFocusRingController::ComputeOpacity(
float opacity;
if (start_delta < fade_in_time) {
opacity = start_delta.InSecondsF() / fade_in_time.InSecondsF();
- if (opacity > 1.0)
- opacity = 1.0;
} else {
opacity = 1.0 - (change_delta.InSecondsF() /
(fade_in_time + fade_out_time).InSecondsF());
- if (opacity < 0.0)
- opacity = 0.0;
}
+ // Layer::SetOpacity will throw an error if we're not within 0...1.
+ opacity = std::min(std::max(opacity, 0.0f), 1.0f);
+
animation_info->opacity = opacity;
}
« 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