Commit 701add99 authored by Matt Menke's avatar Matt Menke Committed by Commit Bot

Revert "[animation-worklet] Transfrom related worklet animations should respond to zoom"

This reverts commit dec72e86.

Reason for revert:
virtual/threaded/fast/animationworklet/worklet-animation-responsive-to-zoom.html seems to be failing most of the time on all platforms.

Sample failures: 
https://ci.chromium.org/p/chromium/builders/luci.chromium.try/win7_chromium_rel_ng/91172
https://ci.chromium.org/p/chromium/builders/luci.chromium.try/mac_chromium_rel_ng/146546
https://ci.chromium.org/p/chromium/builders/luci.chromium.try/linux_chromium_rel_ng/193114

Original change's description:
> [animation-worklet] Transfrom related worklet animations should respond to zoom
> 
> Worklet animation compositing state should be updated when a zoom or viewport
> resize changes css pixel to dip ratio.
> 
> The fix is to simply match what we already do for regular animations for worklet
> animations.
> 
> TEST=virtual/threaded/fast/animationworklet/worklet-animation-responsive-to-zoom.html
> 
> Bug: 879107
> Change-Id: I0b74bd8297e83b18afd087247f09339aedcc618b
> Reviewed-on: https://chromium-review.googlesource.com/1237133
> Reviewed-by: Stephen McGruer <smcgruer@chromium.org>
> Reviewed-by: Majid Valipour <majidvp@chromium.org>
> Commit-Queue: Majid Valipour <majidvp@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#593171}

TBR=majidvp@chromium.org,smcgruer@chromium.org

Change-Id: I9eaf621c931ad9003fd7413aeea9f2ec3a7824a4
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 879107
Reviewed-on: https://chromium-review.googlesource.com/1239773Reviewed-by: default avatarMatt Menke <mmenke@chromium.org>
Commit-Queue: Matt Menke <mmenke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#593414}
parent c67aedd8
<!DOCTYPE html>
<style>
.box {
width: 100px;
height: 100px;
background-color: #00ff00;
transform: translateX(100px);
}
</style>
<div id="target" class="box"></div>
<script>
internals.setZoomFactor(2);
</script>
<!DOCTYPE html>
<style>
.box {
width: 100px;
height: 100px;
background-color: #00ff00;
}
</style>
<div id="target" class="box"></div>
<script id="visual_update" type="text/worklet">
registerAnimator("simple_animator", class {
animate(currentTime, effect) {
effect.localTime = 500;
}
});
</script>
<script src="resources/animation-worklet-tests.js"></script>
<script>
if (window.testRunner)
testRunner.waitUntilDone();
runInAnimationWorklet(
document.getElementById('visual_update').textContent
).then(()=>{
const effect = new KeyframeEffect(
document.getElementById('target'),
[{ transform: 'translateX(0)' }, { transform: 'translateX(200px)'}],
{duration: 1000});
const animation = new WorkletAnimation('simple_animator', effect);
animation.play();
if (window.testRunner) {
waitTwoAnimationFrames(_ => {
internals.setZoomFactor(2);
waitTwoAnimationFrames(_ => {
testRunner.notifyDone();
});
});
}
});
</script>
......@@ -46,7 +46,6 @@
#include "third_party/blink/renderer/core/animation/keyframe_effect.h"
#include "third_party/blink/renderer/core/animation/keyframe_effect_model.h"
#include "third_party/blink/renderer/core/animation/transition_interpolation.h"
#include "third_party/blink/renderer/core/animation/worklet_animation_base.h"
#include "third_party/blink/renderer/core/css/css_keyframe_rule.h"
#include "third_party/blink/renderer/core/css/css_property_equality.h"
#include "third_party/blink/renderer/core/css/css_value_list.h"
......@@ -274,40 +273,31 @@ void CSSAnimations::CalculateCompositorAnimationUpdate(
bool transform_zoom_changed =
old_style->HasCurrentTransformAnimation() &&
old_style->EffectiveZoom() != style.EffectiveZoom();
const auto& snapshot = [&](AnimationEffect* effect) {
for (auto& entry : element_animations->Animations()) {
Animation& animation = *entry.key;
const KeyframeEffectModelBase* keyframe_effect =
GetKeyframeEffectModelBase(effect);
GetKeyframeEffectModelBase(animation.effect());
if (!keyframe_effect)
return false;
continue;
if ((transform_zoom_changed || was_viewport_resized) &&
(keyframe_effect->Affects(PropertyHandle(GetCSSPropertyTransform())) ||
keyframe_effect->Affects(PropertyHandle(GetCSSPropertyTranslate()))))
keyframe_effect->InvalidateCompositorKeyframesSnapshot();
bool update_compositor_keyframes = false;
if (keyframe_effect->SnapshotAllCompositorKeyframesIfNecessary(
element, style, parent_style)) {
return true;
update_compositor_keyframes = true;
} else if (keyframe_effect->HasSyntheticKeyframes() &&
keyframe_effect->SnapshotNeutralCompositorKeyframes(
element, *old_style, style, parent_style)) {
return true;
update_compositor_keyframes = true;
}
return false;
};
for (auto& entry : element_animations->Animations()) {
Animation& animation = *entry.key;
if (snapshot(animation.effect()))
if (update_compositor_keyframes)
update.UpdateCompositorKeyframes(&animation);
}
for (auto& entry : element_animations->GetWorkletAnimations()) {
WorkletAnimationBase& animation = *entry;
if (snapshot(animation.GetEffect()))
animation.InvalidateCompositingState();
}
}
void CSSAnimations::CalculateAnimationUpdate(CSSAnimationUpdate& update,
......
......@@ -26,7 +26,6 @@ class CORE_EXPORT WorkletAnimationBase : public ScriptWrappable {
// Updates the animation on the compositor side to reflect the main thread
// state.
virtual void UpdateCompositingState() = 0;
virtual void InvalidateCompositingState() = 0;
virtual Document* GetDocument() const = 0;
virtual KeyframeEffect* GetEffect() const = 0;
......
......@@ -372,7 +372,8 @@ void WorkletAnimation::UpdateIfNecessary() {
}
void WorkletAnimation::EffectInvalidated() {
InvalidateCompositingState();
effect_needs_restart_ = true;
document_->GetWorkletAnimationController().InvalidateAnimation(*this);
}
void WorkletAnimation::Update(TimingUpdateReason reason) {
......@@ -433,11 +434,6 @@ void WorkletAnimation::UpdateCompositingState() {
}
}
void WorkletAnimation::InvalidateCompositingState() {
effect_needs_restart_ = true;
document_->GetWorkletAnimationController().InvalidateAnimation(*this);
}
void WorkletAnimation::StartOnMain() {
running_on_main_thread_ = true;
SetStartTimeToNow();
......
......@@ -88,7 +88,6 @@ class MODULES_EXPORT WorkletAnimation : public WorkletAnimationBase,
// WorkletAnimationBase implementation.
void Update(TimingUpdateReason) override;
void UpdateCompositingState() override;
void InvalidateCompositingState() override;
// CompositorAnimationClient implementation.
CompositorAnimation* GetCompositorAnimation() const override {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment