Commit 28d9de39 authored by Xida Chen's avatar Xida Chen Committed by Commit Bot

Remove usage of Timing::IsNull

Blink's animation doesn't use Timing::Nullvalue anymore, and this
CL removes the IsNUll.

Bug: 791086
Change-Id: I488f077b96ec6477176876f224f7f5e5d71c07ef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2430484
Commit-Queue: Xida Chen <xidachen@chromium.org>
Reviewed-by: default avatarKevin Ellis <kevers@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811448}
parent 46d7fabd
...@@ -626,7 +626,7 @@ void Animation::NotifyReady(double ready_time) { ...@@ -626,7 +626,7 @@ void Animation::NotifyReady(double ready_time) {
// Refer to Step 8.3 'pending play task' in // Refer to Step 8.3 'pending play task' in
// https://drafts.csswg.org/web-animations/#playing-an-animation-section. // https://drafts.csswg.org/web-animations/#playing-an-animation-section.
void Animation::CommitPendingPlay(double ready_time) { void Animation::CommitPendingPlay(double ready_time) {
DCHECK(!Timing::IsNull(ready_time)); DCHECK(std::isfinite(ready_time));
DCHECK(start_time_ || hold_time_); DCHECK(start_time_ || hold_time_);
DCHECK(pending_play_); DCHECK(pending_play_);
pending_play_ = false; pending_play_ = false;
...@@ -1892,18 +1892,18 @@ void Animation::StartAnimationOnCompositor( ...@@ -1892,18 +1892,18 @@ void Animation::StartAnimationOnCompositor(
start_time = start_time =
start_time.value() - (EffectEnd() / fabs(EffectivePlaybackRate())); start_time.value() - (EffectEnd() / fabs(EffectivePlaybackRate()));
} }
DCHECK(std::isfinite(start_time.value()));
} else { } else {
base::Optional<double> current_time = CurrentTimeInternal(); base::Optional<double> current_time = CurrentTimeInternal();
DCHECK(current_time); DCHECK(current_time);
time_offset = time_offset =
reversed ? EffectEnd() - current_time.value() : current_time.value(); reversed ? EffectEnd() - current_time.value() : current_time.value();
time_offset = time_offset / fabs(EffectivePlaybackRate()); time_offset = time_offset / fabs(EffectivePlaybackRate());
DCHECK(std::isfinite(time_offset));
} }
DCHECK(!start_time || !Timing::IsNull(start_time.value()));
DCHECK_NE(compositor_group_, 0); DCHECK_NE(compositor_group_, 0);
DCHECK(To<KeyframeEffect>(content_.Get())); DCHECK(To<KeyframeEffect>(content_.Get()));
DCHECK(std::isfinite(time_offset));
To<KeyframeEffect>(content_.Get()) To<KeyframeEffect>(content_.Get())
->StartAnimationOnCompositor(compositor_group_, start_time, ->StartAnimationOnCompositor(compositor_group_, start_time,
base::TimeDelta::FromSecondsD(time_offset), base::TimeDelta::FromSecondsD(time_offset),
......
...@@ -97,7 +97,7 @@ class TestAnimationEffect : public AnimationEffect { ...@@ -97,7 +97,7 @@ class TestAnimationEffect : public AnimationEffect {
bool forwards, bool forwards,
base::Optional<double> local_time, base::Optional<double> local_time,
AnimationTimeDelta time_to_next_iteration) const override { AnimationTimeDelta time_to_next_iteration) const override {
DCHECK(!local_time || !Timing::IsNull(local_time.value())); DCHECK(!local_time || std::isfinite(local_time.value()));
local_time_ = local_time; local_time_ = local_time;
time_to_next_iteration_ = time_to_next_iteration; time_to_next_iteration_ = time_to_next_iteration;
return AnimationTimeDelta::FromSecondsD( return AnimationTimeDelta::FromSecondsD(
......
...@@ -16,7 +16,7 @@ Keyframe::PropertySpecificKeyframe::PropertySpecificKeyframe( ...@@ -16,7 +16,7 @@ Keyframe::PropertySpecificKeyframe::PropertySpecificKeyframe(
scoped_refptr<TimingFunction> easing, scoped_refptr<TimingFunction> easing,
EffectModel::CompositeOperation composite) EffectModel::CompositeOperation composite)
: offset_(offset), easing_(std::move(easing)), composite_(composite) { : offset_(offset), easing_(std::move(easing)), composite_(composite) {
DCHECK(!Timing::IsNull(offset)); DCHECK(std::isfinite(offset));
if (!easing_) if (!easing_)
easing_ = LinearTimingFunction::Shared(); easing_ = LinearTimingFunction::Shared();
} }
......
...@@ -82,7 +82,6 @@ struct CORE_EXPORT Timing { ...@@ -82,7 +82,6 @@ struct CORE_EXPORT Timing {
using FillMode = CompositorKeyframeModel::FillMode; using FillMode = CompositorKeyframeModel::FillMode;
using PlaybackDirection = CompositorKeyframeModel::Direction; using PlaybackDirection = CompositorKeyframeModel::Direction;
static bool IsNull(double value) { return std::isnan(value); }
static double NullValue() { return std::numeric_limits<double>::quiet_NaN(); } static double NullValue() { return std::numeric_limits<double>::quiet_NaN(); }
static String FillModeString(FillMode); static String FillModeString(FillMode);
......
...@@ -61,14 +61,14 @@ inline bool LessThanOrEqualToWithinEpsilon(double a, double b) { ...@@ -61,14 +61,14 @@ inline bool LessThanOrEqualToWithinEpsilon(double a, double b) {
} }
static inline double MultiplyZeroAlwaysGivesZero(double x, double y) { static inline double MultiplyZeroAlwaysGivesZero(double x, double y) {
DCHECK(!Timing::IsNull(x)); DCHECK(!std::isnan(x));
DCHECK(!Timing::IsNull(y)); DCHECK(!std::isnan(y));
return x && y ? x * y : 0; return x && y ? x * y : 0;
} }
static inline double MultiplyZeroAlwaysGivesZero(AnimationTimeDelta x, static inline double MultiplyZeroAlwaysGivesZero(AnimationTimeDelta x,
double y) { double y) {
DCHECK(!Timing::IsNull(y)); DCHECK(!std::isnan(y));
return x.is_zero() || y == 0 ? 0 : (x * y).InSecondsF(); return x.is_zero() || y == 0 ? 0 : (x * y).InSecondsF();
} }
......
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