Commit 0ed33abe authored by Peter Kasting's avatar Peter Kasting Committed by Commit Bot

Misc. cleanup, chromecast/ edition.

* TimeDelta::InMicrosecondsF() actually returns a double
* Shorten code

Bug: none
Change-Id: I0dc35be9c2298e79d8a8f0cd34492d09c04cf9c8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2359002
Commit-Queue: Sergey Volk <servolk@chromium.org>
Reviewed-by: default avatarSergey Volk <servolk@chromium.org>
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#798478}
parent a5e24c44
......@@ -294,7 +294,7 @@ void CastMetricsHelper::LogMediumTimeHistogramEvent(const std::string& name,
base::Value CastMetricsHelper::CreateEventBase(const std::string& name) {
base::Value cast_event(base::Value::Type::DICTIONARY);
cast_event.SetKey("name", base::Value(name));
const double time = (Now() - base::TimeTicks()).InMicroseconds();
const double time = (Now() - base::TimeTicks()).InMicrosecondsF();
cast_event.SetKey("time", base::Value(time));
return cast_event;
}
......
......@@ -435,10 +435,8 @@ void AccessibilityFocusRingController::AnimateFocusRings(
return;
}
double fraction = delta / transition_time;
// Ease-in effect.
fraction = pow(fraction, 0.3);
const double fraction = pow(delta / transition_time, 0.3);
// Handle corner case where we're animating but we don't have previous
// rings.
......@@ -480,9 +478,7 @@ void AccessibilityFocusRingController::ComputeOpacity(
opacity = 1.0 - (change_delta / (fade_in_time + fade_out_time));
// Layer::SetOpacity will throw an error if we're not within 0...1.
opacity = base::ClampToRange(opacity, 0.0f, 1.0f);
animation_info->opacity = opacity;
animation_info->opacity = base::ClampToRange(opacity, 0.0f, 1.0f);
}
void AccessibilityFocusRingController::AnimateCaretRing(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment