Modified: trunk/Source/WebCore/ChangeLog (273895 => 273896)
--- trunk/Source/WebCore/ChangeLog 2021-03-04 17:55:21 UTC (rev 273895)
+++ trunk/Source/WebCore/ChangeLog 2021-03-04 17:57:32 UTC (rev 273896)
@@ -1,3 +1,18 @@
+2021-03-04 Antoine Quint <grao...@webkit.org>
+
+ Adjust progress parameter before calling blend() for discrete interpolations
+ https://bugs.webkit.org/show_bug.cgi?id=222736
+
+ Reviewed by Antti Koivisto.
+
+ In the case of discrete interpolation, we must treat progress as 0 for progress < 0.5
+ and 1 otherwise. Currently we do it separately in at two places. So that we don't do
+ it in more places, let's do this directly in CSSPropertyAnimation::blendProperties()
+ so that the progress is already set before any of the blend() methods are called.
+
+ * animation/CSSPropertyAnimation.cpp:
+ (WebCore::CSSPropertyAnimation::blendProperties):
+
2021-03-04 Peng Liu <peng.l...@apple.com>
[GPUProcess] MediaController is using a ClockCM
Modified: trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp (273895 => 273896)
--- trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp 2021-03-04 17:55:21 UTC (rev 273895)
+++ trunk/Source/WebCore/animation/CSSPropertyAnimation.cpp 2021-03-04 17:57:32 UTC (rev 273896)
@@ -645,13 +645,8 @@
void blend(const CSSPropertyBlendingClient*, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
{
- // 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 (progress < 0.5)
- (dst->*m_setter)((a->*PropertyWrapperGetter<T>::m_getter)());
- else
- (dst->*m_setter)((b->*PropertyWrapperGetter<T>::m_getter)());
+ ASSERT(!progress || progress == 1.0);
+ (dst->*m_setter)(this->value(progress ? b : a));
}
protected:
@@ -776,13 +771,9 @@
void blend(const CSSPropertyBlendingClient* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
{
- if (!canInterpolate(a, b)) {
- progress = progress < 0.5 ? 0 : 1;
- if (m_flags.contains(Flags::UsesFillKeyword))
- dst->setBorderImageSliceFill((progress ? b : a)->borderImage().fill());
- } else if (m_flags.contains(Flags::UsesFillKeyword))
- dst->setBorderImageSliceFill(a->borderImage().fill());
- (dst->*m_setter)(blendFunc(anim, (a->*PropertyWrapperGetter<const LengthBox&>::m_getter)(), (b->*PropertyWrapperGetter<const LengthBox&>::m_getter)(), progress));
+ if (m_flags.contains(Flags::UsesFillKeyword))
+ dst->setBorderImageSliceFill((!progress || canInterpolate(a, b) ? a : b)->borderImage().fill());
+ (dst->*m_setter)(blendFunc(anim, this->value(a), this->value(b), progress));
}
protected:
@@ -2156,6 +2147,11 @@
AnimationPropertyWrapperBase* wrapper = CSSPropertyAnimationWrapperMap::singleton().wrapperForProperty(prop);
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))
+ progress = progress < 0.5 ? 0 : 1;
wrapper->blend(anim, dst, a, b, progress);
#if !LOG_DISABLED
wrapper->logBlend(a, b, dst, progress);