summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/animation
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-05-16 09:59:13 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-05-20 10:28:53 +0000
commit6c11fb357ec39bf087b8b632e2b1e375aef1b38b (patch)
treec8315530db18a8ee566521c39ab8a6af4f72bc03 /chromium/third_party/blink/renderer/core/animation
parent3ffaed019d0772e59d6cdb2d0d32fe4834c31f72 (diff)
downloadqtwebengine-chromium-6c11fb357ec39bf087b8b632e2b1e375aef1b38b.tar.gz
BASELINE: Update Chromium to 74.0.3729.159
Change-Id: I8d2497da544c275415aedd94dd25328d555de811 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/core/animation')
-rw-r--r--chromium/third_party/blink/renderer/core/animation/README.md22
-rw-r--r--chromium/third_party/blink/renderer/core/animation/animation.cc6
-rw-r--r--chromium/third_party/blink/renderer/core/animation/animation.h6
-rw-r--r--chromium/third_party/blink/renderer/core/animation/animation_effect.cc9
-rw-r--r--chromium/third_party/blink/renderer/core/animation/animation_input_helpers.cc3
-rw-r--r--chromium/third_party/blink/renderer/core/animation/animation_input_helpers_test.cc5
-rw-r--r--chromium/third_party/blink/renderer/core/animation/basic_shape_interpolation_functions.cc4
-rw-r--r--chromium/third_party/blink/renderer/core/animation/compositor_animations.h2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/compositor_animations_test.cc95
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css/css_animation_update.h4
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css/css_animations.cc126
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css/css_animations.h2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css/css_transition_data.cc2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_border_image_length_box_interpolation_type.cc4
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_clip_interpolation_type.cc10
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_image_slice_interpolation_type.cc17
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_text_indent_interpolation_type.cc2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_translate_interpolation_type.cc2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/document_animations.cc4
-rw-r--r--chromium/third_party/blink/renderer/core/animation/document_timeline.cc13
-rw-r--r--chromium/third_party/blink/renderer/core/animation/document_timeline_test.cc103
-rw-r--r--chromium/third_party/blink/renderer/core/animation/effect_input.cc10
-rw-r--r--chromium/third_party/blink/renderer/core/animation/invalidatable_interpolation.cc2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/keyframe.h2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/length_interpolation_functions.cc7
-rw-r--r--chromium/third_party/blink/renderer/core/animation/length_list_property_functions.cc2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/length_property_functions.cc35
-rw-r--r--chromium/third_party/blink/renderer/core/animation/list_interpolation_functions.cc12
-rw-r--r--chromium/third_party/blink/renderer/core/animation/non_interpolable_value.h21
-rw-r--r--chromium/third_party/blink/renderer/core/animation/number_property_functions.cc10
-rw-r--r--chromium/third_party/blink/renderer/core/animation/pending_animations.cc2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/scroll_timeline.cc56
-rw-r--r--chromium/third_party/blink/renderer/core/animation/scroll_timeline.h7
-rw-r--r--chromium/third_party/blink/renderer/core/animation/scroll_timeline.idl1
-rw-r--r--chromium/third_party/blink/renderer/core/animation/scroll_timeline_options.idl1
-rw-r--r--chromium/third_party/blink/renderer/core/animation/scroll_timeline_test.cc2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/scroll_timeline_util.cc2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/scroll_timeline_util_test.cc2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/size_interpolation_functions.cc2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/svg_transform_list_interpolation_type.cc40
-rw-r--r--chromium/third_party/blink/renderer/core/animation/test_data/transform-animation-update.html19
-rw-r--r--chromium/third_party/blink/renderer/core/animation/timing.cc13
-rw-r--r--chromium/third_party/blink/renderer/core/animation/timing.h1
-rw-r--r--chromium/third_party/blink/renderer/core/animation/timing_input.cc17
-rw-r--r--chromium/third_party/blink/renderer/core/animation/timing_input_test.cc12
-rw-r--r--chromium/third_party/blink/renderer/core/animation/underlying_value_owner.cc4
-rw-r--r--chromium/third_party/blink/renderer/core/animation/worklet_animation_controller.h2
47 files changed, 419 insertions, 306 deletions
diff --git a/chromium/third_party/blink/renderer/core/animation/README.md b/chromium/third_party/blink/renderer/core/animation/README.md
index 9481e72d44f..52b8e83bfee 100644
--- a/chromium/third_party/blink/renderer/core/animation/README.md
+++ b/chromium/third_party/blink/renderer/core/animation/README.md
@@ -68,7 +68,7 @@ The Blink animation engine interacts with Blink/Chrome in the following ways:
Whether or not an animation can be accelerated is determined by
[CheckCanStartAnimationOnCompositor()][] which looks at several aspects
such as the composite mode, other animations affecting same property, and
- whether the target element can be promoted and mutated in compositor.
+ whether the target element can be promoted and mutated in compositor.
Reasons for not compositing animations are captured in [FailureCodes][].
#### Lifetime of a compositor animation
@@ -89,7 +89,11 @@ The Blink animation engine interacts with Blink/Chrome in the following ways:
animation updates the visuals the main thread animation updates the computed
style. There is a special case logic to ensure updates from such accelerated
animations do not cause spurious commits from main to compositor (See
- [CompositedLayerMapping::UpdateGraphicsLayerGeometry()][])
+ [CompositedLayerMapping::UpdateGraphicsLayerGeometry()][], or
+ [FragmentPaintPropertyTreeBuilder::UpdateTransform()][],
+ [FragmentPaintPropertyTreeBuilder::UpdateEffect()][], and
+ [FragmentPaintPropertyTreeBuilder::UpdateFilter()][] for
+ [BlinkGenPropertyTrees mode][])
A compositor animation provides updates on its playback state changes (e.g.,
on start, finish, abort) to its blink counterpart via
@@ -105,6 +109,10 @@ The Blink animation engine interacts with Blink/Chrome in the following ways:
[Animation::PreCommit()]: https://cs.chromium.org/search/?q=file:animation.h+function:PreCommit
[CompositorAnimationDelegate]: https://cs.chromium.org/search/?q=file:compositor_animation_delegate.h
[CompositedLayerMapping::UpdateGraphicsLayerGeometry()]: https://cs.chromium.org/search/?q=file:composited_layer_mapping.h+function:UpdateGraphicsLayerGeometry
+[FragmentPaintPropertyTreeBuilder::UpdateTransform()]: https://cs.chromium.org/search/?q=class:FragmentPaintPropertyTreeBuilder+function:UpdateTransform
+[FragmentPaintPropertyTreeBuilder::UpdateEffect()]: https://cs.chromium.org/search/?q=class:FragmentPaintPropertyTreeBuilder+function:UpdateEffect
+[FragmentPaintPropertyTreeBuilder::UpdateFilter()]: https://cs.chromium.org/search/?q=class:FragmentPaintPropertyTreeBuilder+function:UpdateFilter
+[BlinkGenPropertyTrees mode]: https://chromium.googlesource.com/chromium/src/+/HEAD/third_party/blink/renderer/core/paint/README.md
* ### Javascript
@@ -238,8 +246,8 @@ other specs (for example Javascript callback based effects).
* __[KeyframeEffect][]__ represents the effect an animation has (without any
details of when it started or whether it's playing) and is comprised of
three things:
- * Some __[Timing][]__ information (inherited from [AnimationEffect][]).
- [Example](http://jsbin.com/nuyohulojo/edit?js,output):
+ * Some __[Timing][]__ information (inherited from [AnimationEffect][]).
+ [Example](http://jsbin.com/nuyohulojo/edit?js,output):
```javascript
{
duration: 4000,
@@ -256,8 +264,8 @@ other specs (for example Javascript callback based effects).
* A __[KeyframeEffectModel][]__ that holds a sequence of keyframes to
specify the properties being animated and what values they pass
- through.
- [Example](http://jsbin.com/wiyefaxiru/1/edit?js,output):
+ through.
+ [Example](http://jsbin.com/wiyefaxiru/1/edit?js,output):
```javascript
[
{backgroundColor: 'red', transform: 'rotate(0deg)'},
@@ -275,7 +283,7 @@ other specs (for example Javascript callback based effects).
* An __[InterpolationEffect][]__ which holds a set of
[Interpolation][]s, each one representing the animated values
between adjacent pairs of [PropertySpecificKeyframe][]s, and where
- in the percentage progress they are active.
+ in the percentage progress they are active.
In the example keyframes above the [Interpolations][] generated
would include, among the 5 different property specific keyframe
pairs, one for `backgroundColor: 'red'` to
diff --git a/chromium/third_party/blink/renderer/core/animation/animation.cc b/chromium/third_party/blink/renderer/core/animation/animation.cc
index 7dad569a20d..b9e28da1d5a 100644
--- a/chromium/third_party/blink/renderer/core/animation/animation.cc
+++ b/chromium/third_party/blink/renderer/core/animation/animation.cc
@@ -142,7 +142,7 @@ Animation::Animation(ExecutionContext* execution_context,
}
content_->Attach(this);
}
- probe::didCreateAnimation(timeline_->GetDocument(), sequence_number_);
+ probe::DidCreateAnimation(timeline_->GetDocument(), sequence_number_);
}
Animation::~Animation() {
@@ -865,7 +865,7 @@ void Animation::StartAnimationOnCompositor(
base::Optional<double> start_time = base::nullopt;
double time_offset = 0;
if (start_time_) {
- start_time = TimeTicksInSeconds(TimelineInternal()->ZeroTime()) +
+ start_time = TimelineInternal()->ZeroTime().since_origin().InSecondsF() +
start_time_.value();
if (reversed)
start_time = start_time.value() - (EffectEnd() / fabs(playback_rate_));
@@ -1222,7 +1222,7 @@ Animation::PlayStateUpdateScope::~PlayStateUpdateScope() {
animation_->EndUpdatingState();
if (old_play_state != new_play_state) {
- probe::animationPlayStateChanged(
+ probe::AnimationPlayStateChanged(
animation_->TimelineInternal()->GetDocument(), animation_,
old_play_state, new_play_state);
}
diff --git a/chromium/third_party/blink/renderer/core/animation/animation.h b/chromium/third_party/blink/renderer/core/animation/animation.h
index c4a6db7c401..d42c992d08d 100644
--- a/chromium/third_party/blink/renderer/core/animation/animation.h
+++ b/chromium/third_party/blink/renderer/core/animation/animation.h
@@ -45,9 +45,9 @@
#include "third_party/blink/renderer/core/animation/document_timeline.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/css/css_property_names.h"
-#include "third_party/blink/renderer/core/dom/context_lifecycle_observer.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h"
#include "third_party/blink/renderer/core/dom/events/event_target.h"
+#include "third_party/blink/renderer/core/execution_context/context_lifecycle_observer.h"
#include "third_party/blink/renderer/platform/animation/compositor_animation_client.h"
#include "third_party/blink/renderer/platform/animation/compositor_animation_delegate.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
@@ -145,8 +145,8 @@ class CORE_EXPORT Animation final : public EventTargetWithInlineData,
bool Limited() const { return Limited(CurrentTimeInternal()); }
bool FinishedInternal() const { return finished_; }
- DEFINE_ATTRIBUTE_EVENT_LISTENER(finish, kFinish);
- DEFINE_ATTRIBUTE_EVENT_LISTENER(cancel, kCancel);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(finish, kFinish)
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(cancel, kCancel)
const AtomicString& InterfaceName() const override;
ExecutionContext* GetExecutionContext() const override;
diff --git a/chromium/third_party/blink/renderer/core/animation/animation_effect.cc b/chromium/third_party/blink/renderer/core/animation/animation_effect.cc
index ffd0a17316a..44892999bfb 100644
--- a/chromium/third_party/blink/renderer/core/animation/animation_effect.cc
+++ b/chromium/third_party/blink/renderer/core/animation/animation_effect.cc
@@ -267,10 +267,17 @@ void AnimationEffect::UpdateInheritedTime(double inherited_time,
current_iteration, kLocalIterationDuration, iteration_time, timing_);
}
+ const bool was_canceled = current_phase != calculated_.phase &&
+ current_phase == AnimationEffect::kPhaseNone;
+ calculated_.phase = current_phase;
+ // If the animation was canceled, we need to fire the event condition before
+ // updating the timing so that the cancelation time can be determined.
+ if (was_canceled && event_delegate_)
+ event_delegate_->OnEventCondition(*this);
+
calculated_.current_iteration = current_iteration;
calculated_.progress = progress;
- calculated_.phase = current_phase;
calculated_.is_in_effect = !IsNull(active_time);
calculated_.is_in_play = GetPhase() == kPhaseActive;
calculated_.is_current = GetPhase() == kPhaseBefore || IsInPlay();
diff --git a/chromium/third_party/blink/renderer/core/animation/animation_input_helpers.cc b/chromium/third_party/blink/renderer/core/animation/animation_input_helpers.cc
index 557ed22d95e..dd479937cdf 100644
--- a/chromium/third_party/blink/renderer/core/animation/animation_input_helpers.cc
+++ b/chromium/third_party/blink/renderer/core/animation/animation_input_helpers.cc
@@ -264,8 +264,7 @@ scoped_refptr<TimingFunction> AnimationInputHelpers::ParseTimingFunction(
exception_state.ThrowTypeError("Easing may not be set to a list of values");
return nullptr;
}
- return CSSToStyleMap::MapAnimationTimingFunction(value_list->Item(0), true,
- document);
+ return CSSToStyleMap::MapAnimationTimingFunction(value_list->Item(0));
}
String AnimationInputHelpers::PropertyHandleToKeyframeAttribute(
diff --git a/chromium/third_party/blink/renderer/core/animation/animation_input_helpers_test.cc b/chromium/third_party/blink/renderer/core/animation/animation_input_helpers_test.cc
index 77fd3ef5044..da179987d18 100644
--- a/chromium/third_party/blink/renderer/core/animation/animation_input_helpers_test.cc
+++ b/chromium/third_party/blink/renderer/core/animation/animation_input_helpers_test.cc
@@ -134,16 +134,11 @@ TEST_F(AnimationAnimationInputHelpersTest, ParseAnimationTimingFunction) {
EXPECT_EQ("steps(1, start)",
ParseTimingFunction("step-start", exception_state)->ToString());
- EXPECT_EQ("steps(1, middle)",
- ParseTimingFunction("step-middle", exception_state)->ToString());
EXPECT_EQ("steps(1)",
ParseTimingFunction("step-end", exception_state)->ToString());
EXPECT_EQ(
"steps(3, start)",
ParseTimingFunction("steps(3, start)", exception_state)->ToString());
- EXPECT_EQ(
- "steps(3, middle)",
- ParseTimingFunction("steps(3, middle)", exception_state)->ToString());
EXPECT_EQ("steps(3)",
ParseTimingFunction("steps(3, end)", exception_state)->ToString());
EXPECT_EQ("steps(3)",
diff --git a/chromium/third_party/blink/renderer/core/animation/basic_shape_interpolation_functions.cc b/chromium/third_party/blink/renderer/core/animation/basic_shape_interpolation_functions.cc
index 8a077911c48..ee5cb16555c 100644
--- a/chromium/third_party/blink/renderer/core/animation/basic_shape_interpolation_functions.cc
+++ b/chromium/third_party/blink/renderer/core/animation/basic_shape_interpolation_functions.cc
@@ -83,8 +83,8 @@ std::unique_ptr<InterpolableValue> ConvertCSSCoordinate(
return Unwrap(
CSSPositionAxisListInterpolationType::ConvertPositionAxisCSSValue(
*coordinate));
- return Unwrap(LengthInterpolationFunctions::MaybeConvertLength(
- Length(50, kPercent), 1));
+ return Unwrap(
+ LengthInterpolationFunctions::MaybeConvertLength(Length::Percent(50), 1));
}
std::unique_ptr<InterpolableValue> ConvertCoordinate(
diff --git a/chromium/third_party/blink/renderer/core/animation/compositor_animations.h b/chromium/third_party/blink/renderer/core/animation/compositor_animations.h
index 84413c1043a..a0cf3f06059 100644
--- a/chromium/third_party/blink/renderer/core/animation/compositor_animations.h
+++ b/chromium/third_party/blink/renderer/core/animation/compositor_animations.h
@@ -158,6 +158,8 @@ class CORE_EXPORT CompositorAnimations {
CannotStartElementOnCompositorEffectSVG);
FRIEND_TEST_ALL_PREFIXES(AnimationCompositorAnimationsTest,
CancelIncompatibleCompositorAnimations);
+ FRIEND_TEST_ALL_PREFIXES(AnimationCompositorAnimationsTest,
+ NonAnimatedTransformPropertyChangeGetsUpdated);
};
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/animation/compositor_animations_test.cc b/chromium/third_party/blink/renderer/core/animation/compositor_animations_test.cc
index d27d062cf5f..88255ce836c 100644
--- a/chromium/third_party/blink/renderer/core/animation/compositor_animations_test.cc
+++ b/chromium/third_party/blink/renderer/core/animation/compositor_animations_test.cc
@@ -36,6 +36,8 @@
#include "base/memory/ptr_util.h"
#include "base/memory/scoped_refptr.h"
+#include "cc/animation/animation_host.h"
+#include "cc/layers/picture_layer.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/web/web_settings.h"
#include "third_party/blink/renderer/core/animation/animatable/animatable_double.h"
@@ -52,13 +54,13 @@
#include "third_party/blink/renderer/core/frame/frame_test_helpers.h"
#include "third_party/blink/renderer/core/frame/web_local_frame_impl.h"
#include "third_party/blink/renderer/core/layout/layout_object.h"
+#include "third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.h"
#include "third_party/blink/renderer/core/paint/object_paint_properties.h"
#include "third_party/blink/renderer/core/paint/paint_layer.h"
#include "third_party/blink/renderer/core/style/computed_style.h"
#include "third_party/blink/renderer/core/style/filter_operations.h"
#include "third_party/blink/renderer/core/testing/core_unit_test_helper.h"
#include "third_party/blink/renderer/core/testing/dummy_page_holder.h"
-#include "third_party/blink/renderer/platform/animation/compositor_animation_host.h"
#include "third_party/blink/renderer/platform/animation/compositor_float_animation_curve.h"
#include "third_party/blink/renderer/platform/animation/compositor_float_keyframe.h"
#include "third_party/blink/renderer/platform/animation/compositor_keyframe_model.h"
@@ -465,7 +467,7 @@ class AnimationCompositorAnimationsTest : public RenderingTest {
void BeginFrame() {
helper_.GetWebView()->MainFrameWidget()->BeginFrame(
- WTF::CurrentTimeTicks());
+ WTF::CurrentTimeTicks(), false /* record_main_frame_metrics */);
}
void ForceFullCompositingUpdate() {
@@ -1828,7 +1830,7 @@ TEST_F(AnimationCompositorAnimationsTest,
TEST_F(AnimationCompositorAnimationsTest, TrackRafAnimation) {
LoadTestData("raf-countdown.html");
- CompositorAnimationHost* host =
+ cc::AnimationHost* host =
GetFrame()->GetDocument()->View()->GetCompositorAnimationHost();
// The test file registers two rAF 'animations'; one which ends after 5
@@ -1836,36 +1838,36 @@ TEST_F(AnimationCompositorAnimationsTest, TrackRafAnimation) {
for (int i = 0; i < 9; i++) {
BeginFrame();
ForceFullCompositingUpdate();
- EXPECT_TRUE(host->CurrentFrameHadRAFForTesting());
- EXPECT_TRUE(host->NextFrameHasPendingRAFForTesting());
+ EXPECT_TRUE(host->CurrentFrameHadRAF());
+ EXPECT_TRUE(host->NextFrameHasPendingRAF());
}
// On the 10th iteration, there should be a current rAF, but no more pending
// rAFs.
BeginFrame();
ForceFullCompositingUpdate();
- EXPECT_TRUE(host->CurrentFrameHadRAFForTesting());
- EXPECT_FALSE(host->NextFrameHasPendingRAFForTesting());
+ EXPECT_TRUE(host->CurrentFrameHadRAF());
+ EXPECT_FALSE(host->NextFrameHasPendingRAF());
// On the 11th iteration, there should be no more rAFs firing.
BeginFrame();
ForceFullCompositingUpdate();
- EXPECT_FALSE(host->CurrentFrameHadRAFForTesting());
- EXPECT_FALSE(host->NextFrameHasPendingRAFForTesting());
+ EXPECT_FALSE(host->CurrentFrameHadRAF());
+ EXPECT_FALSE(host->NextFrameHasPendingRAF());
}
TEST_F(AnimationCompositorAnimationsTest, TrackRafAnimationTimeout) {
LoadTestData("raf-timeout.html");
- CompositorAnimationHost* host =
+ cc::AnimationHost* host =
GetFrame()->GetDocument()->View()->GetCompositorAnimationHost();
// The test file executes a rAF, which fires a setTimeout for the next rAF.
// Even with setTimeout(func, 0), the next rAF is not considered pending.
BeginFrame();
ForceFullCompositingUpdate();
- EXPECT_TRUE(host->CurrentFrameHadRAFForTesting());
- EXPECT_FALSE(host->NextFrameHasPendingRAFForTesting());
+ EXPECT_TRUE(host->CurrentFrameHadRAF());
+ EXPECT_FALSE(host->NextFrameHasPendingRAF());
}
TEST_F(AnimationCompositorAnimationsTest, TrackRafAnimationNoneRegistered) {
@@ -1877,16 +1879,16 @@ TEST_F(AnimationCompositorAnimationsTest, TrackRafAnimationNoneRegistered) {
ForceFullCompositingUpdate();
// The HTML does not have any rAFs.
- CompositorAnimationHost* host =
+ cc::AnimationHost* host =
GetFrame()->GetDocument()->View()->GetCompositorAnimationHost();
- EXPECT_FALSE(host->CurrentFrameHadRAFForTesting());
- EXPECT_FALSE(host->NextFrameHasPendingRAFForTesting());
+ EXPECT_FALSE(host->CurrentFrameHadRAF());
+ EXPECT_FALSE(host->NextFrameHasPendingRAF());
// And still shouldn't after another frame.
BeginFrame();
ForceFullCompositingUpdate();
- EXPECT_FALSE(host->CurrentFrameHadRAFForTesting());
- EXPECT_FALSE(host->NextFrameHasPendingRAFForTesting());
+ EXPECT_FALSE(host->CurrentFrameHadRAF());
+ EXPECT_FALSE(host->NextFrameHasPendingRAF());
}
TEST_F(AnimationCompositorAnimationsTest, CanStartElementOnCompositorEffect) {
@@ -1901,10 +1903,54 @@ TEST_F(AnimationCompositorAnimationsTest, CanStartElementOnCompositorEffect) {
CompositorAnimations::CheckCanStartElementOnCompositor(*target);
EXPECT_EQ(code, CompositorAnimations::FailureCode::None());
EXPECT_EQ(document->Timeline().PendingAnimationsCount(), 1u);
- CompositorAnimationHost* host =
- document->View()->GetCompositorAnimationHost();
- EXPECT_EQ(host->GetMainThreadAnimationsCountForTesting(), 0u);
- EXPECT_EQ(host->GetCompositedAnimationsCountForTesting(), 1u);
+ cc::AnimationHost* host = document->View()->GetCompositorAnimationHost();
+ EXPECT_EQ(host->MainThreadAnimationsCount(), 0u);
+ EXPECT_EQ(host->CompositedAnimationsCount(), 1u);
+}
+
+TEST_F(AnimationCompositorAnimationsTest,
+ NonAnimatedTransformPropertyChangeGetsUpdated) {
+ LoadTestData("transform-animation-update.html");
+ Document* document = GetFrame()->GetDocument();
+ Element* target = document->getElementById("target");
+ const ObjectPaintProperties* properties =
+ target->GetLayoutObject()->FirstFragment().PaintProperties();
+ ASSERT_NE(nullptr, properties);
+ const auto* transform = properties->Transform();
+ ASSERT_NE(nullptr, transform);
+ // Make sure composited animation is running on #target.
+ if (RuntimeEnabledFeatures::CompositeAfterPaintEnabled())
+ EXPECT_TRUE(transform->HasDirectCompositingReasons());
+ CompositorAnimations::FailureCode code =
+ CompositorAnimations::CheckCanStartElementOnCompositor(*target);
+ EXPECT_EQ(code, CompositorAnimations::FailureCode::None());
+ EXPECT_EQ(document->Timeline().PendingAnimationsCount(), 1u);
+ cc::AnimationHost* host = document->View()->GetCompositorAnimationHost();
+ EXPECT_EQ(host->MainThreadAnimationsCount(), 0u);
+ EXPECT_EQ(host->CompositedAnimationsCount(), 1u);
+ // Make sure the backface-visibility is correctly set, both in blink and on
+ // the cc::Layer.
+ EXPECT_FALSE(transform->Matrix().IsIdentity()); // Rotated
+ EXPECT_EQ(transform->GetBackfaceVisibility(),
+ TransformPaintPropertyNode::BackfaceVisibility::kVisible);
+ const CompositedLayerMapping* composited_layer_mapping =
+ ToLayoutBoxModelObject(target->GetLayoutObject())
+ ->Layer()
+ ->GetCompositedLayerMapping();
+ ASSERT_NE(nullptr, composited_layer_mapping);
+ const cc::PictureLayer* layer =
+ composited_layer_mapping->MainGraphicsLayer()->CcLayer();
+ ASSERT_NE(nullptr, layer);
+ EXPECT_TRUE(layer->double_sided());
+ // Change the backface visibility, while the compositor animation is
+ // happening.
+ target->setAttribute(html_names::kClassAttr, "backface-hidden");
+ ForceFullCompositingUpdate();
+ // Make sure the setting made it to both blink and all the way to CC.
+ EXPECT_EQ(transform->GetBackfaceVisibility(),
+ TransformPaintPropertyNode::BackfaceVisibility::kHidden);
+ EXPECT_FALSE(layer->double_sided())
+ << "Change to hidden did not get propagated to CC";
}
// Regression test for https://crbug.com/781305. When we have a transform
@@ -1920,10 +1966,9 @@ TEST_F(AnimationCompositorAnimationsTest,
EXPECT_EQ(code, CompositorAnimations::FailureCode::NonActionable(
"Element does not paint into own backing"));
EXPECT_EQ(document->Timeline().PendingAnimationsCount(), 4u);
- CompositorAnimationHost* host =
- document->View()->GetCompositorAnimationHost();
- EXPECT_EQ(host->GetMainThreadAnimationsCountForTesting(), 4u);
- EXPECT_EQ(host->GetCompositedAnimationsCountForTesting(), 0u);
+ cc::AnimationHost* host = document->View()->GetCompositorAnimationHost();
+ EXPECT_EQ(host->MainThreadAnimationsCount(), 4u);
+ EXPECT_EQ(host->CompositedAnimationsCount(), 0u);
}
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/animation/css/css_animation_update.h b/chromium/third_party/blink/renderer/core/animation/css/css_animation_update.h
index 21d53493f3c..d0f764557c6 100644
--- a/chromium/third_party/blink/renderer/core/animation/css/css_animation_update.h
+++ b/chromium/third_party/blink/renderer/core/animation/css/css_animation_update.h
@@ -90,8 +90,8 @@ class UpdatedCSSAnimation {
} // namespace blink
-WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::NewCSSAnimation);
-WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::UpdatedCSSAnimation);
+WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::NewCSSAnimation)
+WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::UpdatedCSSAnimation)
namespace blink {
diff --git a/chromium/third_party/blink/renderer/core/animation/css/css_animations.cc b/chromium/third_party/blink/renderer/core/animation/css/css_animations.cc
index a8bdb4b5871..71407ffacab 100644
--- a/chromium/third_party/blink/renderer/core/animation/css/css_animations.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css/css_animations.cc
@@ -210,6 +210,12 @@ std::unique_ptr<TypedInterpolationValue> SampleAnimation(
return ToTransitionInterpolation(*sample.at(0)).GetInterpolatedValue();
}
+// Returns the start time of an animation given the start delay. A negative
+// start delay results in the animation starting with non-zero progress.
+double StartTimeFromDelay(double start_delay) {
+ return start_delay < 0 ? -start_delay : 0;
+}
+
} // namespace
CSSAnimations::CSSAnimations() = default;
@@ -376,14 +382,14 @@ void CSSAnimations::CalculateAnimationUpdate(CSSAnimationUpdate& update,
wtf_size_t existing_animation_index = 0;
if (css_animations) {
- for (wtf_size_t i = 0; i < css_animations->running_animations_.size();
- i++) {
+ for (wtf_size_t j = 0; j < css_animations->running_animations_.size();
+ j++) {
const RunningAnimation& running_animation =
- *css_animations->running_animations_[i];
+ *css_animations->running_animations_[j];
if (running_animation.name == name &&
running_animation.name_index == name_index) {
existing_animation = &running_animation;
- existing_animation_index = i;
+ existing_animation_index = j;
break;
}
}
@@ -786,28 +792,12 @@ void CSSAnimations::CalculateTransitionUpdateForProperty(
}
TransitionKeyframeVector keyframes;
- double start_keyframe_offset = 0;
-
- if (timing.start_delay > 0) {
- timing.iteration_duration.value() +=
- AnimationTimeDelta::FromSecondsD(timing.start_delay);
- start_keyframe_offset =
- timing.start_delay / timing.iteration_duration->InSecondsF();
- timing.start_delay = 0;
- }
-
- TransitionKeyframe* delay_keyframe = TransitionKeyframe::Create(property);
- delay_keyframe->SetValue(TypedInterpolationValue::Create(
- *transition_type, start.interpolable_value->Clone(),
- start.non_interpolable_value));
- delay_keyframe->SetOffset(0);
- keyframes.push_back(delay_keyframe);
TransitionKeyframe* start_keyframe = TransitionKeyframe::Create(property);
start_keyframe->SetValue(TypedInterpolationValue::Create(
*transition_type, start.interpolable_value->Clone(),
start.non_interpolable_value));
- start_keyframe->SetOffset(start_keyframe_offset);
+ start_keyframe->SetOffset(0);
start_keyframe->SetEasing(std::move(timing.timing_function));
timing.timing_function = LinearTimingFunction::Shared();
keyframes.push_back(start_keyframe);
@@ -824,7 +814,6 @@ void CSSAnimations::CalculateTransitionUpdateForProperty(
CSSAnimatableValueFactory::Create(property, state.old_style);
AnimatableValue* to =
CSSAnimatableValueFactory::Create(property, state.style);
- delay_keyframe->SetCompositorValue(from);
start_keyframe->SetCompositorValue(from);
end_keyframe->SetCompositorValue(to);
}
@@ -1196,27 +1185,86 @@ EventTarget* CSSAnimations::TransitionEventDelegate::GetEventTarget() const {
void CSSAnimations::TransitionEventDelegate::OnEventCondition(
const AnimationEffect& animation_node) {
const AnimationEffect::Phase current_phase = animation_node.GetPhase();
- if (current_phase == AnimationEffect::kPhaseAfter &&
- current_phase != previous_phase_ &&
- GetDocument().HasListenerType(Document::kTransitionEndListener)) {
- String property_name =
- property_.IsCSSCustomProperty()
- ? property_.CustomPropertyName()
- : property_.GetCSSProperty().GetPropertyNameString();
- const Timing& timing = animation_node.SpecifiedTiming();
- double elapsed_time = timing.iteration_duration->InSecondsF();
- const AtomicString& event_type = event_type_names::kTransitionend;
- String pseudo_element =
- PseudoElement::PseudoElementNameForEvents(GetPseudoId());
- TransitionEvent* event = TransitionEvent::Create(
- event_type, property_name, elapsed_time, pseudo_element);
- event->SetTarget(GetEventTarget());
- GetDocument().EnqueueAnimationFrameEvent(event);
+ if (current_phase == previous_phase_)
+ return;
+
+ if (GetDocument().HasListenerType(Document::kTransitionRunListener)) {
+ if (previous_phase_ == AnimationEffect::kPhaseNone) {
+ EnqueueEvent(
+ event_type_names::kTransitionrun,
+ StartTimeFromDelay(animation_node.SpecifiedTiming().start_delay));
+ }
+ }
+
+ if (GetDocument().HasListenerType(Document::kTransitionStartListener)) {
+ if ((current_phase == AnimationEffect::kPhaseActive ||
+ current_phase == AnimationEffect::kPhaseAfter) &&
+ (previous_phase_ == AnimationEffect::kPhaseNone ||
+ previous_phase_ == AnimationEffect::kPhaseBefore)) {
+ EnqueueEvent(
+ event_type_names::kTransitionstart,
+ StartTimeFromDelay(animation_node.SpecifiedTiming().start_delay));
+ } else if ((current_phase == AnimationEffect::kPhaseActive ||
+ current_phase == AnimationEffect::kPhaseBefore) &&
+ previous_phase_ == AnimationEffect::kPhaseAfter) {
+ // If the transition is progressing backwards it is considered to have
+ // started at the end position.
+ EnqueueEvent(
+ event_type_names::kTransitionstart,
+ animation_node.SpecifiedTiming().iteration_duration->InSecondsF());
+ }
+ }
+
+ if (GetDocument().HasListenerType(Document::kTransitionEndListener)) {
+ if (current_phase == AnimationEffect::kPhaseAfter &&
+ (previous_phase_ == AnimationEffect::kPhaseActive ||
+ previous_phase_ == AnimationEffect::kPhaseBefore ||
+ previous_phase_ == AnimationEffect::kPhaseNone)) {
+ EnqueueEvent(
+ event_type_names::kTransitionend,
+ animation_node.SpecifiedTiming().iteration_duration->InSecondsF());
+ } else if (current_phase == AnimationEffect::kPhaseBefore &&
+ (previous_phase_ == AnimationEffect::kPhaseActive ||
+ previous_phase_ == AnimationEffect::kPhaseAfter)) {
+ // If the transition is progressing backwards it is considered to have
+ // ended at the start position.
+ EnqueueEvent(
+ event_type_names::kTransitionend,
+ StartTimeFromDelay(animation_node.SpecifiedTiming().start_delay));
+ }
+ }
+
+ if (GetDocument().HasListenerType(Document::kTransitionCancelListener)) {
+ if (current_phase == AnimationEffect::kPhaseNone) {
+ double cancel_iteration_time =
+ animation_node.Progress().has_value()
+ ? animation_node.Progress().value() *
+ animation_node.SpecifiedTiming()
+ .iteration_duration->InSecondsF()
+ : StartTimeFromDelay(
+ animation_node.SpecifiedTiming().start_delay);
+ EnqueueEvent(event_type_names::kTransitioncancel, cancel_iteration_time);
+ }
}
previous_phase_ = current_phase;
}
+void CSSAnimations::TransitionEventDelegate::EnqueueEvent(
+ const WTF::AtomicString& type,
+ double elapsed_time) {
+ String property_name =
+ property_.IsCSSCustomProperty()
+ ? property_.CustomPropertyName()
+ : property_.GetCSSProperty().GetPropertyNameString();
+ String pseudo_element =
+ PseudoElement::PseudoElementNameForEvents(GetPseudoId());
+ TransitionEvent* event = TransitionEvent::Create(
+ type, property_name, elapsed_time, pseudo_element);
+ event->SetTarget(GetEventTarget());
+ GetDocument().EnqueueAnimationFrameEvent(event);
+}
+
void CSSAnimations::TransitionEventDelegate::Trace(blink::Visitor* visitor) {
visitor->Trace(transition_target_);
AnimationEffect::EventDelegate::Trace(visitor);
@@ -1288,7 +1336,7 @@ bool CSSAnimations::IsAffectedByKeyframesFromScope(
return false;
if (tree_scope.RootNode() == tree_scope.GetDocument())
return false;
- return ToShadowRoot(tree_scope.RootNode()).host() == element;
+ return To<ShadowRoot>(tree_scope.RootNode()).host() == element;
}
bool CSSAnimations::IsAnimatingCustomProperties(
diff --git a/chromium/third_party/blink/renderer/core/animation/css/css_animations.h b/chromium/third_party/blink/renderer/core/animation/css/css_animations.h
index 35f26d3bd54..ae17144a071 100644
--- a/chromium/third_party/blink/renderer/core/animation/css/css_animations.h
+++ b/chromium/third_party/blink/renderer/core/animation/css/css_animations.h
@@ -239,6 +239,8 @@ class CSSAnimations final {
void Trace(blink::Visitor*) override;
private:
+ void EnqueueEvent(const WTF::AtomicString& type, double elapsed_time);
+
const Element& TransitionTarget() const { return *transition_target_; }
EventTarget* GetEventTarget() const;
PseudoId GetPseudoId() const { return transition_target_->GetPseudoId(); }
diff --git a/chromium/third_party/blink/renderer/core/animation/css/css_transition_data.cc b/chromium/third_party/blink/renderer/core/animation/css/css_transition_data.cc
index d0c0f450ad4..a58dd8066d3 100644
--- a/chromium/third_party/blink/renderer/core/animation/css/css_transition_data.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css/css_transition_data.cc
@@ -24,7 +24,7 @@ Timing CSSTransitionData::ConvertToTiming(size_t index) const {
DCHECK_LT(index, property_list_.size());
// Note that the backwards fill part is required for delay to work.
Timing timing = CSSTimingData::ConvertToTiming(index);
- timing.fill_mode = Timing::FillMode::NONE;
+ timing.fill_mode = Timing::FillMode::BACKWARDS;
return timing;
}
diff --git a/chromium/third_party/blink/renderer/core/animation/css_border_image_length_box_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_border_image_length_box_interpolation_type.cc
index 02b0d0062a4..c1288909dda 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_border_image_length_box_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css_border_image_length_box_interpolation_type.cc
@@ -430,14 +430,14 @@ void CSSBorderImageLengthBoxInterpolationType::ApplyStandardPropertyValue(
return clampTo<double>(ToInterpolableNumber(list.Get(index))->Value(),
0);
case SideType::kAuto:
- return Length(kAuto);
+ return Length::Auto();
case SideType::kLength:
return LengthInterpolationFunctions::CreateLength(
*list.Get(index), non_interpolable_values[index].get(),
state.CssToLengthConversionData(), kValueRangeNonNegative);
default:
NOTREACHED();
- return Length(kAuto);
+ return Length::Auto();
}
};
BorderImageLengthBox box(convert_side(kSideTop), convert_side(kSideRight),
diff --git a/chromium/third_party/blink/renderer/core/animation/css_clip_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_clip_interpolation_type.cc
index e66554dcf29..8046ee436d6 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_clip_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css_clip_interpolation_type.cc
@@ -180,10 +180,10 @@ InterpolationValue CSSClipInterpolationType::MaybeConvertNeutral(
if (underlying_autos.is_auto)
return nullptr;
LengthBox neutral_box(
- underlying_autos.is_top_auto ? Length(kAuto) : Length(0, kFixed),
- underlying_autos.is_right_auto ? Length(kAuto) : Length(0, kFixed),
- underlying_autos.is_bottom_auto ? Length(kAuto) : Length(0, kFixed),
- underlying_autos.is_left_auto ? Length(kAuto) : Length(0, kFixed));
+ underlying_autos.is_top_auto ? Length::Auto() : Length::Fixed(0),
+ underlying_autos.is_right_auto ? Length::Auto() : Length::Fixed(0),
+ underlying_autos.is_bottom_auto ? Length::Auto() : Length::Fixed(0),
+ underlying_autos.is_left_auto ? Length::Auto() : Length::Fixed(0));
return CreateClipValue(neutral_box, 1);
}
@@ -287,7 +287,7 @@ void CSSClipInterpolationType::ApplyStandardPropertyValue(
const InterpolableList& list = ToInterpolableList(interpolable_value);
const auto& convert_index = [&list, &state](bool is_auto, wtf_size_t index) {
if (is_auto)
- return Length(kAuto);
+ return Length::Auto();
return LengthInterpolationFunctions::CreateLength(
*list.Get(index), nullptr, state.CssToLengthConversionData(),
kValueRangeAll);
diff --git a/chromium/third_party/blink/renderer/core/animation/css_image_slice_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_image_slice_interpolation_type.cc
index ac3b5438696..bcddce842df 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_image_slice_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css_image_slice_interpolation_type.cc
@@ -162,10 +162,14 @@ InterpolationValue CSSImageSliceInterpolationType::MaybeConvertNeutral(
conversion_checkers.push_back(
UnderlyingSliceTypesChecker::Create(underlying_types));
LengthBox zero_box(
- Length(0, underlying_types.is_number[kSideTop] ? kFixed : kPercent),
- Length(0, underlying_types.is_number[kSideRight] ? kFixed : kPercent),
- Length(0, underlying_types.is_number[kSideBottom] ? kFixed : kPercent),
- Length(0, underlying_types.is_number[kSideLeft] ? kFixed : kPercent));
+ underlying_types.is_number[kSideTop] ? Length::Fixed(0)
+ : Length::Percent(0),
+ underlying_types.is_number[kSideRight] ? Length::Fixed(0)
+ : Length::Percent(0),
+ underlying_types.is_number[kSideBottom] ? Length::Fixed(0)
+ : Length::Percent(0),
+ underlying_types.is_number[kSideLeft] ? Length::Fixed(0)
+ : Length::Percent(0));
return ConvertImageSlice(ImageSlice(zero_box, underlying_types.fill), 1);
}
@@ -272,9 +276,8 @@ void CSSImageSliceInterpolationType::ApplyStandardPropertyValue(
const auto& convert_side = [&types, &list, &style](wtf_size_t index) {
float value =
clampTo<float>(ToInterpolableNumber(list.Get(index))->Value(), 0);
- return types.is_number[index]
- ? Length(value * style.EffectiveZoom(), kFixed)
- : Length(value, kPercent);
+ return types.is_number[index] ? Length::Fixed(value * style.EffectiveZoom())
+ : Length::Percent(value);
};
LengthBox box(convert_side(kSideTop), convert_side(kSideRight),
convert_side(kSideBottom), convert_side(kSideLeft));
diff --git a/chromium/third_party/blink/renderer/core/animation/css_text_indent_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_text_indent_interpolation_type.cc
index 26990911407..f94809b82ff 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_text_indent_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css_text_indent_interpolation_type.cc
@@ -137,7 +137,7 @@ InterpolationValue CSSTextIndentInterpolationType::MaybeConvertNeutral(
ToCSSTextIndentNonInterpolableValue(*underlying.non_interpolable_value)
.Mode();
conversion_checkers.push_back(UnderlyingIndentModeChecker::Create(mode));
- return CreateValue(Length(0, kFixed), mode, 1);
+ return CreateValue(Length::Fixed(0), mode, 1);
}
InterpolationValue CSSTextIndentInterpolationType::MaybeConvertInitial(
diff --git a/chromium/third_party/blink/renderer/core/animation/css_translate_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_translate_interpolation_type.cc
index fb731e65db3..69a4e5ef97c 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_translate_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css_translate_interpolation_type.cc
@@ -90,7 +90,7 @@ InterpolationValue ConvertTranslateOperation(
translate->Y(), zoom)
.interpolable_value);
result->Set(kTranslateZ, LengthInterpolationFunctions::MaybeConvertLength(
- Length(translate->Z(), kFixed), zoom)
+ Length::Fixed(translate->Z()), zoom)
.interpolable_value);
return InterpolationValue(std::move(result));
}
diff --git a/chromium/third_party/blink/renderer/core/animation/document_animations.cc b/chromium/third_party/blink/renderer/core/animation/document_animations.cc
index 12b7aeac3d1..fdc916720ad 100644
--- a/chromium/third_party/blink/renderer/core/animation/document_animations.cc
+++ b/chromium/third_party/blink/renderer/core/animation/document_animations.cc
@@ -30,6 +30,7 @@
#include "third_party/blink/renderer/core/animation/document_animations.h"
+#include "cc/animation/animation_host.h"
#include "third_party/blink/renderer/core/animation/animation_clock.h"
#include "third_party/blink/renderer/core/animation/document_timeline.h"
#include "third_party/blink/renderer/core/animation/pending_animations.h"
@@ -39,7 +40,6 @@
#include "third_party/blink/renderer/core/dom/node.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/local_frame_view.h"
-#include "third_party/blink/renderer/platform/animation/compositor_animation_host.h"
namespace blink {
@@ -78,7 +78,7 @@ void DocumentAnimations::UpdateAnimations(
document.View()->ScheduleAnimation();
}
if (document.View()) {
- if (CompositorAnimationHost* host =
+ if (cc::AnimationHost* host =
document.View()->GetCompositorAnimationHost()) {
wtf_size_t total_animations_count = 0;
if (document.Timeline().HasAnimations()) {
diff --git a/chromium/third_party/blink/renderer/core/animation/document_timeline.cc b/chromium/third_party/blink/renderer/core/animation/document_timeline.cc
index f83a0fe1c0e..43b8369dd76 100644
--- a/chromium/third_party/blink/renderer/core/animation/document_timeline.cc
+++ b/chromium/third_party/blink/renderer/core/animation/document_timeline.cc
@@ -43,7 +43,6 @@
#include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/platform/animation/compositor_animation_timeline.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
-#include "third_party/blink/renderer/platform/wtf/time.h"
namespace blink {
@@ -230,9 +229,9 @@ double DocumentTimeline::CurrentTimeInternal(bool& is_null) {
return std::numeric_limits<double>::quiet_NaN();
}
double result = playback_rate_ == 0
- ? TimeTicksInSeconds(ZeroTime())
+ ? ZeroTime().since_origin().InSecondsF()
: (GetDocument()->GetAnimationClock().CurrentTime() -
- TimeTicksInSeconds(ZeroTime())) *
+ ZeroTime().since_origin().InSecondsF()) *
playback_rate_;
is_null = std::isnan(result);
// This looks like it could never be NaN here.
@@ -268,7 +267,7 @@ bool DocumentTimeline::NeedsAnimationTimingUpdate() {
std::isnan(last_current_time_internal_))
return false;
- // We allow m_lastCurrentTimeInternal to advance here when there
+ // We allow |last_current_time_internal_| to advance here when there
// are no animations to allow animations spawned during style
// recalc to not invalidate this flag.
if (animations_needing_update_.IsEmpty())
@@ -295,10 +294,12 @@ void DocumentTimeline::SetPlaybackRate(double playback_rate) {
return;
double current_time = CurrentTimeInternal();
playback_rate_ = playback_rate;
- zero_time_ = TimeTicksFromSeconds(
+ double zero_time_seconds =
playback_rate == 0 ? current_time
: GetDocument()->GetAnimationClock().CurrentTime() -
- current_time / playback_rate);
+ current_time / playback_rate;
+ zero_time_ =
+ base::TimeTicks() + base::TimeDelta::FromSecondsD(zero_time_seconds);
zero_time_initialized_ = true;
// Corresponding compositor animation may need to be restarted to pick up
diff --git a/chromium/third_party/blink/renderer/core/animation/document_timeline_test.cc b/chromium/third_party/blink/renderer/core/animation/document_timeline_test.cc
index 2d8daa7ce8a..06f7774ba1b 100644
--- a/chromium/third_party/blink/renderer/core/animation/document_timeline_test.cc
+++ b/chromium/third_party/blink/renderer/core/animation/document_timeline_test.cc
@@ -44,6 +44,12 @@
#include "third_party/blink/renderer/core/testing/page_test_base.h"
#include "third_party/blink/renderer/platform/weborigin/kurl.h"
+namespace {
+base::TimeTicks TimeTicksFromSecondsD(double seconds) {
+ return base::TimeTicks() + base::TimeDelta::FromSecondsD(seconds);
+}
+} // namespace
+
namespace blink {
class MockPlatformTiming : public DocumentTimeline::PlatformTiming {
@@ -78,8 +84,7 @@ class AnimationDocumentTimelineTest : public PageTestBase {
}
void UpdateClockAndService(double time) {
- GetAnimationClock().UpdateTime(base::TimeTicks() +
- base::TimeDelta::FromSecondsD(time));
+ GetAnimationClock().UpdateTime(TimeTicksFromSecondsD(time));
GetPendingAnimations().Update(base::Optional<CompositorElementIdSet>(),
false);
timeline->ServiceAnimations(kTimingUpdateForAnimationFrame);
@@ -137,14 +142,12 @@ TEST_F(AnimationDocumentTimelineTest, EmptyForwardsKeyframeAnimation) {
TEST_F(AnimationDocumentTimelineTest, ZeroTime) {
bool is_null;
- GetAnimationClock().UpdateTime(base::TimeTicks() +
- base::TimeDelta::FromSecondsD(100));
+ GetAnimationClock().UpdateTime(TimeTicksFromSecondsD(100));
EXPECT_EQ(100, timeline->CurrentTimeInternal());
EXPECT_EQ(100, timeline->CurrentTimeInternal(is_null));
EXPECT_FALSE(is_null);
- GetAnimationClock().UpdateTime(base::TimeTicks() +
- base::TimeDelta::FromSecondsD(200));
+ GetAnimationClock().UpdateTime(TimeTicksFromSecondsD(200));
EXPECT_EQ(200, timeline->CurrentTimeInternal());
EXPECT_EQ(200, timeline->CurrentTimeInternal(is_null));
EXPECT_FALSE(is_null);
@@ -153,8 +156,7 @@ TEST_F(AnimationDocumentTimelineTest, ZeroTime) {
// EffectiveTime is identical to CurrentTimeInternal except that it returns 0
// when the timeline is inactive.
TEST_F(AnimationDocumentTimelineTest, EffectiveTime) {
- GetAnimationClock().UpdateTime(base::TimeTicks() +
- base::TimeDelta::FromSecondsD(200));
+ GetAnimationClock().UpdateTime(TimeTicksFromSecondsD(200));
EXPECT_EQ(200, timeline->EffectiveTime());
EXPECT_EQ(200, timeline->CurrentTimeInternal());
bool is_null;
@@ -177,15 +179,13 @@ TEST_F(AnimationDocumentTimelineTest, PlaybackRateNormal) {
timeline->SetPlaybackRate(1.0);
EXPECT_EQ(1.0, timeline->PlaybackRate());
- GetAnimationClock().UpdateTime(base::TimeTicks() +
- base::TimeDelta::FromSecondsD(100));
+ GetAnimationClock().UpdateTime(TimeTicksFromSecondsD(100));
EXPECT_EQ(zero_time, timeline->ZeroTime());
EXPECT_EQ(100, timeline->CurrentTimeInternal());
EXPECT_EQ(100, timeline->CurrentTimeInternal(is_null));
EXPECT_FALSE(is_null);
- GetAnimationClock().UpdateTime(base::TimeTicks() +
- base::TimeDelta::FromSecondsD(200));
+ GetAnimationClock().UpdateTime(TimeTicksFromSecondsD(200));
EXPECT_EQ(zero_time, timeline->ZeroTime());
EXPECT_EQ(200, timeline->CurrentTimeInternal());
EXPECT_EQ(200, timeline->CurrentTimeInternal(is_null));
@@ -206,15 +206,13 @@ TEST_F(AnimationDocumentTimelineTest, PlaybackRateNormalWithOriginTime) {
EXPECT_EQ(1000, timeline->CurrentTimeInternal(is_null));
EXPECT_FALSE(is_null);
- GetAnimationClock().UpdateTime(base::TimeTicks() +
- base::TimeDelta::FromSecondsD(100));
+ GetAnimationClock().UpdateTime(TimeTicksFromSecondsD(100));
EXPECT_EQ(TimeTicks() + origin_time, timeline->ZeroTime());
EXPECT_EQ(1100, timeline->CurrentTimeInternal());
EXPECT_EQ(1100, timeline->CurrentTimeInternal(is_null));
EXPECT_FALSE(is_null);
- GetAnimationClock().UpdateTime(base::TimeTicks() +
- base::TimeDelta::FromSecondsD(200));
+ GetAnimationClock().UpdateTime(TimeTicksFromSecondsD(200));
EXPECT_EQ(TimeTicks() + origin_time, timeline->ZeroTime());
EXPECT_EQ(1200, timeline->CurrentTimeInternal());
EXPECT_EQ(1200, timeline->CurrentTimeInternal(is_null));
@@ -224,8 +222,7 @@ TEST_F(AnimationDocumentTimelineTest, PlaybackRateNormalWithOriginTime) {
TEST_F(AnimationDocumentTimelineTest, PlaybackRatePause) {
bool is_null;
- GetAnimationClock().UpdateTime(base::TimeTicks() +
- base::TimeDelta::FromSecondsD(100));
+ GetAnimationClock().UpdateTime(TimeTicksFromSecondsD(100));
EXPECT_EQ(TimeTicks(), timeline->ZeroTime());
EXPECT_EQ(100, timeline->CurrentTimeInternal());
EXPECT_EQ(100, timeline->CurrentTimeInternal(is_null));
@@ -233,17 +230,15 @@ TEST_F(AnimationDocumentTimelineTest, PlaybackRatePause) {
timeline->SetPlaybackRate(0.0);
EXPECT_EQ(0.0, timeline->PlaybackRate());
- GetAnimationClock().UpdateTime(base::TimeTicks() +
- base::TimeDelta::FromSecondsD(200));
- EXPECT_EQ(TimeTicksFromSeconds(100), timeline->ZeroTime());
+ GetAnimationClock().UpdateTime(TimeTicksFromSecondsD(200));
+ EXPECT_EQ(TimeTicksFromSecondsD(100), timeline->ZeroTime());
EXPECT_EQ(100, timeline->CurrentTimeInternal());
EXPECT_EQ(100, timeline->CurrentTimeInternal(is_null));
timeline->SetPlaybackRate(1.0);
EXPECT_EQ(1.0, timeline->PlaybackRate());
- GetAnimationClock().UpdateTime(base::TimeTicks() +
- base::TimeDelta::FromSecondsD(400));
- EXPECT_EQ(TimeTicksFromSeconds(100), timeline->ZeroTime());
+ GetAnimationClock().UpdateTime(TimeTicksFromSecondsD(400));
+ EXPECT_EQ(TimeTicksFromSecondsD(100), timeline->ZeroTime());
EXPECT_EQ(300, timeline->CurrentTimeInternal());
EXPECT_EQ(300, timeline->CurrentTimeInternal(is_null));
@@ -263,8 +258,7 @@ TEST_F(AnimationDocumentTimelineTest, PlaybackRatePauseWithOriginTime) {
EXPECT_EQ(1000, timeline->CurrentTimeInternal(is_null));
EXPECT_FALSE(is_null);
- GetAnimationClock().UpdateTime(base::TimeTicks() +
- base::TimeDelta::FromSecondsD(100));
+ GetAnimationClock().UpdateTime(TimeTicksFromSecondsD(100));
EXPECT_EQ(TimeTicks() + origin_time, timeline->ZeroTime());
EXPECT_EQ(1100, timeline->CurrentTimeInternal());
EXPECT_EQ(1100, timeline->CurrentTimeInternal(is_null));
@@ -272,21 +266,19 @@ TEST_F(AnimationDocumentTimelineTest, PlaybackRatePauseWithOriginTime) {
timeline->SetPlaybackRate(0.0);
EXPECT_EQ(0.0, timeline->PlaybackRate());
- GetAnimationClock().UpdateTime(base::TimeTicks() +
- base::TimeDelta::FromSecondsD(200));
- EXPECT_EQ(TimeTicksFromSeconds(1100), timeline->ZeroTime());
+ GetAnimationClock().UpdateTime(TimeTicksFromSecondsD(200));
+ EXPECT_EQ(TimeTicksFromSecondsD(1100), timeline->ZeroTime());
EXPECT_EQ(1100, timeline->CurrentTimeInternal());
EXPECT_EQ(1100, timeline->CurrentTimeInternal(is_null));
timeline->SetPlaybackRate(1.0);
EXPECT_EQ(1.0, timeline->PlaybackRate());
- EXPECT_EQ(TimeTicksFromSeconds(-900), timeline->ZeroTime());
+ EXPECT_EQ(TimeTicksFromSecondsD(-900), timeline->ZeroTime());
EXPECT_EQ(1100, timeline->CurrentTimeInternal());
EXPECT_EQ(1100, timeline->CurrentTimeInternal(is_null));
- GetAnimationClock().UpdateTime(base::TimeTicks() +
- base::TimeDelta::FromSecondsD(400));
- EXPECT_EQ(TimeTicksFromSeconds(-900), timeline->ZeroTime());
+ GetAnimationClock().UpdateTime(TimeTicksFromSecondsD(400));
+ EXPECT_EQ(TimeTicksFromSecondsD(-900), timeline->ZeroTime());
EXPECT_EQ(1300, timeline->CurrentTimeInternal());
EXPECT_EQ(1300, timeline->CurrentTimeInternal(is_null));
@@ -296,8 +288,7 @@ TEST_F(AnimationDocumentTimelineTest, PlaybackRatePauseWithOriginTime) {
TEST_F(AnimationDocumentTimelineTest, PlaybackRateSlow) {
bool is_null;
- GetAnimationClock().UpdateTime(base::TimeTicks() +
- base::TimeDelta::FromSecondsD(100));
+ GetAnimationClock().UpdateTime(TimeTicksFromSecondsD(100));
EXPECT_EQ(TimeTicks(), timeline->ZeroTime());
EXPECT_EQ(100, timeline->CurrentTimeInternal());
EXPECT_EQ(100, timeline->CurrentTimeInternal(is_null));
@@ -305,17 +296,15 @@ TEST_F(AnimationDocumentTimelineTest, PlaybackRateSlow) {
timeline->SetPlaybackRate(0.5);
EXPECT_EQ(0.5, timeline->PlaybackRate());
- GetAnimationClock().UpdateTime(base::TimeTicks() +
- base::TimeDelta::FromSecondsD(300));
- EXPECT_EQ(TimeTicksFromSeconds(-100), timeline->ZeroTime());
+ GetAnimationClock().UpdateTime(TimeTicksFromSecondsD(300));
+ EXPECT_EQ(TimeTicksFromSecondsD(-100), timeline->ZeroTime());
EXPECT_EQ(200, timeline->CurrentTimeInternal());
EXPECT_EQ(200, timeline->CurrentTimeInternal(is_null));
timeline->SetPlaybackRate(1.0);
EXPECT_EQ(1.0, timeline->PlaybackRate());
- GetAnimationClock().UpdateTime(base::TimeTicks() +
- base::TimeDelta::FromSecondsD(400));
- EXPECT_EQ(TimeTicksFromSeconds(100), timeline->ZeroTime());
+ GetAnimationClock().UpdateTime(TimeTicksFromSecondsD(400));
+ EXPECT_EQ(TimeTicksFromSecondsD(100), timeline->ZeroTime());
EXPECT_EQ(300, timeline->CurrentTimeInternal());
EXPECT_EQ(300, timeline->CurrentTimeInternal(is_null));
@@ -325,8 +314,7 @@ TEST_F(AnimationDocumentTimelineTest, PlaybackRateSlow) {
TEST_F(AnimationDocumentTimelineTest, PlaybackRateFast) {
bool is_null;
- GetAnimationClock().UpdateTime(base::TimeTicks() +
- base::TimeDelta::FromSecondsD(100));
+ GetAnimationClock().UpdateTime(TimeTicksFromSecondsD(100));
EXPECT_EQ(TimeTicks(), timeline->ZeroTime());
EXPECT_EQ(100, timeline->CurrentTimeInternal());
EXPECT_EQ(100, timeline->CurrentTimeInternal(is_null));
@@ -334,17 +322,15 @@ TEST_F(AnimationDocumentTimelineTest, PlaybackRateFast) {
timeline->SetPlaybackRate(2.0);
EXPECT_EQ(2.0, timeline->PlaybackRate());
- GetAnimationClock().UpdateTime(base::TimeTicks() +
- base::TimeDelta::FromSecondsD(300));
- EXPECT_EQ(TimeTicksFromSeconds(50), timeline->ZeroTime());
+ GetAnimationClock().UpdateTime(TimeTicksFromSecondsD(300));
+ EXPECT_EQ(TimeTicksFromSecondsD(50), timeline->ZeroTime());
EXPECT_EQ(500, timeline->CurrentTimeInternal());
EXPECT_EQ(500, timeline->CurrentTimeInternal(is_null));
timeline->SetPlaybackRate(1.0);
EXPECT_EQ(1.0, timeline->PlaybackRate());
- GetAnimationClock().UpdateTime(base::TimeTicks() +
- base::TimeDelta::FromSecondsD(400));
- EXPECT_EQ(TimeTicksFromSeconds(-200), timeline->ZeroTime());
+ GetAnimationClock().UpdateTime(TimeTicksFromSecondsD(400));
+ EXPECT_EQ(TimeTicksFromSecondsD(-200), timeline->ZeroTime());
EXPECT_EQ(600, timeline->CurrentTimeInternal());
EXPECT_EQ(600, timeline->CurrentTimeInternal(is_null));
@@ -358,34 +344,31 @@ TEST_F(AnimationDocumentTimelineTest, PlaybackRateFastWithOriginTime) {
document.Get(), TimeDelta::FromSeconds(-1000), platform_timing);
timeline->ResetForTesting();
- GetAnimationClock().UpdateTime(base::TimeTicks() +
- base::TimeDelta::FromSecondsD(100));
- EXPECT_EQ(TimeTicksFromSeconds(-1000), timeline->ZeroTime());
+ GetAnimationClock().UpdateTime(TimeTicksFromSecondsD(100));
+ EXPECT_EQ(TimeTicksFromSecondsD(-1000), timeline->ZeroTime());
EXPECT_EQ(1100, timeline->CurrentTimeInternal());
EXPECT_EQ(1100, timeline->CurrentTimeInternal(is_null));
EXPECT_FALSE(is_null);
timeline->SetPlaybackRate(2.0);
EXPECT_EQ(2.0, timeline->PlaybackRate());
- EXPECT_EQ(TimeTicksFromSeconds(-450), timeline->ZeroTime());
+ EXPECT_EQ(TimeTicksFromSecondsD(-450), timeline->ZeroTime());
EXPECT_EQ(1100, timeline->CurrentTimeInternal());
EXPECT_EQ(1100, timeline->CurrentTimeInternal(is_null));
- GetAnimationClock().UpdateTime(base::TimeTicks() +
- base::TimeDelta::FromSecondsD(300));
- EXPECT_EQ(TimeTicksFromSeconds(-450), timeline->ZeroTime());
+ GetAnimationClock().UpdateTime(TimeTicksFromSecondsD(300));
+ EXPECT_EQ(TimeTicksFromSecondsD(-450), timeline->ZeroTime());
EXPECT_EQ(1500, timeline->CurrentTimeInternal());
EXPECT_EQ(1500, timeline->CurrentTimeInternal(is_null));
timeline->SetPlaybackRate(1.0);
EXPECT_EQ(1.0, timeline->PlaybackRate());
- EXPECT_EQ(TimeTicksFromSeconds(-1200), timeline->ZeroTime());
+ EXPECT_EQ(TimeTicksFromSecondsD(-1200), timeline->ZeroTime());
EXPECT_EQ(1500, timeline->CurrentTimeInternal());
EXPECT_EQ(1500, timeline->CurrentTimeInternal(is_null));
- GetAnimationClock().UpdateTime(base::TimeTicks() +
- base::TimeDelta::FromSecondsD(400));
- EXPECT_EQ(TimeTicksFromSeconds(-1200), timeline->ZeroTime());
+ GetAnimationClock().UpdateTime(TimeTicksFromSecondsD(400));
+ EXPECT_EQ(TimeTicksFromSecondsD(-1200), timeline->ZeroTime());
EXPECT_EQ(1600, timeline->CurrentTimeInternal());
EXPECT_EQ(1600, timeline->CurrentTimeInternal(is_null));
diff --git a/chromium/third_party/blink/renderer/core/animation/effect_input.cc b/chromium/third_party/blink/renderer/core/animation/effect_input.cc
index c2e3d0c7247..67af486cf41 100644
--- a/chromium/third_party/blink/renderer/core/animation/effect_input.cc
+++ b/chromium/third_party/blink/renderer/core/animation/effect_input.cc
@@ -102,7 +102,7 @@ void SetKeyframeValue(Element* element,
if (!set_result.did_parse && execution_context) {
if (document.GetFrame()) {
document.GetFrame()->Console().AddMessage(ConsoleMessage::Create(
- kJSMessageSource, kWarningMessageLevel,
+ kJSMessageSource, mojom::ConsoleMessageLevel::kWarning,
"Invalid keyframe value for property " + property + ": " + value));
}
}
@@ -426,7 +426,7 @@ bool GetPropertyIndexedKeyframeValues(const v8::Local<v8::Object>& keyframe,
// See https://drafts.csswg.org/web-animations/#processing-a-keyframes-argument
StringKeyframeVector ConvertObjectForm(Element* element,
Document& document,
- const v8::Local<v8::Object>& keyframe,
+ const v8::Local<v8::Object>& v8_keyframe,
ScriptState* script_state,
ExceptionState& exception_state) {
// We implement much of this procedure out of order from the way the spec is
@@ -437,7 +437,7 @@ StringKeyframeVector ConvertObjectForm(Element* element,
// to process a keyframe-like object'.
BasePropertyIndexedKeyframe* property_indexed_keyframe =
NativeValueTraits<BasePropertyIndexedKeyframe>::NativeValue(
- script_state->GetIsolate(), keyframe, exception_state);
+ script_state->GetIsolate(), v8_keyframe, exception_state);
if (exception_state.HadException())
return {};
@@ -466,7 +466,7 @@ StringKeyframeVector ConvertObjectForm(Element* element,
// object' and step 5.2 of the 'procedure to process a keyframes argument'.
Vector<String> keyframe_properties = GetOwnPropertyNames(
- script_state->GetIsolate(), keyframe, exception_state);
+ script_state->GetIsolate(), v8_keyframe, exception_state);
if (exception_state.HadException())
return {};
@@ -496,7 +496,7 @@ StringKeyframeVector ConvertObjectForm(Element* element,
continue;
Vector<String> values;
- if (!GetPropertyIndexedKeyframeValues(keyframe, property, script_state,
+ if (!GetPropertyIndexedKeyframeValues(v8_keyframe, property, script_state,
exception_state, values)) {
return {};
}
diff --git a/chromium/third_party/blink/renderer/core/animation/invalidatable_interpolation.cc b/chromium/third_party/blink/renderer/core/animation/invalidatable_interpolation.cc
index 8d7bac4f0e9..1f765f2761d 100644
--- a/chromium/third_party/blink/renderer/core/animation/invalidatable_interpolation.cc
+++ b/chromium/third_party/blink/renderer/core/animation/invalidatable_interpolation.cc
@@ -25,7 +25,7 @@ void InvalidatableInterpolation::Interpolate(int, double fraction) {
if (is_conversion_cached_ && cached_pair_conversion_)
cached_pair_conversion_->InterpolateValue(fraction, cached_value_);
// We defer the interpolation to ensureValidConversion() if
- // m_cachedPairConversion is null.
+ // |cached_pair_conversion_| is null.
}
std::unique_ptr<PairwisePrimitiveInterpolation>
diff --git a/chromium/third_party/blink/renderer/core/animation/keyframe.h b/chromium/third_party/blink/renderer/core/animation/keyframe.h
index ccf93f6fb8d..5df8b19b8be 100644
--- a/chromium/third_party/blink/renderer/core/animation/keyframe.h
+++ b/chromium/third_party/blink/renderer/core/animation/keyframe.h
@@ -159,7 +159,7 @@ class CORE_EXPORT Keyframe : public GarbageCollectedFinalized<Keyframe> {
const PropertyHandle&,
const Keyframe::PropertySpecificKeyframe& end) const;
- virtual void Trace(Visitor*){};
+ virtual void Trace(Visitor*) {}
protected:
double offset_;
diff --git a/chromium/third_party/blink/renderer/core/animation/length_interpolation_functions.cc b/chromium/third_party/blink/renderer/core/animation/length_interpolation_functions.cc
index cbf455a28a0..bdf01cef458 100644
--- a/chromium/third_party/blink/renderer/core/animation/length_interpolation_functions.cc
+++ b/chromium/third_party/blink/renderer/core/animation/length_interpolation_functions.cc
@@ -196,10 +196,9 @@ Length LengthInterpolationFunctions::CreateLength(
range));
}
if (has_percentage)
- return Length(ClampToRange(percentage, range), kPercent);
- return Length(
- CSSPrimitiveValue::ClampToCSSLengthRange(ClampToRange(pixels, range)),
- kFixed);
+ return Length::Percent(ClampToRange(percentage, range));
+ return Length::Fixed(
+ CSSPrimitiveValue::ClampToCSSLengthRange(ClampToRange(pixels, range)));
}
const CSSValue* LengthInterpolationFunctions::CreateCSSValue(
diff --git a/chromium/third_party/blink/renderer/core/animation/length_list_property_functions.cc b/chromium/third_party/blink/renderer/core/animation/length_list_property_functions.cc
index 10b57c66ce9..c5a2cc780ee 100644
--- a/chromium/third_party/blink/renderer/core/animation/length_list_property_functions.cc
+++ b/chromium/third_party/blink/renderer/core/animation/length_list_property_functions.cc
@@ -123,7 +123,7 @@ static bool AppendToVector(const TransformOrigin& transform_origin,
Vector<Length>& result) {
result.push_back(transform_origin.X());
result.push_back(transform_origin.Y());
- result.push_back(Length(transform_origin.Z(), kFixed));
+ result.push_back(Length::Fixed(transform_origin.Z()));
return true;
}
diff --git a/chromium/third_party/blink/renderer/core/animation/length_property_functions.cc b/chromium/third_party/blink/renderer/core/animation/length_property_functions.cc
index d0ea0f29d13..c11eb097316 100644
--- a/chromium/third_party/blink/renderer/core/animation/length_property_functions.cc
+++ b/chromium/third_party/blink/renderer/core/animation/length_property_functions.cc
@@ -106,15 +106,14 @@ bool LengthPropertyFunctions::GetInitialLength(const CSSProperty& property,
case CSSPropertyBorderLeftWidth:
case CSSPropertyBorderRightWidth:
case CSSPropertyBorderTopWidth:
- result = Length(ComputedStyleInitialValues::InitialBorderWidth(), kFixed);
+ result = Length::Fixed(ComputedStyleInitialValues::InitialBorderWidth());
return true;
case CSSPropertyOutlineWidth:
- result =
- Length(ComputedStyleInitialValues::InitialOutlineWidth(), kFixed);
+ result = Length::Fixed(ComputedStyleInitialValues::InitialOutlineWidth());
return true;
case CSSPropertyColumnRuleWidth:
result =
- Length(ComputedStyleInitialValues::InitialColumnRuleWidth(), kFixed);
+ Length::Fixed(ComputedStyleInitialValues::InitialColumnRuleWidth());
return true;
default:
@@ -230,31 +229,31 @@ bool LengthPropertyFunctions::GetLength(const CSSProperty& property,
return true;
case CSSPropertyBorderBottomWidth:
- result = Length(style.BorderBottomWidth(), kFixed);
+ result = Length::Fixed(style.BorderBottomWidth());
return true;
case CSSPropertyBorderLeftWidth:
- result = Length(style.BorderLeftWidth(), kFixed);
+ result = Length::Fixed(style.BorderLeftWidth());
return true;
case CSSPropertyBorderRightWidth:
- result = Length(style.BorderRightWidth(), kFixed);
+ result = Length::Fixed(style.BorderRightWidth());
return true;
case CSSPropertyBorderTopWidth:
- result = Length(style.BorderTopWidth(), kFixed);
+ result = Length::Fixed(style.BorderTopWidth());
return true;
case CSSPropertyLetterSpacing:
- result = Length(style.LetterSpacing(), kFixed);
+ result = Length::Fixed(style.LetterSpacing());
return true;
case CSSPropertyOutlineOffset:
- result = Length(style.OutlineOffset(), kFixed);
+ result = Length::Fixed(style.OutlineOffset());
return true;
case CSSPropertyOutlineWidth:
- result = Length(style.OutlineWidth(), kFixed);
+ result = Length::Fixed(style.OutlineWidth());
return true;
case CSSPropertyWebkitBorderHorizontalSpacing:
- result = Length(style.HorizontalBorderSpacing(), kFixed);
+ result = Length::Fixed(style.HorizontalBorderSpacing());
return true;
case CSSPropertyWebkitBorderVerticalSpacing:
- result = Length(style.VerticalBorderSpacing(), kFixed);
+ result = Length::Fixed(style.VerticalBorderSpacing());
return true;
case CSSPropertyRowGap:
if (style.RowGap().IsNormal())
@@ -267,13 +266,13 @@ bool LengthPropertyFunctions::GetLength(const CSSProperty& property,
result = style.ColumnGap().GetLength();
return true;
case CSSPropertyColumnRuleWidth:
- result = Length(style.ColumnRuleWidth(), kFixed);
+ result = Length::Fixed(style.ColumnRuleWidth());
return true;
case CSSPropertyWebkitTransformOriginZ:
- result = Length(style.TransformOriginZ(), kFixed);
+ result = Length::Fixed(style.TransformOriginZ());
return true;
case CSSPropertyWordSpacing:
- result = Length(style.WordSpacing(), kFixed);
+ result = Length::Fixed(style.WordSpacing());
return true;
case CSSPropertyBaselineShift:
@@ -290,7 +289,7 @@ bool LengthPropertyFunctions::GetLength(const CSSProperty& property,
case CSSPropertyPerspective:
if (!style.HasPerspective())
return false;
- result = Length(style.Perspective(), kFixed);
+ result = Length::Fixed(style.Perspective());
return true;
case CSSPropertyStrokeWidth:
DCHECK(!IsZoomedLength(CSSProperty::Get(CSSPropertyStrokeWidth)));
@@ -304,7 +303,7 @@ bool LengthPropertyFunctions::GetLength(const CSSProperty& property,
case CSSPropertyColumnWidth:
if (style.HasAutoColumnWidth())
return false;
- result = Length(style.ColumnWidth(), kFixed);
+ result = Length::Fixed(style.ColumnWidth());
return true;
default:
return false;
diff --git a/chromium/third_party/blink/renderer/core/animation/list_interpolation_functions.cc b/chromium/third_party/blink/renderer/core/animation/list_interpolation_functions.cc
index b1625a5c7bb..09bfde3ab4b 100644
--- a/chromium/third_party/blink/renderer/core/animation/list_interpolation_functions.cc
+++ b/chromium/third_party/blink/renderer/core/animation/list_interpolation_functions.cc
@@ -135,17 +135,17 @@ PairwiseInterpolationValue ListInterpolationFunctions::MaybeMergeSingles(
ToNonInterpolableList(*end.non_interpolable_value);
for (wtf_size_t i = 0; i < final_length; i++) {
- PairwiseInterpolationValue result = nullptr;
if (length_matching_strategy ==
LengthMatchingStrategy::kLowestCommonMultiple ||
(i < start_length && i < end_length)) {
- InterpolationValue start(
+ InterpolationValue start_merge(
start_interpolable_list.Get(i % start_length)->Clone(),
start_non_interpolable_list.Get(i % start_length));
- InterpolationValue end(end_interpolable_list.Get(i % end_length)->Clone(),
- end_non_interpolable_list.Get(i % end_length));
- PairwiseInterpolationValue result =
- merge_single_item_conversions.Run(std::move(start), std::move(end));
+ InterpolationValue end_merge(
+ end_interpolable_list.Get(i % end_length)->Clone(),
+ end_non_interpolable_list.Get(i % end_length));
+ PairwiseInterpolationValue result = merge_single_item_conversions.Run(
+ std::move(start_merge), std::move(end_merge));
if (!result)
return nullptr;
result_start_interpolable_list->Set(
diff --git a/chromium/third_party/blink/renderer/core/animation/non_interpolable_value.h b/chromium/third_party/blink/renderer/core/animation/non_interpolable_value.h
index 94ac28aa6dc..a570f8aa8e3 100644
--- a/chromium/third_party/blink/renderer/core/animation/non_interpolable_value.h
+++ b/chromium/third_party/blink/renderer/core/animation/non_interpolable_value.h
@@ -22,19 +22,18 @@ class NonInterpolableValue : public RefCounted<NonInterpolableValue> {
// These macros provide safe downcasts of NonInterpolableValue subclasses with
// debug assertions.
// See CSSDefaultInterpolationType.cpp for example usage.
-#define DECLARE_NON_INTERPOLABLE_VALUE_TYPE() \
- static Type static_type_; \
- Type GetType() const final { return static_type_; }
+#define DECLARE_NON_INTERPOLABLE_VALUE_TYPE() \
+ Type GetType() const final { return static_type_; } \
+ static Type static_type_
#define DEFINE_NON_INTERPOLABLE_VALUE_TYPE(T) \
- NonInterpolableValue::Type T::static_type_ = &T::static_type_;
-
-#define DEFINE_NON_INTERPOLABLE_VALUE_TYPE_CASTS(T) \
- inline bool Is##T(const NonInterpolableValue* value) { \
- return !value || value->GetType() == T::static_type_; \
- } \
- DEFINE_TYPE_CASTS(T, NonInterpolableValue, value, Is##T(value), \
- Is##T(&value));
+ NonInterpolableValue::Type T::static_type_ = &T::static_type_
+
+#define DEFINE_NON_INTERPOLABLE_VALUE_TYPE_CASTS(T) \
+ inline bool Is##T(const NonInterpolableValue* value) { \
+ return !value || value->GetType() == T::static_type_; \
+ } \
+ DEFINE_TYPE_CASTS(T, NonInterpolableValue, value, Is##T(value), Is##T(&value))
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/animation/number_property_functions.cc b/chromium/third_party/blink/renderer/core/animation/number_property_functions.cc
index 2b79364dad9..467a58fb2a6 100644
--- a/chromium/third_party/blink/renderer/core/animation/number_property_functions.cc
+++ b/chromium/third_party/blink/renderer/core/animation/number_property_functions.cc
@@ -65,7 +65,7 @@ base::Optional<double> NumberPropertyFunctions::GetNumber(
case CSSPropertyLineHeight: {
const Length& length = style.SpecifiedLineHeight();
// Numbers are represented by percentages.
- if (length.GetType() != kPercent)
+ if (!length.IsPercent())
return base::Optional<double>();
double value = length.Value();
// -100% represents the keyword "normal".
@@ -104,13 +104,13 @@ double NumberPropertyFunctions::ClampNumber(const CSSProperty& property,
case CSSPropertyOrphans:
case CSSPropertyWidows:
- return clampTo<short>(round(value), 1);
+ return clampTo<int16_t>(round(value), 1);
case CSSPropertyColumnCount:
- return clampTo<unsigned short>(round(value), 1);
+ return clampTo<uint16_t>(round(value), 1);
case CSSPropertyColumnRuleWidth:
- return clampTo<unsigned short>(round(value));
+ return clampTo<uint16_t>(round(value));
case CSSPropertyOrder:
case CSSPropertyZIndex:
@@ -140,7 +140,7 @@ bool NumberPropertyFunctions::SetNumber(const CSSProperty& property,
style.SetFloodOpacity(value);
return true;
case CSSPropertyLineHeight:
- style.SetLineHeight(Length(value * 100, kPercent));
+ style.SetLineHeight(Length::Percent(value * 100));
return true;
case CSSPropertyOpacity:
style.SetOpacity(value);
diff --git a/chromium/third_party/blink/renderer/core/animation/pending_animations.cc b/chromium/third_party/blink/renderer/core/animation/pending_animations.cc
index 315fb5a545d..491ca011b9f 100644
--- a/chromium/third_party/blink/renderer/core/animation/pending_animations.cc
+++ b/chromium/third_party/blink/renderer/core/animation/pending_animations.cc
@@ -152,7 +152,7 @@ void PendingAnimations::NotifyCompositorAnimationStarted(
}
animation->NotifyCompositorStartTime(
monotonic_animation_start_time -
- TimeTicksInSeconds(animation->TimelineInternal()->ZeroTime()));
+ animation->TimelineInternal()->ZeroTime().since_origin().InSecondsF());
}
}
diff --git a/chromium/third_party/blink/renderer/core/animation/scroll_timeline.cc b/chromium/third_party/blink/renderer/core/animation/scroll_timeline.cc
index 63868fca81a..b0e82a3c050 100644
--- a/chromium/third_party/blink/renderer/core/animation/scroll_timeline.cc
+++ b/chromium/third_party/blink/renderer/core/animation/scroll_timeline.cc
@@ -110,21 +110,23 @@ ScrollTimeline* ScrollTimeline::Create(Document& document,
return MakeGarbageCollected<ScrollTimeline>(
scroll_source, orientation, start_scroll_offset, end_scroll_offset,
- options->timeRange().GetAsDouble());
+ options->timeRange().GetAsDouble(),
+ Timing::StringToFillMode(options->fill()));
}
ScrollTimeline::ScrollTimeline(Element* scroll_source,
ScrollDirection orientation,
CSSPrimitiveValue* start_scroll_offset,
CSSPrimitiveValue* end_scroll_offset,
- double time_range)
+ double time_range,
+ Timing::FillMode fill)
: scroll_source_(scroll_source),
resolved_scroll_source_(ResolveScrollSource(scroll_source_)),
orientation_(orientation),
start_scroll_offset_(start_scroll_offset),
end_scroll_offset_(end_scroll_offset),
- time_range_(time_range) {
-}
+ time_range_(time_range),
+ fill_(fill) {}
double ScrollTimeline::currentTime(bool& is_null) {
is_null = true;
@@ -150,30 +152,35 @@ double ScrollTimeline::currentTime(bool& is_null) {
ResolveScrollStartAndEnd(layout_box, max_offset, resolved_start_scroll_offset,
resolved_end_scroll_offset);
- // 3. If current scroll offset is less than startScrollOffset, return an
- // unresolved time value if fill is none or forwards, or 0 otherwise.
- // TODO(smcgruer): Implement |fill|.
+ // 3. If current scroll offset is less than startScrollOffset:
if (current_offset < resolved_start_scroll_offset) {
- return std::numeric_limits<double>::quiet_NaN();
+ // Return an unresolved time value if fill is none or forwards.
+ if (fill_ == Timing::FillMode::NONE || fill_ == Timing::FillMode::FORWARDS)
+ return std::numeric_limits<double>::quiet_NaN();
+
+ // Otherwise, return 0.
+ is_null = false;
+ return 0;
}
- // 4. If current scroll offset is greater than or equal to endScrollOffset,
- // return an unresolved time value if fill is none or backwards, or the
- // effective time range otherwise.
- //
- // TODO(smcgruer): Implement |fill|.
- //
- // Note we deliberately break the spec here by only returning if the current
- // offset is strictly greater, as that is more in line with the web animation
- // spec. See https://github.com/WICG/scroll-animations/issues/19
- if (current_offset > resolved_end_scroll_offset) {
- return std::numeric_limits<double>::quiet_NaN();
+ // 4. If current scroll offset is greater than or equal to endScrollOffset:
+ if (current_offset >= resolved_end_scroll_offset) {
+ // If endScrollOffset is less than the maximum scroll offset of scrollSource
+ // in orientation and fill is none or backwards, return an unresolved time
+ // value.
+ if (resolved_end_scroll_offset < max_offset &&
+ (fill_ == Timing::FillMode::NONE ||
+ fill_ == Timing::FillMode::BACKWARDS)) {
+ return std::numeric_limits<double>::quiet_NaN();
+ }
+
+ // Otherwise, return the effective time range.
+ is_null = false;
+ return time_range_;
}
- // This is not by the spec, but avoids both negative current time and a
- // divsion by zero issue. See
- // https://github.com/WICG/scroll-animations/issues/20 and
- // https://github.com/WICG/scroll-animations/issues/21
+ // This is not by the spec, but avoids a negative current time.
+ // See https://github.com/WICG/scroll-animations/issues/20
if (resolved_start_scroll_offset >= resolved_end_scroll_offset) {
return std::numeric_limits<double>::quiet_NaN();
}
@@ -219,6 +226,9 @@ void ScrollTimeline::timeRange(DoubleOrScrollTimelineAutoKeyword& result) {
result.SetDouble(time_range_);
}
+String ScrollTimeline::fill() {
+ return Timing::FillModeString(fill_);
+}
void ScrollTimeline::GetCurrentAndMaxOffset(const LayoutBox* layout_box,
double& current_offset,
diff --git a/chromium/third_party/blink/renderer/core/animation/scroll_timeline.h b/chromium/third_party/blink/renderer/core/animation/scroll_timeline.h
index a78393c25c8..5a468ee5b58 100644
--- a/chromium/third_party/blink/renderer/core/animation/scroll_timeline.h
+++ b/chromium/third_party/blink/renderer/core/animation/scroll_timeline.h
@@ -7,6 +7,7 @@
#include "third_party/blink/renderer/core/animation/animation_timeline.h"
#include "third_party/blink/renderer/core/animation/scroll_timeline_options.h"
+#include "third_party/blink/renderer/core/animation/timing.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/css/css_primitive_value.h"
#include "third_party/blink/renderer/core/dom/element.h"
@@ -43,7 +44,8 @@ class CORE_EXPORT ScrollTimeline final : public AnimationTimeline {
ScrollDirection,
CSSPrimitiveValue*,
CSSPrimitiveValue*,
- double);
+ double,
+ Timing::FillMode);
// AnimationTimeline implementation.
double currentTime(bool& is_null) final;
@@ -55,6 +57,7 @@ class CORE_EXPORT ScrollTimeline final : public AnimationTimeline {
String startScrollOffset();
String endScrollOffset();
void timeRange(DoubleOrScrollTimelineAutoKeyword&);
+ String fill();
// Returns the Node that should actually have the ScrollableArea (if one
// exists). This can differ from |scrollSource| when |scroll_source_| is the
@@ -63,6 +66,7 @@ class CORE_EXPORT ScrollTimeline final : public AnimationTimeline {
Node* ResolvedScrollSource() const { return resolved_scroll_source_; }
ScrollDirection GetOrientation() const { return orientation_; }
+ Timing::FillMode GetFillMode() const { return fill_; }
void GetCurrentAndMaxOffset(const LayoutBox*,
double& current_offset,
@@ -96,6 +100,7 @@ class CORE_EXPORT ScrollTimeline final : public AnimationTimeline {
Member<CSSPrimitiveValue> start_scroll_offset_;
Member<CSSPrimitiveValue> end_scroll_offset_;
double time_range_;
+ Timing::FillMode fill_;
};
DEFINE_TYPE_CASTS(ScrollTimeline,
diff --git a/chromium/third_party/blink/renderer/core/animation/scroll_timeline.idl b/chromium/third_party/blink/renderer/core/animation/scroll_timeline.idl
index fb29483e14b..91fad5c521a 100644
--- a/chromium/third_party/blink/renderer/core/animation/scroll_timeline.idl
+++ b/chromium/third_party/blink/renderer/core/animation/scroll_timeline.idl
@@ -16,4 +16,5 @@
readonly attribute DOMString startScrollOffset;
readonly attribute DOMString endScrollOffset;
readonly attribute (double or ScrollTimelineAutoKeyword) timeRange;
+ readonly attribute FillMode fill;
};
diff --git a/chromium/third_party/blink/renderer/core/animation/scroll_timeline_options.idl b/chromium/third_party/blink/renderer/core/animation/scroll_timeline_options.idl
index 74e907227c7..aef61713958 100644
--- a/chromium/third_party/blink/renderer/core/animation/scroll_timeline_options.idl
+++ b/chromium/third_party/blink/renderer/core/animation/scroll_timeline_options.idl
@@ -19,4 +19,5 @@ dictionary ScrollTimelineOptions {
DOMString startScrollOffset = "auto";
DOMString endScrollOffset = "auto";
(double or ScrollTimelineAutoKeyword) timeRange = "auto";
+ FillMode fill = "none";
};
diff --git a/chromium/third_party/blink/renderer/core/animation/scroll_timeline_test.cc b/chromium/third_party/blink/renderer/core/animation/scroll_timeline_test.cc
index 0ea4dcba6c0..92bbbb92061 100644
--- a/chromium/third_party/blink/renderer/core/animation/scroll_timeline_test.cc
+++ b/chromium/third_party/blink/renderer/core/animation/scroll_timeline_test.cc
@@ -229,7 +229,7 @@ TEST_F(ScrollTimelineTest, AttachOrDetachAnimationWithNullScrollSource) {
CSSPrimitiveValue* end_scroll_offset = nullptr;
ScrollTimeline* scroll_timeline = MakeGarbageCollected<ScrollTimeline>(
scroll_source, ScrollTimeline::Block, start_scroll_offset,
- end_scroll_offset, 100);
+ end_scroll_offset, 100, Timing::FillMode::NONE);
// Sanity checks.
ASSERT_EQ(scroll_timeline->scrollSource(), nullptr);
diff --git a/chromium/third_party/blink/renderer/core/animation/scroll_timeline_util.cc b/chromium/third_party/blink/renderer/core/animation/scroll_timeline_util.cc
index c9667a02f43..5778cfff289 100644
--- a/chromium/third_party/blink/renderer/core/animation/scroll_timeline_util.cc
+++ b/chromium/third_party/blink/renderer/core/animation/scroll_timeline_util.cc
@@ -52,7 +52,7 @@ std::unique_ptr<CompositorScrollTimeline> ToCompositorScrollTimeline(
return std::make_unique<CompositorScrollTimeline>(
element_id, orientation, start_scroll_offset, end_scroll_offset,
- time_range.GetAsDouble());
+ time_range.GetAsDouble(), scroll_timeline->GetFillMode());
}
base::Optional<CompositorElementId> GetCompositorScrollElementId(
diff --git a/chromium/third_party/blink/renderer/core/animation/scroll_timeline_util_test.cc b/chromium/third_party/blink/renderer/core/animation/scroll_timeline_util_test.cc
index cd0ec23e17c..8f7c41e71c5 100644
--- a/chromium/third_party/blink/renderer/core/animation/scroll_timeline_util_test.cc
+++ b/chromium/third_party/blink/renderer/core/animation/scroll_timeline_util_test.cc
@@ -81,7 +81,7 @@ TEST_F(ScrollTimelineUtilTest, ToCompositorScrollTimelineNullScrollSource) {
CSSPrimitiveValue* end_scroll_offset = nullptr;
ScrollTimeline* timeline = MakeGarbageCollected<ScrollTimeline>(
scroll_source, ScrollTimeline::Block, start_scroll_offset,
- end_scroll_offset, 100);
+ end_scroll_offset, 100, Timing::FillMode::NONE);
std::unique_ptr<CompositorScrollTimeline> compositor_timeline =
ToCompositorScrollTimeline(timeline);
diff --git a/chromium/third_party/blink/renderer/core/animation/size_interpolation_functions.cc b/chromium/third_party/blink/renderer/core/animation/size_interpolation_functions.cc
index a7032b228af..6488247fa13 100644
--- a/chromium/third_party/blink/renderer/core/animation/size_interpolation_functions.cc
+++ b/chromium/third_party/blink/renderer/core/animation/size_interpolation_functions.cc
@@ -180,7 +180,7 @@ static Length CreateLength(
const CSSToLengthConversionData& conversion_data) {
if (non_interpolable_value.IsKeyword()) {
DCHECK_EQ(non_interpolable_value.Keyword(), CSSValueAuto);
- return Length(kAuto);
+ return Length::Auto();
}
return LengthInterpolationFunctions::CreateLength(
interpolable_value, non_interpolable_value.LengthNonInterpolableValue(),
diff --git a/chromium/third_party/blink/renderer/core/animation/svg_transform_list_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/svg_transform_list_interpolation_type.cc
index 2eb432cd652..24f6766723d 100644
--- a/chromium/third_party/blink/renderer/core/animation/svg_transform_list_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/svg_transform_list_interpolation_type.cc
@@ -58,7 +58,7 @@ std::unique_ptr<InterpolableValue> TranslateToInterpolableValue(
SVGTransform* TranslateFromInterpolableValue(const InterpolableValue& value) {
const InterpolableList& list = ToInterpolableList(value);
- SVGTransform* transform = SVGTransform::Create(kSvgTransformTranslate);
+ SVGTransform* transform = SVGTransform::Create(SVGTransformType::kTranslate);
transform->SetTranslate(ToInterpolableNumber(list.Get(0))->Value(),
ToInterpolableNumber(list.Get(1))->Value());
return transform;
@@ -76,7 +76,7 @@ std::unique_ptr<InterpolableValue> ScaleToInterpolableValue(
SVGTransform* ScaleFromInterpolableValue(const InterpolableValue& value) {
const InterpolableList& list = ToInterpolableList(value);
- SVGTransform* transform = SVGTransform::Create(kSvgTransformScale);
+ SVGTransform* transform = SVGTransform::Create(SVGTransformType::kScale);
transform->SetScale(ToInterpolableNumber(list.Get(0))->Value(),
ToInterpolableNumber(list.Get(1))->Value());
return transform;
@@ -95,7 +95,7 @@ std::unique_ptr<InterpolableValue> RotateToInterpolableValue(
SVGTransform* RotateFromInterpolableValue(const InterpolableValue& value) {
const InterpolableList& list = ToInterpolableList(value);
- SVGTransform* transform = SVGTransform::Create(kSvgTransformRotate);
+ SVGTransform* transform = SVGTransform::Create(SVGTransformType::kRotate);
transform->SetRotate(ToInterpolableNumber(list.Get(0))->Value(),
ToInterpolableNumber(list.Get(1))->Value(),
ToInterpolableNumber(list.Get(2))->Value());
@@ -108,7 +108,7 @@ std::unique_ptr<InterpolableValue> SkewXToInterpolableValue(
}
SVGTransform* SkewXFromInterpolableValue(const InterpolableValue& value) {
- SVGTransform* transform = SVGTransform::Create(kSvgTransformSkewx);
+ SVGTransform* transform = SVGTransform::Create(SVGTransformType::kSkewx);
transform->SetSkewX(ToInterpolableNumber(value).Value());
return transform;
}
@@ -119,7 +119,7 @@ std::unique_ptr<InterpolableValue> SkewYToInterpolableValue(
}
SVGTransform* SkewYFromInterpolableValue(const InterpolableValue& value) {
- SVGTransform* transform = SVGTransform::Create(kSvgTransformSkewy);
+ SVGTransform* transform = SVGTransform::Create(SVGTransformType::kSkewy);
transform->SetSkewY(ToInterpolableNumber(value).Value());
return transform;
}
@@ -128,18 +128,18 @@ std::unique_ptr<InterpolableValue> ToInterpolableValue(
SVGTransform* transform,
SVGTransformType transform_type) {
switch (transform_type) {
- case kSvgTransformTranslate:
+ case SVGTransformType::kTranslate:
return TranslateToInterpolableValue(transform);
- case kSvgTransformScale:
+ case SVGTransformType::kScale:
return ScaleToInterpolableValue(transform);
- case kSvgTransformRotate:
+ case SVGTransformType::kRotate:
return RotateToInterpolableValue(transform);
- case kSvgTransformSkewx:
+ case SVGTransformType::kSkewx:
return SkewXToInterpolableValue(transform);
- case kSvgTransformSkewy:
+ case SVGTransformType::kSkewy:
return SkewYToInterpolableValue(transform);
- case kSvgTransformMatrix:
- case kSvgTransformUnknown:
+ case SVGTransformType::kMatrix:
+ case SVGTransformType::kUnknown:
NOTREACHED();
}
NOTREACHED();
@@ -149,18 +149,18 @@ std::unique_ptr<InterpolableValue> ToInterpolableValue(
SVGTransform* FromInterpolableValue(const InterpolableValue& value,
SVGTransformType transform_type) {
switch (transform_type) {
- case kSvgTransformTranslate:
+ case SVGTransformType::kTranslate:
return TranslateFromInterpolableValue(value);
- case kSvgTransformScale:
+ case SVGTransformType::kScale:
return ScaleFromInterpolableValue(value);
- case kSvgTransformRotate:
+ case SVGTransformType::kRotate:
return RotateFromInterpolableValue(value);
- case kSvgTransformSkewx:
+ case SVGTransformType::kSkewx:
return SkewXFromInterpolableValue(value);
- case kSvgTransformSkewy:
+ case SVGTransformType::kSkewy:
return SkewYFromInterpolableValue(value);
- case kSvgTransformMatrix:
- case kSvgTransformUnknown:
+ case SVGTransformType::kMatrix:
+ case SVGTransformType::kUnknown:
NOTREACHED();
}
NOTREACHED();
@@ -224,7 +224,7 @@ InterpolationValue SVGTransformListInterpolationType::MaybeConvertSVGValue(
for (wtf_size_t i = 0; i < svg_list.length(); i++) {
const SVGTransform* transform = svg_list.at(i);
SVGTransformType transform_type(transform->TransformType());
- if (transform_type == kSvgTransformMatrix) {
+ if (transform_type == SVGTransformType::kMatrix) {
// TODO(ericwilligers): Support matrix interpolation.
return nullptr;
}
diff --git a/chromium/third_party/blink/renderer/core/animation/test_data/transform-animation-update.html b/chromium/third_party/blink/renderer/core/animation/test_data/transform-animation-update.html
new file mode 100644
index 00000000000..4f011a80917
--- /dev/null
+++ b/chromium/third_party/blink/renderer/core/animation/test_data/transform-animation-update.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<style>
+@keyframes rotate {
+ from {transform: rotateY(180deg);}
+ to {transform: rotateY(0deg);}
+}
+#target {
+ width: 100px;
+ height: 100px;
+ animation: rotate 9999s linear 0s infinite;
+}
+.backface-visible {
+ backface-visibility: visible;
+}
+.backface-hidden {
+ backface-visibility: hidden;
+}
+</style>
+<div id="target" class="backface-visible"></div>
diff --git a/chromium/third_party/blink/renderer/core/animation/timing.cc b/chromium/third_party/blink/renderer/core/animation/timing.cc
index 9f3cdc5a65f..d37f7fff9ee 100644
--- a/chromium/third_party/blink/renderer/core/animation/timing.cc
+++ b/chromium/third_party/blink/renderer/core/animation/timing.cc
@@ -23,6 +23,19 @@ String Timing::FillModeString(FillMode fill_mode) {
return "none";
}
+Timing::FillMode Timing::StringToFillMode(const String& fill_mode) {
+ if (fill_mode == "none")
+ return Timing::FillMode::NONE;
+ if (fill_mode == "backwards")
+ return Timing::FillMode::BACKWARDS;
+ if (fill_mode == "both")
+ return Timing::FillMode::BOTH;
+ if (fill_mode == "forwards")
+ return Timing::FillMode::FORWARDS;
+ DCHECK_EQ(fill_mode, "auto");
+ return Timing::FillMode::AUTO;
+}
+
String Timing::PlaybackDirectionString(PlaybackDirection playback_direction) {
switch (playback_direction) {
case PlaybackDirection::NORMAL:
diff --git a/chromium/third_party/blink/renderer/core/animation/timing.h b/chromium/third_party/blink/renderer/core/animation/timing.h
index 0903c1315f3..c1be6ade6b4 100644
--- a/chromium/third_party/blink/renderer/core/animation/timing.h
+++ b/chromium/third_party/blink/renderer/core/animation/timing.h
@@ -50,6 +50,7 @@ struct Timing {
using PlaybackDirection = CompositorKeyframeModel::Direction;
static String FillModeString(FillMode);
+ static FillMode StringToFillMode(const String&);
static String PlaybackDirectionString(PlaybackDirection);
static const Timing& Defaults() {
diff --git a/chromium/third_party/blink/renderer/core/animation/timing_input.cc b/chromium/third_party/blink/renderer/core/animation/timing_input.cc
index da804826fef..92a29c8f80d 100644
--- a/chromium/third_party/blink/renderer/core/animation/timing_input.cc
+++ b/chromium/third_party/blink/renderer/core/animation/timing_input.cc
@@ -15,19 +15,6 @@
namespace blink {
namespace {
-Timing::FillMode ConvertFillMode(const String& fill_mode) {
- if (fill_mode == "none")
- return Timing::FillMode::NONE;
- if (fill_mode == "backwards")
- return Timing::FillMode::BACKWARDS;
- if (fill_mode == "both")
- return Timing::FillMode::BOTH;
- if (fill_mode == "forwards")
- return Timing::FillMode::FORWARDS;
- DCHECK_EQ(fill_mode, "auto");
- return Timing::FillMode::AUTO;
-}
-
Timing::PlaybackDirection ConvertPlaybackDirection(const String& direction) {
if (direction == "reverse")
return Timing::PlaybackDirection::REVERSE;
@@ -184,8 +171,8 @@ bool TimingInput::Update(Timing& timing,
changed |= UpdateValueIfChanged(timing.end_delay, input->endDelay() / 1000);
}
if (input->hasFill()) {
- changed |=
- UpdateValueIfChanged(timing.fill_mode, ConvertFillMode(input->fill()));
+ changed |= UpdateValueIfChanged(timing.fill_mode,
+ Timing::StringToFillMode(input->fill()));
}
if (input->hasIterationStart()) {
changed |=
diff --git a/chromium/third_party/blink/renderer/core/animation/timing_input_test.cc b/chromium/third_party/blink/renderer/core/animation/timing_input_test.cc
index de45cbe72be..7953de5cfae 100644
--- a/chromium/third_party/blink/renderer/core/animation/timing_input_test.cc
+++ b/chromium/third_party/blink/renderer/core/animation/timing_input_test.cc
@@ -380,12 +380,6 @@ TEST_F(AnimationTimingInputTest, TimingInputTimingFunction) {
.timing_function);
EXPECT_TRUE(success);
EXPECT_EQ(
- *StepsTimingFunction::Preset(StepsTimingFunction::StepPosition::MIDDLE),
- *ApplyTimingInputString(scope.GetIsolate(), "easing", "step-middle",
- success)
- .timing_function);
- EXPECT_TRUE(success);
- EXPECT_EQ(
*StepsTimingFunction::Preset(StepsTimingFunction::StepPosition::END),
*ApplyTimingInputString(scope.GetIsolate(), "easing", "step-end", success)
.timing_function);
@@ -401,12 +395,6 @@ TEST_F(AnimationTimingInputTest, TimingInputTimingFunction) {
success)
.timing_function);
EXPECT_TRUE(success);
- EXPECT_EQ(*StepsTimingFunction::Create(
- 5, StepsTimingFunction::StepPosition::MIDDLE),
- *ApplyTimingInputString(scope.GetIsolate(), "easing",
- "steps(5, middle)", success)
- .timing_function);
- EXPECT_TRUE(success);
EXPECT_EQ(
*StepsTimingFunction::Create(5, StepsTimingFunction::StepPosition::END),
*ApplyTimingInputString(scope.GetIsolate(), "easing", "steps(5, end)",
diff --git a/chromium/third_party/blink/renderer/core/animation/underlying_value_owner.cc b/chromium/third_party/blink/renderer/core/animation/underlying_value_owner.cc
index 9e3b744a123..ccbca95abd0 100644
--- a/chromium/third_party/blink/renderer/core/animation/underlying_value_owner.cc
+++ b/chromium/third_party/blink/renderer/core/animation/underlying_value_owner.cc
@@ -28,8 +28,8 @@ void UnderlyingValueOwner::Set(const InterpolationType& type,
const InterpolationValue& value) {
DCHECK(value);
type_ = &type;
- // By clearing m_valueOwner we will perform a copy before attempting to mutate
- // m_value, thus upholding the const contract for this instance of
+ // By clearing |value_owner_| we will perform a copy before attempting to
+ // mutate |value_|, thus upholding the const contract for this instance of
// interpolationValue.
value_owner_.Clear();
value_ = &value;
diff --git a/chromium/third_party/blink/renderer/core/animation/worklet_animation_controller.h b/chromium/third_party/blink/renderer/core/animation/worklet_animation_controller.h
index 3b9bdb7774b..0acfb2fb95b 100644
--- a/chromium/third_party/blink/renderer/core/animation/worklet_animation_controller.h
+++ b/chromium/third_party/blink/renderer/core/animation/worklet_animation_controller.h
@@ -58,8 +58,6 @@ class CORE_EXPORT WorkletAnimationController
void SetMutationUpdate(
std::unique_ptr<AnimationWorkletOutput> output) override;
- void NotifyAnimationsPending() override {}
- void NotifyAnimationsReady() override {}
void SynchronizeAnimatorName(const String& animator_name) override;
// Returns true if the animator with given name is registered in