Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp (229659 => 229660)
--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp 2018-03-16 07:01:01 UTC (rev 229659)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp 2018-03-16 08:43:26 UTC (rev 229660)
@@ -192,7 +192,7 @@
{
}
-void TextureMapperAnimation::apply(Client& client, MonotonicTime time)
+void TextureMapperAnimation::apply(ApplicationResult& applicationResults, MonotonicTime time)
{
if (!isActive())
return;
@@ -208,18 +208,18 @@
}
if (!normalizedValue) {
- applyInternal(client, m_keyframes.at(0), m_keyframes.at(1), 0);
+ applyInternal(applicationResults, m_keyframes.at(0), m_keyframes.at(1), 0);
return;
}
if (normalizedValue == 1.0) {
- applyInternal(client, m_keyframes.at(m_keyframes.size() - 2), m_keyframes.at(m_keyframes.size() - 1), 1);
+ applyInternal(applicationResults, m_keyframes.at(m_keyframes.size() - 2), m_keyframes.at(m_keyframes.size() - 1), 1);
return;
}
if (m_keyframes.size() == 2) {
auto& timingFunction = timingFunctionForAnimationValue(m_keyframes.at(0), *m_animation);
normalizedValue = timingFunction.transformTime(normalizedValue, m_animation->duration());
- applyInternal(client, m_keyframes.at(0), m_keyframes.at(1), normalizedValue);
+ applyInternal(applicationResults, m_keyframes.at(0), m_keyframes.at(1), normalizedValue);
return;
}
@@ -232,7 +232,7 @@
normalizedValue = (normalizedValue - from.keyTime()) / (to.keyTime() - from.keyTime());
auto& timingFunction = timingFunctionForAnimationValue(from, *m_animation);
normalizedValue = timingFunction.transformTime(normalizedValue, m_animation->duration());
- applyInternal(client, from, to, normalizedValue);
+ applyInternal(applicationResults, from, to, normalizedValue);
break;
}
}
@@ -269,17 +269,17 @@
return m_state != AnimationState::Stopped || m_animation->fillsForwards();
}
-void TextureMapperAnimation::applyInternal(Client& client, const AnimationValue& from, const AnimationValue& to, float progress)
+void TextureMapperAnimation::applyInternal(ApplicationResult& applicationResults, const AnimationValue& from, const AnimationValue& to, float progress)
{
switch (m_keyframes.property()) {
+ case AnimatedPropertyTransform:
+ applicationResults.transform = applyTransformAnimation(static_cast<const TransformAnimationValue&>(from).value(), static_cast<const TransformAnimationValue&>(to).value(), progress, m_boxSize, m_listsMatch);
+ return;
case AnimatedPropertyOpacity:
- client.setAnimatedOpacity(applyOpacityAnimation((static_cast<const FloatAnimationValue&>(from).value()), (static_cast<const FloatAnimationValue&>(to).value()), progress));
+ applicationResults.opacity = applyOpacityAnimation((static_cast<const FloatAnimationValue&>(from).value()), (static_cast<const FloatAnimationValue&>(to).value()), progress);
return;
- case AnimatedPropertyTransform:
- client.setAnimatedTransform(applyTransformAnimation(static_cast<const TransformAnimationValue&>(from).value(), static_cast<const TransformAnimationValue&>(to).value(), progress, m_boxSize, m_listsMatch));
- return;
case AnimatedPropertyFilter:
- client.setAnimatedFilters(applyFilterAnimation(static_cast<const FilterAnimationValue&>(from).value(), static_cast<const FilterAnimationValue&>(to).value(), progress, m_boxSize));
+ applicationResults.filters = applyFilterAnimation(static_cast<const FilterAnimationValue&>(from).value(), static_cast<const FilterAnimationValue&>(to).value(), progress, m_boxSize);
return;
default:
ASSERT_NOT_REACHED();
@@ -330,10 +330,10 @@
animation.resume();
}
-void TextureMapperAnimations::apply(TextureMapperAnimation::Client& client, MonotonicTime time)
+void TextureMapperAnimations::apply(TextureMapperAnimation::ApplicationResult& applicationResults, MonotonicTime time)
{
for (auto& animation : m_animations)
- animation.apply(client, time);
+ animation.apply(applicationResults, time);
}
bool TextureMapperAnimations::hasActiveAnimationsOfType(AnimatedPropertyID type) const
Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h (229659 => 229660)
--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h 2018-03-16 07:01:01 UTC (rev 229659)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h 2018-03-16 08:43:26 UTC (rev 229660)
@@ -30,11 +30,10 @@
public:
enum class AnimationState { Playing, Paused, Stopped };
- class Client {
- public:
- virtual void setAnimatedTransform(const TransformationMatrix&) = 0;
- virtual void setAnimatedOpacity(float) = 0;
- virtual void setAnimatedFilters(const FilterOperations&) = 0;
+ struct ApplicationResult {
+ std::optional<TransformationMatrix> transform;
+ std::optional<double> opacity;
+ std::optional<FilterOperations> filters;
};
TextureMapperAnimation()
@@ -43,7 +42,7 @@
TextureMapperAnimation(const String&, const KeyframeValueList&, const FloatSize&, const Animation&, bool, MonotonicTime, Seconds, AnimationState);
WEBCORE_EXPORT TextureMapperAnimation(const TextureMapperAnimation&);
- void apply(Client&, MonotonicTime);
+ void apply(ApplicationResult&, MonotonicTime);
void pause(Seconds);
void resume();
bool isActive() const;
@@ -54,7 +53,7 @@
AnimationState state() const { return m_state; }
private:
- void applyInternal(Client&, const AnimationValue& from, const AnimationValue& to, float progress);
+ void applyInternal(ApplicationResult&, const AnimationValue& from, const AnimationValue& to, float progress);
Seconds computeTotalRunningTime(MonotonicTime);
String m_name;
@@ -80,7 +79,7 @@
void suspend(MonotonicTime);
void resume();
- void apply(TextureMapperAnimation::Client&, MonotonicTime);
+ void apply(TextureMapperAnimation::ApplicationResult&, MonotonicTime);
bool isEmpty() const { return m_animations.isEmpty(); }
size_t size() const { return m_animations.size(); }
Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp (229659 => 229660)
--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp 2018-03-16 07:01:01 UTC (rev 229659)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp 2018-03-16 08:43:26 UTC (rev 229660)
@@ -216,26 +216,11 @@
paintSelfAndChildren(options);
}
-void TextureMapperLayer::setAnimatedTransform(const TransformationMatrix& matrix)
-{
- m_currentTransform.setLocalTransform(matrix);
-}
-
-void TextureMapperLayer::setAnimatedOpacity(float opacity)
-{
- m_currentOpacity = opacity;
-}
-
TransformationMatrix TextureMapperLayer::replicaTransform()
{
return TransformationMatrix(m_state.replicaLayer->m_currentTransform.combined()).multiply(m_currentTransform.combined().inverse().value_or(TransformationMatrix()));
}
-void TextureMapperLayer::setAnimatedFilters(const FilterOperations& filters)
-{
- m_currentFilters = filters;
-}
-
static void resolveOverlaps(Region& newRegion, Region& overlapRegion, Region& nonOverlapRegion)
{
Region newOverlapRegion(newRegion);
@@ -652,14 +637,12 @@
void TextureMapperLayer::syncAnimations(MonotonicTime time)
{
- m_animations.apply(*this, time);
- if (!m_animations.hasActiveAnimationsOfType(AnimatedPropertyTransform))
- m_currentTransform.setLocalTransform(m_state.transform);
- if (!m_animations.hasActiveAnimationsOfType(AnimatedPropertyOpacity))
- m_currentOpacity = m_state.opacity;
+ TextureMapperAnimation::ApplicationResult applicationResults;
+ m_animations.apply(applicationResults, time);
- if (!m_animations.hasActiveAnimationsOfType(AnimatedPropertyFilter))
- m_currentFilters = m_state.filters;
+ m_currentTransform.setLocalTransform(applicationResults.transform.value_or(m_state.transform));
+ m_currentOpacity = applicationResults.opacity.value_or(m_state.opacity);
+ m_currentFilters = applicationResults.filters.value_or(m_state.filters);
}
bool TextureMapperLayer::isAncestorFixedToViewport() const