InterpolationValue CSSInterpolationType::maybeConvertSingle( const PropertySpecificKeyframe& keyframe, const InterpolationEnvironment& environment, const InterpolationValue& underlying, ConversionCheckers& conversionCheckers) const { const CSSValue* value = toCSSPropertySpecificKeyframe(keyframe).value(); if (!value) return maybeConvertNeutral(underlying, conversionCheckers); if (value->isVariableReferenceValue() || value->isPendingSubstitutionValue()) { bool omitAnimationTainted = false; const CSSValue* resolvedValue = CSSVariableResolver::resolveVariableReferences( environment.state(), cssProperty(), *value, omitAnimationTainted); conversionCheckers.push_back( ResolvedVariableChecker::create(cssProperty(), value, resolvedValue)); value = resolvedValue; } if (value->isInitialValue() || (value->isUnsetValue() && !CSSPropertyMetadata::isInheritedProperty(cssProperty()))) return maybeConvertInitial(environment.state(), conversionCheckers); if (value->isInheritedValue() || (value->isUnsetValue() && CSSPropertyMetadata::isInheritedProperty(cssProperty()))) return maybeConvertInherit(environment.state(), conversionCheckers); return maybeConvertValue(*value, environment.state(), conversionCheckers); }
InterpolationValue CSSRotateInterpolationType::maybeConvertInherit( const StyleResolverState& state, ConversionCheckers& conversionCheckers) const { Rotation inheritedRotation = getRotation(*state.parentStyle()); conversionCheckers.push_back( InheritedRotationChecker::create(inheritedRotation)); return convertRotation(inheritedRotation); }
InterpolationValue CSSClipInterpolationType::maybeConvertInherit( const StyleResolverState& state, ConversionCheckers& conversionCheckers) const { ClipAutos inheritedAutos = getClipAutos(*state.parentStyle()); conversionCheckers.push_back(InheritedAutosChecker::create(inheritedAutos)); if (inheritedAutos.isAuto) return nullptr; return createClipValue(state.parentStyle()->clip(), state.parentStyle()->effectiveZoom()); }
InterpolationValue CSSImageSliceInterpolationType::maybeConvertInherit( const StyleResolverState& state, ConversionCheckers& conversionCheckers) const { const ImageSlice& inheritedImageSlice = ImageSlicePropertyFunctions::getImageSlice(cssProperty(), *state.parentStyle()); conversionCheckers.push_back(InheritedSliceTypesChecker::create( cssProperty(), SliceTypes(inheritedImageSlice))); return convertImageSlice(inheritedImageSlice, state.parentStyle()->effectiveZoom()); }
InterpolationValue CSSBasicShapeInterpolationType::maybeConvertInherit( const StyleResolverState& state, ConversionCheckers& conversionCheckers) const { const BasicShape* shape = BasicShapePropertyFunctions::getBasicShape( cssProperty(), *state.parentStyle()); // const_cast to take a ref. conversionCheckers.push_back(InheritedShapeChecker::create( cssProperty(), const_cast<BasicShape*>(shape))); return BasicShapeInterpolationFunctions::maybeConvertBasicShape( shape, state.parentStyle()->effectiveZoom()); }
InterpolationValue CSSFilterListInterpolationType::maybeConvertInherit( const StyleResolverState& state, ConversionCheckers& conversionCheckers) const { const FilterOperations& inheritedFilterOperations = FilterListPropertyFunctions::getFilterList(cssProperty(), *state.parentStyle()); conversionCheckers.push_back(InheritedFilterListChecker::create( cssProperty(), inheritedFilterOperations)); return convertFilterList(inheritedFilterOperations, state.style()->effectiveZoom()); }
InterpolationValue CSSFilterListInterpolationType::maybeConvertNeutral( const InterpolationValue& underlying, ConversionCheckers& conversionCheckers) const { // const_cast for taking refs. NonInterpolableList& nonInterpolableList = const_cast<NonInterpolableList&>( toNonInterpolableList(*underlying.nonInterpolableValue)); conversionCheckers.push_back( UnderlyingFilterListChecker::create(&nonInterpolableList)); return InterpolationValue(underlying.interpolableValue->cloneAndZero(), &nonInterpolableList); }
InterpolationValue CSSBasicShapeInterpolationType::maybeConvertNeutral( const InterpolationValue& underlying, ConversionCheckers& conversionCheckers) const { // const_cast is for taking refs. NonInterpolableValue* nonInterpolableValue = const_cast<NonInterpolableValue*>(underlying.nonInterpolableValue.get()); conversionCheckers.push_back( UnderlyingCompatibilityChecker::create(nonInterpolableValue)); return InterpolationValue( BasicShapeInterpolationFunctions::createNeutralValue( *underlying.nonInterpolableValue), nonInterpolableValue); }
InterpolationValue CSSImageSliceInterpolationType::maybeConvertNeutral( const InterpolationValue& underlying, ConversionCheckers& conversionCheckers) const { SliceTypes underlyingTypes = UnderlyingSliceTypesChecker::getUnderlyingSliceTypes(underlying); conversionCheckers.push_back( UnderlyingSliceTypesChecker::create(underlyingTypes)); LengthBox zeroBox( Length(0, underlyingTypes.isNumber[SideTop] ? Fixed : Percent), Length(0, underlyingTypes.isNumber[SideRight] ? Fixed : Percent), Length(0, underlyingTypes.isNumber[SideBottom] ? Fixed : Percent), Length(0, underlyingTypes.isNumber[SideLeft] ? Fixed : Percent)); return convertImageSlice(ImageSlice(zeroBox, underlyingTypes.fill), 1); }
InterpolationValue CSSClipInterpolationType::maybeConvertNeutral( const InterpolationValue& underlying, ConversionCheckers& conversionCheckers) const { ClipAutos underlyingAutos = UnderlyingAutosChecker::getUnderlyingAutos(underlying); conversionCheckers.push_back(UnderlyingAutosChecker::create(underlyingAutos)); if (underlyingAutos.isAuto) return nullptr; LengthBox neutralBox( underlyingAutos.isTopAuto ? Length(Auto) : Length(0, Fixed), underlyingAutos.isRightAuto ? Length(Auto) : Length(0, Fixed), underlyingAutos.isBottomAuto ? Length(Auto) : Length(0, Fixed), underlyingAutos.isLeftAuto ? Length(Auto) : Length(0, Fixed)); return createClipValue(neutralBox, 1); }
InterpolationValue SVGNumberListInterpolationType::maybeConvertNeutral( const InterpolationValue& underlying, ConversionCheckers& conversionCheckers) const { size_t underlyingLength = UnderlyingLengthChecker::getUnderlyingLength(underlying); conversionCheckers.push_back( UnderlyingLengthChecker::create(underlyingLength)); if (underlyingLength == 0) return nullptr; std::unique_ptr<InterpolableList> result = InterpolableList::create(underlyingLength); for (size_t i = 0; i < underlyingLength; i++) result->set(i, InterpolableNumber::create(0)); return InterpolationValue(std::move(result)); }