Commit 41d85551 authored by alancutter's avatar alancutter Committed by Commit bot

Remove maybeConvertSingle override in CSSValueInterpolationType

This change refactors CSSValueInterpolationType to not override
CSSInterpolationType::maybeConvertSingle() and instead
use the more specific conversion functions as is the norm.

This change is part of supporting smooth interpolation of
registered custom properties. More complex behaviour will be
added to CSSInterpolationType::maybeConvertSingle() which must
be shared with the CSSValueInterpolationType subclass.

There are no changes in behaviour made by this patch.

BUG=671904

Review-Url: https://codereview.chromium.org/2614613002
Cr-Commit-Position: refs/heads/master@{#441885}
parent a4ecd5b7
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
#include "core/animation/InterpolationEnvironment.h" #include "core/animation/InterpolationEnvironment.h"
#include "core/animation/StringKeyframe.h" #include "core/animation/StringKeyframe.h"
#include "core/css/CSSInheritedValue.h"
#include "core/css/CSSInitialValue.h"
#include "core/css/resolver/StyleBuilder.h" #include "core/css/resolver/StyleBuilder.h"
namespace blink { namespace blink {
...@@ -35,22 +37,30 @@ class CSSValueNonInterpolableValue : public NonInterpolableValue { ...@@ -35,22 +37,30 @@ class CSSValueNonInterpolableValue : public NonInterpolableValue {
DEFINE_NON_INTERPOLABLE_VALUE_TYPE(CSSValueNonInterpolableValue); DEFINE_NON_INTERPOLABLE_VALUE_TYPE(CSSValueNonInterpolableValue);
DEFINE_NON_INTERPOLABLE_VALUE_TYPE_CASTS(CSSValueNonInterpolableValue); DEFINE_NON_INTERPOLABLE_VALUE_TYPE_CASTS(CSSValueNonInterpolableValue);
InterpolationValue CSSValueInterpolationType::maybeConvertSingle( InterpolationValue CSSValueInterpolationType::maybeConvertInitial(
const PropertySpecificKeyframe& keyframe, const StyleResolverState& state,
const InterpolationEnvironment&, ConversionCheckers& conversionCheckers) const {
const InterpolationValue&, return maybeConvertValue(*CSSInitialValue::create(), state,
ConversionCheckers&) const { conversionCheckers);
if (keyframe.isNeutral()) }
return nullptr;
InterpolationValue CSSValueInterpolationType::maybeConvertInherit(
return InterpolationValue( const StyleResolverState& state,
InterpolableList::create(0), ConversionCheckers& conversionCheckers) const {
CSSValueNonInterpolableValue::create( return maybeConvertValue(*CSSInheritedValue::create(), state,
toCSSPropertySpecificKeyframe(keyframe).value())); conversionCheckers);
}
InterpolationValue CSSValueInterpolationType::maybeConvertValue(
const CSSValue& value,
const StyleResolverState& state,
ConversionCheckers& conversionCheckers) const {
return InterpolationValue(InterpolableList::create(0),
CSSValueNonInterpolableValue::create(&value));
} }
void CSSValueInterpolationType::applyStandardPropertyValue( void CSSValueInterpolationType::applyStandardPropertyValue(
const InterpolableValue&, const InterpolableValue& interpolableValue,
const NonInterpolableValue* nonInterpolableValue, const NonInterpolableValue* nonInterpolableValue,
StyleResolverState& state) const { StyleResolverState& state) const {
StyleBuilder::applyProperty( StyleBuilder::applyProperty(
......
...@@ -25,39 +25,25 @@ class CSSValueInterpolationType : public CSSInterpolationType { ...@@ -25,39 +25,25 @@ class CSSValueInterpolationType : public CSSInterpolationType {
return nullptr; return nullptr;
} }
InterpolationValue maybeConvertSingle(const PropertySpecificKeyframe&,
const InterpolationEnvironment&,
const InterpolationValue& underlying,
ConversionCheckers&) const final;
InterpolationValue maybeConvertStandardPropertyUnderlyingValue( InterpolationValue maybeConvertStandardPropertyUnderlyingValue(
const StyleResolverState&) const final { const StyleResolverState&) const final {
return nullptr; return nullptr;
} }
// As we override CSSInterpolationType::maybeConvertSingle, these are never
// called.
InterpolationValue maybeConvertNeutral(const InterpolationValue& underlying, InterpolationValue maybeConvertNeutral(const InterpolationValue& underlying,
ConversionCheckers&) const final { ConversionCheckers&) const final {
NOTREACHED(); // This type will never interpolate or composite with the underlying value.
// Returning nullptr here means no value will be applied and the value in
// ComputedStyle will remain unchanged.
return nullptr; return nullptr;
} }
InterpolationValue maybeConvertInitial(const StyleResolverState&, InterpolationValue maybeConvertInitial(const StyleResolverState&,
ConversionCheckers&) const final { ConversionCheckers&) const final;
NOTREACHED();
return nullptr;
}
InterpolationValue maybeConvertInherit(const StyleResolverState&, InterpolationValue maybeConvertInherit(const StyleResolverState&,
ConversionCheckers&) const final { ConversionCheckers&) const final;
NOTREACHED();
return nullptr;
}
InterpolationValue maybeConvertValue(const CSSValue& value, InterpolationValue maybeConvertValue(const CSSValue& value,
const StyleResolverState&, const StyleResolverState&,
ConversionCheckers&) const final { ConversionCheckers&) const final;
NOTREACHED();
return nullptr;
}
void composite(UnderlyingValueOwner& underlyingValueOwner, void composite(UnderlyingValueOwner& underlyingValueOwner,
double underlyingFraction, double underlyingFraction,
......
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