Modified: trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp (274408 => 274409)
--- trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp 2021-03-15 06:20:04 UTC (rev 274408)
+++ trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp 2021-03-15 07:36:05 UTC (rev 274409)
@@ -100,13 +100,13 @@
return blend(from.length(), to.length(), progress, ValueRangeNonNegative);
}
-static inline LengthSize blendFunc(const CSSPropertyBlendingClient* anim, const LengthSize& from, const LengthSize& to, double progress)
+static inline LengthSize blendFunc(const CSSPropertyBlendingClient* client, const LengthSize& from, const LengthSize& to, double progress)
{
- return { blendFunc(anim, from.width, to.width, progress, ValueRangeNonNegative),
- blendFunc(anim, from.height, to.height, progress, ValueRangeNonNegative) };
+ return { blendFunc(client, from.width, to.width, progress, ValueRangeNonNegative),
+ blendFunc(client, from.height, to.height, progress, ValueRangeNonNegative) };
}
-static inline ShadowStyle blendFunc(const CSSPropertyBlendingClient* anim, ShadowStyle from, ShadowStyle to, double progress)
+static inline ShadowStyle blendFunc(const CSSPropertyBlendingClient* client, ShadowStyle from, ShadowStyle to, double progress)
{
if (from == to)
return to;
@@ -113,11 +113,11 @@
double fromVal = from == ShadowStyle::Normal ? 1 : 0;
double toVal = to == ShadowStyle::Normal ? 1 : 0;
- double result = blendFunc(anim, fromVal, toVal, progress);
+ double result = blendFunc(client, fromVal, toVal, progress);
return result > 0 ? ShadowStyle::Normal : ShadowStyle::Inset;
}
-static inline std::unique_ptr<ShadowData> blendFunc(const CSSPropertyBlendingClient* anim, const ShadowData* from, const ShadowData* to, double progress)
+static inline std::unique_ptr<ShadowData> blendFunc(const CSSPropertyBlendingClient* client, const ShadowData* from, const ShadowData* to, double progress)
{
ASSERT(from && to);
if (from->style() != to->style())
@@ -126,16 +126,16 @@
return makeUnique<ShadowData>(blend(from->location(), to->location(), progress),
blend(from->radius(), to->radius(), progress),
blend(from->spread(), to->spread(), progress),
- blendFunc(anim, from->style(), to->style(), progress),
+ blendFunc(client, from->style(), to->style(), progress),
from->isWebkitBoxShadow(),
blend(from->color(), to->color(), progress));
}
-static inline TransformOperations blendFunc(const CSSPropertyBlendingClient* animation, const TransformOperations& from, const TransformOperations& to, double progress)
+static inline TransformOperations blendFunc(const CSSPropertyBlendingClient* client, const TransformOperations& from, const TransformOperations& to, double progress)
{
- if (animation->transformFunctionListsMatch())
+ if (client->transformFunctionListsMatch())
return to.blendByMatchingOperations(from, progress);
- return to.blendByUsingMatrixInterpolation(from, progress, is<RenderBox>(animation->renderer()) ? downcast<RenderBox>(*animation->renderer()).borderBoxRect().size() : LayoutSize());
+ return to.blendByUsingMatrixInterpolation(from, progress, is<RenderBox>(client->renderer()) ? downcast<RenderBox>(*client->renderer()).borderBoxRect().size() : LayoutSize());
}
static RefPtr<ScaleTransformOperation> blendFunc(const CSSPropertyBlendingClient* client, ScaleTransformOperation* from, ScaleTransformOperation* to, double progress)
@@ -284,13 +284,13 @@
return ShapeValue::create(toShape.blend(fromShape, progress), to->cssBox());
}
-static inline RefPtr<FilterOperation> blendFunc(const CSSPropertyBlendingClient*, FilterOperation* fromOp, FilterOperation* toOp, double progress, bool blendToPassthrough = false)
+static inline RefPtr<FilterOperation> blendFunc(const CSSPropertyBlendingClient*, FilterOperation* from, FilterOperation* to, double progress, bool blendToPassthrough = false)
{
- ASSERT(toOp);
- return toOp->blend(fromOp, progress, blendToPassthrough);
+ ASSERT(to);
+ return to->blend(from, progress, blendToPassthrough);
}
-static inline FilterOperations blendFilterOperations(const CSSPropertyBlendingClient* anim, const FilterOperations& from, const FilterOperations& to, double progress)
+static inline FilterOperations blendFilterOperations(const CSSPropertyBlendingClient* client, const FilterOperations& from, const FilterOperations& to, double progress)
{
FilterOperations result;
size_t fromSize = from.operations().size();
@@ -299,7 +299,7 @@
for (size_t i = 0; i < size; i++) {
RefPtr<FilterOperation> fromOp = (i < fromSize) ? from.operations()[i].get() : 0;
RefPtr<FilterOperation> toOp = (i < toSize) ? to.operations()[i].get() : 0;
- RefPtr<FilterOperation> blendedOp = toOp ? blendFunc(anim, fromOp.get(), toOp.get(), progress) : (fromOp ? blendFunc(anim, 0, fromOp.get(), progress, true) : 0);
+ RefPtr<FilterOperation> blendedOp = toOp ? blendFunc(client, fromOp.get(), toOp.get(), progress) : (fromOp ? blendFunc(client, 0, fromOp.get(), progress, true) : 0);
if (blendedOp)
result.operations().append(blendedOp);
else {
@@ -313,7 +313,7 @@
return result;
}
-static inline FilterOperations blendFunc(const CSSPropertyBlendingClient* anim, const FilterOperations& from, const FilterOperations& to, double progress, CSSPropertyID propertyID = CSSPropertyFilter)
+static inline FilterOperations blendFunc(const CSSPropertyBlendingClient* client, const FilterOperations& from, const FilterOperations& to, double progress, CSSPropertyID propertyID = CSSPropertyFilter)
{
FilterOperations result;
@@ -322,15 +322,15 @@
bool listsMatch = false;
switch (propertyID) {
case CSSPropertyFilter:
- listsMatch = anim->filterFunctionListsMatch();
+ listsMatch = client->filterFunctionListsMatch();
break;
#if ENABLE(FILTERS_LEVEL_2)
case CSSPropertyWebkitBackdropFilter:
- listsMatch = anim->backdropFilterFunctionListsMatch();
+ listsMatch = client->backdropFilterFunctionListsMatch();
break;
#endif
case CSSPropertyAppleColorFilter:
- listsMatch = anim->colorFilterFunctionListsMatch();
+ listsMatch = client->colorFilterFunctionListsMatch();
break;
default:
break;
@@ -337,7 +337,7 @@
}
if (listsMatch)
- result = blendFilterOperations(anim, from, to, progress);
+ result = blendFilterOperations(client, from, to, progress);
else {
// If the filter function lists don't match, we could try to cross-fade, but don't yet have a way to represent that in CSS.
// For now we'll just fail to animate.
@@ -347,13 +347,13 @@
return result;
}
-static inline RefPtr<StyleImage> blendFilter(const CSSPropertyBlendingClient* anim, CachedImage* image, const FilterOperations& from, const FilterOperations& to, double progress)
+static inline RefPtr<StyleImage> blendFilter(const CSSPropertyBlendingClient* client, CachedImage* image, const FilterOperations& from, const FilterOperations& to, double progress)
{
ASSERT(image);
- FilterOperations filterResult = blendFilterOperations(anim, from, to, progress);
+ FilterOperations filterResult = blendFilterOperations(client, from, to, progress);
auto imageValue = CSSImageValue::create(*image);
- auto filterValue = ComputedStyleExtractor::valueForFilter(anim->currentStyle(), filterResult, DoNotAdjustPixelValues);
+ auto filterValue = ComputedStyleExtractor::valueForFilter(client->currentStyle(), filterResult, DoNotAdjustPixelValues);
auto result = CSSFilterImageValue::create(WTFMove(imageValue), WTFMove(filterValue));
result.get().setFilterOperations(filterResult);
@@ -360,7 +360,7 @@
return StyleGeneratedImage::create(WTFMove(result));
}
-static inline Visibility blendFunc(const CSSPropertyBlendingClient* anim, Visibility from, Visibility to, double progress)
+static inline Visibility blendFunc(const CSSPropertyBlendingClient* client, Visibility from, Visibility to, double progress)
{
// Any non-zero result means we consider the object to be visible. Only at 0 do we consider the object to be
// invisible. The invisible value we use (Visibility::Hidden vs. Visibility::Collapse) depends on the specified from/to values.
@@ -368,31 +368,30 @@
double toVal = to == Visibility::Visible ? 1. : 0.;
if (fromVal == toVal)
return to;
- double result = blendFunc(anim, fromVal, toVal, progress);
+ double result = blendFunc(client, fromVal, toVal, progress);
return result > 0. ? Visibility::Visible : (to != Visibility::Visible ? to : from);
}
-static inline TextUnderlineOffset blendFunc(const CSSPropertyBlendingClient* anim, const TextUnderlineOffset& from, const TextUnderlineOffset& to, double progress)
+static inline TextUnderlineOffset blendFunc(const CSSPropertyBlendingClient* client, const TextUnderlineOffset& from, const TextUnderlineOffset& to, double progress)
{
if (from.isLength() && to.isLength())
- return TextUnderlineOffset::createWithLength(blendFunc(anim, from.lengthValue(), to.lengthValue(), progress));
+ return TextUnderlineOffset::createWithLength(blendFunc(client, from.lengthValue(), to.lengthValue(), progress));
return TextUnderlineOffset::createWithAuto();
}
-static inline TextDecorationThickness blendFunc(const CSSPropertyBlendingClient* anim, const TextDecorationThickness& from, const TextDecorationThickness& to, double progress)
+static inline TextDecorationThickness blendFunc(const CSSPropertyBlendingClient* client, const TextDecorationThickness& from, const TextDecorationThickness& to, double progress)
{
if (from.isLength() && to.isLength())
- return TextDecorationThickness::createWithLength(blendFunc(anim, from.lengthValue(), to.lengthValue(), progress));
+ return TextDecorationThickness::createWithLength(blendFunc(client, from.lengthValue(), to.lengthValue(), progress));
return TextDecorationThickness::createWithAuto();
}
-static inline LengthBox blendFunc(const CSSPropertyBlendingClient* anim, const LengthBox& from, const LengthBox& to, double progress, ValueRange valueRange = ValueRangeNonNegative)
+static inline LengthBox blendFunc(const CSSPropertyBlendingClient* client, const LengthBox& from, const LengthBox& to, double progress, ValueRange valueRange = ValueRangeNonNegative)
{
- LengthBox result(blendFunc(anim, from.top(), to.top(), progress, valueRange),
- blendFunc(anim, from.right(), to.right(), progress, valueRange),
- blendFunc(anim, from.bottom(), to.bottom(), progress, valueRange),
- blendFunc(anim, from.left(), to.left(), progress, valueRange));
-
+ LengthBox result(blendFunc(client, from.top(), to.top(), progress, valueRange),
+ blendFunc(client, from.right(), to.right(), progress, valueRange),
+ blendFunc(client, from.bottom(), to.bottom(), progress, valueRange),
+ blendFunc(client, from.left(), to.left(), progress, valueRange));
return result;
}
@@ -441,7 +440,7 @@
return StyleGeneratedImage::create(WTFMove(crossfadeValue));
}
-static inline RefPtr<StyleImage> blendFunc(const CSSPropertyBlendingClient* anim, StyleImage* from, StyleImage* to, double progress)
+static inline RefPtr<StyleImage> blendFunc(const CSSPropertyBlendingClient* client, StyleImage* from, StyleImage* to, double progress)
{
if (!from || !to)
return to;
@@ -463,7 +462,7 @@
CSSFilterImageValue& fromFilter = downcast<CSSFilterImageValue>(fromGenerated);
CSSFilterImageValue& toFilter = downcast<CSSFilterImageValue>(toGenerated);
if (fromFilter.equalInputImages(toFilter) && fromFilter.cachedImage())
- return blendFilter(anim, fromFilter.cachedImage(), fromFilter.filterOperations(), toFilter.filterOperations(), progress);
+ return blendFilter(client, fromFilter.cachedImage(), fromFilter.filterOperations(), toFilter.filterOperations(), progress);
}
if (is<CSSCrossfadeValue>(fromGenerated) && is<CSSCrossfadeValue>(toGenerated)) {
@@ -482,7 +481,7 @@
if (is<CSSFilterImageValue>(fromGenerated)) {
CSSFilterImageValue& fromFilter = downcast<CSSFilterImageValue>(fromGenerated);
if (fromFilter.cachedImage() && downcast<StyleCachedImage>(*to).cachedImage() == fromFilter.cachedImage())
- return blendFilter(anim, fromFilter.cachedImage(), fromFilter.filterOperations(), FilterOperations(), progress);
+ return blendFilter(client, fromFilter.cachedImage(), fromFilter.filterOperations(), FilterOperations(), progress);
}
// FIXME: Add interpolation between cross-fade and image source.
} else if (is<StyleCachedImage>(*from) && is<StyleGeneratedImage>(*to)) {
@@ -490,7 +489,7 @@
if (is<CSSFilterImageValue>(toGenerated)) {
CSSFilterImageValue& toFilter = downcast<CSSFilterImageValue>(toGenerated);
if (toFilter.cachedImage() && downcast<StyleCachedImage>(*from).cachedImage() == toFilter.cachedImage())
- return blendFilter(anim, toFilter.cachedImage(), FilterOperations(), toFilter.filterOperations(), progress);
+ return blendFilter(client, toFilter.cachedImage(), FilterOperations(), toFilter.filterOperations(), progress);
}
// FIXME: Add interpolation between image source and cross-fade.
}
@@ -498,12 +497,12 @@
// FIXME: Add support cross fade between cached and generated images.
// https://bugs.webkit.org/show_bug.cgi?id=78293
if (is<StyleCachedImage>(*from) && is<StyleCachedImage>(*to))
- return crossfadeBlend(anim, downcast<StyleCachedImage>(from), downcast<StyleCachedImage>(to), progress);
+ return crossfadeBlend(client, downcast<StyleCachedImage>(from), downcast<StyleCachedImage>(to), progress);
return to;
}
-static inline NinePieceImage blendFunc(const CSSPropertyBlendingClient* anim, const NinePieceImage& from, const NinePieceImage& to, double progress)
+static inline NinePieceImage blendFunc(const CSSPropertyBlendingClient* client, const NinePieceImage& from, const NinePieceImage& to, double progress)
{
if (!from.hasImage() || !to.hasImage())
return to;
@@ -513,18 +512,18 @@
if (from.imageSlices() != to.imageSlices() || from.borderSlices() != to.borderSlices() || from.outset() != to.outset() || from.fill() != to.fill() || from.horizontalRule() != to.horizontalRule() || from.verticalRule() != to.verticalRule())
return to;
- if (auto* renderer = anim->renderer()) {
+ if (auto* renderer = client->renderer()) {
if (from.image()->imageSize(renderer, 1.0) != to.image()->imageSize(renderer, 1.0))
return to;
}
- return NinePieceImage(blendFunc(anim, from.image(), to.image(), progress),
+ return NinePieceImage(blendFunc(client, from.image(), to.image(), progress),
from.imageSlices(), from.fill(), from.borderSlices(), from.outset(), from.horizontalRule(), from.verticalRule());
}
#if ENABLE(VARIATION_FONTS)
-static inline FontVariationSettings blendFunc(const CSSPropertyBlendingClient* anim, const FontVariationSettings& from, const FontVariationSettings& to, double progress)
+static inline FontVariationSettings blendFunc(const CSSPropertyBlendingClient* client, const FontVariationSettings& from, const FontVariationSettings& to, double progress)
{
if (!progress)
return from;
@@ -539,7 +538,7 @@
auto& fromItem = from.at(i);
auto& toItem = to.at(i);
ASSERT(fromItem.tag() == toItem.tag());
- float interpolated = blendFunc(anim, fromItem.value(), toItem.value(), progress);
+ float interpolated = blendFunc(client, fromItem.value(), toItem.value(), progress);
result.insert({ fromItem.tag(), interpolated });
}
return result;
@@ -547,14 +546,14 @@
#endif
-static inline FontSelectionValue blendFunc(const CSSPropertyBlendingClient* anim, FontSelectionValue from, FontSelectionValue to, double progress)
+static inline FontSelectionValue blendFunc(const CSSPropertyBlendingClient* client, FontSelectionValue from, FontSelectionValue to, double progress)
{
- return FontSelectionValue(blendFunc(anim, static_cast<float>(from), static_cast<float>(to), progress));
+ return FontSelectionValue(blendFunc(client, static_cast<float>(from), static_cast<float>(to), progress));
}
-static inline Optional<FontSelectionValue> blendFunc(const CSSPropertyBlendingClient* anim, Optional<FontSelectionValue> from, Optional<FontSelectionValue> to, double progress)
+static inline Optional<FontSelectionValue> blendFunc(const CSSPropertyBlendingClient* client, Optional<FontSelectionValue> from, Optional<FontSelectionValue> to, double progress)
{
- return FontSelectionValue(blendFunc(anim, static_cast<float>(from.value()), static_cast<float>(to.value()), progress));
+ return FontSelectionValue(blendFunc(client, static_cast<float>(from.value()), static_cast<float>(to.value()), progress));
}
class AnimationPropertyWrapperBase {
@@ -561,27 +560,27 @@
WTF_MAKE_NONCOPYABLE(AnimationPropertyWrapperBase);
WTF_MAKE_FAST_ALLOCATED;
public:
- explicit AnimationPropertyWrapperBase(CSSPropertyID prop)
- : m_prop(prop)
+ explicit AnimationPropertyWrapperBase(CSSPropertyID property)
+ : m_property(property)
{
}
virtual ~AnimationPropertyWrapperBase() = default;
virtual bool isShorthandWrapper() const { return false; }
- virtual bool equals(const RenderStyle* a, const RenderStyle* b) const = 0;
+ virtual bool equals(const RenderStyle*, const RenderStyle*) const = 0;
virtual bool canInterpolate(const RenderStyle*, const RenderStyle*) const { return true; }
virtual void blend(const CSSPropertyBlendingClient*, RenderStyle*, const RenderStyle*, const RenderStyle*, double) const = 0;
#if !LOG_DISABLED
- virtual void logBlend(const RenderStyle* a, const RenderStyle* b, const RenderStyle* result, double) const = 0;
+ virtual void logBlend(const RenderStyle*, const RenderStyle*, const RenderStyle*, double) const = 0;
#endif
- CSSPropertyID property() const { return m_prop; }
+ CSSPropertyID property() const { return m_property; }
virtual bool animationIsAccelerated() const { return false; }
private:
- CSSPropertyID m_prop;
+ CSSPropertyID m_property;
};
template <typename T>
@@ -588,12 +587,18 @@
class PropertyWrapperGetter : public AnimationPropertyWrapperBase {
WTF_MAKE_FAST_ALLOCATED;
public:
- PropertyWrapperGetter(CSSPropertyID prop, T (RenderStyle::*getter)() const)
- : AnimationPropertyWrapperBase(prop)
+ PropertyWrapperGetter(CSSPropertyID property, T (RenderStyle::*getter)() const)
+ : AnimationPropertyWrapperBase(property)
, m_getter(getter)
{
}
+ T value(const RenderStyle* style) const
+ {
+ return (style->*m_getter)();
+ }
+
+private:
bool equals(const RenderStyle* a, const RenderStyle* b) const override
{
if (a == b)
@@ -600,22 +605,16 @@
return true;
if (!a || !b)
return false;
- return this->value(a) == this->value(b);
+ return value(a) == value(b);
}
- T value(const RenderStyle* a) const
- {
- return (a->*m_getter)();
- }
-
#if !LOG_DISABLED
- void logBlend(const RenderStyle* a, const RenderStyle* b, const RenderStyle* result, double progress) const final
+ void logBlend(const RenderStyle* from, const RenderStyle* to, const RenderStyle* result, double progress) const final
{
- LOG_WITH_STREAM(Animations, stream << " blending " << getPropertyName(property()) << " from " << value(a) << " to " << value(b) << " at " << TextStream::FormatNumberRespectingIntegers(progress) << " -> " << value(result));
+ LOG_WITH_STREAM(Animations, stream << " blending " << getPropertyName(property()) << " from " << value(from) << " to " << value(to) << " at " << TextStream::FormatNumberRespectingIntegers(progress) << " -> " << value(result));
}
#endif
-protected:
T (RenderStyle::*m_getter)() const;
};
@@ -623,15 +622,15 @@
class PropertyWrapper : public PropertyWrapperGetter<T> {
WTF_MAKE_FAST_ALLOCATED;
public:
- PropertyWrapper(CSSPropertyID prop, T (RenderStyle::*getter)() const, void (RenderStyle::*setter)(T))
- : PropertyWrapperGetter<T>(prop, getter)
+ PropertyWrapper(CSSPropertyID property, T (RenderStyle::*getter)() const, void (RenderStyle::*setter)(T))
+ : PropertyWrapperGetter<T>(property, getter)
, m_setter(setter)
{
}
- void blend(const CSSPropertyBlendingClient* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
+ void blend(const CSSPropertyBlendingClient* client, RenderStyle* destination, const RenderStyle* from, const RenderStyle* to, double progress) const override
{
- (dst->*m_setter)(blendFunc(anim, this->value(a), this->value(b), progress));
+ (destination->*m_setter)(blendFunc(client, this->value(from), this->value(to), progress));
}
protected:
@@ -648,7 +647,6 @@
}
private:
-
void blend(const CSSPropertyBlendingClient* client, RenderStyle* destination, const RenderStyle* from, const RenderStyle* to, double progress) const final
{
auto blendedValue = blendFunc(client, this->value(from), this->value(to), progress);
@@ -657,24 +655,24 @@
};
template <typename T>
-class DiscretePropertyWrapper : public PropertyWrapperGetter<T> {
+class DiscretePropertyWrapper final : public PropertyWrapperGetter<T> {
WTF_MAKE_FAST_ALLOCATED;
public:
- DiscretePropertyWrapper(CSSPropertyID prop, T (RenderStyle::*getter)() const, void (RenderStyle::*setter)(T))
- : PropertyWrapperGetter<T>(prop, getter)
+ DiscretePropertyWrapper(CSSPropertyID property, T (RenderStyle::*getter)() const, void (RenderStyle::*setter)(T))
+ : PropertyWrapperGetter<T>(property, getter)
, m_setter(setter)
{
}
+private:
bool canInterpolate(const RenderStyle*, const RenderStyle*) const final { return false; }
- void blend(const CSSPropertyBlendingClient*, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
+ void blend(const CSSPropertyBlendingClient*, RenderStyle* destination, const RenderStyle* from, const RenderStyle* to, double progress) const final
{
ASSERT(!progress || progress == 1.0);
- (dst->*m_setter)(this->value(progress ? b : a));
+ (destination->*this->m_setter)(this->value(progress ? to : from));
}
-protected:
void (RenderStyle::*m_setter)(T);
};
@@ -682,24 +680,24 @@
class RefCountedPropertyWrapper : public PropertyWrapperGetter<T*> {
WTF_MAKE_FAST_ALLOCATED;
public:
- RefCountedPropertyWrapper(CSSPropertyID prop, T* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(RefPtr<T>&&))
- : PropertyWrapperGetter<T*>(prop, getter)
+ RefCountedPropertyWrapper(CSSPropertyID property, T* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(RefPtr<T>&&))
+ : PropertyWrapperGetter<T*>(property, getter)
, m_setter(setter)
{
}
- void blend(const CSSPropertyBlendingClient* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
+private:
+ void blend(const CSSPropertyBlendingClient* client, RenderStyle* destination, const RenderStyle* from, const RenderStyle* to, double progress) const final
{
- (dst->*m_setter)(blendFunc(anim, this->value(a), this->value(b), progress));
+ (destination->*this->m_setter)(blendFunc(client, this->value(from), this->value(to), progress));
}
-protected:
void (RenderStyle::*m_setter)(RefPtr<T>&&);
};
-static bool canInterpolateLengths(const Length& a, const Length& b, bool isLengthPercentage)
+static bool canInterpolateLengths(const Length& from, const Length& to, bool isLengthPercentage)
{
- if (a.type() == b.type())
+ if (from.type() == to.type())
return true;
// Some properties allow for <length-percentage> and <number> values. We must allow animating
@@ -707,15 +705,15 @@
// a <length> or <percentage>. We can use Length::isRelative() to determine whether we are
// dealing with a <number> as opposed to a <length> or <percentage>.
if (isLengthPercentage) {
- return (a.isFixed() || a.isPercentOrCalculated() || a.isRelative())
- && (b.isFixed() || b.isPercentOrCalculated() || b.isRelative())
- && a.isRelative() == b.isRelative();
+ return (from.isFixed() || from.isPercentOrCalculated() || from.isRelative())
+ && (to.isFixed() || to.isPercentOrCalculated() || to.isRelative())
+ && from.isRelative() == to.isRelative();
}
return false;
}
-class LengthPropertyWrapper : public PropertyWrapperGetter<const Length&> {
+class LengthPropertyWrapper final : public PropertyWrapperGetter<const Length&> {
WTF_MAKE_FAST_ALLOCATED;
public:
enum class Flags {
@@ -722,71 +720,69 @@
IsLengthPercentage = 1 << 0,
NegativeLengthsAreInvalid = 1 << 1,
};
- LengthPropertyWrapper(CSSPropertyID prop, const Length& (RenderStyle::*getter)() const, void (RenderStyle::*setter)(Length&&), OptionSet<Flags> flags = { })
- : PropertyWrapperGetter<const Length&>(prop, getter)
+ LengthPropertyWrapper(CSSPropertyID property, const Length& (RenderStyle::*getter)() const, void (RenderStyle::*setter)(Length&&), OptionSet<Flags> flags = { })
+ : PropertyWrapperGetter<const Length&>(property, getter)
, m_setter(setter)
, m_flags(flags)
{
}
- bool canInterpolate(const RenderStyle* a, const RenderStyle* b) const override
+private:
+ bool canInterpolate(const RenderStyle* from, const RenderStyle* to) const final
{
- return canInterpolateLengths(this->value(a), this->value(b), m_flags.contains(Flags::IsLengthPercentage));
+ return canInterpolateLengths(value(from), value(to), m_flags.contains(Flags::IsLengthPercentage));
}
- void blend(const CSSPropertyBlendingClient* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
+ void blend(const CSSPropertyBlendingClient* client, RenderStyle* destination, const RenderStyle* from, const RenderStyle* to, double progress) const final
{
auto valueRange = m_flags.contains(Flags::NegativeLengthsAreInvalid) ? ValueRangeNonNegative : ValueRangeAll;
- (dst->*m_setter)(blendFunc(anim, this->value(a), this->value(b), progress, valueRange));
+ (destination->*m_setter)(blendFunc(client, value(from), value(to), progress, valueRange));
}
-protected:
void (RenderStyle::*m_setter)(Length&&);
-
-private:
OptionSet<Flags> m_flags;
};
-static bool canInterpolateLengthVariants(const LengthSize& a, const LengthSize& b)
+static bool canInterpolateLengthVariants(const LengthSize& from, const LengthSize& to)
{
bool isLengthPercentage = true;
- return canInterpolateLengths(a.width, b.width, isLengthPercentage)
- && canInterpolateLengths(a.height, b.height, isLengthPercentage);
+ return canInterpolateLengths(from.width, to.width, isLengthPercentage)
+ && canInterpolateLengths(from.height, to.height, isLengthPercentage);
}
-static bool canInterpolateLengthVariants(const GapLength& a, const GapLength& b)
+static bool canInterpolateLengthVariants(const GapLength& from, const GapLength& to)
{
- if (a.isNormal() || b.isNormal())
+ if (from.isNormal() || to.isNormal())
return false;
bool isLengthPercentage = true;
- return canInterpolateLengths(a.length(), b.length(), isLengthPercentage);
+ return canInterpolateLengths(from.length(), to.length(), isLengthPercentage);
}
template <typename T>
-class LengthVariantPropertyWrapper : public PropertyWrapperGetter<const T&> {
+class LengthVariantPropertyWrapper final : public PropertyWrapperGetter<const T&> {
WTF_MAKE_FAST_ALLOCATED;
public:
- LengthVariantPropertyWrapper(CSSPropertyID prop, const T& (RenderStyle::*getter)() const, void (RenderStyle::*setter)(T&&))
- : PropertyWrapperGetter<const T&>(prop, getter)
+ LengthVariantPropertyWrapper(CSSPropertyID property, const T& (RenderStyle::*getter)() const, void (RenderStyle::*setter)(T&&))
+ : PropertyWrapperGetter<const T&>(property, getter)
, m_setter(setter)
{
}
- bool canInterpolate(const RenderStyle* a, const RenderStyle* b) const override
+private:
+ bool canInterpolate(const RenderStyle* from, const RenderStyle* to) const final
{
- return canInterpolateLengthVariants(this->value(a), this->value(b));
+ return canInterpolateLengthVariants(this->value(from), this->value(to));
}
- void blend(const CSSPropertyBlendingClient* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
+ void blend(const CSSPropertyBlendingClient* client, RenderStyle* destination, const RenderStyle* from, const RenderStyle* to, double progress) const final
{
- (dst->*m_setter)(blendFunc(anim, this->value(a), this->value(b), progress));
+ (destination->*m_setter)(blendFunc(client, this->value(from), this->value(to), progress));
}
-protected:
void (RenderStyle::*m_setter)(T&&);
};
-class LengthBoxPropertyWrapper : public PropertyWrapperGetter<const LengthBox&> {
+class LengthBoxPropertyWrapper final : public PropertyWrapperGetter<const LengthBox&> {
WTF_MAKE_FAST_ALLOCATED;
public:
enum class Flags {
@@ -794,51 +790,50 @@
UsesFillKeyword = 1 << 1,
AllowsNegativeValues = 1 << 2,
};
- LengthBoxPropertyWrapper(CSSPropertyID prop, const LengthBox& (RenderStyle::*getter)() const, void (RenderStyle::*setter)(LengthBox&&), OptionSet<Flags> flags = { })
- : PropertyWrapperGetter<const LengthBox&>(prop, getter)
+ LengthBoxPropertyWrapper(CSSPropertyID property, const LengthBox& (RenderStyle::*getter)() const, void (RenderStyle::*setter)(LengthBox&&), OptionSet<Flags> flags = { })
+ : PropertyWrapperGetter<const LengthBox&>(property, getter)
, m_setter(setter)
, m_flags(flags)
{
}
- bool canInterpolate(const RenderStyle* a, const RenderStyle* b) const override
+private:
+ bool canInterpolate(const RenderStyle* from, const RenderStyle* to) const final
{
- if (m_flags.contains(Flags::UsesFillKeyword) && a->borderImage().fill() != b->borderImage().fill())
+ if (m_flags.contains(Flags::UsesFillKeyword) && from->borderImage().fill() != to->borderImage().fill())
return false;
- auto& aLengthBox = this->value(a);
- auto& bLengthBox = this->value(b);
+ auto& fromLengthBox = value(from);
+ auto& toLengthBox = value(to);
bool isLengthPercentage = m_flags.contains(Flags::IsLengthPercentage);
- return canInterpolateLengths(aLengthBox.top(), bLengthBox.top(), isLengthPercentage)
- && canInterpolateLengths(aLengthBox.right(), bLengthBox.right(), isLengthPercentage)
- && canInterpolateLengths(aLengthBox.bottom(), bLengthBox.bottom(), isLengthPercentage)
- && canInterpolateLengths(aLengthBox.left(), bLengthBox.left(), isLengthPercentage);
+ return canInterpolateLengths(fromLengthBox.top(), toLengthBox.top(), isLengthPercentage)
+ && canInterpolateLengths(fromLengthBox.right(), toLengthBox.right(), isLengthPercentage)
+ && canInterpolateLengths(fromLengthBox.bottom(), toLengthBox.bottom(), isLengthPercentage)
+ && canInterpolateLengths(fromLengthBox.left(), toLengthBox.left(), isLengthPercentage);
}
- void blend(const CSSPropertyBlendingClient* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
+ void blend(const CSSPropertyBlendingClient* client, RenderStyle* destination, const RenderStyle* from, const RenderStyle* to, double progress) const final
{
if (m_flags.contains(Flags::UsesFillKeyword))
- dst->setBorderImageSliceFill((!progress || canInterpolate(a, b) ? a : b)->borderImage().fill());
+ destination->setBorderImageSliceFill((!progress || canInterpolate(from, to) ? from : to)->borderImage().fill());
auto valueRange = m_flags.contains(Flags::AllowsNegativeValues) ? ValueRangeAll : ValueRangeNonNegative;
- (dst->*m_setter)(blendFunc(anim, this->value(a), this->value(b), progress, valueRange));
+ (destination->*m_setter)(blendFunc(client, value(from), value(to), progress, valueRange));
}
-protected:
void (RenderStyle::*m_setter)(LengthBox&&);
-
-private:
OptionSet<Flags> m_flags;
};
-class PropertyWrapperClipPath : public RefCountedPropertyWrapper<ClipPathOperation> {
+class PropertyWrapperClipPath final : public RefCountedPropertyWrapper<ClipPathOperation> {
WTF_MAKE_FAST_ALLOCATED;
public:
- PropertyWrapperClipPath(CSSPropertyID prop, ClipPathOperation* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(RefPtr<ClipPathOperation>&&))
- : RefCountedPropertyWrapper<ClipPathOperation>(prop, getter, setter)
+ PropertyWrapperClipPath(CSSPropertyID property, ClipPathOperation* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(RefPtr<ClipPathOperation>&&))
+ : RefCountedPropertyWrapper<ClipPathOperation>(property, getter, setter)
{
}
- bool equals(const RenderStyle* a, const RenderStyle* b) const override
+private:
+ bool equals(const RenderStyle* a, const RenderStyle* b) const final
{
// If the style pointers are the same, don't bother doing the test.
// If either is null, return false. If both are null, return true.
@@ -847,8 +842,8 @@
if (!a || !b)
return false;
- auto* clipPathA = this->value(a);
- auto* clipPathB = this->value(b);
+ auto* clipPathA = value(a);
+ auto* clipPathB = value(b);
if (clipPathA == clipPathB)
return true;
if (!clipPathA || !clipPathB)
@@ -858,15 +853,16 @@
};
#if ENABLE(VARIATION_FONTS)
-class PropertyWrapperFontVariationSettings : public PropertyWrapper<FontVariationSettings> {
+class PropertyWrapperFontVariationSettings final : public PropertyWrapper<FontVariationSettings> {
WTF_MAKE_FAST_ALLOCATED;
public:
- PropertyWrapperFontVariationSettings(CSSPropertyID prop, FontVariationSettings (RenderStyle::*getter)() const, void (RenderStyle::*setter)(FontVariationSettings))
- : PropertyWrapper<FontVariationSettings>(prop, getter, setter)
+ PropertyWrapperFontVariationSettings(CSSPropertyID property, FontVariationSettings (RenderStyle::*getter)() const, void (RenderStyle::*setter)(FontVariationSettings))
+ : PropertyWrapper<FontVariationSettings>(property, getter, setter)
{
}
- bool equals(const RenderStyle* a, const RenderStyle* b) const override
+private:
+ bool equals(const RenderStyle* a, const RenderStyle* b) const final
{
// If the style pointers are the same, don't bother doing the test.
// If either is null, return false. If both are null, return true.
@@ -874,20 +870,20 @@
return true;
if (!a || !b)
return false;
- return this->value(a) == this->value(b);
+ return value(a) == value(b);
}
- bool canInterpolate(const RenderStyle* a, const RenderStyle* b) const override
+ bool canInterpolate(const RenderStyle* from, const RenderStyle* to) const final
{
- auto aVariationSettings = value(a);
- auto bVariationSettings = value(b);
+ auto fromVariationSettings = value(from);
+ auto toVariationSettings = value(to);
- if (aVariationSettings.size() != bVariationSettings.size())
+ if (fromVariationSettings.size() != toVariationSettings.size())
return false;
- auto size = aVariationSettings.size();
+ auto size = fromVariationSettings.size();
for (unsigned i = 0; i < size; ++i) {
- if (aVariationSettings.at(i).tag() != bVariationSettings.at(i).tag())
+ if (fromVariationSettings.at(i).tag() != toVariationSettings.at(i).tag())
return false;
}
@@ -896,15 +892,16 @@
};
#endif
-class PropertyWrapperShape : public RefCountedPropertyWrapper<ShapeValue> {
+class PropertyWrapperShape final : public RefCountedPropertyWrapper<ShapeValue> {
WTF_MAKE_FAST_ALLOCATED;
public:
- PropertyWrapperShape(CSSPropertyID prop, ShapeValue* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(RefPtr<ShapeValue>&&))
- : RefCountedPropertyWrapper<ShapeValue>(prop, getter, setter)
+ PropertyWrapperShape(CSSPropertyID property, ShapeValue* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(RefPtr<ShapeValue>&&))
+ : RefCountedPropertyWrapper<ShapeValue>(property, getter, setter)
{
}
- bool equals(const RenderStyle* a, const RenderStyle* b) const override
+private:
+ bool equals(const RenderStyle* a, const RenderStyle* b) const final
{
// If the style pointers are the same, don't bother doing the test.
// If either is null, return false. If both are null, return true.
@@ -913,8 +910,8 @@
if (!a || !b)
return false;
- auto* shapeA = this->value(a);
- auto* shapeB = this->value(b);
+ auto* shapeA = value(a);
+ auto* shapeB = value(b);
if (shapeA == shapeB)
return true;
if (!shapeA || !shapeB)
@@ -923,15 +920,16 @@
}
};
-class StyleImagePropertyWrapper : public RefCountedPropertyWrapper<StyleImage> {
+class StyleImagePropertyWrapper final : public RefCountedPropertyWrapper<StyleImage> {
WTF_MAKE_FAST_ALLOCATED;
public:
- StyleImagePropertyWrapper(CSSPropertyID prop, StyleImage* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(RefPtr<StyleImage>&&))
- : RefCountedPropertyWrapper<StyleImage>(prop, getter, setter)
+ StyleImagePropertyWrapper(CSSPropertyID property, StyleImage* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(RefPtr<StyleImage>&&))
+ : RefCountedPropertyWrapper<StyleImage>(property, getter, setter)
{
}
- bool equals(const RenderStyle* a, const RenderStyle* b) const override
+private:
+ bool equals(const RenderStyle* a, const RenderStyle* b) const final
{
if (a == b)
return true;
@@ -938,23 +936,23 @@
if (!a || !b)
return false;
- auto* imageA = this->value(a);
- auto* imageB = this->value(b);
+ auto* imageA = value(a);
+ auto* imageB = value(b);
return arePointingToEqualData(imageA, imageB);
}
};
template <typename T>
-class AcceleratedPropertyWrapper : public PropertyWrapper<T> {
+class AcceleratedPropertyWrapper final : public PropertyWrapper<T> {
WTF_MAKE_FAST_ALLOCATED;
public:
- AcceleratedPropertyWrapper(CSSPropertyID prop, T (RenderStyle::*getter)() const, void (RenderStyle::*setter)(T))
- : PropertyWrapper<T>(prop, getter, setter)
+ AcceleratedPropertyWrapper(CSSPropertyID property, T (RenderStyle::*getter)() const, void (RenderStyle::*setter)(T))
+ : PropertyWrapper<T>(property, getter, setter)
{
}
private:
- bool animationIsAccelerated() const override { return true; }
+ bool animationIsAccelerated() const final { return true; }
};
template <typename T>
@@ -961,8 +959,8 @@
class AcceleratedIndividualTransformPropertyWrapper final : public RefCountedPropertyWrapper<T> {
WTF_MAKE_FAST_ALLOCATED;
public:
- AcceleratedIndividualTransformPropertyWrapper(CSSPropertyID prop, T* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(RefPtr<T>&&))
- : RefCountedPropertyWrapper<T>(prop, getter, setter)
+ AcceleratedIndividualTransformPropertyWrapper(CSSPropertyID property, T* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(RefPtr<T>&&))
+ : RefCountedPropertyWrapper<T>(property, getter, setter)
{
}
@@ -975,7 +973,7 @@
}
};
-class PropertyWrapperFilter : public PropertyWrapper<const FilterOperations&> {
+class PropertyWrapperFilter final : public PropertyWrapper<const FilterOperations&> {
WTF_MAKE_FAST_ALLOCATED;
public:
PropertyWrapperFilter(CSSPropertyID propertyID, const FilterOperations& (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const FilterOperations&))
@@ -983,7 +981,8 @@
{
}
- bool animationIsAccelerated() const override
+private:
+ bool animationIsAccelerated() const final
{
return property() == CSSPropertyFilter
#if ENABLE(FILTERS_LEVEL_2)
@@ -992,9 +991,9 @@
;
}
- void blend(const CSSPropertyBlendingClient* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
+ void blend(const CSSPropertyBlendingClient* client, RenderStyle* destination, const RenderStyle* from, const RenderStyle* to, double progress) const final
{
- (dst->*m_setter)(blendFunc(anim, this->value(a), this->value(b), progress, property()));
+ (destination->*m_setter)(blendFunc(client, value(from), value(to), progress, property()));
}
};
@@ -1022,17 +1021,18 @@
return otherShadow->isWebkitBoxShadow() ? &defaultWebKitBoxShadowData.get() : &defaultShadowData.get();
}
-class PropertyWrapperShadow : public AnimationPropertyWrapperBase {
+class PropertyWrapperShadow final : public AnimationPropertyWrapperBase {
WTF_MAKE_FAST_ALLOCATED;
public:
- PropertyWrapperShadow(CSSPropertyID prop, const ShadowData* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(std::unique_ptr<ShadowData>, bool))
- : AnimationPropertyWrapperBase(prop)
+ PropertyWrapperShadow(CSSPropertyID property, const ShadowData* (RenderStyle::*getter)() const, void (RenderStyle::*setter)(std::unique_ptr<ShadowData>, bool))
+ : AnimationPropertyWrapperBase(property)
, m_getter(getter)
, m_setter(setter)
{
}
- bool equals(const RenderStyle* a, const RenderStyle* b) const override
+private:
+ bool equals(const RenderStyle* a, const RenderStyle* b) const final
{
if (a == b)
return true;
@@ -1061,20 +1061,20 @@
return true;
}
- void blend(const CSSPropertyBlendingClient* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
+ void blend(const CSSPropertyBlendingClient* client, RenderStyle* destination, const RenderStyle* from, const RenderStyle* to, double progress) const final
{
- const ShadowData* shadowA = (a->*m_getter)();
- const ShadowData* shadowB = (b->*m_getter)();
+ const ShadowData* fromShadow = (from->*m_getter)();
+ const ShadowData* toShadow = (to->*m_getter)();
- int fromLength = shadowListLength(shadowA);
- int toLength = shadowListLength(shadowB);
+ int fromLength = shadowListLength(fromShadow);
+ int toLength = shadowListLength(toShadow);
if (fromLength == toLength || (fromLength <= 1 && toLength <= 1)) {
- (dst->*m_setter)(blendSimpleOrMatchedShadowLists(anim, progress, shadowA, shadowB), false);
+ (destination->*m_setter)(blendSimpleOrMatchedShadowLists(client, progress, fromShadow, toShadow), false);
return;
}
- (dst->*m_setter)(blendMismatchedShadowLists(anim, progress, shadowA, shadowB, fromLength, toLength), false);
+ (destination->*m_setter)(blendMismatchedShadowLists(client, progress, fromShadow, toShadow, fromLength, toLength), false);
}
#if !LOG_DISABLED
@@ -1085,8 +1085,7 @@
}
#endif
-private:
- std::unique_ptr<ShadowData> blendSimpleOrMatchedShadowLists(const CSSPropertyBlendingClient* anim, double progress, const ShadowData* shadowA, const ShadowData* shadowB) const
+ std::unique_ptr<ShadowData> blendSimpleOrMatchedShadowLists(const CSSPropertyBlendingClient* client, double progress, const ShadowData* shadowA, const ShadowData* shadowB) const
{
std::unique_ptr<ShadowData> newShadowData;
ShadowData* lastShadow = 0;
@@ -1095,7 +1094,7 @@
const ShadowData* srcShadow = shadowForBlending(shadowA, shadowB);
const ShadowData* dstShadow = shadowForBlending(shadowB, shadowA);
- std::unique_ptr<ShadowData> blendedShadow = blendFunc(anim, srcShadow, dstShadow, progress);
+ std::unique_ptr<ShadowData> blendedShadow = blendFunc(client, srcShadow, dstShadow, progress);
ShadowData* blendedShadowPtr = blendedShadow.get();
if (!lastShadow)
@@ -1112,7 +1111,7 @@
return newShadowData;
}
- std::unique_ptr<ShadowData> blendMismatchedShadowLists(const CSSPropertyBlendingClient* anim, double progress, const ShadowData* shadowA, const ShadowData* shadowB, int fromLength, int toLength) const
+ std::unique_ptr<ShadowData> blendMismatchedShadowLists(const CSSPropertyBlendingClient* client, double progress, const ShadowData* shadowA, const ShadowData* shadowB, int fromLength, int toLength) const
{
// The shadows in ShadowData are stored in reverse order, so when animating mismatched lists,
// reverse them and match from the end.
@@ -1138,7 +1137,7 @@
const ShadowData* srcShadow = shadowForBlending(fromShadow, toShadow);
const ShadowData* dstShadow = shadowForBlending(toShadow, fromShadow);
- std::unique_ptr<ShadowData> blendedShadow = blendFunc(anim, srcShadow, dstShadow, progress);
+ std::unique_ptr<ShadowData> blendedShadow = blendFunc(client, srcShadow, dstShadow, progress);
// Insert at the start of the list to preserve the order.
blendedShadow->setNext(WTFMove(newShadowData));
newShadowData = WTFMove(blendedShadow);
@@ -1151,17 +1150,18 @@
void (RenderStyle::*m_setter)(std::unique_ptr<ShadowData>, bool);
};
-class PropertyWrapperMaybeInvalidColor : public AnimationPropertyWrapperBase {
+class PropertyWrapperMaybeInvalidColor final : public AnimationPropertyWrapperBase {
WTF_MAKE_FAST_ALLOCATED;
public:
- PropertyWrapperMaybeInvalidColor(CSSPropertyID prop, const Color& (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&))
- : AnimationPropertyWrapperBase(prop)
+ PropertyWrapperMaybeInvalidColor(CSSPropertyID property, const Color& (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&))
+ : AnimationPropertyWrapperBase(property)
, m_getter(getter)
, m_setter(setter)
{
}
- bool equals(const RenderStyle* a, const RenderStyle* b) const override
+private:
+ bool equals(const RenderStyle* a, const RenderStyle* b) const final
{
if (a == b)
return true;
@@ -1182,35 +1182,34 @@
return fromColor == toColor;
}
- void blend(const CSSPropertyBlendingClient* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
+ void blend(const CSSPropertyBlendingClient* client, RenderStyle* destination, const RenderStyle* from, const RenderStyle* to, double progress) const final
{
- Color fromColor = value(a);
- Color toColor = value(b);
+ Color fromColor = value(from);
+ Color toColor = value(to);
if (!fromColor.isValid() && !toColor.isValid())
return;
if (!fromColor.isValid())
- fromColor = a->color();
+ fromColor = from->color();
if (!toColor.isValid())
- toColor = b->color();
- (dst->*m_setter)(blendFunc(anim, fromColor, toColor, progress));
+ toColor = to->color();
+ (destination->*m_setter)(blendFunc(client, fromColor, toColor, progress));
}
- Color value(const RenderStyle* a) const
+ Color value(const RenderStyle* style) const
{
- return (a->*m_getter)();
+ return (style->*m_getter)();
}
#if !LOG_DISABLED
- void logBlend(const RenderStyle* a, const RenderStyle* b, const RenderStyle* result, double progress) const final
+ void logBlend(const RenderStyle* from, const RenderStyle* to, const RenderStyle* result, double progress) const final
{
// FIXME: better logging.
- LOG_WITH_STREAM(Animations, stream << " blending " << getPropertyName(property()) << " from " << value(a) << " to " << value(b) << " at " << TextStream::FormatNumberRespectingIntegers(progress) << " -> " << value(result));
+ LOG_WITH_STREAM(Animations, stream << " blending " << getPropertyName(property()) << " from " << value(from) << " to " << value(to) << " at " << TextStream::FormatNumberRespectingIntegers(progress) << " -> " << value(result));
}
#endif
-private:
const Color& (RenderStyle::*m_getter)() const;
void (RenderStyle::*m_setter)(const Color&);
};
@@ -1217,40 +1216,42 @@
enum MaybeInvalidColorTag { MaybeInvalidColor };
-class PropertyWrapperVisitedAffectedColor : public AnimationPropertyWrapperBase {
+class PropertyWrapperVisitedAffectedColor final : public AnimationPropertyWrapperBase {
WTF_MAKE_FAST_ALLOCATED;
public:
- PropertyWrapperVisitedAffectedColor(CSSPropertyID prop, const Color& (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&), const Color& (RenderStyle::*visitedGetter)() const, void (RenderStyle::*visitedSetter)(const Color&))
- : AnimationPropertyWrapperBase(prop)
- , m_wrapper(makeUnique<PropertyWrapper<const Color&>>(prop, getter, setter))
- , m_visitedWrapper(makeUnique<PropertyWrapper<const Color&>>(prop, visitedGetter, visitedSetter))
+ PropertyWrapperVisitedAffectedColor(CSSPropertyID property, const Color& (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&), const Color& (RenderStyle::*visitedGetter)() const, void (RenderStyle::*visitedSetter)(const Color&))
+ : AnimationPropertyWrapperBase(property)
+ , m_wrapper(makeUnique<PropertyWrapper<const Color&>>(property, getter, setter))
+ , m_visitedWrapper(makeUnique<PropertyWrapper<const Color&>>(property, visitedGetter, visitedSetter))
{
}
- PropertyWrapperVisitedAffectedColor(CSSPropertyID prop, MaybeInvalidColorTag, const Color& (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&), const Color& (RenderStyle::*visitedGetter)() const, void (RenderStyle::*visitedSetter)(const Color&))
- : AnimationPropertyWrapperBase(prop)
- , m_wrapper(makeUnique<PropertyWrapperMaybeInvalidColor>(prop, getter, setter))
- , m_visitedWrapper(makeUnique<PropertyWrapperMaybeInvalidColor>(prop, visitedGetter, visitedSetter))
+ PropertyWrapperVisitedAffectedColor(CSSPropertyID property, MaybeInvalidColorTag, const Color& (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&), const Color& (RenderStyle::*visitedGetter)() const, void (RenderStyle::*visitedSetter)(const Color&))
+ : AnimationPropertyWrapperBase(property)
+ , m_wrapper(makeUnique<PropertyWrapperMaybeInvalidColor>(property, getter, setter))
+ , m_visitedWrapper(makeUnique<PropertyWrapperMaybeInvalidColor>(property, visitedGetter, visitedSetter))
{
}
- bool equals(const RenderStyle* a, const RenderStyle* b) const override
+
+private:
+ bool equals(const RenderStyle* a, const RenderStyle* b) const final
{
return m_wrapper->equals(a, b) && m_visitedWrapper->equals(a, b);
}
- void blend(const CSSPropertyBlendingClient* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
+
+ void blend(const CSSPropertyBlendingClient* client, RenderStyle* destination, const RenderStyle* from, const RenderStyle* to, double progress) const final
{
- m_wrapper->blend(anim, dst, a, b, progress);
- m_visitedWrapper->blend(anim, dst, a, b, progress);
+ m_wrapper->blend(client, destination, from, to, progress);
+ m_visitedWrapper->blend(client, destination, from, to, progress);
}
#if !LOG_DISABLED
- void logBlend(const RenderStyle* a, const RenderStyle* b, const RenderStyle* result, double progress) const final
+ void logBlend(const RenderStyle* from, const RenderStyle* to, const RenderStyle* result, double progress) const final
{
- m_wrapper->logBlend(a, b, result, progress);
- m_visitedWrapper->logBlend(a, b, result, progress);
+ m_wrapper->logBlend(from, to, result, progress);
+ m_visitedWrapper->logBlend(from, to, result, progress);
}
#endif
-private:
std::unique_ptr<AnimationPropertyWrapperBase> m_wrapper;
std::unique_ptr<AnimationPropertyWrapperBase> m_visitedWrapper;
};
@@ -1274,6 +1275,7 @@
#if !LOG_DISABLED
virtual void logBlend(const FillLayer* result, const FillLayer*, const FillLayer*, double) const = 0;
#endif
+
private:
CSSPropertyID m_property;
};
@@ -1289,6 +1291,7 @@
{
}
+protected:
bool equals(const FillLayer* a, const FillLayer* b) const override
{
if (a == b)
@@ -1295,7 +1298,7 @@
return true;
if (!a || !b)
return false;
- return this->value(a) == this->value(b);
+ return value(a) == value(b);
}
T value(const FillLayer* layer) const
@@ -1304,18 +1307,18 @@
}
#if !LOG_DISABLED
- void logBlend(const FillLayer* result, const FillLayer* a, const FillLayer* b, double progress) const override
+ void logBlend(const FillLayer* result, const FillLayer* from, const FillLayer* to, double progress) const override
{
- LOG_WITH_STREAM(Animations, stream << " blending " << getPropertyName(property()) << " from " << value(a) << " to " << value(b) << " at " << TextStream::FormatNumberRespectingIntegers(progress) << " -> " << value(result));
+ LOG_WITH_STREAM(Animations, stream << " blending " << getPropertyName(property()) << " from " << value(from) << " to " << value(to) << " at " << TextStream::FormatNumberRespectingIntegers(progress) << " -> " << value(result));
}
#endif
-protected:
+private:
T (FillLayer::*m_getter)() const;
};
template <typename T>
-class FillLayerPropertyWrapper : public FillLayerPropertyWrapperGetter<const T&> {
+class FillLayerPropertyWrapper final : public FillLayerPropertyWrapperGetter<const T&> {
WTF_MAKE_FAST_ALLOCATED;
public:
FillLayerPropertyWrapper(CSSPropertyID property, const T& (FillLayer::*getter)() const, void (FillLayer::*setter)(T))
@@ -1324,31 +1327,31 @@
{
}
- void blend(const CSSPropertyBlendingClient* anim, FillLayer* dst, const FillLayer* a, const FillLayer* b, double progress) const override
+private:
+ void blend(const CSSPropertyBlendingClient* client, FillLayer* destination, const FillLayer* from, const FillLayer* to, double progress) const final
{
- (dst->*m_setter)(blendFunc(anim, this->value(a), this->value(b), progress));
+ (destination->*this->m_setter)(blendFunc(client, this->value(from), this->value(to), progress));
}
- bool canInterpolate(const FillLayer* a, const FillLayer* b) const override
+ bool canInterpolate(const FillLayer* from, const FillLayer* to) const final
{
- return canInterpolateLengthVariants(this->value(a), this->value(b));
+ return canInterpolateLengthVariants(this->value(from), this->value(to));
}
#if !LOG_DISABLED
- void logBlend(const FillLayer* result, const FillLayer* a, const FillLayer* b, double progress) const override
+ void logBlend(const FillLayer* result, const FillLayer* from, const FillLayer* to, double progress) const final
{
LOG_WITH_STREAM(Animations, stream << " blending " << getPropertyName(FillLayerPropertyWrapperGetter<const T&>::property())
- << " from " << FillLayerPropertyWrapperGetter<const T&>::value(a)
- << " to " << FillLayerPropertyWrapperGetter<const T&>::value(b)
+ << " from " << FillLayerPropertyWrapperGetter<const T&>::value(from)
+ << " to " << FillLayerPropertyWrapperGetter<const T&>::value(to)
<< " at " << TextStream::FormatNumberRespectingIntegers(progress) << " -> " << FillLayerPropertyWrapperGetter<const T&>::value(result));
}
#endif
-protected:
void (FillLayer::*m_setter)(T);
};
-class FillLayerPositionPropertyWrapper : public FillLayerPropertyWrapperGetter<const Length&> {
+class FillLayerPositionPropertyWrapper final : public FillLayerPropertyWrapperGetter<const Length&> {
WTF_MAKE_FAST_ALLOCATED;
public:
FillLayerPositionPropertyWrapper(CSSPropertyID property, const Length& (FillLayer::*lengthGetter)() const, void (FillLayer::*lengthSetter)(Length), Edge (FillLayer::*originGetter)() const, void (FillLayer::*originSetter)(Edge), Edge farEdge)
@@ -1360,7 +1363,8 @@
{
}
- bool equals(const FillLayer* a, const FillLayer* b) const override
+private:
+ bool equals(const FillLayer* a, const FillLayer* b) const final
{
if (a == b)
return true;
@@ -1367,8 +1371,8 @@
if (!a || !b)
return false;
- auto fromLength = this->value(a);
- auto toLength = this->value(b);
+ auto fromLength = value(a);
+ auto toLength = value(b);
Edge fromEdge = (a->*m_originGetter)();
Edge toEdge = (b->*m_originGetter)();
@@ -1376,13 +1380,13 @@
return fromLength == toLength && fromEdge == toEdge;
}
- void blend(const CSSPropertyBlendingClient* anim, FillLayer* dst, const FillLayer* a, const FillLayer* b, double progress) const override
+ void blend(const CSSPropertyBlendingClient* client, FillLayer* destination, const FillLayer* from, const FillLayer* to, double progress) const final
{
- auto fromLength = this->value(a);
- auto toLength = this->value(b);
+ auto fromLength = value(from);
+ auto toLength = value(to);
- Edge fromEdge = (a->*m_originGetter)();
- Edge toEdge = (b->*m_originGetter)();
+ Edge fromEdge = (from->*m_originGetter)();
+ Edge toEdge = (to->*m_originGetter)();
if (fromEdge != toEdge) {
// Convert the right/bottom into a calc _expression_,
@@ -1390,21 +1394,20 @@
fromLength = convertTo100PercentMinusLength(fromLength);
else if (toEdge == m_farEdge) {
toLength = convertTo100PercentMinusLength(toLength);
- (dst->*m_originSetter)(fromEdge); // Now we have a calc(100% - l), it's relative to the left/top edge.
+ (destination->*m_originSetter)(fromEdge); // Now we have a calc(100% - l), it's relative to the left/top edge.
}
}
- (dst->*m_lengthSetter)(blendFunc(anim, fromLength, toLength, progress));
+ (destination->*m_lengthSetter)(blendFunc(client, fromLength, toLength, progress));
}
#if !LOG_DISABLED
- void logBlend(const FillLayer* result, const FillLayer* a, const FillLayer* b, double progress) const override
+ void logBlend(const FillLayer* result, const FillLayer* from, const FillLayer* to, double progress) const final
{
- LOG_WITH_STREAM(Animations, stream << " blending " << getPropertyName(property()) << " from " << value(a) << " to " << value(b) << " at " << TextStream::FormatNumberRespectingIntegers(progress) << " -> " << value(result));
+ LOG_WITH_STREAM(Animations, stream << " blending " << getPropertyName(property()) << " from " << value(from) << " to " << value(to) << " at " << TextStream::FormatNumberRespectingIntegers(progress) << " -> " << value(result));
}
#endif
-protected:
void (FillLayer::*m_lengthSetter)(Length);
Edge (FillLayer::*m_originGetter)() const;
void (FillLayer::*m_originSetter)(Edge);
@@ -1421,26 +1424,26 @@
{
}
- void blend(const CSSPropertyBlendingClient* anim, FillLayer* dst, const FillLayer* a, const FillLayer* b, double progress) const override
+private:
+ void blend(const CSSPropertyBlendingClient* client, FillLayer* destination, const FillLayer* from, const FillLayer* to, double progress) const final
{
- (dst->*m_setter)(blendFunc(anim, this->value(a), this->value(b), progress));
+ (destination->*this->m_setter)(blendFunc(client, this->value(from), this->value(to), progress));
}
#if !LOG_DISABLED
- void logBlend(const FillLayer* result, const FillLayer* a, const FillLayer* b, double progress) const override
+ void logBlend(const FillLayer* result, const FillLayer* from, const FillLayer* to, double progress) const override
{
LOG_WITH_STREAM(Animations, stream << " blending " << getPropertyName(FillLayerPropertyWrapperGetter<T*>::property())
- << " from " << FillLayerPropertyWrapperGetter<T*>::value(a)
- << " to " << FillLayerPropertyWrapperGetter<T*>::value(b)
+ << " from " << FillLayerPropertyWrapperGetter<T*>::value(from)
+ << " to " << FillLayerPropertyWrapperGetter<T*>::value(to)
<< " at " << TextStream::FormatNumberRespectingIntegers(progress) << " -> " << FillLayerPropertyWrapperGetter<T*>::value(result));
}
#endif
-protected:
void (FillLayer::*m_setter)(RefPtr<T>&&);
};
-class FillLayerStyleImagePropertyWrapper : public FillLayerRefCountedPropertyWrapper<StyleImage> {
+class FillLayerStyleImagePropertyWrapper final : public FillLayerRefCountedPropertyWrapper<StyleImage> {
WTF_MAKE_FAST_ALLOCATED;
public:
FillLayerStyleImagePropertyWrapper(CSSPropertyID property, StyleImage* (FillLayer::*getter)() const, void (FillLayer::*setter)(RefPtr<StyleImage>&&))
@@ -1448,24 +1451,25 @@
{
}
- bool equals(const FillLayer* a, const FillLayer* b) const override
+private:
+ bool equals(const FillLayer* a, const FillLayer* b) const final
{
if (a == b)
return true;
if (!a || !b)
return false;
- return arePointingToEqualData(this->value(a), this->value(b));
+ return arePointingToEqualData(value(a), value(b));
}
#if !LOG_DISABLED
- void logBlend(const FillLayer* result, const FillLayer* a, const FillLayer* b, double progress) const override
+ void logBlend(const FillLayer* result, const FillLayer* from, const FillLayer* to, double progress) const final
{
- LOG_WITH_STREAM(Animations, stream << " blending " << getPropertyName(property()) << " from " << value(a) << " to " << value(b) << " at " << TextStream::FormatNumberRespectingIntegers(progress) << " -> " << value(result));
+ LOG_WITH_STREAM(Animations, stream << " blending " << getPropertyName(property()) << " from " << value(from) << " to " << value(to) << " at " << TextStream::FormatNumberRespectingIntegers(progress) << " -> " << value(result));
}
#endif
};
-class FillLayersPropertyWrapper : public AnimationPropertyWrapperBase {
+class FillLayersPropertyWrapper final : public AnimationPropertyWrapperBase {
WTF_MAKE_FAST_ALLOCATED;
public:
typedef const FillLayer& (RenderStyle::*LayersGetter)() const;
@@ -1498,7 +1502,8 @@
}
}
- bool equals(const RenderStyle* a, const RenderStyle* b) const override
+private:
+ bool equals(const RenderStyle* a, const RenderStyle* b) const final
{
if (a == b)
return true;
@@ -1519,10 +1524,10 @@
return true;
}
- bool canInterpolate(const RenderStyle* a, const RenderStyle* b) const override
+ bool canInterpolate(const RenderStyle* from, const RenderStyle* to) const final
{
- auto* fromLayer = &(a->*m_layersGetter)();
- auto* toLayer = &(b->*m_layersGetter)();
+ auto* fromLayer = &(from->*m_layersGetter)();
+ auto* toLayer = &(to->*m_layersGetter)();
while (fromLayer && toLayer) {
if (!m_fillLayerPropertyWrapper->canInterpolate(fromLayer, toLayer))
@@ -1535,16 +1540,16 @@
return true;
}
- void blend(const CSSPropertyBlendingClient* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
+ void blend(const CSSPropertyBlendingClient* client, RenderStyle* destination, const RenderStyle* from, const RenderStyle* to, double progress) const final
{
- auto* aLayer = &(a->*m_layersGetter)();
- auto* bLayer = &(b->*m_layersGetter)();
- auto* dstLayer = &(dst->*m_layersAccessor)();
+ auto* fromLayer = &(from->*m_layersGetter)();
+ auto* toLayer = &(to->*m_layersGetter)();
+ auto* dstLayer = &(destination->*m_layersAccessor)();
- while (aLayer && bLayer && dstLayer) {
- m_fillLayerPropertyWrapper->blend(anim, dstLayer, aLayer, bLayer, progress);
- aLayer = aLayer->next();
- bLayer = bLayer->next();
+ while (fromLayer && toLayer && dstLayer) {
+ m_fillLayerPropertyWrapper->blend(client, dstLayer, fromLayer, toLayer, progress);
+ fromLayer = fromLayer->next();
+ toLayer = toLayer->next();
dstLayer = dstLayer->next();
}
}
@@ -1552,27 +1557,25 @@
#if !LOG_DISABLED
void logBlend(const RenderStyle* from, const RenderStyle* to, const RenderStyle* result, double progress) const final
{
- auto* aLayer = &(from->*m_layersGetter)();
- auto* bLayer = &(to->*m_layersGetter)();
+ auto* fromLayer = &(from->*m_layersGetter)();
+ auto* toLayer = &(to->*m_layersGetter)();
auto* dstLayer = &(result->*m_layersGetter)();
- while (aLayer && bLayer && dstLayer) {
- m_fillLayerPropertyWrapper->logBlend(dstLayer, aLayer, bLayer, progress);
- aLayer = aLayer->next();
- bLayer = bLayer->next();
+ while (fromLayer && toLayer && dstLayer) {
+ m_fillLayerPropertyWrapper->logBlend(dstLayer, fromLayer, toLayer, progress);
+ fromLayer = fromLayer->next();
+ toLayer = toLayer->next();
dstLayer = dstLayer->next();
}
}
#endif
-private:
std::unique_ptr<FillLayerAnimationPropertyWrapperBase> m_fillLayerPropertyWrapper;
-
LayersGetter m_layersGetter;
LayersAccessor m_layersAccessor;
};
-class ShorthandPropertyWrapper : public AnimationPropertyWrapperBase {
+class ShorthandPropertyWrapper final : public AnimationPropertyWrapperBase {
WTF_MAKE_FAST_ALLOCATED;
public:
ShorthandPropertyWrapper(CSSPropertyID property, Vector<AnimationPropertyWrapperBase*> longhandWrappers)
@@ -1581,9 +1584,12 @@
{
}
- bool isShorthandWrapper() const override { return true; }
+ bool isShorthandWrapper() const final { return true; }
- bool equals(const RenderStyle* a, const RenderStyle* b) const override
+ const Vector<AnimationPropertyWrapperBase*>& propertyWrappers() const { return m_propertyWrappers; }
+
+private:
+ bool equals(const RenderStyle* a, const RenderStyle* b) const final
{
if (a == b)
return true;
@@ -1597,27 +1603,24 @@
return true;
}
- void blend(const CSSPropertyBlendingClient* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
+ void blend(const CSSPropertyBlendingClient* client, RenderStyle* destination, const RenderStyle* from, const RenderStyle* to, double progress) const final
{
for (auto& wrapper : m_propertyWrappers)
- wrapper->blend(anim, dst, a, b, progress);
+ wrapper->blend(client, destination, from, to, progress);
}
#if !LOG_DISABLED
- void logBlend(const RenderStyle* a, const RenderStyle* b, const RenderStyle* dst, double progress) const final
+ void logBlend(const RenderStyle* from, const RenderStyle* to, const RenderStyle* destination, double progress) const final
{
for (auto& wrapper : m_propertyWrappers)
- wrapper->logBlend(a, b, dst, progress);
+ wrapper->logBlend(from, to, destination, progress);
}
#endif
- const Vector<AnimationPropertyWrapperBase*>& propertyWrappers() const { return m_propertyWrappers; }
-
-private:
Vector<AnimationPropertyWrapperBase*> m_propertyWrappers;
};
-class PropertyWrapperFlex : public AnimationPropertyWrapperBase {
+class PropertyWrapperFlex final : public AnimationPropertyWrapperBase {
WTF_MAKE_FAST_ALLOCATED;
public:
PropertyWrapperFlex()
@@ -1625,7 +1628,8 @@
{
}
- bool equals(const RenderStyle* a, const RenderStyle* b) const override
+private:
+ bool equals(const RenderStyle* a, const RenderStyle* b) const final
{
if (a == b)
return true;
@@ -1635,16 +1639,16 @@
return a->flexBasis() == b->flexBasis() && a->flexGrow() == b->flexGrow() && a->flexShrink() == b->flexShrink();
}
- bool canInterpolate(const RenderStyle* a, const RenderStyle* b) const override
+ bool canInterpolate(const RenderStyle* from, const RenderStyle* to) const final
{
- return a->flexGrow() != b->flexGrow() && a->flexShrink() != b->flexShrink() && canInterpolateLengths(a->flexBasis(), b->flexBasis(), false);
+ return from->flexGrow() != to->flexGrow() && from->flexShrink() != to->flexShrink() && canInterpolateLengths(from->flexBasis(), to->flexBasis(), false);
}
- void blend(const CSSPropertyBlendingClient* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
+ void blend(const CSSPropertyBlendingClient* client, RenderStyle* destination, const RenderStyle* from, const RenderStyle* to, double progress) const final
{
- dst->setFlexBasis(blendFunc(anim, a->flexBasis(), b->flexBasis(), progress));
- dst->setFlexGrow(blendFunc(anim, a->flexGrow(), b->flexGrow(), progress));
- dst->setFlexShrink(blendFunc(anim, a->flexShrink(), b->flexShrink(), progress));
+ destination->setFlexBasis(blendFunc(client, from->flexBasis(), to->flexBasis(), progress));
+ destination->setFlexGrow(blendFunc(client, from->flexGrow(), to->flexGrow(), progress));
+ destination->setFlexShrink(blendFunc(client, from->flexShrink(), to->flexShrink(), progress));
}
#if !LOG_DISABLED
@@ -1656,11 +1660,11 @@
#endif
};
-class PropertyWrapperSVGPaint : public AnimationPropertyWrapperBase {
+class PropertyWrapperSVGPaint final : public AnimationPropertyWrapperBase {
WTF_MAKE_FAST_ALLOCATED;
public:
- PropertyWrapperSVGPaint(CSSPropertyID prop, SVGPaintType (RenderStyle::*paintTypeGetter)() const, Color (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&))
- : AnimationPropertyWrapperBase(prop)
+ PropertyWrapperSVGPaint(CSSPropertyID property, SVGPaintType (RenderStyle::*paintTypeGetter)() const, Color (RenderStyle::*getter)() const, void (RenderStyle::*setter)(const Color&))
+ : AnimationPropertyWrapperBase(property)
, m_paintTypeGetter(paintTypeGetter)
, m_getter(getter)
, m_setter(setter)
@@ -1667,7 +1671,8 @@
{
}
- bool equals(const RenderStyle* a, const RenderStyle* b) const override
+private:
+ bool equals(const RenderStyle* a, const RenderStyle* b) const final
{
if (a == b)
return true;
@@ -1697,14 +1702,14 @@
return true;
}
- void blend(const CSSPropertyBlendingClient* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
+ void blend(const CSSPropertyBlendingClient* client, RenderStyle* destination, const RenderStyle* from, const RenderStyle* to, double progress) const final
{
- if ((a->*m_paintTypeGetter)() != SVGPaintType::RGBColor
- || (b->*m_paintTypeGetter)() != SVGPaintType::RGBColor)
+ if ((from->*m_paintTypeGetter)() != SVGPaintType::RGBColor
+ || (to->*m_paintTypeGetter)() != SVGPaintType::RGBColor)
return;
- Color fromColor = (a->*m_getter)();
- Color toColor = (b->*m_getter)();
+ Color fromColor = (from->*m_getter)();
+ Color toColor = (to->*m_getter)();
if (!fromColor.isValid() && !toColor.isValid())
return;
@@ -1713,7 +1718,7 @@
fromColor = Color();
if (!toColor.isValid())
toColor = Color();
- (dst->*m_setter)(blendFunc(anim, fromColor, toColor, progress));
+ (destination->*m_setter)(blendFunc(client, fromColor, toColor, progress));
}
#if !LOG_DISABLED
@@ -1724,13 +1729,12 @@
}
#endif
-private:
SVGPaintType (RenderStyle::*m_paintTypeGetter)() const;
Color (RenderStyle::*m_getter)() const;
void (RenderStyle::*m_setter)(const Color&);
};
-class PropertyWrapperFontStyle : public PropertyWrapper<Optional<FontSelectionValue>> {
+class PropertyWrapperFontStyle final : public PropertyWrapper<Optional<FontSelectionValue>> {
WTF_MAKE_FAST_ALLOCATED;
public:
PropertyWrapperFontStyle()
@@ -1738,12 +1742,13 @@
{
}
- bool canInterpolate(const RenderStyle* from, const RenderStyle* to) const override
+private:
+ bool canInterpolate(const RenderStyle* from, const RenderStyle* to) const final
{
return from->fontItalic() && to->fontItalic() && from->fontDescription().fontStyleAxis() == FontStyleAxis::slnt && to->fontDescription().fontStyleAxis() == FontStyleAxis::slnt;
}
- void blend(const CSSPropertyBlendingClient* anim, RenderStyle* dst, const RenderStyle* from, const RenderStyle* to, double progress) const override
+ void blend(const CSSPropertyBlendingClient* client, RenderStyle* destination, const RenderStyle* from, const RenderStyle* to, double progress) const final
{
auto discrete = !canInterpolate(from, to);
@@ -1755,23 +1760,23 @@
auto toFontItalic = to->fontItalic();
auto blendedFontItalic = progress < 0.5 ? fromFontItalic : toFontItalic;
if (!discrete)
- blendedFontItalic = blendFunc(anim, fromFontItalic, toFontItalic, progress);
+ blendedFontItalic = blendFunc(client, fromFontItalic, toFontItalic, progress);
- FontSelector* currentFontSelector = dst->fontCascade().fontSelector();
- auto description = dst->fontDescription();
+ FontSelector* currentFontSelector = destination->fontCascade().fontSelector();
+ auto description = destination->fontDescription();
description.setItalic(blendedFontItalic);
description.setFontStyleAxis(blendedStyleAxis);
- dst->setFontDescription(WTFMove(description));
- dst->fontCascade().update(currentFontSelector);
+ destination->setFontDescription(WTFMove(description));
+ destination->fontCascade().update(currentFontSelector);
}
};
template <typename T>
-class AutoPropertyWrapper : public PropertyWrapper<T> {
+class AutoPropertyWrapper final : public PropertyWrapper<T> {
WTF_MAKE_FAST_ALLOCATED;
public:
- AutoPropertyWrapper(CSSPropertyID prop, T (RenderStyle::*getter)() const, void (RenderStyle::*setter)(T), bool (RenderStyle::*autoGetter)() const, void (RenderStyle::*autoSetter)(), Optional<T> minValue = WTF::nullopt)
- : PropertyWrapper<T>(prop, getter, setter)
+ AutoPropertyWrapper(CSSPropertyID property, T (RenderStyle::*getter)() const, void (RenderStyle::*setter)(T), bool (RenderStyle::*autoGetter)() const, void (RenderStyle::*autoSetter)(), Optional<T> minValue = WTF::nullopt)
+ : PropertyWrapper<T>(property, getter, setter)
, m_autoGetter(autoGetter)
, m_autoSetter(autoSetter)
, m_minValue(minValue)
@@ -1778,17 +1783,18 @@
{
}
- bool canInterpolate(const RenderStyle* from, const RenderStyle* to) const override
+private:
+ bool canInterpolate(const RenderStyle* from, const RenderStyle* to) const final
{
return !(from->*m_autoGetter)() && !(to->*m_autoGetter)();
}
- void blend(const CSSPropertyBlendingClient* anim, RenderStyle* dst, const RenderStyle* from, const RenderStyle* to, double progress) const override
+ void blend(const CSSPropertyBlendingClient* client, RenderStyle* destination, const RenderStyle* from, const RenderStyle* to, double progress) const final
{
- auto blendedValue = blendFunc(anim, this->value(from), this->value(to), progress);
- if (this->m_minValue)
- blendedValue = blendedValue > *this->m_minValue ? blendedValue : *this->m_minValue;
- (dst->*this->m_setter)(blendedValue);
+ auto blendedValue = blendFunc(client, this->value(from), this->value(to), progress);
+ if (m_minValue)
+ blendedValue = blendedValue > *m_minValue ? blendedValue : *m_minValue;
+ (destination->*this->m_setter)(blendedValue);
if (canInterpolate(from, to))
return;
@@ -1796,14 +1802,13 @@
ASSERT(!progress || progress == 1.0);
if (!progress) {
if ((from->*m_autoGetter)())
- (dst->*m_autoSetter)();
+ (destination->*m_autoSetter)();
} else {
if ((to->*m_autoGetter)())
- (dst->*m_autoSetter)();
+ (destination->*m_autoSetter)();
}
}
-private:
bool (RenderStyle::*m_autoGetter)() const;
void (RenderStyle::*m_autoSetter)();
Optional<T> m_minValue;
@@ -1812,19 +1817,20 @@
class NonNegativeFloatPropertyWrapper : public PropertyWrapper<float> {
WTF_MAKE_FAST_ALLOCATED;
public:
- NonNegativeFloatPropertyWrapper(CSSPropertyID prop, float (RenderStyle::*getter)() const, void (RenderStyle::*setter)(float))
- : PropertyWrapper<float>(prop, getter, setter)
+ NonNegativeFloatPropertyWrapper(CSSPropertyID property, float (RenderStyle::*getter)() const, void (RenderStyle::*setter)(float))
+ : PropertyWrapper<float>(property, getter, setter)
{
}
- void blend(const CSSPropertyBlendingClient* anim, RenderStyle* dst, const RenderStyle* from, const RenderStyle* to, double progress) const override
+protected:
+ void blend(const CSSPropertyBlendingClient* client, RenderStyle* destination, const RenderStyle* from, const RenderStyle* to, double progress) const override
{
- auto blendedValue = blendFunc(anim, value(from), value(to), progress);
- (dst->*m_setter)(blendedValue > 0 ? blendedValue : 0);
+ auto blendedValue = blendFunc(client, value(from), value(to), progress);
+ (destination->*m_setter)(blendedValue > 0 ? blendedValue : 0);
}
};
-class PerspectiveWrapper : public NonNegativeFloatPropertyWrapper {
+class PerspectiveWrapper final : public NonNegativeFloatPropertyWrapper {
WTF_MAKE_FAST_ALLOCATED;
public:
PerspectiveWrapper()
@@ -1832,7 +1838,8 @@
{
}
- bool canInterpolate(const RenderStyle* from, const RenderStyle* to) const override
+private:
+ bool canInterpolate(const RenderStyle* from, const RenderStyle* to) const final
{
if (!from->hasPerspective() || !to->hasPerspective())
return false;
@@ -1839,16 +1846,16 @@
return NonNegativeFloatPropertyWrapper::canInterpolate(from, to);
}
- void blend(const CSSPropertyBlendingClient* anim, RenderStyle* dst, const RenderStyle* from, const RenderStyle* to, double progress) const override
+ void blend(const CSSPropertyBlendingClient* client, RenderStyle* destination, const RenderStyle* from, const RenderStyle* to, double progress) const final
{
if (!canInterpolate(from, to))
- (dst->*m_setter)(progress ? value(to) : value(from));
+ (destination->*m_setter)(progress ? value(to) : value(from));
else
- NonNegativeFloatPropertyWrapper::blend(anim, dst, from, to, progress);
+ NonNegativeFloatPropertyWrapper::blend(client, destination, from, to, progress);
}
};
-class CSSPropertyAnimationWrapperMap {
+class CSSPropertyAnimationWrapperMap final {
WTF_MAKE_FAST_ALLOCATED;
public:
static CSSPropertyAnimationWrapperMap& singleton()
@@ -2238,33 +2245,32 @@
return contained;
}
-// Returns true if we need to start animation timers
-void CSSPropertyAnimation::blendProperties(const CSSPropertyBlendingClient* anim, CSSPropertyID prop, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress)
+void CSSPropertyAnimation::blendProperties(const CSSPropertyBlendingClient* client, CSSPropertyID property, RenderStyle* destination, const RenderStyle* from, const RenderStyle* to, double progress)
{
- ASSERT(prop != CSSPropertyInvalid);
+ ASSERT(property != CSSPropertyInvalid);
- AnimationPropertyWrapperBase* wrapper = CSSPropertyAnimationWrapperMap::singleton().wrapperForProperty(prop);
+ AnimationPropertyWrapperBase* wrapper = CSSPropertyAnimationWrapperMap::singleton().wrapperForProperty(property);
if (wrapper) {
// https://drafts.csswg.org/web-animations-1/#discrete
// The property’s values cannot be meaningfully combined, thus it is not additive and
// interpolation swaps from Va to Vb at 50% (p=0.5).
- if (!wrapper->canInterpolate(a, b))
+ if (!wrapper->canInterpolate(from, to))
progress = progress < 0.5 ? 0 : 1;
- wrapper->blend(anim, dst, a, b, progress);
+ wrapper->blend(client, destination, from, to, progress);
#if !LOG_DISABLED
- wrapper->logBlend(a, b, dst, progress);
+ wrapper->logBlend(from, to, destination, progress);
#endif
}
}
-bool CSSPropertyAnimation::isPropertyAnimatable(CSSPropertyID prop)
+bool CSSPropertyAnimation::isPropertyAnimatable(CSSPropertyID property)
{
- return CSSPropertyAnimationWrapperMap::singleton().wrapperForProperty(prop);
+ return CSSPropertyAnimationWrapperMap::singleton().wrapperForProperty(property);
}
-bool CSSPropertyAnimation::animationOfPropertyIsAccelerated(CSSPropertyID prop)
+bool CSSPropertyAnimation::animationOfPropertyIsAccelerated(CSSPropertyID property)
{
- AnimationPropertyWrapperBase* wrapper = CSSPropertyAnimationWrapperMap::singleton().wrapperForProperty(prop);
+ AnimationPropertyWrapperBase* wrapper = CSSPropertyAnimationWrapperMap::singleton().wrapperForProperty(property);
return wrapper ? wrapper->animationIsAccelerated() : false;
}
@@ -2280,19 +2286,19 @@
return foundProperties;
}
-bool CSSPropertyAnimation::propertiesEqual(CSSPropertyID prop, const RenderStyle* a, const RenderStyle* b)
+bool CSSPropertyAnimation::propertiesEqual(CSSPropertyID property, const RenderStyle* a, const RenderStyle* b)
{
- AnimationPropertyWrapperBase* wrapper = CSSPropertyAnimationWrapperMap::singleton().wrapperForProperty(prop);
+ AnimationPropertyWrapperBase* wrapper = CSSPropertyAnimationWrapperMap::singleton().wrapperForProperty(property);
if (wrapper)
return wrapper->equals(a, b);
return true;
}
-bool CSSPropertyAnimation::canPropertyBeInterpolated(CSSPropertyID prop, const RenderStyle* a, const RenderStyle* b)
+bool CSSPropertyAnimation::canPropertyBeInterpolated(CSSPropertyID property, const RenderStyle* from, const RenderStyle* to)
{
- AnimationPropertyWrapperBase* wrapper = CSSPropertyAnimationWrapperMap::singleton().wrapperForProperty(prop);
+ AnimationPropertyWrapperBase* wrapper = CSSPropertyAnimationWrapperMap::singleton().wrapperForProperty(property);
if (wrapper)
- return wrapper->canInterpolate(a, b);
+ return wrapper->canInterpolate(from, to);
return false;
}