Log Message
[web-animations] refactor discrete SVG properties to use a dedicated animation wrapper https://bugs.webkit.org/show_bug.cgi?id=237760
Reviewed by Antti Koivisto. We added getters and setters on RenderStyle for properties exposed on SVGRenderStyle solely for the purpose of animation support. Instead, we add a dedicated animation wrapper that removes the methods from RenderStyle and do all the work in CSSPropertyAnimation.cpp. This will be beneficial for future SVG properties with discrete animation support that are yet to be added. * animation/CSSPropertyAnimation.cpp: (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): * rendering/style/RenderStyle.h: (WebCore::RenderStyle::clipRule const): Deleted. (WebCore::RenderStyle::setClipRule): Deleted. (WebCore::RenderStyle::colorInterpolation const): Deleted. (WebCore::RenderStyle::setColorInterpolation): Deleted. (WebCore::RenderStyle::colorInterpolationFilters const): Deleted. (WebCore::RenderStyle::setColorInterpolationFilters): Deleted. (WebCore::RenderStyle::dominantBaseline const): Deleted. (WebCore::RenderStyle::setDominantBaseline): Deleted. (WebCore::RenderStyle::fillRule const): Deleted. (WebCore::RenderStyle::setFillRule): Deleted.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (291150 => 291151)
--- trunk/Source/WebCore/ChangeLog 2022-03-11 09:20:28 UTC (rev 291150)
+++ trunk/Source/WebCore/ChangeLog 2022-03-11 09:27:16 UTC (rev 291151)
@@ -1,3 +1,30 @@
+2022-03-11 Antoine Quint <grao...@webkit.org>
+
+ [web-animations] refactor discrete SVG properties to use a dedicated animation wrapper
+ https://bugs.webkit.org/show_bug.cgi?id=237760
+
+ Reviewed by Antti Koivisto.
+
+ We added getters and setters on RenderStyle for properties exposed on SVGRenderStyle
+ solely for the purpose of animation support. Instead, we add a dedicated animation
+ wrapper that removes the methods from RenderStyle and do all the work in
+ CSSPropertyAnimation.cpp. This will be beneficial for future SVG properties
+ with discrete animation support that are yet to be added.
+
+ * animation/CSSPropertyAnimation.cpp:
+ (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap):
+ * rendering/style/RenderStyle.h:
+ (WebCore::RenderStyle::clipRule const): Deleted.
+ (WebCore::RenderStyle::setClipRule): Deleted.
+ (WebCore::RenderStyle::colorInterpolation const): Deleted.
+ (WebCore::RenderStyle::setColorInterpolation): Deleted.
+ (WebCore::RenderStyle::colorInterpolationFilters const): Deleted.
+ (WebCore::RenderStyle::setColorInterpolationFilters): Deleted.
+ (WebCore::RenderStyle::dominantBaseline const): Deleted.
+ (WebCore::RenderStyle::setDominantBaseline): Deleted.
+ (WebCore::RenderStyle::fillRule const): Deleted.
+ (WebCore::RenderStyle::setFillRule): Deleted.
+
2022-03-10 Antoine Quint <grao...@webkit.org>
[web-animations] mask-origin should support discrete animation
Modified: trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp (291150 => 291151)
--- trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp 2022-03-11 09:20:28 UTC (rev 291150)
+++ trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp 2022-03-11 09:27:16 UTC (rev 291151)
@@ -2832,6 +2832,46 @@
#endif
};
+template <typename T>
+class DiscreteSVGPropertyWrapper final : public AnimationPropertyWrapperBase {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ DiscreteSVGPropertyWrapper(CSSPropertyID property, T (SVGRenderStyle::*getter)() const, void (SVGRenderStyle::*setter)(T))
+ : AnimationPropertyWrapperBase(property)
+ , m_getter(getter)
+ , m_setter(setter)
+ {
+ }
+
+private:
+ bool canInterpolate(const RenderStyle&, const RenderStyle&, CompositeOperation) const final { return false; }
+
+ bool equals(const RenderStyle& a, const RenderStyle& b) const override
+ {
+ return this->value(a) == this->value(b);
+ }
+
+ void blend(RenderStyle& destination, const RenderStyle& from, const RenderStyle& to, const CSSPropertyBlendingContext& context) const override
+ {
+ ASSERT(!context.progress || context.progress == 1.0);
+ (destination.accessSVGStyle().*this->m_setter)(this->value(context.progress ? to : from));
+ }
+
+#if !LOG_DISABLED
+ void logBlend(const RenderStyle&, const RenderStyle&, const RenderStyle&, double) const override
+ {
+ }
+#endif
+
+ T value(const RenderStyle& style) const
+ {
+ return (style.svgStyle().*this->m_getter)();
+ }
+
+ T (SVGRenderStyle::*m_getter)() const;
+ void (SVGRenderStyle::*m_setter)(T);
+};
+
class CSSPropertyAnimationWrapperMap final {
WTF_MAKE_FAST_ALLOCATED;
public:
@@ -3159,16 +3199,16 @@
new PropertyWrapperContent,
new OffsetRotatePropertyWrapper(CSSPropertyOffsetRotate, &RenderStyle::offsetRotate, &RenderStyle::setOffsetRotate),
new DiscretePropertyWrapper<TextDecorationSkipInk>(CSSPropertyTextDecorationSkipInk, &RenderStyle::textDecorationSkipInk, &RenderStyle::setTextDecorationSkipInk),
- new DiscretePropertyWrapper<ColorInterpolation>(CSSPropertyColorInterpolation, &RenderStyle::colorInterpolation, &RenderStyle::setColorInterpolation),
+ new DiscreteSVGPropertyWrapper<ColorInterpolation>(CSSPropertyColorInterpolation, &SVGRenderStyle::colorInterpolation, &SVGRenderStyle::setColorInterpolation),
new DiscretePropertyWrapper<Kerning>(CSSPropertyFontKerning, &RenderStyle::fontKerning, &RenderStyle::setFontKerning),
new DiscretePropertyWrapper<FontFeatureSettings>(CSSPropertyFontFeatureSettings, &RenderStyle::fontFeatureSettings, &RenderStyle::setFontFeatureSettings),
new FontFamilyWrapper,
- new DiscretePropertyWrapper<WindRule>(CSSPropertyClipRule, &RenderStyle::clipRule, &RenderStyle::setClipRule),
- new DiscretePropertyWrapper<ColorInterpolation>(CSSPropertyColorInterpolationFilters, &RenderStyle::colorInterpolationFilters, &RenderStyle::setColorInterpolationFilters),
- new DiscretePropertyWrapper<DominantBaseline>(CSSPropertyDominantBaseline, &RenderStyle::dominantBaseline, &RenderStyle::setDominantBaseline),
+ new DiscreteSVGPropertyWrapper<WindRule>(CSSPropertyClipRule, &SVGRenderStyle::clipRule, &SVGRenderStyle::setClipRule),
+ new DiscreteSVGPropertyWrapper<ColorInterpolation>(CSSPropertyColorInterpolationFilters, &SVGRenderStyle::colorInterpolationFilters, &SVGRenderStyle::setColorInterpolationFilters),
+ new DiscreteSVGPropertyWrapper<DominantBaseline>(CSSPropertyDominantBaseline, &SVGRenderStyle::dominantBaseline, &SVGRenderStyle::setDominantBaseline),
new CounterWrapper(CSSPropertyCounterIncrement),
new CounterWrapper(CSSPropertyCounterReset),
- new DiscretePropertyWrapper<WindRule>(CSSPropertyFillRule, &RenderStyle::fillRule, &RenderStyle::setFillRule),
+ new DiscreteSVGPropertyWrapper<WindRule>(CSSPropertyFillRule, &SVGRenderStyle::fillRule, &SVGRenderStyle::setFillRule),
new DiscretePropertyWrapper<FontSynthesis>(CSSPropertyFontSynthesis, &RenderStyle::fontSynthesis, &RenderStyle::setFontSynthesis),
new DiscretePropertyWrapper<FontVariantAlternates>(CSSPropertyFontVariantAlternates, &RenderStyle::fontVariantAlternates, &RenderStyle::setFontVariantAlternates),
new FontVariantEastAsianWrapper,
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (291150 => 291151)
--- trunk/Source/WebCore/rendering/style/RenderStyle.h 2022-03-11 09:20:28 UTC (rev 291150)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h 2022-03-11 09:27:16 UTC (rev 291151)
@@ -1438,19 +1438,6 @@
const SVGRenderStyle& svgStyle() const { return m_svgStyle; }
SVGRenderStyle& accessSVGStyle() { return m_svgStyle.access(); }
- WindRule clipRule() const { return svgStyle().clipRule(); }
- void setClipRule(WindRule clipRule) { accessSVGStyle().setClipRule(clipRule); }
- ColorInterpolation colorInterpolation() const { return svgStyle().colorInterpolation(); }
- void setColorInterpolation(ColorInterpolation colorInterpolation) { accessSVGStyle().setColorInterpolation(colorInterpolation); }
- ColorInterpolation colorInterpolationFilters() const { return svgStyle().colorInterpolationFilters(); }
- void setColorInterpolationFilters(ColorInterpolation colorInterpolationFilters) { accessSVGStyle().setColorInterpolationFilters(colorInterpolationFilters); }
-
- DominantBaseline dominantBaseline() const { return svgStyle().dominantBaseline(); }
- void setDominantBaseline(DominantBaseline dominantBaseline) { return accessSVGStyle().setDominantBaseline(dominantBaseline); }
-
- WindRule fillRule() const { return svgStyle().fillRule(); }
- void setFillRule(WindRule fillRule) { accessSVGStyle().setFillRule(fillRule); }
-
SVGPaintType fillPaintType() const { return svgStyle().fillPaintType(); }
Color fillPaintColor() const { return svgStyle().fillPaintColor(); }
void setFillPaintColor(const Color& color) { accessSVGStyle().setFillPaint(SVGPaintType::RGBColor, color, emptyString()); }
_______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes