// Copyright 2017 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "third_party/blink/renderer/core/animation/css_resolution_interpolation_type.h" #include "third_party/blink/renderer/core/css/css_numeric_literal_value.h" #include "third_party/blink/renderer/core/css/css_primitive_value.h" namespace blink { InterpolationValue CSSResolutionInterpolationType::MaybeConvertNeutral( const InterpolationValue&, ConversionCheckers&) const { return InterpolationValue(std::make_unique(0)); } InterpolationValue CSSResolutionInterpolationType::MaybeConvertValue( const CSSValue& value, const StyleResolverState*, ConversionCheckers&) const { auto* primitive_value = DynamicTo(value); if (!primitive_value || !primitive_value->IsResolution()) return nullptr; return InterpolationValue(std::make_unique( primitive_value->ComputeDotsPerPixel())); } const CSSValue* CSSResolutionInterpolationType::CreateCSSValue( const InterpolableValue& value, const NonInterpolableValue*, const StyleResolverState&) const { return CSSNumericLiteralValue::Create( To(value).Value(), CSSPrimitiveValue::UnitType::kDotsPerPixel); } } // namespace blink