diff options
Diffstat (limited to 'chromium/third_party/blink/renderer/core/animation/css_visibility_interpolation_type.cc')
-rw-r--r-- | chromium/third_party/blink/renderer/core/animation/css_visibility_interpolation_type.cc | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/chromium/third_party/blink/renderer/core/animation/css_visibility_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_visibility_interpolation_type.cc index d0153dd94a8..f3156672400 100644 --- a/chromium/third_party/blink/renderer/core/animation/css_visibility_interpolation_type.cc +++ b/chromium/third_party/blink/renderer/core/animation/css_visibility_interpolation_type.cc @@ -49,7 +49,15 @@ class CSSVisibilityNonInterpolableValue : public NonInterpolableValue { }; DEFINE_NON_INTERPOLABLE_VALUE_TYPE(CSSVisibilityNonInterpolableValue); -DEFINE_NON_INTERPOLABLE_VALUE_TYPE_CASTS(CSSVisibilityNonInterpolableValue); +template <> +struct DowncastTraits<CSSVisibilityNonInterpolableValue> { + static bool AllowFrom(const NonInterpolableValue* value) { + return value && AllowFrom(*value); + } + static bool AllowFrom(const NonInterpolableValue& value) { + return value.GetType() == CSSVisibilityNonInterpolableValue::static_type_; + } +}; class UnderlyingVisibilityChecker : public CSSInterpolationType::CSSConversionChecker { @@ -64,10 +72,10 @@ class UnderlyingVisibilityChecker bool IsValid(const StyleResolverState&, const InterpolationValue& underlying) const final { double underlying_fraction = - ToInterpolableNumber(*underlying.interpolable_value).Value(); - EVisibility underlying_visibility = - ToCSSVisibilityNonInterpolableValue(*underlying.non_interpolable_value) - .Visibility(underlying_fraction); + To<InterpolableNumber>(*underlying.interpolable_value).Value(); + EVisibility underlying_visibility = To<CSSVisibilityNonInterpolableValue>( + *underlying.non_interpolable_value) + .Visibility(underlying_fraction); return visibility_ == underlying_visibility; } @@ -100,9 +108,9 @@ InterpolationValue CSSVisibilityInterpolationType::MaybeConvertNeutral( const InterpolationValue& underlying, ConversionCheckers& conversion_checkers) const { double underlying_fraction = - ToInterpolableNumber(*underlying.interpolable_value).Value(); + To<InterpolableNumber>(*underlying.interpolable_value).Value(); EVisibility underlying_visibility = - ToCSSVisibilityNonInterpolableValue(*underlying.non_interpolable_value) + To<CSSVisibilityNonInterpolableValue>(*underlying.non_interpolable_value) .Visibility(underlying_fraction); conversion_checkers.push_back( std::make_unique<UnderlyingVisibilityChecker>(underlying_visibility)); @@ -156,10 +164,10 @@ PairwiseInterpolationValue CSSVisibilityInterpolationType::MaybeMergeSingles( InterpolationValue&& start, InterpolationValue&& end) const { EVisibility start_visibility = - ToCSSVisibilityNonInterpolableValue(*start.non_interpolable_value) + To<CSSVisibilityNonInterpolableValue>(*start.non_interpolable_value) .Visibility(); EVisibility end_visibility = - ToCSSVisibilityNonInterpolableValue(*end.non_interpolable_value) + To<CSSVisibilityNonInterpolableValue>(*end.non_interpolable_value) .Visibility(); // One side must be "visible". // Spec: https://drafts.csswg.org/css-transitions/#animtype-visibility @@ -188,9 +196,9 @@ void CSSVisibilityInterpolationType::ApplyStandardPropertyValue( StyleResolverState& state) const { // Visibility interpolation has been deferred to application time here due to // its non-linear behaviour. - double fraction = ToInterpolableNumber(interpolable_value).Value(); + double fraction = To<InterpolableNumber>(interpolable_value).Value(); EVisibility visibility = - ToCSSVisibilityNonInterpolableValue(non_interpolable_value) + To<CSSVisibilityNonInterpolableValue>(non_interpolable_value) ->Visibility(fraction); state.Style()->SetVisibility(visibility); } |