diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-07-16 11:45:35 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-07-17 08:59:23 +0000 |
commit | 552906b0f222c5d5dd11b9fd73829d510980461a (patch) | |
tree | 3a11e6ed0538a81dd83b20cf3a4783e297f26d91 /chromium/third_party/blink/renderer/core/animation/timing.h | |
parent | 1b05827804eaf047779b597718c03e7d38344261 (diff) | |
download | qtwebengine-chromium-552906b0f222c5d5dd11b9fd73829d510980461a.tar.gz |
BASELINE: Update Chromium to 83.0.4103.122
Change-Id: Ie3a82f5bb0076eec2a7c6a6162326b4301ee291e
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/core/animation/timing.h')
-rw-r--r-- | chromium/third_party/blink/renderer/core/animation/timing.h | 49 |
1 files changed, 35 insertions, 14 deletions
diff --git a/chromium/third_party/blink/renderer/core/animation/timing.h b/chromium/third_party/blink/renderer/core/animation/timing.h index e3d386eeb2d..18cfd2127fc 100644 --- a/chromium/third_party/blink/renderer/core/animation/timing.h +++ b/chromium/third_party/blink/renderer/core/animation/timing.h @@ -45,18 +45,6 @@ namespace blink { class EffectTiming; class ComputedEffectTiming; -static inline bool IsNull(double value) { - return std::isnan(value); -} - -static inline double NullValue() { - return std::numeric_limits<double>::quiet_NaN(); -} - -static inline base::Optional<double> ValueOrUnresolved(double a) { - return IsNull(a) ? base::nullopt : base::Optional<double>(a); -} - struct CORE_EXPORT Timing { USING_FAST_MALLOC(Timing); @@ -75,9 +63,27 @@ struct CORE_EXPORT Timing { kBackwards, }; + // Timing properties set via AnimationEffect.updateTiming override their + // corresponding CSS properties. + enum AnimationTimingOverride { + kOverrideNode = 0, + kOverrideDirection = 1, + kOverrideDuration = 1 << 1, + kOverrideEndDelay = 1 << 2, + kOverideFillMode = 1 << 3, + kOverrideIterationCount = 1 << 4, + kOverrideIterationStart = 1 << 5, + kOverrideStartDelay = 1 << 6, + kOverrideTimingFunction = 1 << 7, + kOverrideAll = (1 << 8) - 1 + }; + using FillMode = CompositorKeyframeModel::FillMode; using PlaybackDirection = CompositorKeyframeModel::Direction; + static bool IsNull(double value) { return std::isnan(value); } + static double NullValue() { return std::numeric_limits<double>::quiet_NaN(); } + static String FillModeString(FillMode); static FillMode StringToFillMode(const String&); static String PlaybackDirectionString(PlaybackDirection); @@ -90,7 +96,8 @@ struct CORE_EXPORT Timing { iteration_count(1), iteration_duration(base::nullopt), direction(PlaybackDirection::NORMAL), - timing_function(LinearTimingFunction::Shared()) {} + timing_function(LinearTimingFunction::Shared()), + timing_overrides(kOverrideNode) {} void AssertValid() const { DCHECK(std::isfinite(start_delay)); @@ -125,6 +132,16 @@ struct CORE_EXPORT Timing { bool operator!=(const Timing& other) const { return !(*this == other); } + // Explicit changes to animation timing through the web animations API, + // override timing changes due to CSS style. + void SetTimingOverride(AnimationTimingOverride override) { + timing_overrides |= override; + } + bool HasTimingOverride(AnimationTimingOverride override) { + return timing_overrides & override; + } + bool HasTimingOverrides() { return timing_overrides != kOverrideNode; } + double start_delay; double end_delay; FillMode fill_mode; @@ -135,6 +152,10 @@ struct CORE_EXPORT Timing { PlaybackDirection direction; scoped_refptr<TimingFunction> timing_function; + // Mask of timing attributes that are set by calls to + // AnimationEffect.updateTiming. Once set, these attributes ignore changes + // based on the CSS style. + uint16_t timing_overrides; struct CalculatedTiming { DISALLOW_NEW(); @@ -149,7 +170,7 @@ struct CORE_EXPORT Timing { AnimationTimeDelta::Max(); AnimationTimeDelta time_to_reverse_effect_change = AnimationTimeDelta::Max(); - double time_to_next_iteration = std::numeric_limits<double>::infinity(); + AnimationTimeDelta time_to_next_iteration = AnimationTimeDelta::Max(); }; CalculatedTiming CalculateTimings(base::Optional<double> local_time, |