summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/animation
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-05-24 11:40:17 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-05-24 12:42:11 +0000
commit5d87695f37678f96492b258bbab36486c59866b4 (patch)
treebe9783bbaf04fb930c4d74ca9c00b5e7954c8bc6 /chromium/third_party/blink/renderer/core/animation
parent6c11fb357ec39bf087b8b632e2b1e375aef1b38b (diff)
downloadqtwebengine-chromium-5d87695f37678f96492b258bbab36486c59866b4.tar.gz
BASELINE: Update Chromium to 75.0.3770.56
Change-Id: I86d2007fd27a45d5797eee06f4c9369b8b50ac4f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/core/animation')
-rw-r--r--chromium/third_party/blink/renderer/core/animation/BUILD.gn33
-rw-r--r--chromium/third_party/blink/renderer/core/animation/animatable/animatable_double.cc44
-rw-r--r--chromium/third_party/blink/renderer/core/animation/animatable/animatable_double.h4
-rw-r--r--chromium/third_party/blink/renderer/core/animation/animatable/animatable_filter_operations.cc72
-rw-r--r--chromium/third_party/blink/renderer/core/animation/animatable/animatable_filter_operations.h12
-rw-r--r--chromium/third_party/blink/renderer/core/animation/animatable/animatable_transform.cc46
-rw-r--r--chromium/third_party/blink/renderer/core/animation/animatable/animatable_transform.h4
-rw-r--r--chromium/third_party/blink/renderer/core/animation/animatable/animatable_value.cc50
-rw-r--r--chromium/third_party/blink/renderer/core/animation/animatable/animatable_value.h22
-rw-r--r--chromium/third_party/blink/renderer/core/animation/animation.cc15
-rw-r--r--chromium/third_party/blink/renderer/core/animation/animation.idl6
-rw-r--r--chromium/third_party/blink/renderer/core/animation/animation_effect.cc82
-rw-r--r--chromium/third_party/blink/renderer/core/animation/animation_effect.h2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/animation_effect.idl5
-rw-r--r--chromium/third_party/blink/renderer/core/animation/animation_input_helpers.cc34
-rw-r--r--chromium/third_party/blink/renderer/core/animation/animation_input_helpers_test.cc47
-rw-r--r--chromium/third_party/blink/renderer/core/animation/animation_test.cc28
-rw-r--r--chromium/third_party/blink/renderer/core/animation/animation_timeline.h1
-rw-r--r--chromium/third_party/blink/renderer/core/animation/basic_shape_interpolation_functions.cc66
-rw-r--r--chromium/third_party/blink/renderer/core/animation/color_property_functions.cc124
-rw-r--r--chromium/third_party/blink/renderer/core/animation/compositor_animations.cc80
-rw-r--r--chromium/third_party/blink/renderer/core/animation/compositor_animations.h12
-rw-r--r--chromium/third_party/blink/renderer/core/animation/compositor_animations_test.cc402
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css/css_animatable_value_factory.cc27
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css/css_animation_data.h8
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css/css_animations.cc92
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css/css_transition_data.h18
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css/css_transition_data_test.cc24
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_angle_interpolation_type.cc7
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_basic_shape_interpolation_type.cc33
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_border_image_length_box_interpolation_type.cc109
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_clip_interpolation_type.cc43
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_clip_interpolation_type.h2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_color_interpolation_type.cc90
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_custom_list_interpolation_type.cc10
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_default_interpolation_type.cc2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_filter_list_interpolation_type.cc62
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_font_size_interpolation_type.cc28
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_font_size_interpolation_type.h2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_font_variation_settings_interpolation_type.cc44
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_font_variation_settings_interpolation_type.h3
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_font_weight_interpolation_type.cc36
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_font_weight_interpolation_type.h2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_image_interpolation_type.cc46
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_image_list_interpolation_type.cc40
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_image_slice_interpolation_type.cc63
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_interpolation_type.cc43
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_interpolation_types_map.cc264
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_length_interpolation_type.cc16
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_length_list_interpolation_type.cc20
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_length_pair_interpolation_type.h2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_number_interpolation_type.cc20
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_offset_rotate_interpolation_type.cc30
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_offset_rotate_interpolation_type.h2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_paint_interpolation_type.cc25
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_path_interpolation_type.cc27
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_position_axis_list_interpolation_type.cc27
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_position_interpolation_type.h8
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_ray_interpolation_type.cc25
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_ray_interpolation_type.h2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_resolution_interpolation_type.cc12
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_rotate_interpolation_type.cc16
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_rotate_interpolation_type.h2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_scale_interpolation_type.cc23
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_scale_interpolation_type.h2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_shadow_list_interpolation_type.cc25
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_size_list_interpolation_type.cc31
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_text_indent_interpolation_type.cc35
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_text_indent_interpolation_type.h2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_time_interpolation_type.cc7
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_transform_interpolation_type.cc29
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_transform_interpolation_type.h2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_transform_origin_interpolation_type.h2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_translate_interpolation_type.cc30
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_translate_interpolation_type.h2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_var_cycle_interpolation_type.cc21
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_visibility_interpolation_type.cc43
-rw-r--r--chromium/third_party/blink/renderer/core/animation/css_visibility_interpolation_type.h2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/document_animations.h6
-rw-r--r--chromium/third_party/blink/renderer/core/animation/document_timeline.cc4
-rw-r--r--chromium/third_party/blink/renderer/core/animation/document_timeline.h2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/document_timeline_test.cc2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/effect_input.cc15
-rw-r--r--chromium/third_party/blink/renderer/core/animation/effect_stack_test.cc41
-rw-r--r--chromium/third_party/blink/renderer/core/animation/element_animation.idl2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/element_animations.cc2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/filter_interpolation_functions.cc33
-rw-r--r--chromium/third_party/blink/renderer/core/animation/image_list_property_functions.h8
-rw-r--r--chromium/third_party/blink/renderer/core/animation/image_slice_property_functions.h11
-rw-r--r--chromium/third_party/blink/renderer/core/animation/interpolable_value.cc2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/interpolable_value.h28
-rw-r--r--chromium/third_party/blink/renderer/core/animation/interpolable_value_test.cc69
-rw-r--r--chromium/third_party/blink/renderer/core/animation/interpolation_effect_test.cc4
-rw-r--r--chromium/third_party/blink/renderer/core/animation/invalidatable_interpolation.cc8
-rw-r--r--chromium/third_party/blink/renderer/core/animation/keyframe_effect.cc6
-rw-r--r--chromium/third_party/blink/renderer/core/animation/keyframe_effect.idl12
-rw-r--r--chromium/third_party/blink/renderer/core/animation/keyframe_effect_model_test.cc115
-rw-r--r--chromium/third_party/blink/renderer/core/animation/length_interpolation_functions.cc43
-rw-r--r--chromium/third_party/blink/renderer/core/animation/length_list_property_functions.cc108
-rw-r--r--chromium/third_party/blink/renderer/core/animation/length_property_functions.cc314
-rw-r--r--chromium/third_party/blink/renderer/core/animation/list_interpolation_functions.cc15
-rw-r--r--chromium/third_party/blink/renderer/core/animation/list_interpolation_functions.h8
-rw-r--r--chromium/third_party/blink/renderer/core/animation/list_interpolation_functions_test.cc11
-rw-r--r--chromium/third_party/blink/renderer/core/animation/number_property_functions.cc102
-rw-r--r--chromium/third_party/blink/renderer/core/animation/number_property_functions.h3
-rw-r--r--chromium/third_party/blink/renderer/core/animation/path_interpolation_functions.cc18
-rw-r--r--chromium/third_party/blink/renderer/core/animation/path_interpolation_functions.h3
-rw-r--r--chromium/third_party/blink/renderer/core/animation/primitive_interpolation.h43
-rw-r--r--chromium/third_party/blink/renderer/core/animation/property_handle.cc4
-rw-r--r--chromium/third_party/blink/renderer/core/animation/property_handle.h2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/property_handle_test.cc8
-rw-r--r--chromium/third_party/blink/renderer/core/animation/sampled_effect.h5
-rw-r--r--chromium/third_party/blink/renderer/core/animation/scroll_timeline.cc21
-rw-r--r--chromium/third_party/blink/renderer/core/animation/scroll_timeline.h4
-rw-r--r--chromium/third_party/blink/renderer/core/animation/scroll_timeline.idl2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/scroll_timeline_test.cc3
-rw-r--r--chromium/third_party/blink/renderer/core/animation/shadow_interpolation_functions.cc25
-rw-r--r--chromium/third_party/blink/renderer/core/animation/size_interpolation_functions.cc43
-rw-r--r--chromium/third_party/blink/renderer/core/animation/size_list_property_functions.cc8
-rw-r--r--chromium/third_party/blink/renderer/core/animation/string_keyframe.cc12
-rw-r--r--chromium/third_party/blink/renderer/core/animation/svg_angle_interpolation_type.cc7
-rw-r--r--chromium/third_party/blink/renderer/core/animation/svg_integer_interpolation_type.cc7
-rw-r--r--chromium/third_party/blink/renderer/core/animation/svg_integer_optional_integer_interpolation_type.cc21
-rw-r--r--chromium/third_party/blink/renderer/core/animation/svg_length_interpolation_type.cc22
-rw-r--r--chromium/third_party/blink/renderer/core/animation/svg_length_list_interpolation_type.cc13
-rw-r--r--chromium/third_party/blink/renderer/core/animation/svg_number_interpolation_type.cc10
-rw-r--r--chromium/third_party/blink/renderer/core/animation/svg_number_list_interpolation_type.cc33
-rw-r--r--chromium/third_party/blink/renderer/core/animation/svg_number_optional_number_interpolation_type.cc23
-rw-r--r--chromium/third_party/blink/renderer/core/animation/svg_path_interpolation_type.cc4
-rw-r--r--chromium/third_party/blink/renderer/core/animation/svg_path_seg_interpolation_functions.cc28
-rw-r--r--chromium/third_party/blink/renderer/core/animation/svg_point_list_interpolation_type.cc21
-rw-r--r--chromium/third_party/blink/renderer/core/animation/svg_rect_interpolation_type.cc21
-rw-r--r--chromium/third_party/blink/renderer/core/animation/svg_transform_list_interpolation_type.cc60
-rw-r--r--chromium/third_party/blink/renderer/core/animation/svg_value_interpolation_type.cc2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/test_data/scale-animation.html13
-rw-r--r--chromium/third_party/blink/renderer/core/animation/timing_calculations.h218
-rw-r--r--chromium/third_party/blink/renderer/core/animation/timing_calculations_test.cc291
-rw-r--r--chromium/third_party/blink/renderer/core/animation/timing_input_test.cc2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/transition_interpolation.cc8
-rw-r--r--chromium/third_party/blink/renderer/core/animation/transition_interpolation.h2
-rw-r--r--chromium/third_party/blink/renderer/core/animation/transition_keyframe.cc5
-rw-r--r--chromium/third_party/blink/renderer/core/animation/transition_keyframe.h15
-rw-r--r--chromium/third_party/blink/renderer/core/animation/typed_interpolation_value.h29
-rw-r--r--chromium/third_party/blink/renderer/core/animation/underlying_length_checker.h9
144 files changed, 2272 insertions, 2546 deletions
diff --git a/chromium/third_party/blink/renderer/core/animation/BUILD.gn b/chromium/third_party/blink/renderer/core/animation/BUILD.gn
index 8dcf27c7d56..7648fa1c57b 100644
--- a/chromium/third_party/blink/renderer/core/animation/BUILD.gn
+++ b/chromium/third_party/blink/renderer/core/animation/BUILD.gn
@@ -8,13 +8,9 @@ blink_core_sources("animation") {
split_count = 5
sources = [
- "animatable/animatable_double.cc",
"animatable/animatable_double.h",
- "animatable/animatable_filter_operations.cc",
"animatable/animatable_filter_operations.h",
- "animatable/animatable_transform.cc",
"animatable/animatable_transform.h",
- "animatable/animatable_value.cc",
"animatable/animatable_value.h",
"animation.cc",
"animation.h",
@@ -243,3 +239,32 @@ blink_core_sources("animation") {
"worklet_animation_controller.h",
]
}
+
+blink_core_tests("unit_tests") {
+ sources = [
+ "animation_clock_test.cc",
+ "animation_effect_test.cc",
+ "animation_input_helpers_test.cc",
+ "animation_sim_test.cc",
+ "animation_test.cc",
+ "animation_test_helper.cc",
+ "animation_test_helper.h",
+ "animation_time_delta_test.cc",
+ "compositor_animations_test.cc",
+ "css/css_animations_test.cc",
+ "css/css_transition_data_test.cc",
+ "document_timeline_test.cc",
+ "effect_input_test.cc",
+ "effect_stack_test.cc",
+ "interpolable_value_test.cc",
+ "interpolation_effect_test.cc",
+ "keyframe_effect_model_test.cc",
+ "keyframe_effect_test.cc",
+ "list_interpolation_functions_test.cc",
+ "property_handle_test.cc",
+ "scroll_timeline_test.cc",
+ "scroll_timeline_util_test.cc",
+ "timing_calculations_test.cc",
+ "timing_input_test.cc",
+ ]
+}
diff --git a/chromium/third_party/blink/renderer/core/animation/animatable/animatable_double.cc b/chromium/third_party/blink/renderer/core/animation/animatable/animatable_double.cc
deleted file mode 100644
index a06df5ca9bf..00000000000
--- a/chromium/third_party/blink/renderer/core/animation/animatable/animatable_double.cc
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2013 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "third_party/blink/renderer/core/animation/animatable/animatable_double.h"
-
-#include <math.h>
-#include "third_party/blink/renderer/platform/animation/animation_utilities.h"
-
-namespace blink {
-
-AnimatableValue* AnimatableDouble::InterpolateTo(const AnimatableValue* value,
- double fraction) const {
- const AnimatableDouble* other = ToAnimatableDouble(value);
- return AnimatableDouble::Create(Blend(number_, other->number_, fraction));
-}
-
-} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/animation/animatable/animatable_double.h b/chromium/third_party/blink/renderer/core/animation/animatable/animatable_double.h
index d9c379963d6..ea88b224b89 100644
--- a/chromium/third_party/blink/renderer/core/animation/animatable/animatable_double.h
+++ b/chromium/third_party/blink/renderer/core/animation/animatable/animatable_double.h
@@ -47,10 +47,6 @@ class CORE_EXPORT AnimatableDouble final : public AnimatableValue {
double ToDouble() const { return number_; }
- protected:
- AnimatableValue* InterpolateTo(const AnimatableValue*,
- double fraction) const override;
-
private:
AnimatableType GetType() const override { return kTypeDouble; }
diff --git a/chromium/third_party/blink/renderer/core/animation/animatable/animatable_filter_operations.cc b/chromium/third_party/blink/renderer/core/animation/animatable/animatable_filter_operations.cc
deleted file mode 100644
index 06359996b13..00000000000
--- a/chromium/third_party/blink/renderer/core/animation/animatable/animatable_filter_operations.cc
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2013 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "third_party/blink/renderer/core/animation/animatable/animatable_filter_operations.h"
-
-#include <algorithm>
-
-namespace blink {
-
-AnimatableValue* AnimatableFilterOperations::InterpolateTo(
- const AnimatableValue* value,
- double fraction) const {
- const AnimatableFilterOperations* target =
- ToAnimatableFilterOperations(value);
-
- if (!Operations().CanInterpolateWith(target->Operations()))
- return DefaultInterpolateTo(this, value, fraction);
-
- FilterOperations result;
- wtf_size_t from_size = Operations().size();
- wtf_size_t to_size = target->Operations().size();
- wtf_size_t size = std::max(from_size, to_size);
- for (wtf_size_t i = 0; i < size; i++) {
- FilterOperation* from =
- (i < from_size) ? operation_wrapper_->Operations().Operations()[i].Get()
- : nullptr;
- FilterOperation* to =
- (i < to_size)
- ? target->operation_wrapper_->Operations().Operations()[i].Get()
- : nullptr;
- FilterOperation* blended_op = FilterOperation::Blend(from, to, fraction);
- if (blended_op)
- result.Operations().push_back(blended_op);
- else
- NOTREACHED();
- }
- return AnimatableFilterOperations::Create(result);
-}
-
-void AnimatableFilterOperations::Trace(Visitor* visitor) {
- visitor->Trace(operation_wrapper_);
- AnimatableValue::Trace(visitor);
-}
-
-} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/animation/animatable/animatable_filter_operations.h b/chromium/third_party/blink/renderer/core/animation/animatable/animatable_filter_operations.h
index cdb0ab7378f..a657b0b54b6 100644
--- a/chromium/third_party/blink/renderer/core/animation/animatable/animatable_filter_operations.h
+++ b/chromium/third_party/blink/renderer/core/animation/animatable/animatable_filter_operations.h
@@ -45,18 +45,18 @@ class AnimatableFilterOperations final : public AnimatableValue {
}
AnimatableFilterOperations(const FilterOperations& operations)
- : operation_wrapper_(FilterOperationsWrapper::Create(operations)) {}
+ : operation_wrapper_(
+ MakeGarbageCollected<FilterOperationsWrapper>(operations)) {}
~AnimatableFilterOperations() override = default;
const FilterOperations& Operations() const {
return operation_wrapper_->Operations();
}
- void Trace(Visitor*) override;
-
- protected:
- AnimatableValue* InterpolateTo(const AnimatableValue*,
- double fraction) const override;
+ void Trace(Visitor* visitor) override {
+ visitor->Trace(operation_wrapper_);
+ AnimatableValue::Trace(visitor);
+ }
private:
AnimatableType GetType() const override { return kTypeFilterOperations; }
diff --git a/chromium/third_party/blink/renderer/core/animation/animatable/animatable_transform.cc b/chromium/third_party/blink/renderer/core/animation/animatable/animatable_transform.cc
deleted file mode 100644
index 247a8acd7e2..00000000000
--- a/chromium/third_party/blink/renderer/core/animation/animatable/animatable_transform.cc
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2013 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "third_party/blink/renderer/core/animation/animatable/animatable_transform.h"
-
-#include "third_party/blink/renderer/platform/animation/animation_utilities.h"
-
-namespace blink {
-
-AnimatableValue* AnimatableTransform::InterpolateTo(
- const AnimatableValue* value,
- double fraction) const {
- const AnimatableTransform& transform = ToAnimatableTransform(*value);
- return AnimatableTransform::Create(
- transform.transform_.Blend(transform_, fraction),
- Blend(zoom_, transform.zoom_, fraction));
-}
-
-} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/animation/animatable/animatable_transform.h b/chromium/third_party/blink/renderer/core/animation/animatable/animatable_transform.h
index 817c57a7a71..bda9b7c1fa7 100644
--- a/chromium/third_party/blink/renderer/core/animation/animatable/animatable_transform.h
+++ b/chromium/third_party/blink/renderer/core/animation/animatable/animatable_transform.h
@@ -53,10 +53,6 @@ class CORE_EXPORT AnimatableTransform final : public AnimatableValue {
}
double Zoom() const { return zoom_; }
- protected:
- AnimatableValue* InterpolateTo(const AnimatableValue*,
- double fraction) const override;
-
private:
AnimatableType GetType() const override { return kTypeTransform; }
diff --git a/chromium/third_party/blink/renderer/core/animation/animatable/animatable_value.cc b/chromium/third_party/blink/renderer/core/animation/animatable/animatable_value.cc
deleted file mode 100644
index 322b1e41dc0..00000000000
--- a/chromium/third_party/blink/renderer/core/animation/animatable/animatable_value.cc
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2013 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "third_party/blink/renderer/core/animation/animatable/animatable_value.h"
-
-#include <algorithm>
-#include "third_party/blink/renderer/platform/wtf/std_lib_extras.h"
-
-namespace blink {
-
-AnimatableValue* AnimatableValue::Interpolate(const AnimatableValue* left,
- const AnimatableValue* right,
- double fraction) {
- DCHECK(left);
- DCHECK(right);
-
- if (fraction && fraction != 1 && left->IsSameType(right))
- return left->InterpolateTo(right, fraction);
-
- return DefaultInterpolateTo(left, right, fraction);
-}
-
-} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/animation/animatable/animatable_value.h b/chromium/third_party/blink/renderer/core/animation/animatable/animatable_value.h
index 6d62f1cf45b..f18b38a9738 100644
--- a/chromium/third_party/blink/renderer/core/animation/animatable/animatable_value.h
+++ b/chromium/third_party/blink/renderer/core/animation/animatable/animatable_value.h
@@ -42,19 +42,11 @@ class CORE_EXPORT AnimatableValue
public:
virtual ~AnimatableValue() = default;
- static AnimatableValue* Interpolate(const AnimatableValue*,
- const AnimatableValue*,
- double fraction);
bool IsDouble() const { return GetType() == kTypeDouble; }
bool IsFilterOperations() const { return GetType() == kTypeFilterOperations; }
bool IsTransform() const { return GetType() == kTypeTransform; }
bool IsUnknown() const { return GetType() == kTypeUnknown; }
- bool IsSameType(const AnimatableValue* value) const {
- DCHECK(value);
- return value->GetType() == GetType();
- }
-
virtual void Trace(Visitor*) {}
protected:
@@ -65,22 +57,8 @@ class CORE_EXPORT AnimatableValue
kTypeUnknown,
};
- virtual AnimatableValue* InterpolateTo(const AnimatableValue*,
- double fraction) const {
- NOTREACHED();
- return nullptr;
- }
- static AnimatableValue* DefaultInterpolateTo(const AnimatableValue* left,
- const AnimatableValue* right,
- double fraction) {
- return const_cast<AnimatableValue*>((fraction < 0.5) ? left : right);
- }
-
private:
virtual AnimatableType GetType() const = 0;
-
- template <class Keyframe>
- friend class KeyframeEffectModel;
};
#define DEFINE_ANIMATABLE_VALUE_TYPE_CASTS(thisType, predicate) \
diff --git a/chromium/third_party/blink/renderer/core/animation/animation.cc b/chromium/third_party/blink/renderer/core/animation/animation.cc
index b9e28da1d5a..37364a4906e 100644
--- a/chromium/third_party/blink/renderer/core/animation/animation.cc
+++ b/chromium/third_party/blink/renderer/core/animation/animation.cc
@@ -53,7 +53,6 @@
#include "third_party/blink/renderer/platform/bindings/script_forbidden_scope.h"
#include "third_party/blink/renderer/platform/heap/persistent.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
-#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/wtf/math_extras.h"
namespace blink {
@@ -94,8 +93,6 @@ Animation* Animation::Create(AnimationEffect* effect,
Animation* Animation::Create(ExecutionContext* execution_context,
AnimationEffect* effect,
ExceptionState& exception_state) {
- DCHECK(RuntimeEnabledFeatures::WebAnimationsAPIEnabled());
-
Document* document = To<Document>(execution_context);
return Create(effect, &document->Timeline(), exception_state);
}
@@ -104,8 +101,6 @@ Animation* Animation::Create(ExecutionContext* execution_context,
AnimationEffect* effect,
AnimationTimeline* timeline,
ExceptionState& exception_state) {
- DCHECK(RuntimeEnabledFeatures::WebAnimationsAPIEnabled());
-
if (!timeline) {
return Create(execution_context, effect, exception_state);
}
@@ -975,8 +970,9 @@ bool Animation::Update(TimingUpdateReason reason) {
if (GetExecutionContext() && HasEventListeners(event_type)) {
double event_current_time = NullValue();
pending_cancelled_event_ =
- AnimationPlaybackEvent::Create(event_type, event_current_time,
- TimelineInternal()->currentTime());
+ MakeGarbageCollected<AnimationPlaybackEvent>(
+ event_type, event_current_time,
+ TimelineInternal()->currentTime());
pending_cancelled_event_->SetTarget(this);
pending_cancelled_event_->SetCurrentTarget(this);
timeline_->GetDocument()->EnqueueAnimationFrameEvent(
@@ -987,8 +983,9 @@ bool Animation::Update(TimingUpdateReason reason) {
if (GetExecutionContext() && HasEventListeners(event_type)) {
double event_current_time = CurrentTimeInternal() * 1000;
pending_finished_event_ =
- AnimationPlaybackEvent::Create(event_type, event_current_time,
- TimelineInternal()->currentTime());
+ MakeGarbageCollected<AnimationPlaybackEvent>(
+ event_type, event_current_time,
+ TimelineInternal()->currentTime());
pending_finished_event_->SetTarget(this);
pending_finished_event_->SetCurrentTarget(this);
timeline_->GetDocument()->EnqueueAnimationFrameEvent(
diff --git a/chromium/third_party/blink/renderer/core/animation/animation.idl b/chromium/third_party/blink/renderer/core/animation/animation.idl
index a096e1dc90f..7b78ea25f5c 100644
--- a/chromium/third_party/blink/renderer/core/animation/animation.idl
+++ b/chromium/third_party/blink/renderer/core/animation/animation.idl
@@ -28,19 +28,19 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-// https://drafts.csswg.org/web-animations/#animation
+// https://drafts.csswg.org/web-animations/#the-animation-interface
enum AnimationPlayState { "idle", "pending", "running", "paused", "finished" };
[
+ Exposed=Window,
Constructor(optional AnimationEffect? effect = null, optional AnimationTimeline? timeline),
- Exposed(Window WebAnimationsAPI),
ConstructorCallWith=ExecutionContext,
RaisesException=Constructor,
ActiveScriptWrappable
] interface Animation : EventTarget {
+ [Measure] attribute AnimationEffect? effect;
// TODO(suzyh): Make timeline mutable.
- [RuntimeEnabled=WebAnimationsAPI] attribute AnimationEffect? effect;
[RuntimeEnabled=WebAnimationsAPI] readonly attribute AnimationTimeline? timeline;
[Measure] attribute double? startTime;
[Measure, RaisesException=Setter] attribute double? currentTime;
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 44892999bfb..d2b748a5fdf 100644
--- a/chromium/third_party/blink/renderer/core/animation/animation_effect.cc
+++ b/chromium/third_party/blink/renderer/core/animation/animation_effect.cc
@@ -189,17 +189,35 @@ void AnimationEffect::UpdateInheritedTime(double inherited_time,
const Phase current_phase =
CalculatePhase(active_duration, local_time, direction, timing_);
- // FIXME: parentPhase depends on groups being implemented.
- const AnimationEffect::Phase kParentPhase = AnimationEffect::kPhaseActive;
const double active_time = CalculateActiveTime(
active_duration,
ResolvedFillMode(timing_.fill_mode, IsKeyframeEffect()), local_time,
- kParentPhase, current_phase, timing_);
+ current_phase, timing_);
- double current_iteration;
base::Optional<double> progress;
- if (!IterationDuration().is_zero()) {
- const double iteration_duration = IterationDuration().InSecondsF();
+ const double iteration_duration = IterationDuration().InSecondsF();
+
+ const double overall_progress = CalculateOverallProgress(
+ current_phase, active_time, iteration_duration, timing_.iteration_count,
+ timing_.iteration_start);
+ const double simple_iteration_progress = CalculateSimpleIterationProgress(
+ current_phase, overall_progress, timing_.iteration_start, active_time,
+ active_duration, timing_.iteration_count);
+ const double current_iteration = CalculateCurrentIteration(
+ current_phase, active_time, timing_.iteration_count, overall_progress,
+ simple_iteration_progress);
+
+ const double directed_progress = CalculateDirectedProgress(
+ simple_iteration_progress, current_iteration, timing_.direction);
+ progress = CalculateTransformedProgress(
+ directed_progress, iteration_duration, timing_.timing_function);
+ if (IsNull(progress.value())) {
+ progress.reset();
+ }
+
+ // Conditionally compute the time to next iteration, which is only
+ // applicable if the iteration duration is non-zero.
+ if (iteration_duration) {
const double start_offset = MultiplyZeroAlwaysGivesZero(
timing_.iteration_start, iteration_duration);
DCHECK_GE(start_offset, 0);
@@ -208,63 +226,11 @@ void AnimationEffect::UpdateInheritedTime(double inherited_time,
const double iteration_time = CalculateIterationTime(
iteration_duration, active_duration, offset_active_time, start_offset,
current_phase, timing_);
-
- current_iteration = CalculateCurrentIteration(
- iteration_duration, iteration_time, offset_active_time, timing_);
- const base::Optional<double> transformed_time = CalculateTransformedTime(
- current_iteration, iteration_duration, iteration_time, timing_);
-
- // The infinite iterationDuration case here is a workaround because
- // the specified behaviour does not handle infinite durations well.
- // There is an open issue against the spec to fix this:
- // https://github.com/w3c/web-animations/issues/142
- if (!std::isfinite(iteration_duration))
- progress = fmod(timing_.iteration_start, 1.0);
- else if (transformed_time)
- progress = transformed_time.value() / iteration_duration;
-
if (!IsNull(iteration_time)) {
time_to_next_iteration = iteration_duration - iteration_time;
if (active_duration - active_time < time_to_next_iteration)
time_to_next_iteration = std::numeric_limits<double>::infinity();
}
- } else {
- const double kLocalIterationDuration = 1;
- const double local_active_duration =
- kLocalIterationDuration * timing_.iteration_count;
- DCHECK_GE(local_active_duration, 0);
- const double end_time = std::max(
- timing_.start_delay + active_duration + timing_.end_delay, 0.0);
- const double before_active_boundary_time =
- std::max(std::min(timing_.start_delay, end_time), 0.0);
- // local_local_time should be greater than or equal to the
- // before_active_boundary_time once the local_time goes past the start
- // delay.
- const double local_local_time =
- local_time < timing_.start_delay
- ? local_time
- : std::max(local_active_duration + timing_.start_delay,
- before_active_boundary_time);
-
- const AnimationEffect::Phase local_current_phase = CalculatePhase(
- local_active_duration, local_local_time, direction, timing_);
- const double local_active_time = CalculateActiveTime(
- local_active_duration,
- ResolvedFillMode(timing_.fill_mode, IsKeyframeEffect()),
- local_local_time, kParentPhase, local_current_phase, timing_);
- const double start_offset =
- timing_.iteration_start * kLocalIterationDuration;
- DCHECK_GE(start_offset, 0);
- const double offset_active_time = CalculateOffsetActiveTime(
- local_active_duration, local_active_time, start_offset);
- const double iteration_time = CalculateIterationTime(
- kLocalIterationDuration, local_active_duration, offset_active_time,
- start_offset, current_phase, timing_);
-
- current_iteration = CalculateCurrentIteration(
- kLocalIterationDuration, iteration_time, offset_active_time, timing_);
- progress = CalculateTransformedTime(
- current_iteration, kLocalIterationDuration, iteration_time, timing_);
}
const bool was_canceled = current_phase != calculated_.phase &&
diff --git a/chromium/third_party/blink/renderer/core/animation/animation_effect.h b/chromium/third_party/blink/renderer/core/animation/animation_effect.h
index feb3b477363..5e64dc179cc 100644
--- a/chromium/third_party/blink/renderer/core/animation/animation_effect.h
+++ b/chromium/third_party/blink/renderer/core/animation/animation_effect.h
@@ -118,6 +118,7 @@ class CORE_EXPORT AnimationEffect : public ScriptWrappable {
double TimeToReverseEffectChange() const {
return EnsureCalculated().time_to_reverse_effect_change;
}
+ double LocalTime() const { return EnsureCalculated().local_time; }
AnimationTimeDelta IterationDuration() const;
double RepeatedDuration() const;
@@ -187,7 +188,6 @@ class CORE_EXPORT AnimationEffect : public ScriptWrappable {
} calculated_;
mutable bool needs_update_;
mutable double last_update_time_;
- String name_;
const CalculatedTiming& EnsureCalculated() const;
};
diff --git a/chromium/third_party/blink/renderer/core/animation/animation_effect.idl b/chromium/third_party/blink/renderer/core/animation/animation_effect.idl
index 1aca06b7761..bf779a5e8bf 100644
--- a/chromium/third_party/blink/renderer/core/animation/animation_effect.idl
+++ b/chromium/third_party/blink/renderer/core/animation/animation_effect.idl
@@ -30,9 +30,8 @@
// https://drafts.csswg.org/web-animations/#the-animationeffect-interface
-[
- RuntimeEnabled=WebAnimationsAPI
-] interface AnimationEffect {
+[Exposed=Window]
+interface AnimationEffect {
EffectTiming getTiming();
ComputedEffectTiming getComputedTiming();
[RaisesException] void updateTiming(optional OptionalEffectTiming timing);
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 dd479937cdf..b9ae4d1358b 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
@@ -33,13 +33,13 @@ static String RemoveSVGPrefix(const String& property) {
}
static String CSSPropertyToKeyframeAttribute(const CSSProperty& property) {
- DCHECK_NE(property.PropertyID(), CSSPropertyInvalid);
- DCHECK_NE(property.PropertyID(), CSSPropertyVariable);
+ DCHECK_NE(property.PropertyID(), CSSPropertyID::kInvalid);
+ DCHECK_NE(property.PropertyID(), CSSPropertyID::kVariable);
switch (property.PropertyID()) {
- case CSSPropertyFloat:
+ case CSSPropertyID::kFloat:
return "cssFloat";
- case CSSPropertyOffset:
+ case CSSPropertyID::kOffset:
return "cssOffset";
default:
return property.GetJSPropertyName();
@@ -58,23 +58,23 @@ CSSPropertyID AnimationInputHelpers::KeyframeAttributeToCSSProperty(
const String& property,
const Document& document) {
if (CSSVariableParser::IsValidVariableName(property))
- return CSSPropertyVariable;
+ return CSSPropertyID::kVariable;
// Disallow prefixed properties.
if (property[0] == '-')
- return CSSPropertyInvalid;
+ return CSSPropertyID::kInvalid;
if (IsASCIIUpper(property[0]))
- return CSSPropertyInvalid;
+ return CSSPropertyID::kInvalid;
if (property == "cssFloat")
- return CSSPropertyFloat;
+ return CSSPropertyID::kFloat;
if (property == "cssOffset")
- return CSSPropertyOffset;
+ return CSSPropertyID::kOffset;
StringBuilder builder;
for (wtf_size_t i = 0; i < property.length(); ++i) {
// Disallow hyphenated properties.
if (property[i] == '-')
- return CSSPropertyInvalid;
+ return CSSPropertyID::kInvalid;
if (IsASCIIUpper(property[i]))
builder.Append('-');
builder.Append(property[i]);
@@ -87,14 +87,14 @@ CSSPropertyID AnimationInputHelpers::KeyframeAttributeToPresentationAttribute(
const Element* element) {
if (!RuntimeEnabledFeatures::WebAnimationsSVGEnabled() || !element ||
!element->IsSVGElement() || !IsSVGPrefixed(property))
- return CSSPropertyInvalid;
+ return CSSPropertyID::kInvalid;
String unprefixed_property = RemoveSVGPrefix(property);
if (SVGElement::IsAnimatableCSSProperty(QualifiedName(
g_null_atom, AtomicString(unprefixed_property), g_null_atom)))
return cssPropertyID(unprefixed_property);
- return CSSPropertyInvalid;
+ return CSSPropertyID::kInvalid;
}
using AttributeNameMap = HashMap<QualifiedName, const QualifiedName*>;
@@ -250,16 +250,16 @@ scoped_refptr<TimingFunction> AnimationInputHelpers::ParseTimingFunction(
SecureContextMode secure_context_mode =
document ? document->GetSecureContextMode()
: SecureContextMode::kInsecureContext;
- const CSSValue* value =
- CSSParser::ParseSingleValue(CSSPropertyTransitionTimingFunction, string,
- StrictCSSParserContext(secure_context_mode));
- if (!value || !value->IsValueList()) {
+ const CSSValue* value = CSSParser::ParseSingleValue(
+ CSSPropertyID::kTransitionTimingFunction, string,
+ StrictCSSParserContext(secure_context_mode));
+ const auto* value_list = DynamicTo<CSSValueList>(value);
+ if (!value_list) {
DCHECK(!value || value->IsCSSWideKeyword());
exception_state.ThrowTypeError("'" + string +
"' is not a valid value for easing");
return nullptr;
}
- const CSSValueList* value_list = ToCSSValueList(value);
if (value_list->length() > 1) {
exception_state.ThrowTypeError("Easing may not be set to a list of values");
return nullptr;
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 da179987d18..699fa9802bf 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
@@ -73,47 +73,48 @@ class AnimationAnimationInputHelpersTest : public PageTestBase {
void TearDown() override {
document.Release();
- ThreadState::Current()->CollectAllGarbage();
+ ThreadState::Current()->CollectAllGarbageForTesting();
}
Persistent<Document> document;
};
TEST_F(AnimationAnimationInputHelpersTest, ParseKeyframePropertyAttributes) {
- EXPECT_EQ(CSSPropertyLineHeight,
+ EXPECT_EQ(CSSPropertyID::kLineHeight,
KeyframeAttributeToCSSProperty("lineHeight"));
- EXPECT_EQ(CSSPropertyBorderTopWidth,
+ EXPECT_EQ(CSSPropertyID::kBorderTopWidth,
KeyframeAttributeToCSSProperty("borderTopWidth"));
- EXPECT_EQ(CSSPropertyWidth, KeyframeAttributeToCSSProperty("width"));
- EXPECT_EQ(CSSPropertyFloat, KeyframeAttributeToCSSProperty("float"));
- EXPECT_EQ(CSSPropertyFloat, KeyframeAttributeToCSSProperty("cssFloat"));
- EXPECT_EQ(CSSPropertyVariable, KeyframeAttributeToCSSProperty("--"));
- EXPECT_EQ(CSSPropertyVariable, KeyframeAttributeToCSSProperty("---"));
- EXPECT_EQ(CSSPropertyVariable, KeyframeAttributeToCSSProperty("--x"));
- EXPECT_EQ(CSSPropertyVariable,
+ EXPECT_EQ(CSSPropertyID::kWidth, KeyframeAttributeToCSSProperty("width"));
+ EXPECT_EQ(CSSPropertyID::kFloat, KeyframeAttributeToCSSProperty("float"));
+ EXPECT_EQ(CSSPropertyID::kFloat, KeyframeAttributeToCSSProperty("cssFloat"));
+ EXPECT_EQ(CSSPropertyID::kVariable, KeyframeAttributeToCSSProperty("--"));
+ EXPECT_EQ(CSSPropertyID::kVariable, KeyframeAttributeToCSSProperty("---"));
+ EXPECT_EQ(CSSPropertyID::kVariable, KeyframeAttributeToCSSProperty("--x"));
+ EXPECT_EQ(CSSPropertyID::kVariable,
KeyframeAttributeToCSSProperty("--webkit-custom-property"));
- EXPECT_EQ(CSSPropertyInvalid, KeyframeAttributeToCSSProperty(""));
- EXPECT_EQ(CSSPropertyInvalid, KeyframeAttributeToCSSProperty("-"));
- EXPECT_EQ(CSSPropertyInvalid, KeyframeAttributeToCSSProperty("line-height"));
- EXPECT_EQ(CSSPropertyInvalid,
+ EXPECT_EQ(CSSPropertyID::kInvalid, KeyframeAttributeToCSSProperty(""));
+ EXPECT_EQ(CSSPropertyID::kInvalid, KeyframeAttributeToCSSProperty("-"));
+ EXPECT_EQ(CSSPropertyID::kInvalid,
+ KeyframeAttributeToCSSProperty("line-height"));
+ EXPECT_EQ(CSSPropertyID::kInvalid,
KeyframeAttributeToCSSProperty("border-topWidth"));
- EXPECT_EQ(CSSPropertyInvalid, KeyframeAttributeToCSSProperty("Width"));
- EXPECT_EQ(CSSPropertyInvalid,
+ EXPECT_EQ(CSSPropertyID::kInvalid, KeyframeAttributeToCSSProperty("Width"));
+ EXPECT_EQ(CSSPropertyID::kInvalid,
KeyframeAttributeToCSSProperty("-epub-text-transform"));
- EXPECT_EQ(CSSPropertyInvalid,
+ EXPECT_EQ(CSSPropertyID::kInvalid,
KeyframeAttributeToCSSProperty("EpubTextTransform"));
- EXPECT_EQ(CSSPropertyInvalid,
+ EXPECT_EQ(CSSPropertyID::kInvalid,
KeyframeAttributeToCSSProperty("-internal-marquee-repetition"));
- EXPECT_EQ(CSSPropertyInvalid,
+ EXPECT_EQ(CSSPropertyID::kInvalid,
KeyframeAttributeToCSSProperty("InternalMarqueeRepetition"));
- EXPECT_EQ(CSSPropertyInvalid,
+ EXPECT_EQ(CSSPropertyID::kInvalid,
KeyframeAttributeToCSSProperty("-webkit-filter"));
- EXPECT_EQ(CSSPropertyInvalid,
+ EXPECT_EQ(CSSPropertyID::kInvalid,
KeyframeAttributeToCSSProperty("-webkit-transform"));
- EXPECT_EQ(CSSPropertyInvalid,
+ EXPECT_EQ(CSSPropertyID::kInvalid,
KeyframeAttributeToCSSProperty("webkitTransform"));
- EXPECT_EQ(CSSPropertyInvalid,
+ EXPECT_EQ(CSSPropertyID::kInvalid,
KeyframeAttributeToCSSProperty("WebkitTransform"));
}
diff --git a/chromium/third_party/blink/renderer/core/animation/animation_test.cc b/chromium/third_party/blink/renderer/core/animation/animation_test.cc
index c0a9e879bd5..b9636a533c4 100644
--- a/chromium/third_party/blink/renderer/core/animation/animation_test.cc
+++ b/chromium/third_party/blink/renderer/core/animation/animation_test.cc
@@ -54,7 +54,7 @@ namespace blink {
class AnimationAnimationTest : public RenderingTest {
public:
AnimationAnimationTest()
- : RenderingTest(SingleChildLocalFrameClient::Create()) {}
+ : RenderingTest(MakeGarbageCollected<SingleChildLocalFrameClient>()) {}
void SetUp() override {
RenderingTest::SetUp();
@@ -63,7 +63,7 @@ class AnimationAnimationTest : public RenderingTest {
}
void SetUpWithoutStartingTimeline() {
- page_holder = DummyPageHolder::Create();
+ page_holder = std::make_unique<DummyPageHolder>();
document = &page_holder->GetDocument();
document->GetAnimationClock().ResetTimeForTesting();
timeline = DocumentTimeline::Create(document.Get());
@@ -79,9 +79,9 @@ class AnimationAnimationTest : public RenderingTest {
PropertyHandle PropertyHandleOpacity(GetCSSPropertyOpacity());
TransitionKeyframe* start_keyframe =
TransitionKeyframe::Create(PropertyHandleOpacity);
- start_keyframe->SetValue(TypedInterpolationValue::Create(
+ start_keyframe->SetValue(std::make_unique<TypedInterpolationValue>(
CSSNumberInterpolationType(PropertyHandleOpacity),
- InterpolableNumber::Create(1.0)));
+ std::make_unique<InterpolableNumber>(1.0)));
start_keyframe->SetOffset(0.0);
// Egregious hack: Sideload the compositor value.
// This is usually set in a part of the rendering process SimulateFrame
@@ -89,9 +89,9 @@ class AnimationAnimationTest : public RenderingTest {
start_keyframe->SetCompositorValue(AnimatableDouble::Create(1.0));
TransitionKeyframe* end_keyframe =
TransitionKeyframe::Create(PropertyHandleOpacity);
- end_keyframe->SetValue(TypedInterpolationValue::Create(
+ end_keyframe->SetValue(std::make_unique<TypedInterpolationValue>(
CSSNumberInterpolationType(PropertyHandleOpacity),
- InterpolableNumber::Create(0.0)));
+ std::make_unique<InterpolableNumber>(0.0)));
end_keyframe->SetOffset(1.0);
// Egregious hack: Sideload the compositor value.
end_keyframe->SetCompositorValue(AnimatableDouble::Create(0.0));
@@ -116,11 +116,11 @@ class AnimationAnimationTest : public RenderingTest {
timing.iteration_duration = AnimationTimeDelta::FromSecondsD(30);
Persistent<StringKeyframe> start_keyframe = StringKeyframe::Create();
- start_keyframe->SetCSSPropertyValue(CSSPropertyOpacity, "1.0",
+ start_keyframe->SetCSSPropertyValue(CSSPropertyID::kOpacity, "1.0",
SecureContextMode::kInsecureContext,
nullptr);
Persistent<StringKeyframe> end_keyframe = StringKeyframe::Create();
- end_keyframe->SetCSSPropertyValue(CSSPropertyOpacity, "0.0",
+ end_keyframe->SetCSSPropertyValue(CSSPropertyID::kOpacity, "0.0",
SecureContextMode::kInsecureContext,
nullptr);
@@ -787,7 +787,7 @@ TEST_F(AnimationAnimationTest, AttachedAnimations) {
EXPECT_EQ(
1U, element->GetElementAnimations()->Animations().find(animation)->value);
- ThreadState::Current()->CollectAllGarbage();
+ ThreadState::Current()->CollectAllGarbageForTesting();
EXPECT_TRUE(element->GetElementAnimations()->Animations().IsEmpty());
}
@@ -953,11 +953,13 @@ TEST_F(AnimationAnimationTest, SetKeyframesCausesCompositorPending) {
// Now change the keyframes; this should mark the animation as compositor
// pending as we need to sync the compositor side.
Persistent<StringKeyframe> start_keyframe = StringKeyframe::Create();
- start_keyframe->SetCSSPropertyValue(
- CSSPropertyOpacity, "0.0", SecureContextMode::kInsecureContext, nullptr);
+ start_keyframe->SetCSSPropertyValue(CSSPropertyID::kOpacity, "0.0",
+ SecureContextMode::kInsecureContext,
+ nullptr);
Persistent<StringKeyframe> end_keyframe = StringKeyframe::Create();
- end_keyframe->SetCSSPropertyValue(
- CSSPropertyOpacity, "1.0", SecureContextMode::kInsecureContext, nullptr);
+ end_keyframe->SetCSSPropertyValue(CSSPropertyID::kOpacity, "1.0",
+ SecureContextMode::kInsecureContext,
+ nullptr);
StringKeyframeVector keyframes;
keyframes.push_back(start_keyframe);
diff --git a/chromium/third_party/blink/renderer/core/animation/animation_timeline.h b/chromium/third_party/blink/renderer/core/animation/animation_timeline.h
index e78ebc5f746..4d06d1542c5 100644
--- a/chromium/third_party/blink/renderer/core/animation/animation_timeline.h
+++ b/chromium/third_party/blink/renderer/core/animation/animation_timeline.h
@@ -20,6 +20,7 @@ class CORE_EXPORT AnimationTimeline : public ScriptWrappable {
virtual bool IsDocumentTimeline() const { return false; }
virtual bool IsScrollTimeline() const { return false; }
+ virtual bool IsActive() const = 0;
};
} // namespace blink
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 ee5cb16555c..3b5b2d0350b 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
@@ -175,8 +175,7 @@ enum CircleComponentIndex : unsigned {
InterpolationValue ConvertCSSValue(
const cssvalue::CSSBasicShapeCircleValue& circle) {
- std::unique_ptr<InterpolableList> list =
- InterpolableList::Create(kCircleComponentIndexCount);
+ auto list = std::make_unique<InterpolableList>(kCircleComponentIndexCount);
list->Set(kCircleCenterXIndex, ConvertCSSCoordinate(circle.CenterX()));
list->Set(kCircleCenterYIndex, ConvertCSSCoordinate(circle.CenterY()));
@@ -192,8 +191,7 @@ InterpolationValue ConvertCSSValue(
InterpolationValue ConvertBasicShape(const BasicShapeCircle& circle,
double zoom) {
- std::unique_ptr<InterpolableList> list =
- InterpolableList::Create(kCircleComponentIndexCount);
+ auto list = std::make_unique<InterpolableList>(kCircleComponentIndexCount);
list->Set(kCircleCenterXIndex, ConvertCoordinate(circle.CenterX(), zoom));
list->Set(kCircleCenterYIndex, ConvertCoordinate(circle.CenterY(), zoom));
@@ -208,8 +206,7 @@ InterpolationValue ConvertBasicShape(const BasicShapeCircle& circle,
}
std::unique_ptr<InterpolableValue> CreateNeutralValue() {
- std::unique_ptr<InterpolableList> list =
- InterpolableList::Create(kCircleComponentIndexCount);
+ auto list = std::make_unique<InterpolableList>(kCircleComponentIndexCount);
list->Set(kCircleCenterXIndex, CreateNeutralInterpolableCoordinate());
list->Set(kCircleCenterYIndex, CreateNeutralInterpolableCoordinate());
list->Set(kCircleRadiusIndex, CreateNeutralInterpolableRadius());
@@ -244,8 +241,7 @@ enum EllipseComponentIndex : unsigned {
InterpolationValue ConvertCSSValue(
const cssvalue::CSSBasicShapeEllipseValue& ellipse) {
- std::unique_ptr<InterpolableList> list =
- InterpolableList::Create(kEllipseComponentIndexCount);
+ auto list = std::make_unique<InterpolableList>(kEllipseComponentIndexCount);
list->Set(kEllipseCenterXIndex, ConvertCSSCoordinate(ellipse.CenterX()));
list->Set(kEllipseCenterYIndex, ConvertCSSCoordinate(ellipse.CenterY()));
@@ -264,8 +260,7 @@ InterpolationValue ConvertCSSValue(
InterpolationValue ConvertBasicShape(const BasicShapeEllipse& ellipse,
double zoom) {
- std::unique_ptr<InterpolableList> list =
- InterpolableList::Create(kEllipseComponentIndexCount);
+ auto list = std::make_unique<InterpolableList>(kEllipseComponentIndexCount);
list->Set(kEllipseCenterXIndex, ConvertCoordinate(ellipse.CenterX(), zoom));
list->Set(kEllipseCenterYIndex, ConvertCoordinate(ellipse.CenterY(), zoom));
@@ -283,8 +278,7 @@ InterpolationValue ConvertBasicShape(const BasicShapeEllipse& ellipse,
}
std::unique_ptr<InterpolableValue> CreateNeutralValue() {
- std::unique_ptr<InterpolableList> list =
- InterpolableList::Create(kEllipseComponentIndexCount);
+ auto list = std::make_unique<InterpolableList>(kEllipseComponentIndexCount);
list->Set(kEllipseCenterXIndex, CreateNeutralInterpolableCoordinate());
list->Set(kEllipseCenterYIndex, CreateNeutralInterpolableCoordinate());
list->Set(kEllipseRadiusXIndex, CreateNeutralInterpolableRadius());
@@ -330,8 +324,7 @@ enum InsetComponentIndex : unsigned {
InterpolationValue ConvertCSSValue(
const cssvalue::CSSBasicShapeInsetValue& inset) {
- std::unique_ptr<InterpolableList> list =
- InterpolableList::Create(kInsetComponentIndexCount);
+ auto list = std::make_unique<InterpolableList>(kInsetComponentIndexCount);
list->Set(kInsetTopIndex, ConvertCSSLength(inset.Top()));
list->Set(kInsetRightIndex, ConvertCSSLength(inset.Right()));
list->Set(kInsetBottomIndex, ConvertCSSLength(inset.Bottom()));
@@ -360,8 +353,7 @@ InterpolationValue ConvertCSSValue(
InterpolationValue ConvertBasicShape(const BasicShapeInset& inset,
double zoom) {
- std::unique_ptr<InterpolableList> list =
- InterpolableList::Create(kInsetComponentIndexCount);
+ auto list = std::make_unique<InterpolableList>(kInsetComponentIndexCount);
list->Set(kInsetTopIndex, ConvertLength(inset.Top(), zoom));
list->Set(kInsetRightIndex, ConvertLength(inset.Right(), zoom));
list->Set(kInsetBottomIndex, ConvertLength(inset.Bottom(), zoom));
@@ -389,8 +381,7 @@ InterpolationValue ConvertBasicShape(const BasicShapeInset& inset,
}
std::unique_ptr<InterpolableValue> CreateNeutralValue() {
- std::unique_ptr<InterpolableList> list =
- InterpolableList::Create(kInsetComponentIndexCount);
+ auto list = std::make_unique<InterpolableList>(kInsetComponentIndexCount);
list->Set(kInsetTopIndex,
LengthInterpolationFunctions::CreateNeutralInterpolableValue());
list->Set(kInsetRightIndex,
@@ -455,7 +446,7 @@ namespace polygon_functions {
InterpolationValue ConvertCSSValue(
const cssvalue::CSSBasicShapePolygonValue& polygon) {
wtf_size_t size = polygon.Values().size();
- std::unique_ptr<InterpolableList> list = InterpolableList::Create(size);
+ auto list = std::make_unique<InterpolableList>(size);
for (wtf_size_t i = 0; i < size; i++)
list->Set(i, ConvertCSSLength(polygon.Values()[i].Get()));
return InterpolationValue(std::move(list),
@@ -466,7 +457,7 @@ InterpolationValue ConvertCSSValue(
InterpolationValue ConvertBasicShape(const BasicShapePolygon& polygon,
double zoom) {
wtf_size_t size = polygon.Values().size();
- std::unique_ptr<InterpolableList> list = InterpolableList::Create(size);
+ auto list = std::make_unique<InterpolableList>(size);
for (wtf_size_t i = 0; i < size; i++)
list->Set(i, ConvertLength(polygon.Values()[i], zoom));
return InterpolationValue(std::move(list),
@@ -476,8 +467,7 @@ InterpolationValue ConvertBasicShape(const BasicShapePolygon& polygon,
std::unique_ptr<InterpolableValue> CreateNeutralValue(
const BasicShapeNonInterpolableValue& non_interpolable_value) {
- std::unique_ptr<InterpolableList> list =
- InterpolableList::Create(non_interpolable_value.size());
+ auto list = std::make_unique<InterpolableList>(non_interpolable_value.size());
for (wtf_size_t i = 0; i < non_interpolable_value.size(); i++)
list->Set(i,
LengthInterpolationFunctions::CreateNeutralInterpolableValue());
@@ -510,21 +500,21 @@ scoped_refptr<BasicShape> CreateBasicShape(
InterpolationValue basic_shape_interpolation_functions::MaybeConvertCSSValue(
const CSSValue& value) {
- if (value.IsBasicShapeCircleValue()) {
- return circle_functions::ConvertCSSValue(
- cssvalue::ToCSSBasicShapeCircleValue(value));
+ if (auto* circle_value =
+ DynamicTo<cssvalue::CSSBasicShapeCircleValue>(value)) {
+ return circle_functions::ConvertCSSValue(*circle_value);
}
- if (value.IsBasicShapeEllipseValue()) {
- return ellipse_functions::ConvertCSSValue(
- cssvalue::ToCSSBasicShapeEllipseValue(value));
+
+ if (auto* ellipse_value =
+ DynamicTo<cssvalue::CSSBasicShapeEllipseValue>(value)) {
+ return ellipse_functions::ConvertCSSValue(*ellipse_value);
}
- if (value.IsBasicShapeInsetValue()) {
- return inset_functions::ConvertCSSValue(
- cssvalue::ToCSSBasicShapeInsetValue(value));
+ if (auto* inset_value = DynamicTo<cssvalue::CSSBasicShapeInsetValue>(value)) {
+ return inset_functions::ConvertCSSValue(*inset_value);
}
- if (value.IsBasicShapePolygonValue()) {
- return polygon_functions::ConvertCSSValue(
- cssvalue::ToCSSBasicShapePolygonValue(value));
+ if (auto* polygon_value =
+ DynamicTo<cssvalue::CSSBasicShapePolygonValue>(value)) {
+ return polygon_functions::ConvertCSSValue(*polygon_value);
}
return nullptr;
}
@@ -536,16 +526,16 @@ InterpolationValue basic_shape_interpolation_functions::MaybeConvertBasicShape(
return nullptr;
switch (shape->GetType()) {
case BasicShape::kBasicShapeCircleType:
- return circle_functions::ConvertBasicShape(ToBasicShapeCircle(*shape),
+ return circle_functions::ConvertBasicShape(To<BasicShapeCircle>(*shape),
zoom);
case BasicShape::kBasicShapeEllipseType:
- return ellipse_functions::ConvertBasicShape(ToBasicShapeEllipse(*shape),
+ return ellipse_functions::ConvertBasicShape(To<BasicShapeEllipse>(*shape),
zoom);
case BasicShape::kBasicShapeInsetType:
- return inset_functions::ConvertBasicShape(ToBasicShapeInset(*shape),
+ return inset_functions::ConvertBasicShape(To<BasicShapeInset>(*shape),
zoom);
case BasicShape::kBasicShapePolygonType:
- return polygon_functions::ConvertBasicShape(ToBasicShapePolygon(*shape),
+ return polygon_functions::ConvertBasicShape(To<BasicShapePolygon>(*shape),
zoom);
default:
NOTREACHED();
diff --git a/chromium/third_party/blink/renderer/core/animation/color_property_functions.cc b/chromium/third_party/blink/renderer/core/animation/color_property_functions.cc
index cc45e417d93..67d8cb41cec 100644
--- a/chromium/third_party/blink/renderer/core/animation/color_property_functions.cc
+++ b/chromium/third_party/blink/renderer/core/animation/color_property_functions.cc
@@ -17,41 +17,41 @@ OptionalStyleColor ColorPropertyFunctions::GetUnvisitedColor(
const CSSProperty& property,
const ComputedStyle& style) {
switch (property.PropertyID()) {
- case CSSPropertyBackgroundColor:
+ case CSSPropertyID::kBackgroundColor:
return style.BackgroundColor();
- case CSSPropertyBorderLeftColor:
+ case CSSPropertyID::kBorderLeftColor:
return style.BorderLeftColor();
- case CSSPropertyBorderRightColor:
+ case CSSPropertyID::kBorderRightColor:
return style.BorderRightColor();
- case CSSPropertyBorderTopColor:
+ case CSSPropertyID::kBorderTopColor:
return style.BorderTopColor();
- case CSSPropertyBorderBottomColor:
+ case CSSPropertyID::kBorderBottomColor:
return style.BorderBottomColor();
- case CSSPropertyCaretColor:
+ case CSSPropertyID::kCaretColor:
if (style.CaretColor().IsAutoColor())
return nullptr;
return style.CaretColor().ToStyleColor();
- case CSSPropertyColor:
+ case CSSPropertyID::kColor:
return style.GetColor();
- case CSSPropertyOutlineColor:
+ case CSSPropertyID::kOutlineColor:
return style.OutlineColor();
- case CSSPropertyColumnRuleColor:
+ case CSSPropertyID::kColumnRuleColor:
return style.ColumnRuleColor();
- case CSSPropertyWebkitTextEmphasisColor:
+ case CSSPropertyID::kWebkitTextEmphasisColor:
return style.TextEmphasisColor();
- case CSSPropertyWebkitTextFillColor:
+ case CSSPropertyID::kWebkitTextFillColor:
return style.TextFillColor();
- case CSSPropertyWebkitTextStrokeColor:
+ case CSSPropertyID::kWebkitTextStrokeColor:
return style.TextStrokeColor();
- case CSSPropertyFloodColor:
+ case CSSPropertyID::kFloodColor:
return style.FloodColor();
- case CSSPropertyLightingColor:
+ case CSSPropertyID::kLightingColor:
return style.LightingColor();
- case CSSPropertyStopColor:
+ case CSSPropertyID::kStopColor:
return style.StopColor();
- case CSSPropertyWebkitTapHighlightColor:
+ case CSSPropertyID::kWebkitTapHighlightColor:
return style.TapHighlightColor();
- case CSSPropertyTextDecorationColor:
+ case CSSPropertyID::kTextDecorationColor:
return style.TextDecorationColor();
default:
NOTREACHED();
@@ -63,43 +63,43 @@ OptionalStyleColor ColorPropertyFunctions::GetVisitedColor(
const CSSProperty& property,
const ComputedStyle& style) {
switch (property.PropertyID()) {
- case CSSPropertyBackgroundColor:
+ case CSSPropertyID::kBackgroundColor:
return style.VisitedLinkBackgroundColor();
- case CSSPropertyBorderLeftColor:
+ case CSSPropertyID::kBorderLeftColor:
return style.VisitedLinkBorderLeftColor();
- case CSSPropertyBorderRightColor:
+ case CSSPropertyID::kBorderRightColor:
return style.VisitedLinkBorderRightColor();
- case CSSPropertyBorderTopColor:
+ case CSSPropertyID::kBorderTopColor:
return style.VisitedLinkBorderTopColor();
- case CSSPropertyBorderBottomColor:
+ case CSSPropertyID::kBorderBottomColor:
return style.VisitedLinkBorderBottomColor();
- case CSSPropertyCaretColor:
+ case CSSPropertyID::kCaretColor:
// TODO(rego): "auto" value for caret-color should not interpolate
// (http://crbug.com/676295).
if (style.VisitedLinkCaretColor().IsAutoColor())
return StyleColor::CurrentColor();
return style.VisitedLinkCaretColor().ToStyleColor();
- case CSSPropertyColor:
+ case CSSPropertyID::kColor:
return style.VisitedLinkColor();
- case CSSPropertyOutlineColor:
+ case CSSPropertyID::kOutlineColor:
return style.VisitedLinkOutlineColor();
- case CSSPropertyColumnRuleColor:
+ case CSSPropertyID::kColumnRuleColor:
return style.VisitedLinkColumnRuleColor();
- case CSSPropertyWebkitTextEmphasisColor:
+ case CSSPropertyID::kWebkitTextEmphasisColor:
return style.VisitedLinkTextEmphasisColor();
- case CSSPropertyWebkitTextFillColor:
+ case CSSPropertyID::kWebkitTextFillColor:
return style.VisitedLinkTextFillColor();
- case CSSPropertyWebkitTextStrokeColor:
+ case CSSPropertyID::kWebkitTextStrokeColor:
return style.VisitedLinkTextStrokeColor();
- case CSSPropertyFloodColor:
+ case CSSPropertyID::kFloodColor:
return style.FloodColor();
- case CSSPropertyLightingColor:
+ case CSSPropertyID::kLightingColor:
return style.LightingColor();
- case CSSPropertyStopColor:
+ case CSSPropertyID::kStopColor:
return style.StopColor();
- case CSSPropertyWebkitTapHighlightColor:
+ case CSSPropertyID::kWebkitTapHighlightColor:
return style.TapHighlightColor();
- case CSSPropertyTextDecorationColor:
+ case CSSPropertyID::kTextDecorationColor:
return style.VisitedLinkTextDecorationColor();
default:
NOTREACHED();
@@ -111,45 +111,45 @@ void ColorPropertyFunctions::SetUnvisitedColor(const CSSProperty& property,
ComputedStyle& style,
const Color& color) {
switch (property.PropertyID()) {
- case CSSPropertyBackgroundColor:
+ case CSSPropertyID::kBackgroundColor:
style.SetBackgroundColor(color);
return;
- case CSSPropertyBorderBottomColor:
+ case CSSPropertyID::kBorderBottomColor:
style.SetBorderBottomColor(color);
return;
- case CSSPropertyBorderLeftColor:
+ case CSSPropertyID::kBorderLeftColor:
style.SetBorderLeftColor(color);
return;
- case CSSPropertyBorderRightColor:
+ case CSSPropertyID::kBorderRightColor:
style.SetBorderRightColor(color);
return;
- case CSSPropertyBorderTopColor:
+ case CSSPropertyID::kBorderTopColor:
style.SetBorderTopColor(color);
return;
- case CSSPropertyCaretColor:
+ case CSSPropertyID::kCaretColor:
return style.SetCaretColor(color);
- case CSSPropertyColor:
+ case CSSPropertyID::kColor:
style.SetColor(color);
return;
- case CSSPropertyFloodColor:
+ case CSSPropertyID::kFloodColor:
style.SetFloodColor(color);
return;
- case CSSPropertyLightingColor:
+ case CSSPropertyID::kLightingColor:
style.SetLightingColor(color);
return;
- case CSSPropertyOutlineColor:
+ case CSSPropertyID::kOutlineColor:
style.SetOutlineColor(color);
return;
- case CSSPropertyStopColor:
+ case CSSPropertyID::kStopColor:
style.SetStopColor(color);
return;
- case CSSPropertyTextDecorationColor:
+ case CSSPropertyID::kTextDecorationColor:
style.SetTextDecorationColor(color);
return;
- case CSSPropertyColumnRuleColor:
+ case CSSPropertyID::kColumnRuleColor:
style.SetColumnRuleColor(color);
return;
- case CSSPropertyWebkitTextStrokeColor:
+ case CSSPropertyID::kWebkitTextStrokeColor:
style.SetTextStrokeColor(color);
return;
default:
@@ -162,45 +162,45 @@ void ColorPropertyFunctions::SetVisitedColor(const CSSProperty& property,
ComputedStyle& style,
const Color& color) {
switch (property.PropertyID()) {
- case CSSPropertyBackgroundColor:
+ case CSSPropertyID::kBackgroundColor:
style.SetVisitedLinkBackgroundColor(color);
return;
- case CSSPropertyBorderBottomColor:
+ case CSSPropertyID::kBorderBottomColor:
style.SetVisitedLinkBorderBottomColor(color);
return;
- case CSSPropertyBorderLeftColor:
+ case CSSPropertyID::kBorderLeftColor:
style.SetVisitedLinkBorderLeftColor(color);
return;
- case CSSPropertyBorderRightColor:
+ case CSSPropertyID::kBorderRightColor:
style.SetVisitedLinkBorderRightColor(color);
return;
- case CSSPropertyBorderTopColor:
+ case CSSPropertyID::kBorderTopColor:
style.SetVisitedLinkBorderTopColor(color);
return;
- case CSSPropertyCaretColor:
+ case CSSPropertyID::kCaretColor:
return style.SetVisitedLinkCaretColor(color);
- case CSSPropertyColor:
+ case CSSPropertyID::kColor:
style.SetVisitedLinkColor(color);
return;
- case CSSPropertyFloodColor:
+ case CSSPropertyID::kFloodColor:
style.SetFloodColor(color);
return;
- case CSSPropertyLightingColor:
+ case CSSPropertyID::kLightingColor:
style.SetLightingColor(color);
return;
- case CSSPropertyOutlineColor:
+ case CSSPropertyID::kOutlineColor:
style.SetVisitedLinkOutlineColor(color);
return;
- case CSSPropertyStopColor:
+ case CSSPropertyID::kStopColor:
style.SetStopColor(color);
return;
- case CSSPropertyTextDecorationColor:
+ case CSSPropertyID::kTextDecorationColor:
style.SetVisitedLinkTextDecorationColor(color);
return;
- case CSSPropertyColumnRuleColor:
+ case CSSPropertyID::kColumnRuleColor:
style.SetVisitedLinkColumnRuleColor(color);
return;
- case CSSPropertyWebkitTextStrokeColor:
+ case CSSPropertyID::kWebkitTextStrokeColor:
style.SetVisitedLinkTextStrokeColor(color);
return;
default:
diff --git a/chromium/third_party/blink/renderer/core/animation/compositor_animations.cc b/chromium/third_party/blink/renderer/core/animation/compositor_animations.cc
index 45d30eb9965..49a465b2b9d 100644
--- a/chromium/third_party/blink/renderer/core/animation/compositor_animations.cc
+++ b/chromium/third_party/blink/renderer/core/animation/compositor_animations.cc
@@ -89,10 +89,10 @@ bool ConsiderAnimationAsIncompatible(const Animation& animation,
bool IsTransformRelatedCSSProperty(const PropertyHandle property) {
return property.IsCSSProperty() &&
- (property.GetCSSProperty().IDEquals(CSSPropertyRotate) ||
- property.GetCSSProperty().IDEquals(CSSPropertyScale) ||
- property.GetCSSProperty().IDEquals(CSSPropertyTransform) ||
- property.GetCSSProperty().IDEquals(CSSPropertyTranslate));
+ (property.GetCSSProperty().IDEquals(CSSPropertyID::kRotate) ||
+ property.GetCSSProperty().IDEquals(CSSPropertyID::kScale) ||
+ property.GetCSSProperty().IDEquals(CSSPropertyID::kTransform) ||
+ property.GetCSSProperty().IDEquals(CSSPropertyID::kTranslate));
}
bool IsTransformRelatedAnimation(const Element& target_element,
@@ -152,23 +152,22 @@ CompositorElementIdNamespace CompositorElementNamespaceForProperty(
return CompositorElementIdNamespace::kPrimary;
}
switch (property) {
- case CSSPropertyOpacity:
+ case CSSPropertyID::kOpacity:
return CompositorElementIdNamespace::kPrimaryEffect;
- case CSSPropertyRotate:
- case CSSPropertyScale:
- case CSSPropertyTranslate:
- case CSSPropertyTransform:
+ case CSSPropertyID::kRotate:
+ case CSSPropertyID::kScale:
+ case CSSPropertyID::kTranslate:
+ case CSSPropertyID::kTransform:
return CompositorElementIdNamespace::kPrimaryTransform;
- case CSSPropertyFilter:
- case CSSPropertyBackdropFilter: {
+ case CSSPropertyID::kFilter:
+ case CSSPropertyID::kBackdropFilter:
return CompositorElementIdNamespace::kEffectFilter;
- case CSSPropertyVariable:
- return CompositorElementIdNamespace::kPrimary;
- default:
- NOTREACHED();
- }
+ case CSSPropertyID::kVariable:
return CompositorElementIdNamespace::kPrimary;
+ default:
+ NOTREACHED();
}
+ return CompositorElementIdNamespace::kPrimary;
}
} // namespace
@@ -235,12 +234,12 @@ CompositorAnimations::CheckCanStartEffectOnCompositor(
// FIXME: Determine candidacy based on the CSSValue instead of a snapshot
// AnimatableValue.
switch (property.GetCSSProperty().PropertyID()) {
- case CSSPropertyOpacity:
+ case CSSPropertyID::kOpacity:
break;
- case CSSPropertyRotate:
- case CSSPropertyScale:
- case CSSPropertyTranslate:
- case CSSPropertyTransform:
+ case CSSPropertyID::kRotate:
+ case CSSPropertyID::kScale:
+ case CSSPropertyID::kTranslate:
+ case CSSPropertyID::kTransform:
if (ToAnimatableTransform(keyframe->GetAnimatableValue())
->GetTransformOperations()
.DependsOnBoxSize()) {
@@ -249,8 +248,8 @@ CompositorAnimations::CheckCanStartEffectOnCompositor(
"size");
}
break;
- case CSSPropertyFilter:
- case CSSPropertyBackdropFilter: {
+ case CSSPropertyID::kFilter:
+ case CSSPropertyID::kBackdropFilter: {
const FilterOperations& operations =
ToAnimatableFilterOperations(keyframe->GetAnimatableValue())
->Operations();
@@ -260,7 +259,7 @@ CompositorAnimations::CheckCanStartEffectOnCompositor(
}
break;
}
- case CSSPropertyVariable: {
+ case CSSPropertyID::kVariable: {
DCHECK(RuntimeEnabledFeatures::OffMainThreadCSSPaintEnabled());
if (!keyframe->GetAnimatableValue()->IsDouble()) {
// TODO(kevers): Extend support to other custom property types.
@@ -658,46 +657,43 @@ void CompositorAnimations::GetAnimationOnCompositor(
std::unique_ptr<CompositorAnimationCurve> curve;
DCHECK(timing.timing_function);
switch (property.GetCSSProperty().PropertyID()) {
- case CSSPropertyOpacity: {
+ case CSSPropertyID::kOpacity: {
target_property = compositor_target_property::OPACITY;
- std::unique_ptr<CompositorFloatAnimationCurve> float_curve =
- CompositorFloatAnimationCurve::Create();
+ auto float_curve = std::make_unique<CompositorFloatAnimationCurve>();
AddKeyframesToCurve(*float_curve, values);
float_curve->SetTimingFunction(*timing.timing_function);
float_curve->SetScaledDuration(scale);
curve = std::move(float_curve);
break;
}
- case CSSPropertyFilter:
- case CSSPropertyBackdropFilter: {
+ case CSSPropertyID::kFilter:
+ case CSSPropertyID::kBackdropFilter: {
target_property = compositor_target_property::FILTER;
- std::unique_ptr<CompositorFilterAnimationCurve> filter_curve =
- CompositorFilterAnimationCurve::Create();
+ auto filter_curve = std::make_unique<CompositorFilterAnimationCurve>();
AddKeyframesToCurve(*filter_curve, values);
filter_curve->SetTimingFunction(*timing.timing_function);
filter_curve->SetScaledDuration(scale);
curve = std::move(filter_curve);
break;
}
- case CSSPropertyRotate:
- case CSSPropertyScale:
- case CSSPropertyTranslate:
- case CSSPropertyTransform: {
+ case CSSPropertyID::kRotate:
+ case CSSPropertyID::kScale:
+ case CSSPropertyID::kTranslate:
+ case CSSPropertyID::kTransform: {
target_property = compositor_target_property::TRANSFORM;
- std::unique_ptr<CompositorTransformAnimationCurve> transform_curve =
- CompositorTransformAnimationCurve::Create();
+ auto transform_curve =
+ std::make_unique<CompositorTransformAnimationCurve>();
AddKeyframesToCurve(*transform_curve, values);
transform_curve->SetTimingFunction(*timing.timing_function);
transform_curve->SetScaledDuration(scale);
curve = std::move(transform_curve);
break;
}
- case CSSPropertyVariable: {
+ case CSSPropertyID::kVariable: {
DCHECK(RuntimeEnabledFeatures::OffMainThreadCSSPaintEnabled());
target_property = compositor_target_property::CSS_CUSTOM_PROPERTY;
// TODO(kevers): Extend support to non-float types.
- std::unique_ptr<CompositorFloatAnimationCurve> float_curve =
- CompositorFloatAnimationCurve::Create();
+ auto float_curve = std::make_unique<CompositorFloatAnimationCurve>();
AddKeyframesToCurve(*float_curve, values);
float_curve->SetTimingFunction(*timing.timing_function);
float_curve->SetScaledDuration(scale);
@@ -710,8 +706,8 @@ void CompositorAnimations::GetAnimationOnCompositor(
}
DCHECK(curve.get());
- std::unique_ptr<CompositorKeyframeModel> keyframe_model =
- CompositorKeyframeModel::Create(*curve, target_property, group, 0);
+ auto keyframe_model = std::make_unique<CompositorKeyframeModel>(
+ *curve, target_property, 0, group);
if (start_time)
keyframe_model->SetStartTime(start_time.value());
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 a0cf3f06059..12546f27559 100644
--- a/chromium/third_party/blink/renderer/core/animation/compositor_animations.h
+++ b/chromium/third_party/blink/renderer/core/animation/compositor_animations.h
@@ -148,18 +148,6 @@ class CORE_EXPORT CompositorAnimations {
static FailureCode CheckCanStartElementOnCompositor(const Element&);
friend class AnimationCompositorAnimationsTest;
- FRIEND_TEST_ALL_PREFIXES(AnimationCompositorAnimationsTest,
- CanStartElementOnCompositorTransformCAP);
- FRIEND_TEST_ALL_PREFIXES(AnimationCompositorAnimationsTest,
- CanStartElementOnCompositorEffectCAP);
- FRIEND_TEST_ALL_PREFIXES(AnimationCompositorAnimationsTest,
- CanStartElementOnCompositorEffect);
- FRIEND_TEST_ALL_PREFIXES(AnimationCompositorAnimationsTest,
- 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 88255ce836c..b3f0f03d056 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
@@ -38,6 +38,7 @@
#include "base/memory/scoped_refptr.h"
#include "cc/animation/animation_host.h"
#include "cc/layers/picture_layer.h"
+#include "cc/trees/transform_node.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"
@@ -67,7 +68,7 @@
#include "third_party/blink/renderer/platform/geometry/float_box.h"
#include "third_party/blink/renderer/platform/geometry/int_size.h"
#include "third_party/blink/renderer/platform/testing/histogram_tester.h"
-#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h"
+#include "third_party/blink/renderer/platform/testing/paint_test_configurations.h"
#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"
#include "third_party/blink/renderer/platform/testing/url_test_helpers.h"
#include "third_party/blink/renderer/platform/transforms/transform_operations.h"
@@ -78,7 +79,8 @@ namespace blink {
using namespace css_test_helpers;
-class AnimationCompositorAnimationsTest : public RenderingTest {
+class AnimationCompositorAnimationsTest : public PaintTestConfigurations,
+ public RenderingTest {
protected:
scoped_refptr<TimingFunction> linear_timing_function_;
scoped_refptr<TimingFunction> cubic_ease_timing_function_;
@@ -169,6 +171,10 @@ class AnimationCompositorAnimationsTest : public RenderingTest {
.Ok();
}
+ bool CheckCanStartElementOnCompositor(const Element& element) {
+ return CompositorAnimations::CheckCanStartElementOnCompositor(element).Ok();
+ }
+
void GetAnimationOnCompositor(
Timing& timing,
StringKeyframeEffectModel& effect,
@@ -241,9 +247,9 @@ class AnimationCompositorAnimationsTest : public RenderingTest {
EffectModel::CompositeOperation op,
double offset = 0) {
String value = "0.1";
- if (id == CSSPropertyTransform)
+ if (id == CSSPropertyID::kTransform)
value = "none"; // AnimatableTransform::Create(TransformOperations(), 1);
- else if (id == CSSPropertyColor)
+ else if (id == CSSPropertyID::kColor)
value = "red";
StringKeyframe* keyframe = CreateReplaceOpKeyframe(id, value, offset);
@@ -268,7 +274,7 @@ class AnimationCompositorAnimationsTest : public RenderingTest {
double offset = 1.0 / (values.size() - 1) * i;
String value = String::Number(values[i]);
frames->push_back(
- CreateReplaceOpKeyframe(CSSPropertyOpacity, value, offset));
+ CreateReplaceOpKeyframe(CSSPropertyID::kOpacity, value, offset));
}
return frames;
}
@@ -452,8 +458,8 @@ class AnimationCompositorAnimationsTest : public RenderingTest {
}
void LoadTestData(const std::string& file_name) {
- String testing_path = test::BlinkRootDir();
- testing_path.append("/renderer/core/animation/test_data/");
+ String testing_path =
+ test::BlinkRootDir() + "/renderer/core/animation/test_data/";
WebURL url = url_test_helpers::RegisterMockedURLLoadFromBase(
WebString::FromUTF8(base_url_), testing_path,
WebString::FromUTF8(file_name));
@@ -506,77 +512,80 @@ class LayoutObjectProxy : public LayoutObject {
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
-TEST_F(AnimationCompositorAnimationsTest,
+INSTANTIATE_PAINT_TEST_SUITE_P(AnimationCompositorAnimationsTest);
+
+TEST_P(AnimationCompositorAnimationsTest,
CanStartEffectOnCompositorKeyframeMultipleCSSProperties) {
- StringKeyframe* keyframe_good_multiple =
- CreateDefaultKeyframe(CSSPropertyOpacity, EffectModel::kCompositeReplace);
+ StringKeyframe* keyframe_good_multiple = CreateDefaultKeyframe(
+ CSSPropertyID::kOpacity, EffectModel::kCompositeReplace);
keyframe_good_multiple->SetCSSPropertyValue(
- CSSPropertyTransform, "none", SecureContextMode::kInsecureContext,
+ CSSPropertyID::kTransform, "none", SecureContextMode::kInsecureContext,
nullptr);
EXPECT_TRUE(DuplicateSingleKeyframeAndTestIsCandidateOnResult(
keyframe_good_multiple));
- StringKeyframe* keyframe_bad_multiple_id =
- CreateDefaultKeyframe(CSSPropertyColor, EffectModel::kCompositeReplace);
+ StringKeyframe* keyframe_bad_multiple_id = CreateDefaultKeyframe(
+ CSSPropertyID::kColor, EffectModel::kCompositeReplace);
keyframe_bad_multiple_id->SetCSSPropertyValue(
- CSSPropertyOpacity, "0.1", SecureContextMode::kInsecureContext, nullptr);
+ CSSPropertyID::kOpacity, "0.1", SecureContextMode::kInsecureContext,
+ nullptr);
EXPECT_FALSE(DuplicateSingleKeyframeAndTestIsCandidateOnResult(
keyframe_bad_multiple_id));
}
-TEST_F(AnimationCompositorAnimationsTest,
+TEST_P(AnimationCompositorAnimationsTest,
IsNotCandidateForCompositorAnimationTransformDependsOnBoxSize) {
// Absolute transforms can be animated on the compositor.
String transform = "translateX(2px) translateY(2px)";
StringKeyframe* good_keyframe =
- CreateReplaceOpKeyframe(CSSPropertyTransform, transform);
+ CreateReplaceOpKeyframe(CSSPropertyID::kTransform, transform);
EXPECT_TRUE(DuplicateSingleKeyframeAndTestIsCandidateOnResult(good_keyframe));
// Transforms that rely on the box size, such as percent calculations, cannot
// be animated on the compositor (as the box size may change).
String transform2 = "translateX(50%) translateY(2px)";
StringKeyframe* bad_keyframe =
- CreateReplaceOpKeyframe(CSSPropertyTransform, transform2);
+ CreateReplaceOpKeyframe(CSSPropertyID::kTransform, transform2);
EXPECT_FALSE(DuplicateSingleKeyframeAndTestIsCandidateOnResult(bad_keyframe));
// Similarly, calc transforms cannot be animated on the compositor.
String transform3 = "translateX(calc(100% + (0.5 * 100px)))";
StringKeyframe* bad_keyframe2 =
- CreateReplaceOpKeyframe(CSSPropertyTransform, transform3);
+ CreateReplaceOpKeyframe(CSSPropertyID::kTransform, transform3);
EXPECT_FALSE(
DuplicateSingleKeyframeAndTestIsCandidateOnResult(bad_keyframe2));
}
-TEST_F(AnimationCompositorAnimationsTest,
+TEST_P(AnimationCompositorAnimationsTest,
CanStartEffectOnCompositorKeyframeEffectModel) {
StringKeyframeVector frames_same;
frames_same.push_back(CreateDefaultKeyframe(
- CSSPropertyColor, EffectModel::kCompositeReplace, 0.0));
+ CSSPropertyID::kColor, EffectModel::kCompositeReplace, 0.0));
frames_same.push_back(CreateDefaultKeyframe(
- CSSPropertyColor, EffectModel::kCompositeReplace, 1.0));
+ CSSPropertyID::kColor, EffectModel::kCompositeReplace, 1.0));
EXPECT_FALSE(CanStartEffectOnCompositor(
timing_, *StringKeyframeEffectModel::Create(frames_same)));
StringKeyframeVector frames_mixed_properties;
StringKeyframe* keyframe = StringKeyframe::Create();
keyframe->SetOffset(0);
- keyframe->SetCSSPropertyValue(CSSPropertyColor, "red",
+ keyframe->SetCSSPropertyValue(CSSPropertyID::kColor, "red",
SecureContextMode::kInsecureContext, nullptr);
- keyframe->SetCSSPropertyValue(CSSPropertyOpacity, "0",
+ keyframe->SetCSSPropertyValue(CSSPropertyID::kOpacity, "0",
SecureContextMode::kInsecureContext, nullptr);
frames_mixed_properties.push_back(keyframe);
keyframe = StringKeyframe::Create();
keyframe->SetOffset(1);
- keyframe->SetCSSPropertyValue(CSSPropertyColor, "green",
+ keyframe->SetCSSPropertyValue(CSSPropertyID::kColor, "green",
SecureContextMode::kInsecureContext, nullptr);
- keyframe->SetCSSPropertyValue(CSSPropertyOpacity, "1",
+ keyframe->SetCSSPropertyValue(CSSPropertyID::kOpacity, "1",
SecureContextMode::kInsecureContext, nullptr);
frames_mixed_properties.push_back(keyframe);
EXPECT_FALSE(CanStartEffectOnCompositor(
timing_, *StringKeyframeEffectModel::Create(frames_mixed_properties)));
}
-TEST_F(AnimationCompositorAnimationsTest,
+TEST_P(AnimationCompositorAnimationsTest,
CanStartEffectOnCompositorCustomCssProperty) {
ScopedOffMainThreadCSSPaintForTest off_main_thread_css_paint(true);
RegisterProperty(GetDocument(), "--foo", "<number>", "0", false);
@@ -605,7 +614,7 @@ TEST_F(AnimationCompositorAnimationsTest,
EXPECT_FALSE(DuplicateSingleKeyframeAndTestIsCandidateOnResult(keyframe));
}
-TEST_F(AnimationCompositorAnimationsTest,
+TEST_P(AnimationCompositorAnimationsTest,
ConvertTimingForCompositorStartDelay) {
timing_.iteration_duration = AnimationTimeDelta::FromSecondsD(20);
@@ -618,13 +627,13 @@ TEST_F(AnimationCompositorAnimationsTest,
EXPECT_DOUBLE_EQ(2.0, compositor_timing_.scaled_time_offset);
}
-TEST_F(AnimationCompositorAnimationsTest,
+TEST_P(AnimationCompositorAnimationsTest,
ConvertTimingForCompositorIterationStart) {
timing_.iteration_start = 2.2;
EXPECT_TRUE(ConvertTimingForCompositor(timing_, compositor_timing_));
}
-TEST_F(AnimationCompositorAnimationsTest,
+TEST_P(AnimationCompositorAnimationsTest,
ConvertTimingForCompositorIterationCount) {
timing_.iteration_count = 5.0;
EXPECT_TRUE(ConvertTimingForCompositor(timing_, compositor_timing_));
@@ -646,7 +655,7 @@ TEST_F(AnimationCompositorAnimationsTest,
EXPECT_EQ(-1, compositor_timing_.adjusted_iteration_count);
}
-TEST_F(AnimationCompositorAnimationsTest,
+TEST_P(AnimationCompositorAnimationsTest,
ConvertTimingForCompositorIterationsAndStartDelay) {
timing_.iteration_count = 4.0;
timing_.iteration_duration = AnimationTimeDelta::FromSecondsD(5);
@@ -665,7 +674,7 @@ TEST_F(AnimationCompositorAnimationsTest,
EXPECT_TRUE(ConvertTimingForCompositor(timing_, compositor_timing_));
}
-TEST_F(AnimationCompositorAnimationsTest, ConvertTimingForCompositorDirection) {
+TEST_P(AnimationCompositorAnimationsTest, ConvertTimingForCompositorDirection) {
timing_.direction = Timing::PlaybackDirection::NORMAL;
EXPECT_TRUE(ConvertTimingForCompositor(timing_, compositor_timing_));
EXPECT_EQ(compositor_timing_.direction, Timing::PlaybackDirection::NORMAL);
@@ -685,7 +694,7 @@ TEST_F(AnimationCompositorAnimationsTest, ConvertTimingForCompositorDirection) {
EXPECT_EQ(compositor_timing_.direction, Timing::PlaybackDirection::REVERSE);
}
-TEST_F(AnimationCompositorAnimationsTest,
+TEST_P(AnimationCompositorAnimationsTest,
ConvertTimingForCompositorDirectionIterationsAndStartDelay) {
timing_.direction = Timing::PlaybackDirection::ALTERNATE_NORMAL;
timing_.iteration_count = 4.0;
@@ -728,7 +737,7 @@ TEST_F(AnimationCompositorAnimationsTest,
Timing::PlaybackDirection::ALTERNATE_REVERSE);
}
-TEST_F(AnimationCompositorAnimationsTest,
+TEST_P(AnimationCompositorAnimationsTest,
CanStartEffectOnCompositorTimingFunctionLinear) {
timing_.timing_function = linear_timing_function_;
EXPECT_TRUE(
@@ -737,7 +746,7 @@ TEST_F(AnimationCompositorAnimationsTest,
CanStartEffectOnCompositor(timing_, *keyframe_animation_effect5_));
}
-TEST_F(AnimationCompositorAnimationsTest,
+TEST_P(AnimationCompositorAnimationsTest,
CanStartEffectOnCompositorTimingFunctionCubic) {
timing_.timing_function = cubic_ease_timing_function_;
EXPECT_TRUE(
@@ -752,7 +761,7 @@ TEST_F(AnimationCompositorAnimationsTest,
CanStartEffectOnCompositor(timing_, *keyframe_animation_effect5_));
}
-TEST_F(AnimationCompositorAnimationsTest,
+TEST_P(AnimationCompositorAnimationsTest,
CanStartEffectOnCompositorTimingFunctionSteps) {
timing_.timing_function = step_timing_function_;
EXPECT_TRUE(
@@ -761,7 +770,7 @@ TEST_F(AnimationCompositorAnimationsTest,
CanStartEffectOnCompositor(timing_, *keyframe_animation_effect5_));
}
-TEST_F(AnimationCompositorAnimationsTest,
+TEST_P(AnimationCompositorAnimationsTest,
CanStartEffectOnCompositorTimingFunctionFrames) {
timing_.timing_function = frames_timing_function_;
EXPECT_TRUE(
@@ -770,7 +779,7 @@ TEST_F(AnimationCompositorAnimationsTest,
CanStartEffectOnCompositor(timing_, *keyframe_animation_effect5_));
}
-TEST_F(AnimationCompositorAnimationsTest,
+TEST_P(AnimationCompositorAnimationsTest,
CanStartEffectOnCompositorTimingFunctionChainedLinear) {
EXPECT_TRUE(
CanStartEffectOnCompositor(timing_, *keyframe_animation_effect2_));
@@ -778,7 +787,7 @@ TEST_F(AnimationCompositorAnimationsTest,
CanStartEffectOnCompositor(timing_, *keyframe_animation_effect5_));
}
-TEST_F(AnimationCompositorAnimationsTest,
+TEST_P(AnimationCompositorAnimationsTest,
CanStartEffectOnCompositorNonLinearTimingFunctionOnFirstOrLastFrame) {
keyframe_vector2_->at(0)->SetEasing(cubic_ease_timing_function_.get());
keyframe_animation_effect2_ =
@@ -801,7 +810,7 @@ TEST_F(AnimationCompositorAnimationsTest,
CanStartEffectOnCompositor(timing_, *keyframe_animation_effect5_));
}
-TEST_F(AnimationCompositorAnimationsTest,
+TEST_P(AnimationCompositorAnimationsTest,
CanStartEffectOnCompositorFailuresProperties) {
// An effect with no keyframes has no Properties, so can not be composited.
StringKeyframeVector empty_keyframe_vector;
@@ -809,9 +818,14 @@ TEST_F(AnimationCompositorAnimationsTest,
timing_, *StringKeyframeEffectModel::Create(empty_keyframe_vector)));
}
-TEST_F(AnimationCompositorAnimationsTest,
+TEST_P(AnimationCompositorAnimationsTest,
CanStartElementOnCompositorEffectOpacity) {
- ScopedBlinkGenPropertyTreesForTest blink_gen_property_trees(true);
+ // This test doesn't apply for pre-BlinkGenPropertyTrees due to the element id
+ // namespaces.
+ if (!RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled() &&
+ !RuntimeEnabledFeatures::CompositeAfterPaintEnabled())
+ return;
+
Persistent<Element> element = GetDocument().CreateElementForBinding("shared");
LayoutObjectProxy* layout_object = LayoutObjectProxy::Create(element.Get());
@@ -832,9 +846,9 @@ TEST_F(AnimationCompositorAnimationsTest,
StringKeyframeVector key_frames;
key_frames.push_back(CreateDefaultKeyframe(
- CSSPropertyOpacity, EffectModel::kCompositeReplace, 0.0));
+ CSSPropertyID::kOpacity, EffectModel::kCompositeReplace, 0.0));
key_frames.push_back(CreateDefaultKeyframe(
- CSSPropertyOpacity, EffectModel::kCompositeReplace, 1.0));
+ CSSPropertyID::kOpacity, EffectModel::kCompositeReplace, 1.0));
KeyframeEffectModelBase* animation_effect =
StringKeyframeEffectModel::Create(key_frames);
@@ -898,7 +912,7 @@ TEST_F(AnimationCompositorAnimationsTest,
LayoutObjectProxy::Dispose(new_layout_object);
}
-TEST_F(AnimationCompositorAnimationsTest,
+TEST_P(AnimationCompositorAnimationsTest,
CanStartElementOnCompositorEffectInvalid) {
base::Optional<CompositorElementIdSet> none;
auto style = ComputedStyle::Create();
@@ -987,7 +1001,7 @@ TEST_F(AnimationCompositorAnimationsTest,
LayoutObjectProxy::Dispose(layout_object);
}
-TEST_F(AnimationCompositorAnimationsTest,
+TEST_P(AnimationCompositorAnimationsTest,
CanStartElementOnCompositorEffectFilter) {
base::Optional<CompositorElementIdSet> none;
@@ -1010,8 +1024,8 @@ TEST_F(AnimationCompositorAnimationsTest,
// Filter Properties use a different ID namespace
StringKeyframeEffectModel* effect1 = CreateKeyframeEffectModel(
- CreateReplaceOpKeyframe(CSSPropertyFilter, "none", 0),
- CreateReplaceOpKeyframe(CSSPropertyFilter, "sepia(50%)", 1.0));
+ CreateReplaceOpKeyframe(CSSPropertyID::kFilter, "none", 0),
+ CreateReplaceOpKeyframe(CSSPropertyID::kFilter, "sepia(50%)", 1.0));
KeyframeEffect* keyframe_effect1 =
KeyframeEffect::Create(element.Get(), effect1, timing_);
@@ -1033,8 +1047,8 @@ TEST_F(AnimationCompositorAnimationsTest,
// Filters that affect neighboring pixels can't be composited.
StringKeyframeEffectModel* effect2 = CreateKeyframeEffectModel(
- CreateReplaceOpKeyframe(CSSPropertyFilter, "none", 0),
- CreateReplaceOpKeyframe(CSSPropertyFilter, "blur(10px)", 1.0));
+ CreateReplaceOpKeyframe(CSSPropertyID::kFilter, "none", 0),
+ CreateReplaceOpKeyframe(CSSPropertyID::kFilter, "blur(10px)", 1.0));
KeyframeEffect* keyframe_effect2 =
KeyframeEffect::Create(element.Get(), effect2, timing_);
@@ -1052,9 +1066,14 @@ TEST_F(AnimationCompositorAnimationsTest,
LayoutObjectProxy::Dispose(layout_object);
}
-TEST_F(AnimationCompositorAnimationsTest,
+TEST_P(AnimationCompositorAnimationsTest,
CanStartElementOnCompositorEffectTransform) {
- ScopedBlinkGenPropertyTreesForTest blink_gen_property_trees(true);
+ // This test doesn't apply for pre-BlinkGenPropertyTrees due to the element id
+ // namespaces.
+ if (!RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled() &&
+ !RuntimeEnabledFeatures::CompositeAfterPaintEnabled())
+ return;
+
Persistent<Element> element = GetDocument().CreateElementForBinding("shared");
LayoutObjectProxy* layout_object = LayoutObjectProxy::Create(element.Get());
@@ -1079,8 +1098,8 @@ TEST_F(AnimationCompositorAnimationsTest,
auto style = ComputedStyle::Create();
StringKeyframeEffectModel* effect1 = CreateKeyframeEffectModel(
- CreateReplaceOpKeyframe(CSSPropertyTransform, "none", 0),
- CreateReplaceOpKeyframe(CSSPropertyTransform, "rotate(45deg)", 1.0));
+ CreateReplaceOpKeyframe(CSSPropertyID::kTransform, "none", 0),
+ CreateReplaceOpKeyframe(CSSPropertyID::kTransform, "rotate(45deg)", 1.0));
KeyframeEffect* keyframe_effect1 =
KeyframeEffect::Create(element.Get(), effect1, timing_);
@@ -1105,10 +1124,12 @@ TEST_F(AnimationCompositorAnimationsTest,
timing_, *element.Get(), animation1, *effect1, disjoint_ids));
StringKeyframeEffectModel* effect2 = CreateKeyframeEffectModel(
- CreateReplaceOpKeyframe(CSSPropertyTransform, "translateX(-45px)", 0),
- CreateReplaceOpKeyframe(CSSPropertyRotate, "none", 0),
- CreateReplaceOpKeyframe(CSSPropertyTransform, "translateX(45px)", 1.0),
- CreateReplaceOpKeyframe(CSSPropertyRotate, "45deg", 1.0));
+ CreateReplaceOpKeyframe(CSSPropertyID::kTransform, "translateX(-45px)",
+ 0),
+ CreateReplaceOpKeyframe(CSSPropertyID::kRotate, "none", 0),
+ CreateReplaceOpKeyframe(CSSPropertyID::kTransform, "translateX(45px)",
+ 1.0),
+ CreateReplaceOpKeyframe(CSSPropertyID::kRotate, "45deg", 1.0));
KeyframeEffect* keyframe_effect2 =
KeyframeEffect::Create(element.Get(), effect2, timing_);
@@ -1128,7 +1149,7 @@ TEST_F(AnimationCompositorAnimationsTest,
LayoutObjectProxy::Dispose(layout_object);
}
-TEST_F(AnimationCompositorAnimationsTest,
+TEST_P(AnimationCompositorAnimationsTest,
CanStartEffectOnCompositorTimingFunctionChainedCubicMatchingOffsets) {
keyframe_vector2_->at(0)->SetEasing(cubic_ease_timing_function_.get());
keyframe_animation_effect2_ =
@@ -1152,7 +1173,7 @@ TEST_F(AnimationCompositorAnimationsTest,
CanStartEffectOnCompositor(timing_, *keyframe_animation_effect5_));
}
-TEST_F(AnimationCompositorAnimationsTest,
+TEST_P(AnimationCompositorAnimationsTest,
CanStartEffectOnCompositorTimingFunctionMixedGood) {
keyframe_vector5_->at(0)->SetEasing(linear_timing_function_.get());
keyframe_vector5_->at(1)->SetEasing(cubic_ease_timing_function_.get());
@@ -1164,7 +1185,7 @@ TEST_F(AnimationCompositorAnimationsTest,
CanStartEffectOnCompositor(timing_, *keyframe_animation_effect5_));
}
-TEST_F(AnimationCompositorAnimationsTest,
+TEST_P(AnimationCompositorAnimationsTest,
CanStartEffectOnCompositorTimingFunctionWithStepOrFrameOkay) {
keyframe_vector2_->at(0)->SetEasing(step_timing_function_.get());
keyframe_animation_effect2_ =
@@ -1206,20 +1227,20 @@ TEST_F(AnimationCompositorAnimationsTest,
CanStartEffectOnCompositor(timing_, *keyframe_animation_effect5_));
}
-TEST_F(AnimationCompositorAnimationsTest, CanStartEffectOnCompositorBasic) {
+TEST_P(AnimationCompositorAnimationsTest, CanStartEffectOnCompositorBasic) {
StringKeyframeVector basic_frames_vector;
basic_frames_vector.push_back(CreateDefaultKeyframe(
- CSSPropertyOpacity, EffectModel::kCompositeReplace, 0.0));
+ CSSPropertyID::kOpacity, EffectModel::kCompositeReplace, 0.0));
basic_frames_vector.push_back(CreateDefaultKeyframe(
- CSSPropertyOpacity, EffectModel::kCompositeReplace, 1.0));
+ CSSPropertyID::kOpacity, EffectModel::kCompositeReplace, 1.0));
StringKeyframeVector non_basic_frames_vector;
non_basic_frames_vector.push_back(CreateDefaultKeyframe(
- CSSPropertyOpacity, EffectModel::kCompositeReplace, 0.0));
+ CSSPropertyID::kOpacity, EffectModel::kCompositeReplace, 0.0));
non_basic_frames_vector.push_back(CreateDefaultKeyframe(
- CSSPropertyOpacity, EffectModel::kCompositeReplace, 0.5));
+ CSSPropertyID::kOpacity, EffectModel::kCompositeReplace, 0.5));
non_basic_frames_vector.push_back(CreateDefaultKeyframe(
- CSSPropertyOpacity, EffectModel::kCompositeReplace, 1.0));
+ CSSPropertyID::kOpacity, EffectModel::kCompositeReplace, 1.0));
basic_frames_vector[0]->SetEasing(linear_timing_function_.get());
StringKeyframeEffectModel* basic_frames =
@@ -1240,9 +1261,9 @@ TEST_F(AnimationCompositorAnimationsTest, CanStartEffectOnCompositorBasic) {
StringKeyframeVector non_allowed_frames_vector;
non_allowed_frames_vector.push_back(CreateDefaultKeyframe(
- CSSPropertyOpacity, EffectModel::kCompositeAdd, 0.1));
+ CSSPropertyID::kOpacity, EffectModel::kCompositeAdd, 0.1));
non_allowed_frames_vector.push_back(CreateDefaultKeyframe(
- CSSPropertyOpacity, EffectModel::kCompositeAdd, 0.25));
+ CSSPropertyID::kOpacity, EffectModel::kCompositeAdd, 0.25));
StringKeyframeEffectModel* non_allowed_frames =
StringKeyframeEffectModel::Create(non_allowed_frames_vector);
EXPECT_FALSE(CanStartEffectOnCompositor(timing_, *non_allowed_frames));
@@ -1269,11 +1290,11 @@ TEST_F(AnimationCompositorAnimationsTest, CanStartEffectOnCompositorBasic) {
// -----------------------------------------------------------------------
// -----------------------------------------------------------------------
-TEST_F(AnimationCompositorAnimationsTest, CreateSimpleOpacityAnimation) {
+TEST_P(AnimationCompositorAnimationsTest, CreateSimpleOpacityAnimation) {
// KeyframeEffect to convert
StringKeyframeEffectModel* effect = CreateKeyframeEffectModel(
- CreateReplaceOpKeyframe(CSSPropertyOpacity, "0.2", 0),
- CreateReplaceOpKeyframe(CSSPropertyOpacity, "0.5", 1.0));
+ CreateReplaceOpKeyframe(CSSPropertyID::kOpacity, "0.2", 0),
+ CreateReplaceOpKeyframe(CSSPropertyID::kOpacity, "0.5", 1.0));
std::unique_ptr<CompositorKeyframeModel> keyframe_model =
ConvertToCompositorAnimation(*effect);
@@ -1303,12 +1324,12 @@ TEST_F(AnimationCompositorAnimationsTest, CreateSimpleOpacityAnimation) {
keyframes[1]->GetTimingFunctionForTesting()->GetType());
}
-TEST_F(AnimationCompositorAnimationsTest,
+TEST_P(AnimationCompositorAnimationsTest,
CreateSimpleOpacityAnimationDuration) {
// KeyframeEffect to convert
StringKeyframeEffectModel* effect = CreateKeyframeEffectModel(
- CreateReplaceOpKeyframe(CSSPropertyOpacity, "0.2", 0),
- CreateReplaceOpKeyframe(CSSPropertyOpacity, "0.5", 1.0));
+ CreateReplaceOpKeyframe(CSSPropertyID::kOpacity, "0.2", 0),
+ CreateReplaceOpKeyframe(CSSPropertyID::kOpacity, "0.5", 1.0));
const AnimationTimeDelta kDuration = AnimationTimeDelta::FromSecondsD(10);
timing_.iteration_duration = kDuration;
@@ -1325,14 +1346,14 @@ TEST_F(AnimationCompositorAnimationsTest,
EXPECT_EQ(kDuration, keyframes[1]->Time() * kDuration);
}
-TEST_F(AnimationCompositorAnimationsTest,
+TEST_P(AnimationCompositorAnimationsTest,
CreateMultipleKeyframeOpacityAnimationLinear) {
// KeyframeEffect to convert
StringKeyframeEffectModel* effect = CreateKeyframeEffectModel(
- CreateReplaceOpKeyframe(CSSPropertyOpacity, "0.2", 0),
- CreateReplaceOpKeyframe(CSSPropertyOpacity, "0.0", 0.25),
- CreateReplaceOpKeyframe(CSSPropertyOpacity, "0.25", 0.5),
- CreateReplaceOpKeyframe(CSSPropertyOpacity, "0.5", 1.0));
+ CreateReplaceOpKeyframe(CSSPropertyID::kOpacity, "0.2", 0),
+ CreateReplaceOpKeyframe(CSSPropertyID::kOpacity, "0.0", 0.25),
+ CreateReplaceOpKeyframe(CSSPropertyID::kOpacity, "0.25", 0.5),
+ CreateReplaceOpKeyframe(CSSPropertyID::kOpacity, "0.5", 1.0));
timing_.iteration_count = 5;
timing_.direction = Timing::PlaybackDirection::ALTERNATE_NORMAL;
@@ -1375,12 +1396,12 @@ TEST_F(AnimationCompositorAnimationsTest,
keyframes[3]->GetTimingFunctionForTesting()->GetType());
}
-TEST_F(AnimationCompositorAnimationsTest,
+TEST_P(AnimationCompositorAnimationsTest,
CreateSimpleOpacityAnimationStartDelay) {
// KeyframeEffect to convert
StringKeyframeEffectModel* effect = CreateKeyframeEffectModel(
- CreateReplaceOpKeyframe(CSSPropertyOpacity, "0.2", 0),
- CreateReplaceOpKeyframe(CSSPropertyOpacity, "0.5", 1.0));
+ CreateReplaceOpKeyframe(CSSPropertyID::kOpacity, "0.2", 0),
+ CreateReplaceOpKeyframe(CSSPropertyID::kOpacity, "0.5", 1.0));
const double kStartDelay = 3.25;
@@ -1408,14 +1429,17 @@ TEST_F(AnimationCompositorAnimationsTest,
EXPECT_EQ(0.5f, keyframes[1]->Value());
}
-TEST_F(AnimationCompositorAnimationsTest,
+TEST_P(AnimationCompositorAnimationsTest,
CreateMultipleKeyframeOpacityAnimationChained) {
// KeyframeEffect to convert
StringKeyframeVector frames;
- frames.push_back(CreateReplaceOpKeyframe(CSSPropertyOpacity, "0.2", 0));
- frames.push_back(CreateReplaceOpKeyframe(CSSPropertyOpacity, "0.0", 0.25));
- frames.push_back(CreateReplaceOpKeyframe(CSSPropertyOpacity, "0.35", 0.5));
- frames.push_back(CreateReplaceOpKeyframe(CSSPropertyOpacity, "0.5", 1.0));
+ frames.push_back(CreateReplaceOpKeyframe(CSSPropertyID::kOpacity, "0.2", 0));
+ frames.push_back(
+ CreateReplaceOpKeyframe(CSSPropertyID::kOpacity, "0.0", 0.25));
+ frames.push_back(
+ CreateReplaceOpKeyframe(CSSPropertyID::kOpacity, "0.35", 0.5));
+ frames.push_back(
+ CreateReplaceOpKeyframe(CSSPropertyID::kOpacity, "0.5", 1.0));
frames[0]->SetEasing(cubic_ease_timing_function_.get());
frames[1]->SetEasing(linear_timing_function_.get());
frames[2]->SetEasing(cubic_custom_timing_function_.get());
@@ -1467,16 +1491,19 @@ TEST_F(AnimationCompositorAnimationsTest,
keyframes[3]->GetTimingFunctionForTesting()->GetType());
}
-TEST_F(AnimationCompositorAnimationsTest, CreateReversedOpacityAnimation) {
+TEST_P(AnimationCompositorAnimationsTest, CreateReversedOpacityAnimation) {
scoped_refptr<TimingFunction> cubic_easy_flip_timing_function =
CubicBezierTimingFunction::Create(0.0, 0.0, 0.0, 1.0);
// KeyframeEffect to convert
StringKeyframeVector frames;
- frames.push_back(CreateReplaceOpKeyframe(CSSPropertyOpacity, "0.2", 0));
- frames.push_back(CreateReplaceOpKeyframe(CSSPropertyOpacity, "0.0", 0.25));
- frames.push_back(CreateReplaceOpKeyframe(CSSPropertyOpacity, "0.25", 0.5));
- frames.push_back(CreateReplaceOpKeyframe(CSSPropertyOpacity, "0.5", 1.0));
+ frames.push_back(CreateReplaceOpKeyframe(CSSPropertyID::kOpacity, "0.2", 0));
+ frames.push_back(
+ CreateReplaceOpKeyframe(CSSPropertyID::kOpacity, "0.0", 0.25));
+ frames.push_back(
+ CreateReplaceOpKeyframe(CSSPropertyID::kOpacity, "0.25", 0.5));
+ frames.push_back(
+ CreateReplaceOpKeyframe(CSSPropertyID::kOpacity, "0.5", 1.0));
frames[0]->SetEasing(CubicBezierTimingFunction::Preset(
CubicBezierTimingFunction::EaseType::EASE_IN));
frames[1]->SetEasing(linear_timing_function_.get());
@@ -1528,12 +1555,12 @@ TEST_F(AnimationCompositorAnimationsTest, CreateReversedOpacityAnimation) {
keyframes[3]->GetTimingFunctionForTesting()->GetType());
}
-TEST_F(AnimationCompositorAnimationsTest,
+TEST_P(AnimationCompositorAnimationsTest,
CreateReversedOpacityAnimationNegativeStartDelay) {
// KeyframeEffect to convert
StringKeyframeEffectModel* effect = CreateKeyframeEffectModel(
- CreateReplaceOpKeyframe(CSSPropertyOpacity, "0.2", 0),
- CreateReplaceOpKeyframe(CSSPropertyOpacity, "0.5", 1.0));
+ CreateReplaceOpKeyframe(CSSPropertyID::kOpacity, "0.2", 0),
+ CreateReplaceOpKeyframe(CSSPropertyID::kOpacity, "0.5", 1.0));
const double kNegativeStartDelay = -3;
@@ -1560,12 +1587,12 @@ TEST_F(AnimationCompositorAnimationsTest,
ASSERT_EQ(2UL, keyframes.size());
}
-TEST_F(AnimationCompositorAnimationsTest,
+TEST_P(AnimationCompositorAnimationsTest,
CreateSimpleOpacityAnimationFillModeNone) {
// KeyframeEffect to convert
StringKeyframeEffectModel* effect = CreateKeyframeEffectModel(
- CreateReplaceOpKeyframe(CSSPropertyOpacity, "0.2", 0),
- CreateReplaceOpKeyframe(CSSPropertyOpacity, "0.5", 1.0));
+ CreateReplaceOpKeyframe(CSSPropertyID::kOpacity, "0.2", 0),
+ CreateReplaceOpKeyframe(CSSPropertyID::kOpacity, "0.5", 1.0));
timing_.fill_mode = Timing::FillMode::NONE;
@@ -1575,12 +1602,12 @@ TEST_F(AnimationCompositorAnimationsTest,
keyframe_model->GetFillMode());
}
-TEST_F(AnimationCompositorAnimationsTest,
+TEST_P(AnimationCompositorAnimationsTest,
CreateSimpleOpacityAnimationFillModeAuto) {
// KeyframeEffect to convert
StringKeyframeEffectModel* effect = CreateKeyframeEffectModel(
- CreateReplaceOpKeyframe(CSSPropertyOpacity, "0.2", 0),
- CreateReplaceOpKeyframe(CSSPropertyOpacity, "0.5", 1.0));
+ CreateReplaceOpKeyframe(CSSPropertyID::kOpacity, "0.2", 0),
+ CreateReplaceOpKeyframe(CSSPropertyID::kOpacity, "0.5", 1.0));
timing_.fill_mode = Timing::FillMode::AUTO;
@@ -1597,12 +1624,12 @@ TEST_F(AnimationCompositorAnimationsTest,
keyframe_model->GetFillMode());
}
-TEST_F(AnimationCompositorAnimationsTest,
+TEST_P(AnimationCompositorAnimationsTest,
CreateSimpleOpacityAnimationWithTimingFunction) {
// KeyframeEffect to convert
StringKeyframeEffectModel* effect = CreateKeyframeEffectModel(
- CreateReplaceOpKeyframe(CSSPropertyOpacity, "0.2", 0),
- CreateReplaceOpKeyframe(CSSPropertyOpacity, "0.5", 1.0));
+ CreateReplaceOpKeyframe(CSSPropertyID::kOpacity, "0.2", 0),
+ CreateReplaceOpKeyframe(CSSPropertyID::kOpacity, "0.5", 1.0));
timing_.timing_function = cubic_custom_timing_function_;
@@ -1640,7 +1667,7 @@ TEST_F(AnimationCompositorAnimationsTest,
keyframes[1]->GetTimingFunctionForTesting()->GetType());
}
-TEST_F(AnimationCompositorAnimationsTest,
+TEST_P(AnimationCompositorAnimationsTest,
CreateSimpleCustomFloatPropertyAnimation) {
ScopedOffMainThreadCSSPaintForTest off_main_thread_css_paint(true);
@@ -1674,7 +1701,7 @@ TEST_F(AnimationCompositorAnimationsTest,
keyframes[1]->GetTimingFunctionForTesting()->GetType());
}
-TEST_F(AnimationCompositorAnimationsTest,
+TEST_P(AnimationCompositorAnimationsTest,
CancelIncompatibleCompositorAnimations) {
Persistent<Element> element = GetDocument().CreateElementForBinding("shared");
base::Optional<CompositorElementIdSet> none;
@@ -1686,9 +1713,9 @@ TEST_F(AnimationCompositorAnimationsTest,
Persistent<HeapVector<Member<StringKeyframe>>> key_frames =
MakeGarbageCollected<HeapVector<Member<StringKeyframe>>>();
key_frames->push_back(CreateDefaultKeyframe(
- CSSPropertyOpacity, EffectModel::kCompositeReplace, 0.0));
+ CSSPropertyID::kOpacity, EffectModel::kCompositeReplace, 0.0));
key_frames->push_back(CreateDefaultKeyframe(
- CSSPropertyOpacity, EffectModel::kCompositeReplace, 1.0));
+ CSSPropertyID::kOpacity, EffectModel::kCompositeReplace, 1.0));
KeyframeEffectModelBase* animation_effect1 =
StringKeyframeEffectModel::Create(*key_frames);
KeyframeEffectModelBase* animation_effect2 =
@@ -1738,7 +1765,7 @@ TEST_F(AnimationCompositorAnimationsTest,
element->SetLayoutObject(nullptr);
LayoutObjectProxy::Dispose(layout_object);
- ThreadState::Current()->CollectAllGarbage();
+ ThreadState::Current()->CollectAllGarbageForTesting();
EXPECT_TRUE(element->GetElementAnimations()->Animations().IsEmpty());
}
@@ -1760,15 +1787,16 @@ void UpdateDummyEffectNode(ObjectPaintProperties& properties,
}
} // namespace
+TEST_P(AnimationCompositorAnimationsTest,
+ CanStartElementOnCompositorTransformBasedOnPaintProperties) {
+ if (!RuntimeEnabledFeatures::CompositeAfterPaintEnabled())
+ return;
-TEST_F(AnimationCompositorAnimationsTest,
- CanStartElementOnCompositorTransformCAP) {
Persistent<Element> element = GetDocument().CreateElementForBinding("shared");
LayoutObjectProxy* layout_object = LayoutObjectProxy::Create(element.Get());
layout_object->EnsureIdForTestingProxy();
element->SetLayoutObject(layout_object);
- ScopedCompositeAfterPaintForTest enable_cap(true);
auto& properties = layout_object->GetMutableForPainting()
.FirstFragment()
.EnsurePaintProperties();
@@ -1777,31 +1805,30 @@ TEST_F(AnimationCompositorAnimationsTest,
// animation.
UpdateDummyTransformNode(properties,
CompositingReason::kActiveTransformAnimation);
- EXPECT_TRUE(
- CompositorAnimations::CheckCanStartElementOnCompositor(*element).Ok());
+ EXPECT_TRUE(CheckCanStartElementOnCompositor(*element));
// Setting to CompositingReasonNone should produce false.
UpdateDummyTransformNode(properties, CompositingReason::kNone);
- EXPECT_FALSE(
- CompositorAnimations::CheckCanStartElementOnCompositor(*element).Ok());
+ EXPECT_FALSE(CheckCanStartElementOnCompositor(*element));
// Clearing the transform node entirely should also produce false.
properties.ClearTransform();
- EXPECT_FALSE(
- CompositorAnimations::CheckCanStartElementOnCompositor(*element).Ok());
+ EXPECT_FALSE(CheckCanStartElementOnCompositor(*element));
element->SetLayoutObject(nullptr);
LayoutObjectProxy::Dispose(layout_object);
}
-TEST_F(AnimationCompositorAnimationsTest,
- CanStartElementOnCompositorEffectCAP) {
+TEST_P(AnimationCompositorAnimationsTest,
+ CanStartElementOnCompositorEffectBasedOnPaintProperties) {
+ if (!RuntimeEnabledFeatures::CompositeAfterPaintEnabled())
+ return;
+
Persistent<Element> element = GetDocument().CreateElementForBinding("shared");
LayoutObjectProxy* layout_object = LayoutObjectProxy::Create(element.Get());
layout_object->EnsureIdForTestingProxy();
element->SetLayoutObject(layout_object);
- ScopedCompositeAfterPaintForTest enable_cap(true);
auto& properties = layout_object->GetMutableForPainting()
.FirstFragment()
.EnsurePaintProperties();
@@ -1810,24 +1837,21 @@ TEST_F(AnimationCompositorAnimationsTest,
// animation.
UpdateDummyEffectNode(properties,
CompositingReason::kActiveTransformAnimation);
- EXPECT_TRUE(
- CompositorAnimations::CheckCanStartElementOnCompositor(*element).Ok());
+ EXPECT_TRUE(CheckCanStartElementOnCompositor(*element));
// Setting to CompositingReasonNone should produce false.
UpdateDummyEffectNode(properties, CompositingReason::kNone);
- EXPECT_FALSE(
- CompositorAnimations::CheckCanStartElementOnCompositor(*element).Ok());
+ EXPECT_FALSE(CheckCanStartElementOnCompositor(*element));
// Clearing the effect node entirely should also produce false.
properties.ClearEffect();
- EXPECT_FALSE(
- CompositorAnimations::CheckCanStartElementOnCompositor(*element).Ok());
+ EXPECT_FALSE(CheckCanStartElementOnCompositor(*element));
element->SetLayoutObject(nullptr);
LayoutObjectProxy::Dispose(layout_object);
}
-TEST_F(AnimationCompositorAnimationsTest, TrackRafAnimation) {
+TEST_P(AnimationCompositorAnimationsTest, TrackRafAnimation) {
LoadTestData("raf-countdown.html");
cc::AnimationHost* host =
@@ -1856,7 +1880,7 @@ TEST_F(AnimationCompositorAnimationsTest, TrackRafAnimation) {
EXPECT_FALSE(host->NextFrameHasPendingRAF());
}
-TEST_F(AnimationCompositorAnimationsTest, TrackRafAnimationTimeout) {
+TEST_P(AnimationCompositorAnimationsTest, TrackRafAnimationTimeout) {
LoadTestData("raf-timeout.html");
cc::AnimationHost* host =
@@ -1870,7 +1894,7 @@ TEST_F(AnimationCompositorAnimationsTest, TrackRafAnimationTimeout) {
EXPECT_FALSE(host->NextFrameHasPendingRAF());
}
-TEST_F(AnimationCompositorAnimationsTest, TrackRafAnimationNoneRegistered) {
+TEST_P(AnimationCompositorAnimationsTest, TrackRafAnimationNoneRegistered) {
SetBodyInnerHTML("<div id='box'></div>");
// Run a full frame after loading the test data so that scripted animations
@@ -1891,25 +1915,91 @@ TEST_F(AnimationCompositorAnimationsTest, TrackRafAnimationNoneRegistered) {
EXPECT_FALSE(host->NextFrameHasPendingRAF());
}
-TEST_F(AnimationCompositorAnimationsTest, CanStartElementOnCompositorEffect) {
+TEST_P(AnimationCompositorAnimationsTest, CompositedTransformAnimation) {
+ // TODO(wangxianzhu): Fix this test for CompositeAfterPaint.
+ if (RuntimeEnabledFeatures::CompositeAfterPaintEnabled())
+ return;
+
LoadTestData("transform-animation.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);
+ if (RuntimeEnabledFeatures::CompositeAfterPaintEnabled() ||
+ RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled()) {
+ EXPECT_TRUE(transform->HasDirectCompositingReasons());
+ EXPECT_TRUE(transform->HasActiveTransformAnimation());
+ // Make sure the animation state is initialized in paint properties.
+ auto* property_trees =
+ document->View()->RootCcLayer()->layer_tree_host()->property_trees();
+ auto* cc_transform = property_trees->transform_tree.Node(
+ property_trees->element_id_to_transform_node_index
+ [transform->GetCompositorElementId()]);
+ ASSERT_NE(nullptr, cc_transform);
+ EXPECT_TRUE(cc_transform->has_potential_animation);
+ EXPECT_TRUE(cc_transform->is_currently_animating);
+ EXPECT_EQ(cc::kNotScaled, cc_transform->starting_animation_scale);
+ EXPECT_EQ(cc::kNotScaled, cc_transform->maximum_animation_scale);
+ }
+
+ // Make sure the animation is started on the compositor.
+ EXPECT_TRUE(CheckCanStartElementOnCompositor(*target));
+ EXPECT_EQ(document->Timeline().PendingAnimationsCount(), 1u);
+ cc::AnimationHost* host = document->View()->GetCompositorAnimationHost();
+ EXPECT_EQ(host->MainThreadAnimationsCount(), 0u);
+ EXPECT_EQ(host->CompositedAnimationsCount(), 1u);
+}
+
+TEST_P(AnimationCompositorAnimationsTest, CompositedScaleAnimation) {
+ // TODO(wangxianzhu): Fix this test for CompositeAfterPaint.
if (RuntimeEnabledFeatures::CompositeAfterPaintEnabled())
- EXPECT_TRUE(properties->Transform()->HasDirectCompositingReasons());
- CompositorAnimations::FailureCode code =
- CompositorAnimations::CheckCanStartElementOnCompositor(*target);
- EXPECT_EQ(code, CompositorAnimations::FailureCode::None());
+ return;
+
+ LoadTestData("scale-animation.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);
+ if (RuntimeEnabledFeatures::CompositeAfterPaintEnabled() ||
+ RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled()) {
+ EXPECT_TRUE(transform->HasDirectCompositingReasons());
+ EXPECT_TRUE(transform->HasActiveTransformAnimation());
+ // Make sure the animation state is initialized in paint properties.
+ auto* property_trees =
+ document->View()->RootCcLayer()->layer_tree_host()->property_trees();
+ auto* cc_transform = property_trees->transform_tree.Node(
+ property_trees->element_id_to_transform_node_index
+ [transform->GetCompositorElementId()]);
+ ASSERT_NE(nullptr, cc_transform);
+ EXPECT_TRUE(cc_transform->has_potential_animation);
+ EXPECT_TRUE(cc_transform->is_currently_animating);
+ EXPECT_EQ(2.f, cc_transform->starting_animation_scale);
+ EXPECT_EQ(5.f, cc_transform->maximum_animation_scale);
+ }
+
+ // Make sure the animation is started on the compositor.
+ EXPECT_TRUE(CheckCanStartElementOnCompositor(*target));
EXPECT_EQ(document->Timeline().PendingAnimationsCount(), 1u);
cc::AnimationHost* host = document->View()->GetCompositorAnimationHost();
EXPECT_EQ(host->MainThreadAnimationsCount(), 0u);
EXPECT_EQ(host->CompositedAnimationsCount(), 1u);
}
-TEST_F(AnimationCompositorAnimationsTest,
+TEST_P(AnimationCompositorAnimationsTest,
NonAnimatedTransformPropertyChangeGetsUpdated) {
+ // This test doesn't apply for pre-BlinkGenPropertyTrees due to the element id
+ // namespaces.
+ if (!RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled() ||
+ // TODO(wangxianzhu): Fix this test for CompositeAfterPaint.
+ RuntimeEnabledFeatures::CompositeAfterPaintEnabled())
+ return;
+
LoadTestData("transform-animation-update.html");
Document* document = GetFrame()->GetDocument();
Element* target = document->getElementById("target");
@@ -1919,11 +2009,19 @@ TEST_F(AnimationCompositorAnimationsTest,
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_TRUE(transform->HasDirectCompositingReasons());
+ EXPECT_TRUE(transform->HasActiveTransformAnimation());
+ EXPECT_TRUE(CheckCanStartElementOnCompositor(*target));
+ // Make sure the animation state is initialized in paint properties.
+ auto* property_trees =
+ document->View()->RootCcLayer()->layer_tree_host()->property_trees();
+ auto* cc_transform = property_trees->transform_tree.Node(
+ property_trees->element_id_to_transform_node_index
+ [transform->GetCompositorElementId()]);
+ ASSERT_NE(nullptr, cc_transform);
+ EXPECT_TRUE(cc_transform->has_potential_animation);
+ EXPECT_TRUE(cc_transform->is_currently_animating);
+ // Make sure the animation is started on the compositor.
EXPECT_EQ(document->Timeline().PendingAnimationsCount(), 1u);
cc::AnimationHost* host = document->View()->GetCompositorAnimationHost();
EXPECT_EQ(host->MainThreadAnimationsCount(), 0u);
@@ -1931,7 +2029,7 @@ TEST_F(AnimationCompositorAnimationsTest,
// 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(),
+ EXPECT_EQ(transform->GetBackfaceVisibilityForTesting(),
TransformPaintPropertyNode::BackfaceVisibility::kVisible);
const CompositedLayerMapping* composited_layer_mapping =
ToLayoutBoxModelObject(target->GetLayoutObject())
@@ -1942,29 +2040,37 @@ TEST_F(AnimationCompositorAnimationsTest,
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(),
+ EXPECT_EQ(transform->GetBackfaceVisibilityForTesting(),
TransformPaintPropertyNode::BackfaceVisibility::kHidden);
EXPECT_FALSE(layer->double_sided())
<< "Change to hidden did not get propagated to CC";
+ // Make sure the animation state is initialized in paint properties after
+ // blink pushing new paint properties without animation state change.
+ property_trees =
+ document->View()->RootCcLayer()->layer_tree_host()->property_trees();
+ cc_transform = property_trees->transform_tree.Node(
+ property_trees->element_id_to_transform_node_index
+ [transform->GetCompositorElementId()]);
+ ASSERT_NE(nullptr, cc_transform);
+ EXPECT_TRUE(cc_transform->has_potential_animation);
+ EXPECT_TRUE(cc_transform->is_currently_animating);
}
// Regression test for https://crbug.com/781305. When we have a transform
// animation on a SVG element, the effect can be started on compositor but the
// element itself cannot.
-TEST_F(AnimationCompositorAnimationsTest,
+TEST_P(AnimationCompositorAnimationsTest,
CannotStartElementOnCompositorEffectSVG) {
LoadTestData("transform-animation-on-svg.html");
Document* document = GetFrame()->GetDocument();
Element* target = document->getElementById("dots");
- CompositorAnimations::FailureCode code =
- CompositorAnimations::CheckCanStartElementOnCompositor(*target);
- EXPECT_EQ(code, CompositorAnimations::FailureCode::NonActionable(
- "Element does not paint into own backing"));
+ EXPECT_FALSE(CheckCanStartElementOnCompositor(*target));
EXPECT_EQ(document->Timeline().PendingAnimationsCount(), 4u);
cc::AnimationHost* host = document->View()->GetCompositorAnimationHost();
EXPECT_EQ(host->MainThreadAnimationsCount(), 4u);
diff --git a/chromium/third_party/blink/renderer/core/animation/css/css_animatable_value_factory.cc b/chromium/third_party/blink/renderer/core/animation/css/css_animatable_value_factory.cc
index 40778cb7b58..b55f03bcfa0 100644
--- a/chromium/third_party/blink/renderer/core/animation/css/css_animatable_value_factory.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css/css_animatable_value_factory.cc
@@ -60,45 +60,44 @@ AnimatableValue* CSSAnimatableValueFactory::Create(
const CSSProperty& css_property = property.GetCSSProperty();
#if DCHECK_IS_ON()
// Variables are conditionally interpolable and compositable.
- if (css_property.PropertyID() != CSSPropertyVariable) {
+ if (css_property.PropertyID() != CSSPropertyID::kVariable) {
DCHECK(css_property.IsInterpolable());
DCHECK(css_property.IsCompositableProperty());
}
#endif
switch (css_property.PropertyID()) {
- case CSSPropertyOpacity:
+ case CSSPropertyID::kOpacity:
return AnimatableDouble::Create(style.Opacity());
- case CSSPropertyFilter:
+ case CSSPropertyID::kFilter:
return AnimatableFilterOperations::Create(style.Filter());
- case CSSPropertyBackdropFilter:
+ case CSSPropertyID::kBackdropFilter:
return AnimatableFilterOperations::Create(style.BackdropFilter());
- case CSSPropertyTransform:
+ case CSSPropertyID::kTransform:
return AnimatableTransform::Create(style.Transform(),
style.EffectiveZoom());
- case CSSPropertyTranslate: {
+ case CSSPropertyID::kTranslate: {
return CreateFromTransformProperties(style.Translate(),
style.EffectiveZoom(), nullptr);
}
- case CSSPropertyRotate: {
+ case CSSPropertyID::kRotate: {
return CreateFromTransformProperties(style.Rotate(),
style.EffectiveZoom(), nullptr);
}
- case CSSPropertyScale: {
+ case CSSPropertyID::kScale: {
return CreateFromTransformProperties(style.Scale(), style.EffectiveZoom(),
nullptr);
}
- case CSSPropertyVariable: {
+ case CSSPropertyID::kVariable: {
if (!RuntimeEnabledFeatures::OffMainThreadCSSPaintEnabled()) {
return nullptr;
}
const AtomicString& property_name = property.CustomPropertyName();
const CSSValue* value = style.GetRegisteredVariable(property_name);
- if (!value || !value->IsPrimitiveValue() ||
- !ToCSSPrimitiveValue(*value).IsNumber()) {
+ const auto* primitive_value = DynamicTo<CSSPrimitiveValue>(value);
+ if (!primitive_value || !primitive_value->IsNumber())
return nullptr;
- }
- return AnimatableDouble::Create(
- ToCSSPrimitiveValue(*value).GetFloatValue());
+
+ return AnimatableDouble::Create(primitive_value->GetFloatValue());
}
default:
NOTREACHED();
diff --git a/chromium/third_party/blink/renderer/core/animation/css/css_animation_data.h b/chromium/third_party/blink/renderer/core/animation/css/css_animation_data.h
index e716e49804c..6466df5b258 100644
--- a/chromium/third_party/blink/renderer/core/animation/css/css_animation_data.h
+++ b/chromium/third_party/blink/renderer/core/animation/css/css_animation_data.h
@@ -16,9 +16,8 @@ namespace blink {
class CSSAnimationData final : public CSSTimingData {
public:
- static std::unique_ptr<CSSAnimationData> Create() {
- return base::WrapUnique(new CSSAnimationData);
- }
+ CSSAnimationData();
+ explicit CSSAnimationData(const CSSAnimationData&);
std::unique_ptr<CSSAnimationData> Clone() const {
return base::WrapUnique(new CSSAnimationData(*this));
@@ -60,9 +59,6 @@ class CSSAnimationData final : public CSSTimingData {
static EAnimPlayState InitialPlayState() { return EAnimPlayState::kPlaying; }
private:
- CSSAnimationData();
- explicit CSSAnimationData(const CSSAnimationData&);
-
Vector<AtomicString> name_list_;
Vector<double> iteration_count_list_;
Vector<Timing::PlaybackDirection> direction_list_;
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 71407ffacab..5649817359d 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
@@ -45,6 +45,7 @@
#include "third_party/blink/renderer/core/animation/interpolation_type.h"
#include "third_party/blink/renderer/core/animation/keyframe_effect.h"
#include "third_party/blink/renderer/core/animation/keyframe_effect_model.h"
+#include "third_party/blink/renderer/core/animation/timing_calculations.h"
#include "third_party/blink/renderer/core/animation/transition_interpolation.h"
#include "third_party/blink/renderer/core/animation/worklet_animation_base.h"
#include "third_party/blink/renderer/core/css/css_keyframe_rule.h"
@@ -110,14 +111,14 @@ StringKeyframeEffectModel* CreateKeyframeEffectModel(
for (unsigned j = 0; j < properties.PropertyCount(); j++) {
const CSSProperty& property = properties.PropertyAt(j).Property();
specified_properties_for_use_counter.insert(&property);
- if (property.PropertyID() == CSSPropertyAnimationTimingFunction) {
+ if (property.PropertyID() == CSSPropertyID::kAnimationTimingFunction) {
const CSSValue& value = properties.PropertyAt(j).Value();
scoped_refptr<TimingFunction> timing_function;
if (value.IsInheritedValue() && parent_style->Animations()) {
timing_function = parent_style->Animations()->TimingFunctionList()[0];
- } else if (value.IsValueList()) {
- timing_function = CSSToStyleMap::MapAnimationTimingFunction(
- ToCSSValueList(value).Item(0));
+ } else if (auto* value_list = DynamicTo<CSSValueList>(value)) {
+ timing_function =
+ CSSToStyleMap::MapAnimationTimingFunction(value_list->Item(0));
} else {
DCHECK(value.IsCSSWideKeyword());
timing_function = CSSTimingData::InitialTimingFunction();
@@ -794,16 +795,14 @@ void CSSAnimations::CalculateTransitionUpdateForProperty(
TransitionKeyframeVector keyframes;
TransitionKeyframe* start_keyframe = TransitionKeyframe::Create(property);
- start_keyframe->SetValue(TypedInterpolationValue::Create(
+ start_keyframe->SetValue(std::make_unique<TypedInterpolationValue>(
*transition_type, start.interpolable_value->Clone(),
start.non_interpolable_value));
start_keyframe->SetOffset(0);
- start_keyframe->SetEasing(std::move(timing.timing_function));
- timing.timing_function = LinearTimingFunction::Shared();
keyframes.push_back(start_keyframe);
TransitionKeyframe* end_keyframe = TransitionKeyframe::Create(property);
- end_keyframe->SetValue(TypedInterpolationValue::Create(
+ end_keyframe->SetValue(std::make_unique<TypedInterpolationValue>(
*transition_type, end.interpolable_value->Clone(),
end.non_interpolable_value));
end_keyframe->SetOffset(1);
@@ -861,7 +860,7 @@ void CSSAnimations::CalculateTransitionUpdateForStandardProperty(
CSSPropertyID resolved_id =
resolveCSSPropertyID(transition_property.unresolved_property);
- bool animate_all = resolved_id == CSSPropertyAll;
+ bool animate_all = resolved_id == CSSPropertyID::kAll;
const StylePropertyShorthand& property_list =
animate_all ? PropertiesForTransitionAll()
: shorthandForProperty(resolved_id);
@@ -921,7 +920,7 @@ void CSSAnimations::CalculateTransitionUpdate(CSSAnimationUpdate& update,
++transition_index) {
const CSSTransitionData::TransitionProperty& transition_property =
transition_data->PropertyList()[transition_index];
- if (transition_property.unresolved_property == CSSPropertyAll) {
+ if (transition_property.unresolved_property == CSSPropertyID::kAll) {
any_transition_had_transition_all = true;
}
if (property_pass == PropertyPass::kCustom) {
@@ -1236,14 +1235,14 @@ void CSSAnimations::TransitionEventDelegate::OnEventCondition(
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);
+ // Per the css-transitions-2 spec, transitioncancel is fired with the
+ // "active time of the animation at the moment it was cancelled,
+ // calculated using a fill mode of both".
+ double cancel_active_time = CalculateActiveTime(
+ animation_node.RepeatedDuration(), Timing::FillMode::BOTH,
+ animation_node.LocalTime(), previous_phase_,
+ animation_node.SpecifiedTiming());
+ EnqueueEvent(event_type_names::kTransitioncancel, cancel_active_time);
}
}
@@ -1274,22 +1273,21 @@ const StylePropertyShorthand& CSSAnimations::PropertiesForTransitionAll() {
DEFINE_STATIC_LOCAL(Vector<const CSSProperty*>, properties, ());
DEFINE_STATIC_LOCAL(StylePropertyShorthand, property_shorthand, ());
if (properties.IsEmpty()) {
- for (int i = firstCSSProperty; i <= lastCSSProperty; ++i) {
- CSSPropertyID id = convertToCSSPropertyID(i);
+ for (CSSPropertyID id : CSSPropertyIDList()) {
// Avoid creating overlapping transitions with perspective-origin and
// transition-origin.
- if (id == CSSPropertyWebkitPerspectiveOriginX ||
- id == CSSPropertyWebkitPerspectiveOriginY ||
- id == CSSPropertyWebkitTransformOriginX ||
- id == CSSPropertyWebkitTransformOriginY ||
- id == CSSPropertyWebkitTransformOriginZ)
+ if (id == CSSPropertyID::kWebkitPerspectiveOriginX ||
+ id == CSSPropertyID::kWebkitPerspectiveOriginY ||
+ id == CSSPropertyID::kWebkitTransformOriginX ||
+ id == CSSPropertyID::kWebkitTransformOriginY ||
+ id == CSSPropertyID::kWebkitTransformOriginZ)
continue;
const CSSProperty& property = CSSProperty::Get(id);
if (property.IsInterpolable())
properties.push_back(&property);
}
property_shorthand = StylePropertyShorthand(
- CSSPropertyInvalid, properties.begin(), properties.size());
+ CSSPropertyID::kInvalid, properties.begin(), properties.size());
}
return property_shorthand;
}
@@ -1298,27 +1296,27 @@ const StylePropertyShorthand& CSSAnimations::PropertiesForTransitionAll() {
// animations. https://drafts.csswg.org/web-animations/#not-animatable-section
bool CSSAnimations::IsAnimationAffectingProperty(const CSSProperty& property) {
switch (property.PropertyID()) {
- case CSSPropertyAnimation:
- case CSSPropertyAnimationDelay:
- case CSSPropertyAnimationDirection:
- case CSSPropertyAnimationDuration:
- case CSSPropertyAnimationFillMode:
- case CSSPropertyAnimationIterationCount:
- case CSSPropertyAnimationName:
- case CSSPropertyAnimationPlayState:
- case CSSPropertyAnimationTimingFunction:
- case CSSPropertyContain:
- case CSSPropertyDirection:
- case CSSPropertyDisplay:
- case CSSPropertyTextOrientation:
- case CSSPropertyTransition:
- case CSSPropertyTransitionDelay:
- case CSSPropertyTransitionDuration:
- case CSSPropertyTransitionProperty:
- case CSSPropertyTransitionTimingFunction:
- case CSSPropertyUnicodeBidi:
- case CSSPropertyWillChange:
- case CSSPropertyWritingMode:
+ case CSSPropertyID::kAnimation:
+ case CSSPropertyID::kAnimationDelay:
+ case CSSPropertyID::kAnimationDirection:
+ case CSSPropertyID::kAnimationDuration:
+ case CSSPropertyID::kAnimationFillMode:
+ case CSSPropertyID::kAnimationIterationCount:
+ case CSSPropertyID::kAnimationName:
+ case CSSPropertyID::kAnimationPlayState:
+ case CSSPropertyID::kAnimationTimingFunction:
+ case CSSPropertyID::kContain:
+ case CSSPropertyID::kDirection:
+ case CSSPropertyID::kDisplay:
+ case CSSPropertyID::kTextOrientation:
+ case CSSPropertyID::kTransition:
+ case CSSPropertyID::kTransitionDelay:
+ case CSSPropertyID::kTransitionDuration:
+ case CSSPropertyID::kTransitionProperty:
+ case CSSPropertyID::kTransitionTimingFunction:
+ case CSSPropertyID::kUnicodeBidi:
+ case CSSPropertyID::kWillChange:
+ case CSSPropertyID::kWritingMode:
return true;
default:
return false;
diff --git a/chromium/third_party/blink/renderer/core/animation/css/css_transition_data.h b/chromium/third_party/blink/renderer/core/animation/css/css_transition_data.h
index 24bec6abe87..b97de8e4b54 100644
--- a/chromium/third_party/blink/renderer/core/animation/css/css_transition_data.h
+++ b/chromium/third_party/blink/renderer/core/animation/css/css_transition_data.h
@@ -27,16 +27,16 @@ class CORE_EXPORT CSSTransitionData final : public CSSTimingData {
DISALLOW_NEW();
TransitionProperty(CSSPropertyID id)
: property_type(kTransitionKnownProperty), unresolved_property(id) {
- DCHECK_NE(id, CSSPropertyInvalid);
+ DCHECK_NE(id, CSSPropertyID::kInvalid);
}
TransitionProperty(const AtomicString& string)
: property_type(kTransitionUnknownProperty),
- unresolved_property(CSSPropertyInvalid),
+ unresolved_property(CSSPropertyID::kInvalid),
property_string(string) {}
TransitionProperty(TransitionPropertyType type)
- : property_type(type), unresolved_property(CSSPropertyInvalid) {
+ : property_type(type), unresolved_property(CSSPropertyID::kInvalid) {
DCHECK_EQ(type, kTransitionNone);
}
@@ -51,14 +51,13 @@ class CORE_EXPORT CSSTransitionData final : public CSSTimingData {
AtomicString property_string;
};
- static std::unique_ptr<CSSTransitionData> Create() {
- return base::WrapUnique(new CSSTransitionData);
- }
-
std::unique_ptr<CSSTransitionData> Clone() {
return base::WrapUnique(new CSSTransitionData(*this));
}
+ CSSTransitionData();
+ explicit CSSTransitionData(const CSSTransitionData&);
+
bool TransitionsMatchForStyleRecalc(const CSSTransitionData& other) const;
bool operator==(const CSSTransitionData& other) const {
return TransitionsMatchForStyleRecalc(other);
@@ -72,13 +71,10 @@ class CORE_EXPORT CSSTransitionData final : public CSSTimingData {
Vector<TransitionProperty>& PropertyList() { return property_list_; }
static TransitionProperty InitialProperty() {
- return TransitionProperty(CSSPropertyAll);
+ return TransitionProperty(CSSPropertyID::kAll);
}
private:
- CSSTransitionData();
- explicit CSSTransitionData(const CSSTransitionData&);
-
Vector<TransitionProperty> property_list_;
};
diff --git a/chromium/third_party/blink/renderer/core/animation/css/css_transition_data_test.cc b/chromium/third_party/blink/renderer/core/animation/css/css_transition_data_test.cc
index 3c4cd8a7d2b..fb1ff4620e2 100644
--- a/chromium/third_party/blink/renderer/core/animation/css/css_transition_data_test.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css/css_transition_data_test.cc
@@ -10,14 +10,18 @@
namespace blink {
TEST(CSSTransitionData, TransitionsMatchForStyleRecalc_Initial) {
- std::unique_ptr<CSSTransitionData> transition1 = CSSTransitionData::Create();
- std::unique_ptr<CSSTransitionData> transition2 = CSSTransitionData::Create();
+ std::unique_ptr<CSSTransitionData> transition1 =
+ std::make_unique<CSSTransitionData>();
+ std::unique_ptr<CSSTransitionData> transition2 =
+ std::make_unique<CSSTransitionData>();
EXPECT_TRUE(transition1->TransitionsMatchForStyleRecalc(*transition2));
}
TEST(CSSTransitionData, TransitionsMatchForStyleRecalc_CubicBezierSameObject) {
- std::unique_ptr<CSSTransitionData> transition1 = CSSTransitionData::Create();
- std::unique_ptr<CSSTransitionData> transition2 = CSSTransitionData::Create();
+ std::unique_ptr<CSSTransitionData> transition1 =
+ std::make_unique<CSSTransitionData>();
+ std::unique_ptr<CSSTransitionData> transition2 =
+ std::make_unique<CSSTransitionData>();
scoped_refptr<TimingFunction> func =
CubicBezierTimingFunction::Create(0.2f, 0.2f, 0.9f, 0.7f);
transition1->TimingFunctionList().push_back(func);
@@ -27,8 +31,10 @@ TEST(CSSTransitionData, TransitionsMatchForStyleRecalc_CubicBezierSameObject) {
TEST(CSSTransitionData,
TransitionsMatchForStyleRecalc_CubicBezierDifferentObjects) {
- std::unique_ptr<CSSTransitionData> transition1 = CSSTransitionData::Create();
- std::unique_ptr<CSSTransitionData> transition2 = CSSTransitionData::Create();
+ std::unique_ptr<CSSTransitionData> transition1 =
+ std::make_unique<CSSTransitionData>();
+ std::unique_ptr<CSSTransitionData> transition2 =
+ std::make_unique<CSSTransitionData>();
scoped_refptr<TimingFunction> func1 =
CubicBezierTimingFunction::Create(0.2f, 0.2f, 0.9f, 0.7f);
scoped_refptr<TimingFunction> func2 =
@@ -40,8 +46,10 @@ TEST(CSSTransitionData,
TEST(CSSTransitionData,
TransitionsMatchForStyleRecalc_CubicBezierDifferentValues) {
- std::unique_ptr<CSSTransitionData> transition1 = CSSTransitionData::Create();
- std::unique_ptr<CSSTransitionData> transition2 = CSSTransitionData::Create();
+ std::unique_ptr<CSSTransitionData> transition1 =
+ std::make_unique<CSSTransitionData>();
+ std::unique_ptr<CSSTransitionData> transition2 =
+ std::make_unique<CSSTransitionData>();
scoped_refptr<TimingFunction> func1 =
CubicBezierTimingFunction::Create(0.1f, 0.25f, 0.9f, 0.57f);
scoped_refptr<TimingFunction> func2 =
diff --git a/chromium/third_party/blink/renderer/core/animation/css_angle_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_angle_interpolation_type.cc
index e5f27144a22..c0db244170f 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_angle_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css_angle_interpolation_type.cc
@@ -11,17 +11,18 @@ namespace blink {
InterpolationValue CSSAngleInterpolationType::MaybeConvertNeutral(
const InterpolationValue&,
ConversionCheckers&) const {
- return InterpolationValue(InterpolableNumber::Create(0));
+ return InterpolationValue(std::make_unique<InterpolableNumber>(0));
}
InterpolationValue CSSAngleInterpolationType::MaybeConvertValue(
const CSSValue& value,
const StyleResolverState*,
ConversionCheckers&) const {
- if (!value.IsPrimitiveValue() || !ToCSSPrimitiveValue(value).IsAngle())
+ auto* primitive_value = DynamicTo<CSSPrimitiveValue>(value);
+ if (!primitive_value || !primitive_value->IsAngle())
return nullptr;
return InterpolationValue(
- InterpolableNumber::Create(ToCSSPrimitiveValue(value).ComputeDegrees()));
+ std::make_unique<InterpolableNumber>(primitive_value->ComputeDegrees()));
}
const CSSValue* CSSAngleInterpolationType::CreateCSSValue(
diff --git a/chromium/third_party/blink/renderer/core/animation/css_basic_shape_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_basic_shape_interpolation_type.cc
index 1b9fb29863c..8b0a6916c89 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_basic_shape_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css_basic_shape_interpolation_type.cc
@@ -24,7 +24,7 @@ namespace {
const BasicShape* GetBasicShape(const CSSProperty& property,
const ComputedStyle& style) {
switch (property.PropertyID()) {
- case CSSPropertyShapeOutside:
+ case CSSPropertyID::kShapeOutside:
if (!style.ShapeOutside())
return nullptr;
if (style.ShapeOutside()->GetType() != ShapeValue::kShape)
@@ -32,12 +32,12 @@ const BasicShape* GetBasicShape(const CSSProperty& property,
if (style.ShapeOutside()->CssBox() != CSSBoxType::kMissing)
return nullptr;
return style.ShapeOutside()->Shape();
- case CSSPropertyClipPath:
+ case CSSPropertyID::kClipPath:
if (!style.ClipPath())
return nullptr;
if (style.ClipPath()->GetType() != ClipPathOperation::SHAPE)
return nullptr;
- return ToShapeClipPathOperation(style.ClipPath())->GetBasicShape();
+ return To<ShapeClipPathOperation>(style.ClipPath())->GetBasicShape();
default:
NOTREACHED();
return nullptr;
@@ -47,18 +47,12 @@ const BasicShape* GetBasicShape(const CSSProperty& property,
class UnderlyingCompatibilityChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
- static std::unique_ptr<UnderlyingCompatibilityChecker> Create(
- scoped_refptr<NonInterpolableValue> underlying_non_interpolable_value) {
- return base::WrapUnique(new UnderlyingCompatibilityChecker(
- std::move(underlying_non_interpolable_value)));
- }
-
- private:
UnderlyingCompatibilityChecker(
scoped_refptr<NonInterpolableValue> underlying_non_interpolable_value)
: underlying_non_interpolable_value_(
std::move(underlying_non_interpolable_value)) {}
+ private:
bool IsValid(const StyleResolverState&,
const InterpolationValue& underlying) const final {
return basic_shape_interpolation_functions::ShapesAreCompatible(
@@ -72,18 +66,11 @@ class UnderlyingCompatibilityChecker
class InheritedShapeChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
- static std::unique_ptr<InheritedShapeChecker> Create(
- const CSSProperty& property,
- scoped_refptr<BasicShape> inherited_shape) {
- return base::WrapUnique(
- new InheritedShapeChecker(property, std::move(inherited_shape)));
- }
-
- private:
InheritedShapeChecker(const CSSProperty& property,
scoped_refptr<BasicShape> inherited_shape)
: property_(property), inherited_shape_(std::move(inherited_shape)) {}
+ private:
bool IsValid(const StyleResolverState& state,
const InterpolationValue&) const final {
return DataEquivalent(inherited_shape_.get(),
@@ -104,7 +91,7 @@ InterpolationValue CSSBasicShapeInterpolationType::MaybeConvertNeutral(
const_cast<NonInterpolableValue*>(
underlying.non_interpolable_value.get());
conversion_checkers.push_back(
- UnderlyingCompatibilityChecker::Create(non_interpolable_value));
+ std::make_unique<UnderlyingCompatibilityChecker>(non_interpolable_value));
return InterpolationValue(
basic_shape_interpolation_functions::CreateNeutralValue(
*underlying.non_interpolable_value),
@@ -123,7 +110,7 @@ InterpolationValue CSSBasicShapeInterpolationType::MaybeConvertInherit(
ConversionCheckers& conversion_checkers) const {
const BasicShape* shape = GetBasicShape(CssProperty(), *state.ParentStyle());
// const_cast to take a ref.
- conversion_checkers.push_back(InheritedShapeChecker::Create(
+ conversion_checkers.push_back(std::make_unique<InheritedShapeChecker>(
CssProperty(), const_cast<BasicShape*>(shape)));
return basic_shape_interpolation_functions::MaybeConvertBasicShape(
shape, state.ParentStyle()->EffectiveZoom());
@@ -136,7 +123,7 @@ InterpolationValue CSSBasicShapeInterpolationType::MaybeConvertValue(
if (!value.IsBaseValueList())
return basic_shape_interpolation_functions::MaybeConvertCSSValue(value);
- const CSSValueList& list = ToCSSValueList(value);
+ const auto& list = To<CSSValueList>(value);
if (list.length() != 1)
return nullptr;
return basic_shape_interpolation_functions::MaybeConvertCSSValue(
@@ -186,11 +173,11 @@ void CSSBasicShapeInterpolationType::ApplyStandardPropertyValue(
interpolable_value, *non_interpolable_value,
state.CssToLengthConversionData());
switch (CssProperty().PropertyID()) {
- case CSSPropertyShapeOutside:
+ case CSSPropertyID::kShapeOutside:
state.Style()->SetShapeOutside(
ShapeValue::CreateShapeValue(std::move(shape), CSSBoxType::kMissing));
break;
- case CSSPropertyClipPath:
+ case CSSPropertyID::kClipPath:
state.Style()->SetClipPath(
ShapeClipPathOperation::Create(std::move(shape)));
break;
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 c1288909dda..c8708cee48e 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
@@ -38,11 +38,13 @@ SideType GetSideType(const BorderImageLength& side) {
}
SideType GetSideType(const CSSValue& side) {
- if (side.IsPrimitiveValue() && ToCSSPrimitiveValue(side).IsNumber()) {
+ auto* side_primitive_value = DynamicTo<CSSPrimitiveValue>(side);
+ if (side_primitive_value && side_primitive_value->IsNumber()) {
return SideType::kNumber;
}
- if (side.IsIdentifierValue() &&
- ToCSSIdentifierValue(side).GetValueID() == CSSValueAuto) {
+ auto* side_identifier_value = DynamicTo<CSSIdentifierValue>(side);
+ if (side_identifier_value &&
+ side_identifier_value->GetValueID() == CSSValueID::kAuto) {
return SideType::kAuto;
}
return SideType::kLength;
@@ -78,18 +80,18 @@ const BorderImageLengthBox& GetBorderImageLengthBox(
const CSSProperty& property,
const ComputedStyle& style) {
switch (property.PropertyID()) {
- case CSSPropertyBorderImageOutset:
+ case CSSPropertyID::kBorderImageOutset:
return style.BorderImageOutset();
- case CSSPropertyBorderImageWidth:
+ case CSSPropertyID::kBorderImageWidth:
return style.BorderImageWidth();
- case CSSPropertyWebkitMaskBoxImageOutset:
+ case CSSPropertyID::kWebkitMaskBoxImageOutset:
return style.MaskBoxImageOutset();
- case CSSPropertyWebkitMaskBoxImageWidth:
+ case CSSPropertyID::kWebkitMaskBoxImageWidth:
return style.MaskBoxImageWidth();
default:
NOTREACHED();
return GetBorderImageLengthBox(
- CSSProperty::Get(CSSPropertyBorderImageOutset),
+ CSSProperty::Get(CSSPropertyID::kBorderImageOutset),
ComputedStyle::InitialStyle());
}
}
@@ -98,16 +100,16 @@ void SetBorderImageLengthBox(const CSSProperty& property,
ComputedStyle& style,
const BorderImageLengthBox& box) {
switch (property.PropertyID()) {
- case CSSPropertyBorderImageOutset:
+ case CSSPropertyID::kBorderImageOutset:
style.SetBorderImageOutset(box);
break;
- case CSSPropertyWebkitMaskBoxImageOutset:
+ case CSSPropertyID::kWebkitMaskBoxImageOutset:
style.SetMaskBoxImageOutset(box);
break;
- case CSSPropertyBorderImageWidth:
+ case CSSPropertyID::kBorderImageWidth:
style.SetBorderImageWidth(box);
break;
- case CSSPropertyWebkitMaskBoxImageWidth:
+ case CSSPropertyID::kWebkitMaskBoxImageWidth:
style.SetMaskBoxImageWidth(box);
break;
default:
@@ -169,12 +171,6 @@ namespace {
class UnderlyingSideTypesChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
- static std::unique_ptr<UnderlyingSideTypesChecker> Create(
- const SideTypes& underlying_side_types) {
- return base::WrapUnique(
- new UnderlyingSideTypesChecker(underlying_side_types));
- }
-
static SideTypes GetUnderlyingSideTypes(
const InterpolationValue& underlying) {
return ToCSSBorderImageLengthBoxNonInterpolableValue(
@@ -182,10 +178,10 @@ class UnderlyingSideTypesChecker
.GetSideTypes();
}
- private:
- UnderlyingSideTypesChecker(const SideTypes& underlying_side_types)
+ explicit UnderlyingSideTypesChecker(const SideTypes& underlying_side_types)
: underlying_side_types_(underlying_side_types) {}
+ private:
bool IsValid(const StyleResolverState&,
const InterpolationValue& underlying) const final {
return underlying_side_types_ == GetUnderlyingSideTypes(underlying);
@@ -197,18 +193,11 @@ class UnderlyingSideTypesChecker
class InheritedSideTypesChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
- static std::unique_ptr<InheritedSideTypesChecker> Create(
- const CSSProperty& property,
- const SideTypes& inherited_side_types) {
- return base::WrapUnique(
- new InheritedSideTypesChecker(property, inherited_side_types));
- }
-
- private:
InheritedSideTypesChecker(const CSSProperty& property,
const SideTypes& inherited_side_types)
: property_(property), inherited_side_types_(inherited_side_types) {}
+ private:
bool IsValid(const StyleResolverState& state,
const InterpolationValue& underlying) const final {
return inherited_side_types_ ==
@@ -221,8 +210,7 @@ class InheritedSideTypesChecker
InterpolationValue ConvertBorderImageLengthBox(const BorderImageLengthBox& box,
double zoom) {
- std::unique_ptr<InterpolableList> list =
- InterpolableList::Create(kSideIndexCount);
+ auto list = std::make_unique<InterpolableList>(kSideIndexCount);
Vector<scoped_refptr<NonInterpolableValue>> non_interpolable_values(
kSideIndexCount);
const BorderImageLength* sides[kSideIndexCount] = {};
@@ -234,9 +222,9 @@ InterpolationValue ConvertBorderImageLengthBox(const BorderImageLengthBox& box,
for (wtf_size_t i = 0; i < kSideIndexCount; i++) {
const BorderImageLength& side = *sides[i];
if (side.IsNumber()) {
- list->Set(i, InterpolableNumber::Create(side.Number()));
+ list->Set(i, std::make_unique<InterpolableNumber>(side.Number()));
} else if (side.length().IsAuto()) {
- list->Set(i, InterpolableList::Create(0));
+ list->Set(i, std::make_unique<InterpolableList>(0));
} else {
InterpolationValue converted_side =
LengthInterpolationFunctions::MaybeConvertLength(side.length(), zoom);
@@ -262,7 +250,7 @@ CSSBorderImageLengthBoxInterpolationType::MaybeConvertNeutral(
SideTypes underlying_side_types =
UnderlyingSideTypesChecker::GetUnderlyingSideTypes(underlying);
conversion_checkers.push_back(
- UnderlyingSideTypesChecker::Create(underlying_side_types));
+ std::make_unique<UnderlyingSideTypesChecker>(underlying_side_types));
return InterpolationValue(underlying.interpolable_value->CloneAndZero(),
ToCSSBorderImageLengthBoxNonInterpolableValue(
*underlying.non_interpolable_value)
@@ -283,8 +271,8 @@ CSSBorderImageLengthBoxInterpolationType::MaybeConvertInherit(
ConversionCheckers& conversion_checkers) const {
const BorderImageLengthBox& inherited =
GetBorderImageLengthBox(CssProperty(), *state.ParentStyle());
- conversion_checkers.push_back(
- InheritedSideTypesChecker::Create(CssProperty(), SideTypes(inherited)));
+ conversion_checkers.push_back(std::make_unique<InheritedSideTypesChecker>(
+ CssProperty(), SideTypes(inherited)));
return ConvertBorderImageLengthBox(inherited,
state.ParentStyle()->EffectiveZoom());
}
@@ -293,43 +281,48 @@ InterpolationValue CSSBorderImageLengthBoxInterpolationType::MaybeConvertValue(
const CSSValue& value,
const StyleResolverState*,
ConversionCheckers&) const {
- if (!value.IsQuadValue())
+ const auto* quad = DynamicTo<CSSQuadValue>(value);
+ if (!quad)
return nullptr;
- const CSSQuadValue& quad = ToCSSQuadValue(value);
- std::unique_ptr<InterpolableList> list =
- InterpolableList::Create(kSideIndexCount);
+ auto list = std::make_unique<InterpolableList>(kSideIndexCount);
Vector<scoped_refptr<NonInterpolableValue>> non_interpolable_values(
kSideIndexCount);
const CSSValue* sides[kSideIndexCount] = {};
- sides[kSideTop] = quad.Top();
- sides[kSideRight] = quad.Right();
- sides[kSideBottom] = quad.Bottom();
- sides[kSideLeft] = quad.Left();
+ sides[kSideTop] = quad->Top();
+ sides[kSideRight] = quad->Right();
+ sides[kSideBottom] = quad->Bottom();
+ sides[kSideLeft] = quad->Left();
for (wtf_size_t i = 0; i < kSideIndexCount; i++) {
const CSSValue& side = *sides[i];
- if (side.IsPrimitiveValue() && ToCSSPrimitiveValue(side).IsNumber()) {
- list->Set(i, InterpolableNumber::Create(
- ToCSSPrimitiveValue(side).GetDoubleValue()));
- } else if (side.IsIdentifierValue() &&
- ToCSSIdentifierValue(side).GetValueID() == CSSValueAuto) {
- list->Set(i, InterpolableList::Create(0));
- } else {
- InterpolationValue converted_side =
- LengthInterpolationFunctions::MaybeConvertCSSValue(side);
- if (!converted_side)
- return nullptr;
- list->Set(i, std::move(converted_side.interpolable_value));
- non_interpolable_values[i] =
- std::move(converted_side.non_interpolable_value);
+ auto* side_primitive_value = DynamicTo<CSSPrimitiveValue>(side);
+ if (side_primitive_value && side_primitive_value->IsNumber()) {
+ list->Set(i, std::make_unique<InterpolableNumber>(
+ side_primitive_value->GetDoubleValue()));
+ continue;
+ }
+
+ auto* side_identifier_value = DynamicTo<CSSIdentifierValue>(side);
+ if (side_identifier_value &&
+ side_identifier_value->GetValueID() == CSSValueID::kAuto) {
+ list->Set(i, std::make_unique<InterpolableList>(0));
+ continue;
}
+
+ InterpolationValue converted_side =
+ LengthInterpolationFunctions::MaybeConvertCSSValue(side);
+ if (!converted_side)
+ return nullptr;
+ list->Set(i, std::move(converted_side.interpolable_value));
+ non_interpolable_values[i] =
+ std::move(converted_side.non_interpolable_value);
}
return InterpolationValue(
std::move(list),
CSSBorderImageLengthBoxNonInterpolableValue::Create(
- SideTypes(quad), std::move(non_interpolable_values)));
+ SideTypes(*quad), std::move(non_interpolable_values)));
}
InterpolationValue CSSBorderImageLengthBoxInterpolationType::
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 8046ee436d6..07629097b8f 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
@@ -116,13 +116,10 @@ DEFINE_NON_INTERPOLABLE_VALUE_TYPE_CASTS(CSSClipNonInterpolableValue);
class UnderlyingAutosChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
+ explicit UnderlyingAutosChecker(const ClipAutos& underlying_autos)
+ : underlying_autos_(underlying_autos) {}
~UnderlyingAutosChecker() final = default;
- static std::unique_ptr<UnderlyingAutosChecker> Create(
- const ClipAutos& underlying_autos) {
- return base::WrapUnique(new UnderlyingAutosChecker(underlying_autos));
- }
-
static ClipAutos GetUnderlyingAutos(const InterpolationValue& underlying) {
if (!underlying)
return ClipAutos();
@@ -131,9 +128,6 @@ class UnderlyingAutosChecker
}
private:
- UnderlyingAutosChecker(const ClipAutos& underlying_autos)
- : underlying_autos_(underlying_autos) {}
-
bool IsValid(const StyleResolverState&,
const InterpolationValue& underlying) const final {
return underlying_autos_ == GetUnderlyingAutos(underlying);
@@ -154,14 +148,13 @@ static std::unique_ptr<InterpolableValue> ConvertClipComponent(
const Length& length,
double zoom) {
if (length.IsAuto())
- return InterpolableList::Create(0);
+ return std::make_unique<InterpolableList>(0);
return LengthInterpolationFunctions::MaybeConvertLength(length, zoom)
.interpolable_value;
}
static InterpolationValue CreateClipValue(const LengthBox& clip, double zoom) {
- std::unique_ptr<InterpolableList> list =
- InterpolableList::Create(kClipComponentIndexCount);
+ auto list = std::make_unique<InterpolableList>(kClipComponentIndexCount);
list->Set(kClipTop, ConvertClipComponent(clip.Top(), zoom));
list->Set(kClipRight, ConvertClipComponent(clip.Right(), zoom));
list->Set(kClipBottom, ConvertClipComponent(clip.Bottom(), zoom));
@@ -176,7 +169,7 @@ InterpolationValue CSSClipInterpolationType::MaybeConvertNeutral(
ClipAutos underlying_autos =
UnderlyingAutosChecker::GetUnderlyingAutos(underlying);
conversion_checkers.push_back(
- UnderlyingAutosChecker::Create(underlying_autos));
+ std::make_unique<UnderlyingAutosChecker>(underlying_autos));
if (underlying_autos.is_auto)
return nullptr;
LengthBox neutral_box(
@@ -205,14 +198,15 @@ InterpolationValue CSSClipInterpolationType::MaybeConvertInherit(
}
static bool IsCSSAuto(const CSSValue& value) {
- return value.IsIdentifierValue() &&
- ToCSSIdentifierValue(value).GetValueID() == CSSValueAuto;
+ auto* identifier_value = DynamicTo<CSSIdentifierValue>(value);
+ return identifier_value &&
+ identifier_value->GetValueID() == CSSValueID::kAuto;
}
static std::unique_ptr<InterpolableValue> ConvertClipComponent(
const CSSValue& length) {
if (IsCSSAuto(length))
- return InterpolableList::Create(0);
+ return std::make_unique<InterpolableList>(0);
return LengthInterpolationFunctions::MaybeConvertCSSValue(length)
.interpolable_value;
}
@@ -221,17 +215,16 @@ InterpolationValue CSSClipInterpolationType::MaybeConvertValue(
const CSSValue& value,
const StyleResolverState*,
ConversionCheckers&) const {
- if (!value.IsQuadValue())
+ const auto* quad = DynamicTo<CSSQuadValue>(value);
+ if (!quad)
return nullptr;
- const CSSQuadValue& quad = ToCSSQuadValue(value);
- std::unique_ptr<InterpolableList> list =
- InterpolableList::Create(kClipComponentIndexCount);
- list->Set(kClipTop, ConvertClipComponent(*quad.Top()));
- list->Set(kClipRight, ConvertClipComponent(*quad.Right()));
- list->Set(kClipBottom, ConvertClipComponent(*quad.Bottom()));
- list->Set(kClipLeft, ConvertClipComponent(*quad.Left()));
- ClipAutos autos(IsCSSAuto(*quad.Top()), IsCSSAuto(*quad.Right()),
- IsCSSAuto(*quad.Bottom()), IsCSSAuto(*quad.Left()));
+ auto list = std::make_unique<InterpolableList>(kClipComponentIndexCount);
+ list->Set(kClipTop, ConvertClipComponent(*quad->Top()));
+ list->Set(kClipRight, ConvertClipComponent(*quad->Right()));
+ list->Set(kClipBottom, ConvertClipComponent(*quad->Bottom()));
+ list->Set(kClipLeft, ConvertClipComponent(*quad->Left()));
+ ClipAutos autos(IsCSSAuto(*quad->Top()), IsCSSAuto(*quad->Right()),
+ IsCSSAuto(*quad->Bottom()), IsCSSAuto(*quad->Left()));
return InterpolationValue(std::move(list),
CSSClipNonInterpolableValue::Create(autos));
}
diff --git a/chromium/third_party/blink/renderer/core/animation/css_clip_interpolation_type.h b/chromium/third_party/blink/renderer/core/animation/css_clip_interpolation_type.h
index acf734b9234..c8cf1b06eeb 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_clip_interpolation_type.h
+++ b/chromium/third_party/blink/renderer/core/animation/css_clip_interpolation_type.h
@@ -13,7 +13,7 @@ class CSSClipInterpolationType : public CSSInterpolationType {
public:
CSSClipInterpolationType(PropertyHandle property)
: CSSInterpolationType(property) {
- DCHECK_EQ(CssProperty().PropertyID(), CSSPropertyClip);
+ DCHECK_EQ(CssProperty().PropertyID(), CSSPropertyID::kClip);
}
InterpolationValue MaybeConvertStandardPropertyUnderlyingValue(
diff --git a/chromium/third_party/blink/renderer/core/animation/css_color_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_color_interpolation_type.cc
index fa2106da6b8..0383871f1e2 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_color_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css_color_interpolation_type.cc
@@ -33,40 +33,41 @@ enum InterpolableColorIndex : unsigned {
static std::unique_ptr<InterpolableValue> CreateInterpolableColorForIndex(
InterpolableColorIndex index) {
DCHECK_LT(index, kInterpolableColorIndexCount);
- std::unique_ptr<InterpolableList> list =
- InterpolableList::Create(kInterpolableColorIndexCount);
+ auto list = std::make_unique<InterpolableList>(kInterpolableColorIndexCount);
for (unsigned i = 0; i < kInterpolableColorIndexCount; i++)
- list->Set(i, InterpolableNumber::Create(i == index));
+ list->Set(i, std::make_unique<InterpolableNumber>(i == index));
return std::move(list);
}
std::unique_ptr<InterpolableValue>
CSSColorInterpolationType::CreateInterpolableColor(const Color& color) {
- std::unique_ptr<InterpolableList> list =
- InterpolableList::Create(kInterpolableColorIndexCount);
- list->Set(kRed, InterpolableNumber::Create(color.Red() * color.Alpha()));
- list->Set(kGreen, InterpolableNumber::Create(color.Green() * color.Alpha()));
- list->Set(kBlue, InterpolableNumber::Create(color.Blue() * color.Alpha()));
- list->Set(kAlpha, InterpolableNumber::Create(color.Alpha()));
- list->Set(kCurrentcolor, InterpolableNumber::Create(0));
- list->Set(kWebkitActivelink, InterpolableNumber::Create(0));
- list->Set(kWebkitLink, InterpolableNumber::Create(0));
- list->Set(kQuirkInherit, InterpolableNumber::Create(0));
+ auto list = std::make_unique<InterpolableList>(kInterpolableColorIndexCount);
+ list->Set(kRed,
+ std::make_unique<InterpolableNumber>(color.Red() * color.Alpha()));
+ list->Set(kGreen, std::make_unique<InterpolableNumber>(color.Green() *
+ color.Alpha()));
+ list->Set(kBlue,
+ std::make_unique<InterpolableNumber>(color.Blue() * color.Alpha()));
+ list->Set(kAlpha, std::make_unique<InterpolableNumber>(color.Alpha()));
+ list->Set(kCurrentcolor, std::make_unique<InterpolableNumber>(0));
+ list->Set(kWebkitActivelink, std::make_unique<InterpolableNumber>(0));
+ list->Set(kWebkitLink, std::make_unique<InterpolableNumber>(0));
+ list->Set(kQuirkInherit, std::make_unique<InterpolableNumber>(0));
return std::move(list);
}
std::unique_ptr<InterpolableValue>
CSSColorInterpolationType::CreateInterpolableColor(CSSValueID keyword) {
switch (keyword) {
- case CSSValueCurrentcolor:
+ case CSSValueID::kCurrentcolor:
return CreateInterpolableColorForIndex(kCurrentcolor);
- case CSSValueWebkitActivelink:
+ case CSSValueID::kWebkitActivelink:
return CreateInterpolableColorForIndex(kWebkitActivelink);
- case CSSValueWebkitLink:
+ case CSSValueID::kWebkitLink:
return CreateInterpolableColorForIndex(kWebkitLink);
- case CSSValueInternalQuirkInherit:
+ case CSSValueID::kInternalQuirkInherit:
return CreateInterpolableColorForIndex(kQuirkInherit);
- case CSSValueWebkitFocusRingColor:
+ case CSSValueID::kWebkitFocusRingColor:
return CreateInterpolableColor(LayoutTheme::GetTheme().FocusRingColor());
default:
DCHECK(StyleColor::IsColorKeyword(keyword));
@@ -83,14 +84,14 @@ CSSColorInterpolationType::CreateInterpolableColor(const StyleColor& color) {
std::unique_ptr<InterpolableValue>
CSSColorInterpolationType::MaybeCreateInterpolableColor(const CSSValue& value) {
- if (value.IsColorValue())
- return CreateInterpolableColor(ToCSSColorValue(value).Value());
- if (!value.IsIdentifierValue())
+ if (auto* color_value = DynamicTo<CSSColorValue>(value))
+ return CreateInterpolableColor(color_value->Value());
+ auto* identifier_value = DynamicTo<CSSIdentifierValue>(value);
+ if (!identifier_value)
return nullptr;
- const CSSIdentifierValue& identifier_value = ToCSSIdentifierValue(value);
- if (!StyleColor::IsColorKeyword(identifier_value.GetValueID()))
+ if (!StyleColor::IsColorKeyword(identifier_value->GetValueID()))
return nullptr;
- return CreateInterpolableColor(identifier_value.GetValueID());
+ return CreateInterpolableColor(identifier_value->GetValueID());
}
static void AddPremultipliedColor(double& red,
@@ -127,13 +128,14 @@ Color CSSColorInterpolationType::ResolveInterpolableColor(
StyleColor current_style_color = StyleColor::CurrentColor();
if (is_text_decoration) {
current_style_color =
- current_color_getter(CSSProperty::Get(CSSPropertyWebkitTextFillColor),
- *state.Style())
+ current_color_getter(
+ CSSProperty::Get(CSSPropertyID::kWebkitTextFillColor),
+ *state.Style())
.Access();
}
if (current_style_color.IsCurrentColor()) {
current_style_color =
- current_color_getter(CSSProperty::Get(CSSPropertyColor),
+ current_color_getter(CSSProperty::Get(CSSPropertyID::kColor),
*state.Style())
.Access();
}
@@ -167,17 +169,11 @@ Color CSSColorInterpolationType::ResolveInterpolableColor(
class InheritedColorChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
- static std::unique_ptr<InheritedColorChecker> Create(
- const CSSProperty& property,
- const OptionalStyleColor& color) {
- return base::WrapUnique(new InheritedColorChecker(property, color));
- }
-
- private:
InheritedColorChecker(const CSSProperty& property,
const OptionalStyleColor& color)
: property_(property), color_(color) {}
+ private:
bool IsValid(const StyleResolverState& state,
const InterpolationValue& underlying) const final {
return color_ == ColorPropertyFunctions::GetUnvisitedColor(
@@ -216,7 +212,7 @@ InterpolationValue CSSColorInterpolationType::MaybeConvertInherit(
ColorPropertyFunctions::GetUnvisitedColor(CssProperty(),
*state.ParentStyle());
conversion_checkers.push_back(
- InheritedColorChecker::Create(CssProperty(), inherited_color));
+ std::make_unique<InheritedColorChecker>(CssProperty(), inherited_color));
return ConvertStyleColorPair(inherited_color, inherited_color);
}
@@ -230,19 +226,21 @@ InterpolationValue CSSColorInterpolationType::MaybeConvertValue(
const CSSValue& value,
const StyleResolverState* state,
ConversionCheckers& conversion_checkers) const {
- if (CssProperty().PropertyID() == CSSPropertyColor &&
- value.IsIdentifierValue() &&
- ToCSSIdentifierValue(value).GetValueID() == CSSValueCurrentcolor) {
- DCHECK(state);
- return MaybeConvertInherit(*state, conversion_checkers);
+ if (CssProperty().PropertyID() == CSSPropertyID::kColor) {
+ auto* identifier_value = DynamicTo<CSSIdentifierValue>(value);
+ if (identifier_value &&
+ identifier_value->GetValueID() == CSSValueID::kCurrentcolor) {
+ DCHECK(state);
+ return MaybeConvertInherit(*state, conversion_checkers);
+ }
}
std::unique_ptr<InterpolableValue> interpolable_color =
MaybeCreateInterpolableColor(value);
if (!interpolable_color)
return nullptr;
- std::unique_ptr<InterpolableList> color_pair =
- InterpolableList::Create(kInterpolableColorPairIndexCount);
+ auto color_pair =
+ std::make_unique<InterpolableList>(kInterpolableColorPairIndexCount);
color_pair->Set(kUnvisited, interpolable_color->Clone());
color_pair->Set(kVisited, std::move(interpolable_color));
return InterpolationValue(std::move(color_pair));
@@ -254,8 +252,8 @@ InterpolationValue CSSColorInterpolationType::ConvertStyleColorPair(
if (unvisited_color.IsNull() || visited_color.IsNull()) {
return nullptr;
}
- std::unique_ptr<InterpolableList> color_pair =
- InterpolableList::Create(kInterpolableColorPairIndexCount);
+ auto color_pair =
+ std::make_unique<InterpolableList>(kInterpolableColorPairIndexCount);
color_pair->Set(kUnvisited,
CreateInterpolableColor(unvisited_color.Access()));
color_pair->Set(kVisited, CreateInterpolableColor(visited_color.Access()));
@@ -280,12 +278,12 @@ void CSSColorInterpolationType::ApplyStandardPropertyValue(
CssProperty(), *state.Style(),
ResolveInterpolableColor(
*color_pair.Get(kUnvisited), state, false,
- CssProperty().PropertyID() == CSSPropertyTextDecorationColor));
+ CssProperty().PropertyID() == CSSPropertyID::kTextDecorationColor));
ColorPropertyFunctions::SetVisitedColor(
CssProperty(), *state.Style(),
ResolveInterpolableColor(
*color_pair.Get(kVisited), state, true,
- CssProperty().PropertyID() == CSSPropertyTextDecorationColor));
+ CssProperty().PropertyID() == CSSPropertyID::kTextDecorationColor));
}
const CSSValue* CSSColorInterpolationType::CreateCSSValue(
diff --git a/chromium/third_party/blink/renderer/core/animation/css_custom_list_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_custom_list_interpolation_type.cc
index 75df242561c..2f20993e011 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_custom_list_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css_custom_list_interpolation_type.cc
@@ -18,7 +18,7 @@ InterpolationValue CSSCustomListInterpolationType::MaybeConvertNeutral(
size_t underlying_length =
UnderlyingLengthChecker::GetUnderlyingLength(underlying);
conversion_checkers.push_back(
- UnderlyingLengthChecker::Create(underlying_length));
+ std::make_unique<UnderlyingLengthChecker>(underlying_length));
if (underlying_length == 0)
return nullptr;
@@ -39,16 +39,16 @@ InterpolationValue CSSCustomListInterpolationType::MaybeConvertValue(
const CSSValue& value,
const StyleResolverState* state,
ConversionCheckers&) const {
- if (!value.IsValueList())
+ const auto* list = DynamicTo<CSSValueList>(value);
+ if (!list)
return nullptr;
ConversionCheckers null_checkers;
- const CSSValueList& list = ToCSSValueList(value);
return ListInterpolationFunctions::CreateList(
- list.length(), [this, &list, state, &null_checkers](size_t index) {
+ list->length(), [this, list, state, &null_checkers](size_t index) {
return this->inner_interpolation_type_->MaybeConvertValue(
- list.Item(index), state, null_checkers);
+ list->Item(index), state, null_checkers);
});
}
diff --git a/chromium/third_party/blink/renderer/core/animation/css_default_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_default_interpolation_type.cc
index 7cb1a882fe3..25eba0fe7d5 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_default_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css_default_interpolation_type.cc
@@ -28,7 +28,7 @@ InterpolationValue CSSDefaultInterpolationType::MaybeConvertSingle(
return nullptr;
}
return InterpolationValue(
- InterpolableList::Create(0),
+ std::make_unique<InterpolableList>(0),
CSSDefaultNonInterpolableValue::Create(
ToCSSPropertySpecificKeyframe(keyframe).Value()));
}
diff --git a/chromium/third_party/blink/renderer/core/animation/css_filter_list_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_filter_list_interpolation_type.cc
index eea3067d4c7..a27c0c84703 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_filter_list_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css_filter_list_interpolation_type.cc
@@ -26,9 +26,9 @@ const FilterOperations& GetFilterList(const CSSProperty& property,
default:
NOTREACHED();
FALLTHROUGH;
- case CSSPropertyBackdropFilter:
+ case CSSPropertyID::kBackdropFilter:
return style.BackdropFilter();
- case CSSPropertyFilter:
+ case CSSPropertyID::kFilter:
return style.Filter();
}
}
@@ -37,10 +37,10 @@ void SetFilterList(const CSSProperty& property,
ComputedStyle& style,
const FilterOperations& filter_operations) {
switch (property.PropertyID()) {
- case CSSPropertyBackdropFilter:
+ case CSSPropertyID::kBackdropFilter:
style.SetBackdropFilter(filter_operations);
break;
- case CSSPropertyFilter:
+ case CSSPropertyID::kFilter:
style.SetFilter(filter_operations);
break;
default:
@@ -52,11 +52,9 @@ void SetFilterList(const CSSProperty& property,
class UnderlyingFilterListChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
- static std::unique_ptr<UnderlyingFilterListChecker> Create(
- scoped_refptr<NonInterpolableList> non_interpolable_list) {
- return base::WrapUnique(
- new UnderlyingFilterListChecker(std::move(non_interpolable_list)));
- }
+ UnderlyingFilterListChecker(
+ scoped_refptr<NonInterpolableList> non_interpolable_list)
+ : non_interpolable_list_(std::move(non_interpolable_list)) {}
bool IsValid(const StyleResolverState&,
const InterpolationValue& underlying) const final {
@@ -75,22 +73,17 @@ class UnderlyingFilterListChecker
}
private:
- UnderlyingFilterListChecker(
- scoped_refptr<NonInterpolableList> non_interpolable_list)
- : non_interpolable_list_(std::move(non_interpolable_list)) {}
-
scoped_refptr<NonInterpolableList> non_interpolable_list_;
};
class InheritedFilterListChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
- static std::unique_ptr<InheritedFilterListChecker> Create(
- const CSSProperty& property,
- const FilterOperations& filter_operations) {
- return base::WrapUnique(
- new InheritedFilterListChecker(property, filter_operations));
- }
+ InheritedFilterListChecker(const CSSProperty& property,
+ const FilterOperations& filter_operations)
+ : property_(property),
+ filter_operations_wrapper_(
+ MakeGarbageCollected<FilterOperationsWrapper>(filter_operations)) {}
bool IsValid(const StyleResolverState& state,
const InterpolationValue&) const final {
@@ -100,12 +93,6 @@ class InheritedFilterListChecker
}
private:
- InheritedFilterListChecker(const CSSProperty& property,
- const FilterOperations& filter_operations)
- : property_(property),
- filter_operations_wrapper_(
- FilterOperationsWrapper::Create(filter_operations)) {}
-
const CSSProperty& property_;
Persistent<FilterOperationsWrapper> filter_operations_wrapper_;
};
@@ -113,8 +100,7 @@ class InheritedFilterListChecker
InterpolationValue ConvertFilterList(const FilterOperations& filter_operations,
double zoom) {
wtf_size_t length = filter_operations.size();
- std::unique_ptr<InterpolableList> interpolable_list =
- InterpolableList::Create(length);
+ auto interpolable_list = std::make_unique<InterpolableList>(length);
Vector<scoped_refptr<NonInterpolableValue>> non_interpolable_values(length);
for (wtf_size_t i = 0; i < length; i++) {
InterpolationValue filter_result =
@@ -140,7 +126,7 @@ InterpolationValue CSSFilterListInterpolationType::MaybeConvertNeutral(
NonInterpolableList& non_interpolable_list = const_cast<NonInterpolableList&>(
ToNonInterpolableList(*underlying.non_interpolable_value));
conversion_checkers.push_back(
- UnderlyingFilterListChecker::Create(&non_interpolable_list));
+ std::make_unique<UnderlyingFilterListChecker>(&non_interpolable_list));
return InterpolationValue(underlying.interpolable_value->CloneAndZero(),
&non_interpolable_list);
}
@@ -157,7 +143,7 @@ InterpolationValue CSSFilterListInterpolationType::MaybeConvertInherit(
ConversionCheckers& conversion_checkers) const {
const FilterOperations& inherited_filter_operations =
GetFilterList(CssProperty(), *state.ParentStyle());
- conversion_checkers.push_back(InheritedFilterListChecker::Create(
+ conversion_checkers.push_back(std::make_unique<InheritedFilterListChecker>(
CssProperty(), inherited_filter_operations));
return ConvertFilterList(inherited_filter_operations,
state.Style()->EffectiveZoom());
@@ -167,18 +153,17 @@ InterpolationValue CSSFilterListInterpolationType::MaybeConvertValue(
const CSSValue& value,
const StyleResolverState*,
ConversionCheckers&) const {
- if (value.IsIdentifierValue() &&
- ToCSSIdentifierValue(value).GetValueID() == CSSValueNone)
- return InterpolationValue(InterpolableList::Create(0),
+ auto* identifier_value = DynamicTo<CSSIdentifierValue>(value);
+ if (identifier_value && identifier_value->GetValueID() == CSSValueID::kNone)
+ return InterpolationValue(std::make_unique<InterpolableList>(0),
NonInterpolableList::Create());
if (!value.IsBaseValueList())
return nullptr;
- const CSSValueList& list = ToCSSValueList(value);
+ const auto& list = To<CSSValueList>(value);
wtf_size_t length = list.length();
- std::unique_ptr<InterpolableList> interpolable_list =
- InterpolableList::Create(length);
+ auto interpolable_list = std::make_unique<InterpolableList>(length);
Vector<scoped_refptr<NonInterpolableValue>> non_interpolable_values(length);
for (wtf_size_t i = 0; i < length; i++) {
InterpolationValue item_result =
@@ -235,8 +220,8 @@ PairwiseInterpolationValue CSSFilterListInterpolationType::MaybeMergeSingles(
ToInterpolableList(*shorter.interpolable_value);
const NonInterpolableList& longer_non_interpolable_list =
ToNonInterpolableList(*longer.non_interpolable_value);
- std::unique_ptr<InterpolableList> extended_interpolable_list =
- InterpolableList::Create(longer_length);
+ auto extended_interpolable_list =
+ std::make_unique<InterpolableList>(longer_length);
for (wtf_size_t i = 0; i < longer_length; i++) {
if (i < shorter_length)
extended_interpolable_list->Set(
@@ -289,8 +274,7 @@ void CSSFilterListInterpolationType::Composite(
if (length <= underlying_length)
return;
- std::unique_ptr<InterpolableList> extended_interpolable_list =
- InterpolableList::Create(length);
+ auto extended_interpolable_list = std::make_unique<InterpolableList>(length);
for (wtf_size_t i = 0; i < length; i++) {
if (i < underlying_length)
extended_interpolable_list->Set(
diff --git a/chromium/third_party/blink/renderer/core/animation/css_font_size_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_font_size_interpolation_type.cc
index 0bd5d9c40fd..d69a3b6754c 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_font_size_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css_font_size_interpolation_type.cc
@@ -21,12 +21,9 @@ namespace {
class IsMonospaceChecker : public CSSInterpolationType::CSSConversionChecker {
public:
- static std::unique_ptr<IsMonospaceChecker> Create(bool is_monospace) {
- return base::WrapUnique(new IsMonospaceChecker(is_monospace));
- }
+ IsMonospaceChecker(bool is_monospace) : is_monospace_(is_monospace) {}
private:
- IsMonospaceChecker(bool is_monospace) : is_monospace_(is_monospace) {}
bool IsValid(const StyleResolverState& state,
const InterpolationValue&) const final {
@@ -39,15 +36,10 @@ class IsMonospaceChecker : public CSSInterpolationType::CSSConversionChecker {
class InheritedFontSizeChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
- static std::unique_ptr<InheritedFontSizeChecker> Create(
- const FontDescription::Size& inherited_font_size) {
- return base::WrapUnique(new InheritedFontSizeChecker(inherited_font_size));
- }
-
- private:
InheritedFontSizeChecker(const FontDescription::Size& inherited_font_size)
: inherited_font_size_(inherited_font_size.value) {}
+ private:
bool IsValid(const StyleResolverState& state,
const InterpolationValue&) const final {
return inherited_font_size_ ==
@@ -68,19 +60,20 @@ InterpolationValue MaybeConvertKeyword(
InterpolationType::ConversionCheckers& conversion_checkers) {
if (FontSizeFunctions::IsValidValueID(value_id)) {
bool is_monospace = state.Style()->GetFontDescription().IsMonospace();
- conversion_checkers.push_back(IsMonospaceChecker::Create(is_monospace));
+ conversion_checkers.push_back(
+ std::make_unique<IsMonospaceChecker>(is_monospace));
return ConvertFontSize(state.GetFontBuilder().FontSizeForKeyword(
FontSizeFunctions::KeywordSize(value_id), is_monospace));
}
- if (value_id != CSSValueSmaller && value_id != CSSValueLarger)
+ if (value_id != CSSValueID::kSmaller && value_id != CSSValueID::kLarger)
return nullptr;
const FontDescription::Size& inherited_font_size =
state.ParentFontDescription().GetSize();
conversion_checkers.push_back(
- InheritedFontSizeChecker::Create(inherited_font_size));
- if (value_id == CSSValueSmaller)
+ std::make_unique<InheritedFontSizeChecker>(inherited_font_size));
+ if (value_id == CSSValueID::kSmaller)
return ConvertFontSize(
FontDescription::SmallerSize(inherited_font_size).value);
return ConvertFontSize(
@@ -109,7 +102,7 @@ InterpolationValue CSSFontSizeInterpolationType::MaybeConvertInherit(
const FontDescription::Size& inherited_font_size =
state.ParentFontDescription().GetSize();
conversion_checkers.push_back(
- InheritedFontSizeChecker::Create(inherited_font_size));
+ std::make_unique<InheritedFontSizeChecker>(inherited_font_size));
return ConvertFontSize(inherited_font_size.value);
}
@@ -123,11 +116,12 @@ InterpolationValue CSSFontSizeInterpolationType::MaybeConvertValue(
if (result)
return InterpolationValue(std::move(result));
- if (!value.IsIdentifierValue())
+ auto* identifier_value = DynamicTo<CSSIdentifierValue>(value);
+ if (!identifier_value)
return nullptr;
DCHECK(state);
- return MaybeConvertKeyword(ToCSSIdentifierValue(value).GetValueID(), *state,
+ return MaybeConvertKeyword(identifier_value->GetValueID(), *state,
conversion_checkers);
}
diff --git a/chromium/third_party/blink/renderer/core/animation/css_font_size_interpolation_type.h b/chromium/third_party/blink/renderer/core/animation/css_font_size_interpolation_type.h
index 71e0e704198..ce78dc0594b 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_font_size_interpolation_type.h
+++ b/chromium/third_party/blink/renderer/core/animation/css_font_size_interpolation_type.h
@@ -13,7 +13,7 @@ class CSSFontSizeInterpolationType : public CSSInterpolationType {
public:
CSSFontSizeInterpolationType(PropertyHandle property)
: CSSInterpolationType(property) {
- DCHECK_EQ(CssProperty().PropertyID(), CSSPropertyFontSize);
+ DCHECK_EQ(CssProperty().PropertyID(), CSSPropertyID::kFontSize);
}
InterpolationValue MaybeConvertStandardPropertyUnderlyingValue(
diff --git a/chromium/third_party/blink/renderer/core/animation/css_font_variation_settings_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_font_variation_settings_interpolation_type.cc
index 2eb8bc30487..6262ba25091 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_font_variation_settings_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css_font_variation_settings_interpolation_type.cc
@@ -57,16 +57,11 @@ static bool TagsMatch(const NonInterpolableValue& a,
class UnderlyingTagsChecker : public InterpolationType::ConversionChecker {
public:
+ explicit UnderlyingTagsChecker(const Vector<AtomicString>& tags)
+ : tags_(tags) {}
~UnderlyingTagsChecker() final = default;
- static std::unique_ptr<UnderlyingTagsChecker> Create(
- const Vector<AtomicString>& tags) {
- return base::WrapUnique(new UnderlyingTagsChecker(tags));
- }
-
private:
- UnderlyingTagsChecker(const Vector<AtomicString>& tags) : tags_(tags) {}
-
bool IsValid(const InterpolationEnvironment&,
const InterpolationValue& underlying) const final {
return tags_ == GetTags(*underlying.non_interpolable_value);
@@ -78,18 +73,13 @@ class UnderlyingTagsChecker : public InterpolationType::ConversionChecker {
class InheritedFontVariationSettingsChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
- ~InheritedFontVariationSettingsChecker() final = default;
+ explicit InheritedFontVariationSettingsChecker(
+ const FontVariationSettings* settings)
+ : settings_(settings) {}
- static std::unique_ptr<InheritedFontVariationSettingsChecker> Create(
- const FontVariationSettings* settings) {
- return base::WrapUnique(
- new InheritedFontVariationSettingsChecker(settings));
- }
+ ~InheritedFontVariationSettingsChecker() final = default;
private:
- InheritedFontVariationSettingsChecker(const FontVariationSettings* settings)
- : settings_(settings) {}
-
bool IsValid(const StyleResolverState& state,
const InterpolationValue&) const final {
return DataEquivalent(
@@ -106,10 +96,11 @@ static InterpolationValue ConvertFontVariationSettings(
return nullptr;
}
wtf_size_t length = settings->size();
- std::unique_ptr<InterpolableList> numbers = InterpolableList::Create(length);
+ auto numbers = std::make_unique<InterpolableList>(length);
Vector<AtomicString> tags;
for (wtf_size_t i = 0; i < length; ++i) {
- numbers->Set(i, InterpolableNumber::Create(settings->at(i).Value()));
+ numbers->Set(i,
+ std::make_unique<InterpolableNumber>(settings->at(i).Value()));
tags.push_back(settings->at(i).Tag());
}
return InterpolationValue(
@@ -121,7 +112,7 @@ InterpolationValue
CSSFontVariationSettingsInterpolationType::MaybeConvertNeutral(
const InterpolationValue& underlying,
ConversionCheckers& conversion_checkers) const {
- conversion_checkers.push_back(UnderlyingTagsChecker::Create(
+ conversion_checkers.push_back(std::make_unique<UnderlyingTagsChecker>(
GetTags(*underlying.non_interpolable_value)));
return InterpolationValue(underlying.interpolable_value->CloneAndZero(),
underlying.non_interpolable_value);
@@ -141,7 +132,7 @@ CSSFontVariationSettingsInterpolationType::MaybeConvertInherit(
const FontVariationSettings* inherited =
state.ParentStyle()->GetFontDescription().VariationSettings();
conversion_checkers.push_back(
- InheritedFontVariationSettingsChecker::Create(inherited));
+ std::make_unique<InheritedFontVariationSettingsChecker>(inherited));
return ConvertFontVariationSettings(inherited);
}
@@ -149,17 +140,16 @@ InterpolationValue CSSFontVariationSettingsInterpolationType::MaybeConvertValue(
const CSSValue& value,
const StyleResolverState*,
ConversionCheckers&) const {
- if (!value.IsValueList()) {
+ const auto* list = DynamicTo<CSSValueList>(value);
+ if (!list) {
return nullptr;
}
- const CSSValueList& list = ToCSSValueList(value);
- wtf_size_t length = list.length();
- std::unique_ptr<InterpolableList> numbers = InterpolableList::Create(length);
+ wtf_size_t length = list->length();
+ auto numbers = std::make_unique<InterpolableList>(length);
Vector<AtomicString> tags;
for (wtf_size_t i = 0; i < length; ++i) {
- const cssvalue::CSSFontVariationValue& item =
- cssvalue::ToCSSFontVariationValue(list.Item(i));
- numbers->Set(i, InterpolableNumber::Create(item.Value()));
+ const auto& item = To<cssvalue::CSSFontVariationValue>(list->Item(i));
+ numbers->Set(i, std::make_unique<InterpolableNumber>(item.Value()));
tags.push_back(item.Tag());
}
return InterpolationValue(
diff --git a/chromium/third_party/blink/renderer/core/animation/css_font_variation_settings_interpolation_type.h b/chromium/third_party/blink/renderer/core/animation/css_font_variation_settings_interpolation_type.h
index 9c3abf2b9ca..75fb8e216d1 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_font_variation_settings_interpolation_type.h
+++ b/chromium/third_party/blink/renderer/core/animation/css_font_variation_settings_interpolation_type.h
@@ -13,7 +13,8 @@ class CSSFontVariationSettingsInterpolationType : public CSSInterpolationType {
public:
CSSFontVariationSettingsInterpolationType(PropertyHandle property)
: CSSInterpolationType(property) {
- DCHECK_EQ(CssProperty().PropertyID(), CSSPropertyFontVariationSettings);
+ DCHECK_EQ(CssProperty().PropertyID(),
+ CSSPropertyID::kFontVariationSettings);
}
InterpolationValue MaybeConvertStandardPropertyUnderlyingValue(
diff --git a/chromium/third_party/blink/renderer/core/animation/css_font_weight_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_font_weight_interpolation_type.cc
index 294ee3e22b3..b3c5a38e541 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_font_weight_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css_font_weight_interpolation_type.cc
@@ -17,15 +17,10 @@ namespace blink {
class InheritedFontWeightChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
- static std::unique_ptr<InheritedFontWeightChecker> Create(
- FontSelectionValue font_weight) {
- return base::WrapUnique(new InheritedFontWeightChecker(font_weight));
- }
-
- private:
- InheritedFontWeightChecker(FontSelectionValue font_weight)
+ explicit InheritedFontWeightChecker(FontSelectionValue font_weight)
: font_weight_(font_weight) {}
+ private:
bool IsValid(const StyleResolverState& state,
const InterpolationValue&) const final {
return font_weight_ == state.ParentStyle()->GetFontWeight();
@@ -36,13 +31,13 @@ class InheritedFontWeightChecker
InterpolationValue CSSFontWeightInterpolationType::CreateFontWeightValue(
FontSelectionValue font_weight) const {
- return InterpolationValue(InterpolableNumber::Create(font_weight));
+ return InterpolationValue(std::make_unique<InterpolableNumber>(font_weight));
}
InterpolationValue CSSFontWeightInterpolationType::MaybeConvertNeutral(
const InterpolationValue&,
ConversionCheckers&) const {
- return InterpolationValue(InterpolableNumber::Create(0));
+ return InterpolationValue(std::make_unique<InterpolableNumber>(0));
}
InterpolationValue CSSFontWeightInterpolationType::MaybeConvertInitial(
@@ -59,7 +54,7 @@ InterpolationValue CSSFontWeightInterpolationType::MaybeConvertInherit(
FontSelectionValue inherited_font_weight =
state.ParentStyle()->GetFontWeight();
conversion_checkers.push_back(
- InheritedFontWeightChecker::Create(inherited_font_weight));
+ std::make_unique<InheritedFontWeightChecker>(inherited_font_weight));
return CreateFontWeightValue(inherited_font_weight);
}
@@ -67,31 +62,30 @@ InterpolationValue CSSFontWeightInterpolationType::MaybeConvertValue(
const CSSValue& value,
const StyleResolverState* state,
ConversionCheckers& conversion_checkers) const {
- if (value.IsPrimitiveValue()) {
+ if (auto* primitive_value = DynamicTo<CSSPrimitiveValue>(value)) {
return CreateFontWeightValue(
- FontSelectionValue(ToCSSPrimitiveValue(value).GetFloatValue()));
+ FontSelectionValue(primitive_value->GetFloatValue()));
}
- CHECK(value.IsIdentifierValue());
- const CSSIdentifierValue& identifier_value = ToCSSIdentifierValue(value);
+ const auto& identifier_value = To<CSSIdentifierValue>(value);
CSSValueID keyword = identifier_value.GetValueID();
switch (keyword) {
- case CSSValueInvalid:
+ case CSSValueID::kInvalid:
return nullptr;
- case CSSValueNormal:
+ case CSSValueID::kNormal:
return CreateFontWeightValue(NormalWeightValue());
- case CSSValueBold:
+ case CSSValueID::kBold:
return CreateFontWeightValue(BoldWeightValue());
- case CSSValueBolder:
- case CSSValueLighter: {
+ case CSSValueID::kBolder:
+ case CSSValueID::kLighter: {
DCHECK(state);
FontSelectionValue inherited_font_weight =
state->ParentStyle()->GetFontWeight();
conversion_checkers.push_back(
- InheritedFontWeightChecker::Create(inherited_font_weight));
- if (keyword == CSSValueBolder) {
+ std::make_unique<InheritedFontWeightChecker>(inherited_font_weight));
+ if (keyword == CSSValueID::kBolder) {
return CreateFontWeightValue(
FontDescription::BolderWeight(inherited_font_weight));
}
diff --git a/chromium/third_party/blink/renderer/core/animation/css_font_weight_interpolation_type.h b/chromium/third_party/blink/renderer/core/animation/css_font_weight_interpolation_type.h
index b05e57c8f7b..e069fbb349a 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_font_weight_interpolation_type.h
+++ b/chromium/third_party/blink/renderer/core/animation/css_font_weight_interpolation_type.h
@@ -13,7 +13,7 @@ class CSSFontWeightInterpolationType : public CSSInterpolationType {
public:
CSSFontWeightInterpolationType(PropertyHandle property)
: CSSInterpolationType(property) {
- DCHECK_EQ(CssProperty().PropertyID(), CSSPropertyFontWeight);
+ DCHECK_EQ(CssProperty().PropertyID(), CSSPropertyID::kFontWeight);
}
InterpolationValue MaybeConvertStandardPropertyUnderlyingValue(
diff --git a/chromium/third_party/blink/renderer/core/animation/css_image_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_image_interpolation_type.cc
index 067f9b6425b..9addee2037e 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_image_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css_image_interpolation_type.cc
@@ -20,11 +20,11 @@ namespace {
const StyleImage* GetStyleImage(const CSSProperty& property,
const ComputedStyle& style) {
switch (property.PropertyID()) {
- case CSSPropertyBorderImageSource:
+ case CSSPropertyID::kBorderImageSource:
return style.BorderImageSource();
- case CSSPropertyListStyleImage:
+ case CSSPropertyID::kListStyleImage:
return style.ListStyleImage();
- case CSSPropertyWebkitMaskBoxImageSource:
+ case CSSPropertyID::kWebkitMaskBoxImageSource:
return style.MaskBoxImageSource();
default:
NOTREACHED();
@@ -57,7 +57,7 @@ class CSSImageNonInterpolableValue : public NonInterpolableValue {
return start_;
if (progress >= 1)
return end_;
- return cssvalue::CSSCrossfadeValue::Create(
+ return MakeGarbageCollected<cssvalue::CSSCrossfadeValue>(
start_, end_,
CSSPrimitiveValue::Create(progress,
CSSPrimitiveValue::UnitType::kNumber));
@@ -103,7 +103,7 @@ InterpolationValue CSSImageInterpolationType::MaybeConvertCSSValue(
bool accept_gradients) {
if (value.IsImageValue() || (value.IsGradientValue() && accept_gradients)) {
CSSValue* refable_css_value = const_cast<CSSValue*>(&value);
- return InterpolationValue(InterpolableNumber::Create(1),
+ return InterpolationValue(std::make_unique<InterpolableNumber>(1),
CSSImageNonInterpolableValue::Create(
refable_css_value, refable_css_value));
}
@@ -120,7 +120,8 @@ CSSImageInterpolationType::StaticMergeSingleConversions(
return nullptr;
}
return PairwiseInterpolationValue(
- InterpolableNumber::Create(0), InterpolableNumber::Create(1),
+ std::make_unique<InterpolableNumber>(0),
+ std::make_unique<InterpolableNumber>(1),
CSSImageNonInterpolableValue::Merge(start.non_interpolable_value,
end.non_interpolable_value));
}
@@ -159,17 +160,11 @@ bool CSSImageInterpolationType::EqualNonInterpolableValues(
class UnderlyingImageChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
- ~UnderlyingImageChecker() final = default;
-
- static std::unique_ptr<UnderlyingImageChecker> Create(
- const InterpolationValue& underlying) {
- return base::WrapUnique(new UnderlyingImageChecker(underlying));
- }
-
- private:
UnderlyingImageChecker(const InterpolationValue& underlying)
: underlying_(underlying.Clone()) {}
+ ~UnderlyingImageChecker() final = default;
+ private:
bool IsValid(const StyleResolverState&,
const InterpolationValue& underlying) const final {
if (!underlying && !underlying_)
@@ -189,7 +184,8 @@ class UnderlyingImageChecker
InterpolationValue CSSImageInterpolationType::MaybeConvertNeutral(
const InterpolationValue& underlying,
ConversionCheckers& conversion_checkers) const {
- conversion_checkers.push_back(UnderlyingImageChecker::Create(underlying));
+ conversion_checkers.push_back(
+ std::make_unique<UnderlyingImageChecker>(underlying));
return InterpolationValue(underlying.Clone());
}
@@ -202,20 +198,12 @@ InterpolationValue CSSImageInterpolationType::MaybeConvertInitial(
class InheritedImageChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
- ~InheritedImageChecker() final = default;
-
- static std::unique_ptr<InheritedImageChecker> Create(
- const CSSProperty& property,
- StyleImage* inherited_image) {
- return base::WrapUnique(
- new InheritedImageChecker(property, inherited_image));
- }
-
- private:
InheritedImageChecker(const CSSProperty& property,
StyleImage* inherited_image)
: property_(property), inherited_image_(inherited_image) {}
+ ~InheritedImageChecker() final = default;
+ private:
bool IsValid(const StyleResolverState& state,
const InterpolationValue& underlying) const final {
const StyleImage* inherited_image =
@@ -241,7 +229,7 @@ InterpolationValue CSSImageInterpolationType::MaybeConvertInherit(
GetStyleImage(CssProperty(), *state.ParentStyle());
StyleImage* refable_image = const_cast<StyleImage*>(inherited_image);
conversion_checkers.push_back(
- InheritedImageChecker::Create(CssProperty(), refable_image));
+ std::make_unique<InheritedImageChecker>(CssProperty(), refable_image));
return MaybeConvertStyleImage(inherited_image, true);
}
@@ -273,13 +261,13 @@ void CSSImageInterpolationType::ApplyStandardPropertyValue(
StyleImage* image = ResolveStyleImage(CssProperty(), interpolable_value,
non_interpolable_value, state);
switch (CssProperty().PropertyID()) {
- case CSSPropertyBorderImageSource:
+ case CSSPropertyID::kBorderImageSource:
state.Style()->SetBorderImageSource(image);
break;
- case CSSPropertyListStyleImage:
+ case CSSPropertyID::kListStyleImage:
state.Style()->SetListStyleImage(image);
break;
- case CSSPropertyWebkitMaskBoxImageSource:
+ case CSSPropertyID::kWebkitMaskBoxImageSource:
state.Style()->SetMaskBoxImageSource(image);
break;
default:
diff --git a/chromium/third_party/blink/renderer/core/animation/css_image_list_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_image_list_interpolation_type.cc
index 893589c499c..f543ad9ec12 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_image_list_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css_image_list_interpolation_type.cc
@@ -21,17 +21,11 @@ namespace blink {
class UnderlyingImageListChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
+ explicit UnderlyingImageListChecker(const InterpolationValue& underlying)
+ : underlying_(underlying.Clone()) {}
~UnderlyingImageListChecker() final = default;
- static std::unique_ptr<UnderlyingImageListChecker> Create(
- const InterpolationValue& underlying) {
- return base::WrapUnique(new UnderlyingImageListChecker(underlying));
- }
-
private:
- UnderlyingImageListChecker(const InterpolationValue& underlying)
- : underlying_(underlying.Clone()) {}
-
bool IsValid(const StyleResolverState&,
const InterpolationValue& underlying) const final {
return ListInterpolationFunctions::EqualValues(
@@ -45,7 +39,8 @@ class UnderlyingImageListChecker
InterpolationValue CSSImageListInterpolationType::MaybeConvertNeutral(
const InterpolationValue& underlying,
ConversionCheckers& conversion_checkers) const {
- conversion_checkers.push_back(UnderlyingImageListChecker::Create(underlying));
+ conversion_checkers.push_back(
+ std::make_unique<UnderlyingImageListChecker>(underlying));
return underlying.Clone();
}
@@ -73,20 +68,13 @@ InterpolationValue CSSImageListInterpolationType::MaybeConvertStyleImageList(
class InheritedImageListChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
- ~InheritedImageListChecker() final = default;
-
- static std::unique_ptr<InheritedImageListChecker> Create(
- const CSSProperty& property,
- const StyleImageList* inherited_image_list) {
- return base::WrapUnique(
- new InheritedImageListChecker(property, inherited_image_list));
- }
-
- private:
InheritedImageListChecker(const CSSProperty& property,
const StyleImageList* inherited_image_list)
: property_(property), inherited_image_list_(inherited_image_list) {}
+ ~InheritedImageListChecker() final = default;
+
+ private:
bool IsValid(const StyleResolverState& state,
const InterpolationValue& underlying) const final {
StyleImageList* inherited_image_list =
@@ -109,8 +97,8 @@ InterpolationValue CSSImageListInterpolationType::MaybeConvertInherit(
StyleImageList* inherited_image_list = MakeGarbageCollected<StyleImageList>();
ImageListPropertyFunctions::GetImageList(CssProperty(), *state.ParentStyle(),
inherited_image_list);
- conversion_checkers.push_back(
- InheritedImageListChecker::Create(CssProperty(), inherited_image_list));
+ conversion_checkers.push_back(std::make_unique<InheritedImageListChecker>(
+ CssProperty(), inherited_image_list));
return MaybeConvertStyleImageList(inherited_image_list);
}
@@ -118,8 +106,8 @@ InterpolationValue CSSImageListInterpolationType::MaybeConvertValue(
const CSSValue& value,
const StyleResolverState*,
ConversionCheckers&) const {
- if (value.IsIdentifierValue() &&
- ToCSSIdentifierValue(value).GetValueID() == CSSValueNone)
+ auto* identifier_value = DynamicTo<CSSIdentifierValue>(value);
+ if (identifier_value && identifier_value->GetValueID() == CSSValueID::kNone)
return nullptr;
CSSValueList* temp_list = nullptr;
@@ -127,12 +115,10 @@ InterpolationValue CSSImageListInterpolationType::MaybeConvertValue(
temp_list = CSSValueList::CreateCommaSeparated();
temp_list->Append(value);
}
- const CSSValueList& value_list =
- temp_list ? *temp_list : ToCSSValueList(value);
+ const auto& value_list = temp_list ? *temp_list : To<CSSValueList>(value);
const wtf_size_t length = value_list.length();
- std::unique_ptr<InterpolableList> interpolable_list =
- InterpolableList::Create(length);
+ auto interpolable_list = std::make_unique<InterpolableList>(length);
Vector<scoped_refptr<NonInterpolableValue>> non_interpolable_values(length);
for (wtf_size_t i = 0; i < length; i++) {
InterpolationValue component =
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 bcddce842df..2686262fef4 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
@@ -27,17 +27,26 @@ struct SliceTypes {
fill = slice.fill;
}
explicit SliceTypes(const cssvalue::CSSBorderImageSliceValue& slice) {
- is_number[kSideTop] = slice.Slices().Top()->IsPrimitiveValue() &&
- ToCSSPrimitiveValue(slice.Slices().Top())->IsNumber();
+ auto* top_primitive_value =
+ DynamicTo<CSSPrimitiveValue>(slice.Slices().Top());
+ is_number[kSideTop] =
+ top_primitive_value && top_primitive_value->IsNumber();
+
+ auto* right_primitive_value =
+ DynamicTo<CSSPrimitiveValue>(slice.Slices().Right());
is_number[kSideRight] =
- slice.Slices().Right()->IsPrimitiveValue() &&
- ToCSSPrimitiveValue(slice.Slices().Right())->IsNumber();
+ right_primitive_value && right_primitive_value->IsNumber();
+
+ auto* bottom_primitive_value =
+ DynamicTo<CSSPrimitiveValue>(slice.Slices().Bottom());
is_number[kSideBottom] =
- slice.Slices().Bottom()->IsPrimitiveValue() &&
- ToCSSPrimitiveValue(slice.Slices().Bottom())->IsNumber();
+ bottom_primitive_value && bottom_primitive_value->IsNumber();
+
+ auto* left_primitive_value =
+ DynamicTo<CSSPrimitiveValue>(slice.Slices().Left());
is_number[kSideLeft] =
- slice.Slices().Left()->IsPrimitiveValue() &&
- ToCSSPrimitiveValue(slice.Slices().Left())->IsNumber();
+ left_primitive_value && left_primitive_value->IsNumber();
+
fill = slice.Fill();
}
@@ -82,10 +91,8 @@ namespace {
class UnderlyingSliceTypesChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
- static std::unique_ptr<UnderlyingSliceTypesChecker> Create(
- const SliceTypes& underlying_types) {
- return base::WrapUnique(new UnderlyingSliceTypesChecker(underlying_types));
- }
+ explicit UnderlyingSliceTypesChecker(const SliceTypes& underlying_types)
+ : underlying_types_(underlying_types) {}
static SliceTypes GetUnderlyingSliceTypes(
const InterpolationValue& underlying) {
@@ -95,9 +102,6 @@ class UnderlyingSliceTypesChecker
}
private:
- UnderlyingSliceTypesChecker(const SliceTypes& underlying_types)
- : underlying_types_(underlying_types) {}
-
bool IsValid(const StyleResolverState&,
const InterpolationValue& underlying) const final {
return underlying_types_ == GetUnderlyingSliceTypes(underlying);
@@ -109,18 +113,11 @@ class UnderlyingSliceTypesChecker
class InheritedSliceTypesChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
- static std::unique_ptr<InheritedSliceTypesChecker> Create(
- const CSSProperty& property,
- const SliceTypes& inherited_types) {
- return base::WrapUnique(
- new InheritedSliceTypesChecker(property, inherited_types));
- }
-
- private:
InheritedSliceTypesChecker(const CSSProperty& property,
const SliceTypes& inherited_types)
: property_(property), inherited_types_(inherited_types) {}
+ private:
bool IsValid(const StyleResolverState& state,
const InterpolationValue& underlying) const final {
return inherited_types_ ==
@@ -133,8 +130,7 @@ class InheritedSliceTypesChecker
};
InterpolationValue ConvertImageSlice(const ImageSlice& slice, double zoom) {
- std::unique_ptr<InterpolableList> list =
- InterpolableList::Create(kSideIndexCount);
+ auto list = std::make_unique<InterpolableList>(kSideIndexCount);
const Length* sides[kSideIndexCount] = {};
sides[kSideTop] = &slice.slices.Top();
sides[kSideRight] = &slice.slices.Right();
@@ -143,7 +139,7 @@ InterpolationValue ConvertImageSlice(const ImageSlice& slice, double zoom) {
for (wtf_size_t i = 0; i < kSideIndexCount; i++) {
const Length& side = *sides[i];
- list->Set(i, InterpolableNumber::Create(
+ list->Set(i, std::make_unique<InterpolableNumber>(
side.IsFixed() ? side.Pixels() / zoom : side.Percent()));
}
@@ -160,7 +156,7 @@ InterpolationValue CSSImageSliceInterpolationType::MaybeConvertNeutral(
SliceTypes underlying_types =
UnderlyingSliceTypesChecker::GetUnderlyingSliceTypes(underlying);
conversion_checkers.push_back(
- UnderlyingSliceTypesChecker::Create(underlying_types));
+ std::make_unique<UnderlyingSliceTypesChecker>(underlying_types));
LengthBox zero_box(
underlying_types.is_number[kSideTop] ? Length::Fixed(0)
: Length::Percent(0),
@@ -186,7 +182,7 @@ InterpolationValue CSSImageSliceInterpolationType::MaybeConvertInherit(
const ImageSlice& inherited_image_slice =
ImageSlicePropertyFunctions::GetImageSlice(CssProperty(),
*state.ParentStyle());
- conversion_checkers.push_back(InheritedSliceTypesChecker::Create(
+ conversion_checkers.push_back(std::make_unique<InheritedSliceTypesChecker>(
CssProperty(), SliceTypes(inherited_image_slice)));
return ConvertImageSlice(inherited_image_slice,
state.ParentStyle()->EffectiveZoom());
@@ -196,13 +192,12 @@ InterpolationValue CSSImageSliceInterpolationType::MaybeConvertValue(
const CSSValue& value,
const StyleResolverState*,
ConversionCheckers&) const {
- if (!value.IsBorderImageSliceValue())
+ if (!IsA<cssvalue::CSSBorderImageSliceValue>(value))
return nullptr;
const cssvalue::CSSBorderImageSliceValue& slice =
- cssvalue::ToCSSBorderImageSliceValue(value);
- std::unique_ptr<InterpolableList> list =
- InterpolableList::Create(kSideIndexCount);
+ To<cssvalue::CSSBorderImageSliceValue>(value);
+ auto list = std::make_unique<InterpolableList>(kSideIndexCount);
const CSSValue* sides[kSideIndexCount];
sides[kSideTop] = slice.Slices().Top();
sides[kSideRight] = slice.Slices().Right();
@@ -210,9 +205,9 @@ InterpolationValue CSSImageSliceInterpolationType::MaybeConvertValue(
sides[kSideLeft] = slice.Slices().Left();
for (wtf_size_t i = 0; i < kSideIndexCount; i++) {
- const CSSPrimitiveValue& side = *ToCSSPrimitiveValue(sides[i]);
+ const auto& side = *To<CSSPrimitiveValue>(sides[i]);
DCHECK(side.IsNumber() || side.IsPercentage());
- list->Set(i, InterpolableNumber::Create(side.GetDoubleValue()));
+ list->Set(i, std::make_unique<InterpolableNumber>(side.GetDoubleValue()));
}
return InterpolationValue(
diff --git a/chromium/third_party/blink/renderer/core/animation/css_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_interpolation_type.cc
index 101252cb947..29081598968 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css_interpolation_type.cc
@@ -29,15 +29,6 @@ namespace blink {
class ResolvedVariableChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
- static std::unique_ptr<ResolvedVariableChecker> Create(
- CSSPropertyID property,
- const CSSValue* variable_reference,
- const CSSValue* resolved_value) {
- return base::WrapUnique(new ResolvedVariableChecker(
- property, variable_reference, resolved_value));
- }
-
- private:
ResolvedVariableChecker(CSSPropertyID property,
const CSSValue* variable_reference,
const CSSValue* resolved_value)
@@ -45,6 +36,7 @@ class ResolvedVariableChecker
variable_reference_(variable_reference),
resolved_value_(resolved_value) {}
+ private:
bool IsValid(const StyleResolverState& state,
const InterpolationValue& underlying) const final {
// TODO(alancutter): Just check the variables referenced instead of doing a
@@ -64,16 +56,6 @@ class ResolvedVariableChecker
class InheritedCustomPropertyChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
- static std::unique_ptr<InheritedCustomPropertyChecker> Create(
- const AtomicString& property,
- bool is_inherited_property,
- const CSSValue* inherited_value,
- const CSSValue* initial_value) {
- return base::WrapUnique(new InheritedCustomPropertyChecker(
- property, is_inherited_property, inherited_value, initial_value));
- }
-
- private:
InheritedCustomPropertyChecker(const AtomicString& name,
bool is_inherited_property,
const CSSValue* inherited_value,
@@ -83,6 +65,7 @@ class InheritedCustomPropertyChecker
inherited_value_(inherited_value),
initial_value_(initial_value) {}
+ private:
bool IsValid(const StyleResolverState& state,
const InterpolationValue&) const final {
const CSSValue* inherited_value =
@@ -103,20 +86,13 @@ class InheritedCustomPropertyChecker
class ResolvedRegisteredCustomPropertyChecker
: public InterpolationType::ConversionChecker {
public:
- static std::unique_ptr<ResolvedRegisteredCustomPropertyChecker> Create(
- const CSSCustomPropertyDeclaration& declaration,
- scoped_refptr<CSSVariableData> resolved_tokens) {
- return base::WrapUnique(new ResolvedRegisteredCustomPropertyChecker(
- declaration, std::move(resolved_tokens)));
- }
-
- private:
ResolvedRegisteredCustomPropertyChecker(
const CSSCustomPropertyDeclaration& declaration,
scoped_refptr<CSSVariableData> resolved_tokens)
: declaration_(declaration),
resolved_tokens_(std::move(resolved_tokens)) {}
+ private:
bool IsValid(const InterpolationEnvironment& environment,
const InterpolationValue&) const final {
DCHECK(ToCSSInterpolationEnvironment(environment).HasVariableResolver());
@@ -172,7 +148,7 @@ InterpolationValue CSSInterpolationType::MaybeConvertSingleInternal(
if (GetProperty().IsCSSCustomProperty()) {
DCHECK(css_environment.HasVariableResolver());
return MaybeConvertCustomPropertyDeclaration(
- ToCSSCustomPropertyDeclaration(*value), state,
+ To<CSSCustomPropertyDeclaration>(*value), state,
css_environment.VariableResolver(), conversion_checkers);
}
@@ -182,7 +158,7 @@ InterpolationValue CSSInterpolationType::MaybeConvertSingleInternal(
const CSSValue* resolved_value =
CSSVariableResolver(state).ResolveVariableReferences(
CssProperty().PropertyID(), *value, omit_animation_tainted);
- conversion_checkers.push_back(ResolvedVariableChecker::Create(
+ conversion_checkers.push_back(std::make_unique<ResolvedVariableChecker>(
CssProperty().PropertyID(), value, resolved_value));
value = resolved_value;
}
@@ -221,8 +197,9 @@ InterpolationValue CSSInterpolationType::MaybeConvertCustomPropertyDeclaration(
if (!value) {
value = Registration().Initial();
}
- conversion_checkers.push_back(InheritedCustomPropertyChecker::Create(
- name, is_inherited_property, value, Registration().Initial()));
+ conversion_checkers.push_back(
+ std::make_unique<InheritedCustomPropertyChecker>(
+ name, is_inherited_property, value, Registration().Initial()));
}
if (!value) {
return nullptr;
@@ -238,8 +215,8 @@ InterpolationValue CSSInterpolationType::MaybeConvertCustomPropertyDeclaration(
declaration, cycle_detected);
DCHECK(!cycle_detected);
conversion_checkers.push_back(
- ResolvedRegisteredCustomPropertyChecker::Create(declaration,
- resolved_tokens));
+ std::make_unique<ResolvedRegisteredCustomPropertyChecker>(
+ declaration, resolved_tokens));
} else {
resolved_tokens = declaration.Value();
}
diff --git a/chromium/third_party/blink/renderer/core/animation/css_interpolation_types_map.cc b/chromium/third_party/blink/renderer/core/animation/css_interpolation_types_map.cc
index 602dd12cacf..e60c294470a 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_interpolation_types_map.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css_interpolation_types_map.cc
@@ -117,237 +117,237 @@ const InterpolationTypes& CSSInterpolationTypesMap::Get(
LayoutAnimationsPolicy::AffectedCSSProperties().Contains(&css_property);
if (allow_all_animations_ || !property_maybe_blocked_by_feature_policy) {
switch (css_property.PropertyID()) {
- case CSSPropertyBaselineShift:
- case CSSPropertyBorderBottomWidth:
- case CSSPropertyBorderLeftWidth:
- case CSSPropertyBorderRightWidth:
- case CSSPropertyBorderTopWidth:
- case CSSPropertyBottom:
- case CSSPropertyCx:
- case CSSPropertyCy:
- case CSSPropertyFlexBasis:
- case CSSPropertyHeight:
- case CSSPropertyLeft:
- case CSSPropertyLetterSpacing:
- case CSSPropertyMarginBottom:
- case CSSPropertyMarginLeft:
- case CSSPropertyMarginRight:
- case CSSPropertyMarginTop:
- case CSSPropertyMaxHeight:
- case CSSPropertyMaxWidth:
- case CSSPropertyMinHeight:
- case CSSPropertyMinWidth:
- case CSSPropertyOffsetDistance:
- case CSSPropertyOutlineOffset:
- case CSSPropertyOutlineWidth:
- case CSSPropertyPaddingBottom:
- case CSSPropertyPaddingLeft:
- case CSSPropertyPaddingRight:
- case CSSPropertyPaddingTop:
- case CSSPropertyPerspective:
- case CSSPropertyR:
- case CSSPropertyRight:
- case CSSPropertyRx:
- case CSSPropertyRy:
- case CSSPropertyShapeMargin:
- case CSSPropertyStrokeDashoffset:
- case CSSPropertyStrokeWidth:
- case CSSPropertyTop:
- case CSSPropertyVerticalAlign:
- case CSSPropertyWebkitBorderHorizontalSpacing:
- case CSSPropertyWebkitBorderVerticalSpacing:
- case CSSPropertyColumnGap:
- case CSSPropertyRowGap:
- case CSSPropertyColumnRuleWidth:
- case CSSPropertyColumnWidth:
- case CSSPropertyWebkitPerspectiveOriginX:
- case CSSPropertyWebkitPerspectiveOriginY:
- case CSSPropertyWebkitTransformOriginX:
- case CSSPropertyWebkitTransformOriginY:
- case CSSPropertyWebkitTransformOriginZ:
- case CSSPropertyWidth:
- case CSSPropertyWordSpacing:
- case CSSPropertyX:
- case CSSPropertyY:
+ case CSSPropertyID::kBaselineShift:
+ case CSSPropertyID::kBorderBottomWidth:
+ case CSSPropertyID::kBorderLeftWidth:
+ case CSSPropertyID::kBorderRightWidth:
+ case CSSPropertyID::kBorderTopWidth:
+ case CSSPropertyID::kBottom:
+ case CSSPropertyID::kCx:
+ case CSSPropertyID::kCy:
+ case CSSPropertyID::kFlexBasis:
+ case CSSPropertyID::kHeight:
+ case CSSPropertyID::kLeft:
+ case CSSPropertyID::kLetterSpacing:
+ case CSSPropertyID::kMarginBottom:
+ case CSSPropertyID::kMarginLeft:
+ case CSSPropertyID::kMarginRight:
+ case CSSPropertyID::kMarginTop:
+ case CSSPropertyID::kMaxHeight:
+ case CSSPropertyID::kMaxWidth:
+ case CSSPropertyID::kMinHeight:
+ case CSSPropertyID::kMinWidth:
+ case CSSPropertyID::kOffsetDistance:
+ case CSSPropertyID::kOutlineOffset:
+ case CSSPropertyID::kOutlineWidth:
+ case CSSPropertyID::kPaddingBottom:
+ case CSSPropertyID::kPaddingLeft:
+ case CSSPropertyID::kPaddingRight:
+ case CSSPropertyID::kPaddingTop:
+ case CSSPropertyID::kPerspective:
+ case CSSPropertyID::kR:
+ case CSSPropertyID::kRight:
+ case CSSPropertyID::kRx:
+ case CSSPropertyID::kRy:
+ case CSSPropertyID::kShapeMargin:
+ case CSSPropertyID::kStrokeDashoffset:
+ case CSSPropertyID::kStrokeWidth:
+ case CSSPropertyID::kTop:
+ case CSSPropertyID::kVerticalAlign:
+ case CSSPropertyID::kWebkitBorderHorizontalSpacing:
+ case CSSPropertyID::kWebkitBorderVerticalSpacing:
+ case CSSPropertyID::kColumnGap:
+ case CSSPropertyID::kRowGap:
+ case CSSPropertyID::kColumnRuleWidth:
+ case CSSPropertyID::kColumnWidth:
+ case CSSPropertyID::kWebkitPerspectiveOriginX:
+ case CSSPropertyID::kWebkitPerspectiveOriginY:
+ case CSSPropertyID::kWebkitTransformOriginX:
+ case CSSPropertyID::kWebkitTransformOriginY:
+ case CSSPropertyID::kWebkitTransformOriginZ:
+ case CSSPropertyID::kWidth:
+ case CSSPropertyID::kWordSpacing:
+ case CSSPropertyID::kX:
+ case CSSPropertyID::kY:
applicable_types->push_back(
std::make_unique<CSSLengthInterpolationType>(used_property));
break;
- case CSSPropertyFlexGrow:
- case CSSPropertyFlexShrink:
- case CSSPropertyFillOpacity:
- case CSSPropertyFloodOpacity:
- case CSSPropertyFontSizeAdjust:
- case CSSPropertyOpacity:
- case CSSPropertyOrder:
- case CSSPropertyOrphans:
- case CSSPropertyShapeImageThreshold:
- case CSSPropertyStopOpacity:
- case CSSPropertyStrokeMiterlimit:
- case CSSPropertyStrokeOpacity:
- case CSSPropertyColumnCount:
- case CSSPropertyTextSizeAdjust:
- case CSSPropertyWidows:
- case CSSPropertyZIndex:
+ case CSSPropertyID::kFlexGrow:
+ case CSSPropertyID::kFlexShrink:
+ case CSSPropertyID::kFillOpacity:
+ case CSSPropertyID::kFloodOpacity:
+ case CSSPropertyID::kFontSizeAdjust:
+ case CSSPropertyID::kOpacity:
+ case CSSPropertyID::kOrder:
+ case CSSPropertyID::kOrphans:
+ case CSSPropertyID::kShapeImageThreshold:
+ case CSSPropertyID::kStopOpacity:
+ case CSSPropertyID::kStrokeMiterlimit:
+ case CSSPropertyID::kStrokeOpacity:
+ case CSSPropertyID::kColumnCount:
+ case CSSPropertyID::kTextSizeAdjust:
+ case CSSPropertyID::kWidows:
+ case CSSPropertyID::kZIndex:
applicable_types->push_back(
std::make_unique<CSSNumberInterpolationType>(used_property));
break;
- case CSSPropertyLineHeight:
+ case CSSPropertyID::kLineHeight:
applicable_types->push_back(
std::make_unique<CSSLengthInterpolationType>(used_property));
applicable_types->push_back(
std::make_unique<CSSNumberInterpolationType>(used_property));
break;
- case CSSPropertyBackgroundColor:
- case CSSPropertyBorderBottomColor:
- case CSSPropertyBorderLeftColor:
- case CSSPropertyBorderRightColor:
- case CSSPropertyBorderTopColor:
- case CSSPropertyCaretColor:
- case CSSPropertyColor:
- case CSSPropertyFloodColor:
- case CSSPropertyLightingColor:
- case CSSPropertyOutlineColor:
- case CSSPropertyStopColor:
- case CSSPropertyTextDecorationColor:
- case CSSPropertyColumnRuleColor:
- case CSSPropertyWebkitTextStrokeColor:
+ case CSSPropertyID::kBackgroundColor:
+ case CSSPropertyID::kBorderBottomColor:
+ case CSSPropertyID::kBorderLeftColor:
+ case CSSPropertyID::kBorderRightColor:
+ case CSSPropertyID::kBorderTopColor:
+ case CSSPropertyID::kCaretColor:
+ case CSSPropertyID::kColor:
+ case CSSPropertyID::kFloodColor:
+ case CSSPropertyID::kLightingColor:
+ case CSSPropertyID::kOutlineColor:
+ case CSSPropertyID::kStopColor:
+ case CSSPropertyID::kTextDecorationColor:
+ case CSSPropertyID::kColumnRuleColor:
+ case CSSPropertyID::kWebkitTextStrokeColor:
applicable_types->push_back(
std::make_unique<CSSColorInterpolationType>(used_property));
break;
- case CSSPropertyFill:
- case CSSPropertyStroke:
+ case CSSPropertyID::kFill:
+ case CSSPropertyID::kStroke:
applicable_types->push_back(
std::make_unique<CSSPaintInterpolationType>(used_property));
break;
- case CSSPropertyOffsetPath:
+ case CSSPropertyID::kOffsetPath:
applicable_types->push_back(
std::make_unique<CSSRayInterpolationType>(used_property));
FALLTHROUGH;
- case CSSPropertyD:
+ case CSSPropertyID::kD:
applicable_types->push_back(
std::make_unique<CSSPathInterpolationType>(used_property));
break;
- case CSSPropertyBoxShadow:
- case CSSPropertyTextShadow:
+ case CSSPropertyID::kBoxShadow:
+ case CSSPropertyID::kTextShadow:
applicable_types->push_back(
std::make_unique<CSSShadowListInterpolationType>(used_property));
break;
- case CSSPropertyBorderImageSource:
- case CSSPropertyListStyleImage:
- case CSSPropertyWebkitMaskBoxImageSource:
+ case CSSPropertyID::kBorderImageSource:
+ case CSSPropertyID::kListStyleImage:
+ case CSSPropertyID::kWebkitMaskBoxImageSource:
applicable_types->push_back(
std::make_unique<CSSImageInterpolationType>(used_property));
break;
- case CSSPropertyBackgroundImage:
- case CSSPropertyWebkitMaskImage:
+ case CSSPropertyID::kBackgroundImage:
+ case CSSPropertyID::kWebkitMaskImage:
applicable_types->push_back(
std::make_unique<CSSImageListInterpolationType>(used_property));
break;
- case CSSPropertyStrokeDasharray:
+ case CSSPropertyID::kStrokeDasharray:
applicable_types->push_back(
std::make_unique<CSSLengthListInterpolationType>(used_property));
break;
- case CSSPropertyFontWeight:
+ case CSSPropertyID::kFontWeight:
applicable_types->push_back(
std::make_unique<CSSFontWeightInterpolationType>(used_property));
break;
- case CSSPropertyFontVariationSettings:
+ case CSSPropertyID::kFontVariationSettings:
applicable_types->push_back(
std::make_unique<CSSFontVariationSettingsInterpolationType>(
used_property));
break;
- case CSSPropertyVisibility:
+ case CSSPropertyID::kVisibility:
applicable_types->push_back(
std::make_unique<CSSVisibilityInterpolationType>(used_property));
break;
- case CSSPropertyClip:
+ case CSSPropertyID::kClip:
applicable_types->push_back(
std::make_unique<CSSClipInterpolationType>(used_property));
break;
- case CSSPropertyOffsetRotate:
+ case CSSPropertyID::kOffsetRotate:
applicable_types->push_back(
std::make_unique<CSSOffsetRotateInterpolationType>(used_property));
break;
- case CSSPropertyBackgroundPositionX:
- case CSSPropertyBackgroundPositionY:
- case CSSPropertyWebkitMaskPositionX:
- case CSSPropertyWebkitMaskPositionY:
+ case CSSPropertyID::kBackgroundPositionX:
+ case CSSPropertyID::kBackgroundPositionY:
+ case CSSPropertyID::kWebkitMaskPositionX:
+ case CSSPropertyID::kWebkitMaskPositionY:
applicable_types->push_back(
std::make_unique<CSSPositionAxisListInterpolationType>(
used_property));
break;
- case CSSPropertyObjectPosition:
- case CSSPropertyOffsetAnchor:
- case CSSPropertyOffsetPosition:
- case CSSPropertyPerspectiveOrigin:
+ case CSSPropertyID::kObjectPosition:
+ case CSSPropertyID::kOffsetAnchor:
+ case CSSPropertyID::kOffsetPosition:
+ case CSSPropertyID::kPerspectiveOrigin:
applicable_types->push_back(
std::make_unique<CSSPositionInterpolationType>(used_property));
break;
- case CSSPropertyBorderBottomLeftRadius:
- case CSSPropertyBorderBottomRightRadius:
- case CSSPropertyBorderTopLeftRadius:
- case CSSPropertyBorderTopRightRadius:
+ case CSSPropertyID::kBorderBottomLeftRadius:
+ case CSSPropertyID::kBorderBottomRightRadius:
+ case CSSPropertyID::kBorderTopLeftRadius:
+ case CSSPropertyID::kBorderTopRightRadius:
applicable_types->push_back(
std::make_unique<CSSLengthPairInterpolationType>(used_property));
break;
- case CSSPropertyTranslate:
+ case CSSPropertyID::kTranslate:
applicable_types->push_back(
std::make_unique<CSSTranslateInterpolationType>(used_property));
break;
- case CSSPropertyTransformOrigin:
+ case CSSPropertyID::kTransformOrigin:
applicable_types->push_back(
std::make_unique<CSSTransformOriginInterpolationType>(
used_property));
break;
- case CSSPropertyBackgroundSize:
- case CSSPropertyWebkitMaskSize:
+ case CSSPropertyID::kBackgroundSize:
+ case CSSPropertyID::kWebkitMaskSize:
applicable_types->push_back(
std::make_unique<CSSSizeListInterpolationType>(used_property));
break;
- case CSSPropertyBorderImageOutset:
- case CSSPropertyBorderImageWidth:
- case CSSPropertyWebkitMaskBoxImageOutset:
- case CSSPropertyWebkitMaskBoxImageWidth:
+ case CSSPropertyID::kBorderImageOutset:
+ case CSSPropertyID::kBorderImageWidth:
+ case CSSPropertyID::kWebkitMaskBoxImageOutset:
+ case CSSPropertyID::kWebkitMaskBoxImageWidth:
applicable_types->push_back(
std::make_unique<CSSBorderImageLengthBoxInterpolationType>(
used_property));
break;
- case CSSPropertyScale:
+ case CSSPropertyID::kScale:
applicable_types->push_back(
std::make_unique<CSSScaleInterpolationType>(used_property));
break;
- case CSSPropertyFontSize:
+ case CSSPropertyID::kFontSize:
applicable_types->push_back(
std::make_unique<CSSFontSizeInterpolationType>(used_property));
break;
- case CSSPropertyTextIndent:
+ case CSSPropertyID::kTextIndent:
applicable_types->push_back(
std::make_unique<CSSTextIndentInterpolationType>(used_property));
break;
- case CSSPropertyBorderImageSlice:
- case CSSPropertyWebkitMaskBoxImageSlice:
+ case CSSPropertyID::kBorderImageSlice:
+ case CSSPropertyID::kWebkitMaskBoxImageSlice:
applicable_types->push_back(
std::make_unique<CSSImageSliceInterpolationType>(used_property));
break;
- case CSSPropertyClipPath:
- case CSSPropertyShapeOutside:
+ case CSSPropertyID::kClipPath:
+ case CSSPropertyID::kShapeOutside:
applicable_types->push_back(
std::make_unique<CSSBasicShapeInterpolationType>(used_property));
break;
- case CSSPropertyRotate:
+ case CSSPropertyID::kRotate:
applicable_types->push_back(
std::make_unique<CSSRotateInterpolationType>(used_property));
break;
- case CSSPropertyBackdropFilter:
- case CSSPropertyFilter:
+ case CSSPropertyID::kBackdropFilter:
+ case CSSPropertyID::kFilter:
applicable_types->push_back(
std::make_unique<CSSFilterListInterpolationType>(used_property));
break;
- case CSSPropertyTransform:
+ case CSSPropertyID::kTransform:
applicable_types->push_back(
std::make_unique<CSSTransformInterpolationType>(used_property));
break;
- case CSSPropertyVariable:
+ case CSSPropertyID::kVariable:
DCHECK_EQ(GetRegistration(registry_.Get(), property), nullptr);
break;
default:
diff --git a/chromium/third_party/blink/renderer/core/animation/css_length_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_length_interpolation_type.cc
index 26c93224804..5fb7836e6a3 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_length_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css_length_interpolation_type.cc
@@ -36,16 +36,10 @@ float CSSLengthInterpolationType::EffectiveZoom(
class InheritedLengthChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
- static std::unique_ptr<InheritedLengthChecker> Create(
- const CSSProperty& property,
- const Length& length) {
- return base::WrapUnique(new InheritedLengthChecker(property, length));
- }
-
- private:
InheritedLengthChecker(const CSSProperty& property, const Length& length)
: property_(property), length_(length) {}
+ private:
bool IsValid(const StyleResolverState& state,
const InterpolationValue& underlying) const final {
Length parent_length;
@@ -82,8 +76,8 @@ InterpolationValue CSSLengthInterpolationType::MaybeConvertInherit(
Length inherited_length;
LengthPropertyFunctions::GetLength(CssProperty(), *state.ParentStyle(),
inherited_length);
- conversion_checkers.push_back(
- InheritedLengthChecker::Create(CssProperty(), inherited_length));
+ conversion_checkers.push_back(std::make_unique<InheritedLengthChecker>(
+ CssProperty(), inherited_length));
if (inherited_length.IsAuto()) {
// If the inherited value changes to a length, the InheritedLengthChecker
// will invalidate the interpolation's cache.
@@ -97,8 +91,8 @@ InterpolationValue CSSLengthInterpolationType::MaybeConvertValue(
const CSSValue& value,
const StyleResolverState*,
ConversionCheckers& conversion_checkers) const {
- if (value.IsIdentifierValue()) {
- CSSValueID value_id = ToCSSIdentifierValue(value).GetValueID();
+ if (auto* identifier_value = DynamicTo<CSSIdentifierValue>(value)) {
+ CSSValueID value_id = identifier_value->GetValueID();
double pixels;
if (!LengthPropertyFunctions::GetPixelsForKeyword(CssProperty(), value_id,
pixels))
diff --git a/chromium/third_party/blink/renderer/core/animation/css_length_list_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_length_list_interpolation_type.cc
index b26f3124b8d..1bc611abbd6 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_length_list_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css_length_list_interpolation_type.cc
@@ -31,7 +31,7 @@ InterpolationValue CSSLengthListInterpolationType::MaybeConvertNeutral(
wtf_size_t underlying_length =
UnderlyingLengthChecker::GetUnderlyingLength(underlying);
conversion_checkers.push_back(
- UnderlyingLengthChecker::Create(underlying_length));
+ std::make_unique<UnderlyingLengthChecker>(underlying_length));
if (underlying_length == 0)
return nullptr;
@@ -69,20 +69,12 @@ InterpolationValue CSSLengthListInterpolationType::MaybeConvertInitial(
class InheritedLengthListChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
- ~InheritedLengthListChecker() final = default;
-
- static std::unique_ptr<InheritedLengthListChecker> Create(
- const CSSProperty& property,
- const Vector<Length>& inherited_length_list) {
- return base::WrapUnique(
- new InheritedLengthListChecker(property, inherited_length_list));
- }
-
- private:
InheritedLengthListChecker(const CSSProperty& property,
const Vector<Length>& inherited_length_list)
: property_(property), inherited_length_list_(inherited_length_list) {}
+ ~InheritedLengthListChecker() final = default;
+ private:
bool IsValid(const StyleResolverState& state,
const InterpolationValue& underlying) const final {
Vector<Length> inherited_length_list;
@@ -101,8 +93,8 @@ InterpolationValue CSSLengthListInterpolationType::MaybeConvertInherit(
Vector<Length> inherited_length_list;
bool success = LengthListPropertyFunctions::GetLengthList(
CssProperty(), *state.ParentStyle(), inherited_length_list);
- conversion_checkers.push_back(
- InheritedLengthListChecker::Create(CssProperty(), inherited_length_list));
+ conversion_checkers.push_back(std::make_unique<InheritedLengthListChecker>(
+ CssProperty(), inherited_length_list));
if (!success)
return nullptr;
return MaybeConvertLengthList(inherited_length_list,
@@ -116,7 +108,7 @@ InterpolationValue CSSLengthListInterpolationType::MaybeConvertValue(
if (!value.IsBaseValueList())
return nullptr;
- const CSSValueList& list = ToCSSValueList(value);
+ const auto& list = To<CSSValueList>(value);
return ListInterpolationFunctions::CreateList(
list.length(), [&list](wtf_size_t index) {
return LengthInterpolationFunctions::MaybeConvertCSSValue(
diff --git a/chromium/third_party/blink/renderer/core/animation/css_length_pair_interpolation_type.h b/chromium/third_party/blink/renderer/core/animation/css_length_pair_interpolation_type.h
index c0490d0a3e3..5c5eb589dcb 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_length_pair_interpolation_type.h
+++ b/chromium/third_party/blink/renderer/core/animation/css_length_pair_interpolation_type.h
@@ -21,7 +21,7 @@ class CSSLengthPairInterpolationType : public CSSLengthListInterpolationType {
InterpolationValue MaybeConvertValue(const CSSValue& value,
const StyleResolverState*,
ConversionCheckers&) const final {
- const CSSValuePair& pair = ToCSSValuePair(value);
+ const auto& pair = To<CSSValuePair>(value);
return ListInterpolationFunctions::CreateList(2, [&pair](size_t index) {
const CSSValue& item = index == 0 ? pair.First() : pair.Second();
return LengthInterpolationFunctions::MaybeConvertCSSValue(item);
diff --git a/chromium/third_party/blink/renderer/core/animation/css_number_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_number_interpolation_type.cc
index ed26664353c..303f5ab0102 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_number_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css_number_interpolation_type.cc
@@ -17,17 +17,11 @@ namespace blink {
class InheritedNumberChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
- static std::unique_ptr<InheritedNumberChecker> Create(
- const CSSProperty& property,
- base::Optional<double> number) {
- return base::WrapUnique(new InheritedNumberChecker(property, number));
- }
-
- private:
InheritedNumberChecker(const CSSProperty& property,
base::Optional<double> number)
: property_(property), number_(number) {}
+ private:
bool IsValid(const StyleResolverState& state,
const InterpolationValue& underlying) const final {
base::Optional<double> parent_number =
@@ -50,7 +44,7 @@ const CSSValue* CSSNumberInterpolationType::CreateCSSValue(
InterpolationValue CSSNumberInterpolationType::CreateNumberValue(
double number) const {
- return InterpolationValue(InterpolableNumber::Create(number));
+ return InterpolationValue(std::make_unique<InterpolableNumber>(number));
}
InterpolationValue CSSNumberInterpolationType::MaybeConvertNeutral(
@@ -77,7 +71,7 @@ InterpolationValue CSSNumberInterpolationType::MaybeConvertInherit(
base::Optional<double> inherited =
NumberPropertyFunctions::GetNumber(CssProperty(), *state.ParentStyle());
conversion_checkers.push_back(
- InheritedNumberChecker::Create(CssProperty(), inherited));
+ std::make_unique<InheritedNumberChecker>(CssProperty(), inherited));
if (!inherited)
return nullptr;
return CreateNumberValue(*inherited);
@@ -87,11 +81,11 @@ InterpolationValue CSSNumberInterpolationType::MaybeConvertValue(
const CSSValue& value,
const StyleResolverState*,
ConversionCheckers&) const {
- if (!value.IsPrimitiveValue() ||
- !(ToCSSPrimitiveValue(value).IsNumber() ||
- ToCSSPrimitiveValue(value).IsPercentage()))
+ auto* primitive_value = DynamicTo<CSSPrimitiveValue>(value);
+ if (!primitive_value ||
+ !(primitive_value->IsNumber() || primitive_value->IsPercentage()))
return nullptr;
- return CreateNumberValue(ToCSSPrimitiveValue(value).GetDoubleValue());
+ return CreateNumberValue(primitive_value->GetDoubleValue());
}
InterpolationValue
diff --git a/chromium/third_party/blink/renderer/core/animation/css_offset_rotate_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_offset_rotate_interpolation_type.cc
index 85736429f12..eb886c3a73b 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_offset_rotate_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css_offset_rotate_interpolation_type.cc
@@ -43,11 +43,9 @@ namespace {
class UnderlyingRotationTypeChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
- static std::unique_ptr<UnderlyingRotationTypeChecker> Create(
- OffsetRotationType underlying_rotation_type) {
- return base::WrapUnique(
- new UnderlyingRotationTypeChecker(underlying_rotation_type));
- }
+ explicit UnderlyingRotationTypeChecker(
+ OffsetRotationType underlying_rotation_type)
+ : underlying_rotation_type_(underlying_rotation_type) {}
bool IsValid(const StyleResolverState&,
const InterpolationValue& underlying) const final {
@@ -57,20 +55,15 @@ class UnderlyingRotationTypeChecker
}
private:
- UnderlyingRotationTypeChecker(OffsetRotationType underlying_rotation_type)
- : underlying_rotation_type_(underlying_rotation_type) {}
-
OffsetRotationType underlying_rotation_type_;
};
class InheritedOffsetRotationChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
- static std::unique_ptr<InheritedOffsetRotationChecker> Create(
- StyleOffsetRotation inherited_rotation) {
- return base::WrapUnique(
- new InheritedOffsetRotationChecker(inherited_rotation));
- }
+ explicit InheritedOffsetRotationChecker(
+ StyleOffsetRotation inherited_rotation)
+ : inherited_rotation_(inherited_rotation) {}
bool IsValid(const StyleResolverState& state,
const InterpolationValue& underlying) const final {
@@ -78,15 +71,12 @@ class InheritedOffsetRotationChecker
}
private:
- InheritedOffsetRotationChecker(StyleOffsetRotation inherited_rotation)
- : inherited_rotation_(inherited_rotation) {}
-
StyleOffsetRotation inherited_rotation_;
};
InterpolationValue ConvertOffsetRotate(const StyleOffsetRotation& rotation) {
return InterpolationValue(
- InterpolableNumber::Create(rotation.angle),
+ std::make_unique<InterpolableNumber>(rotation.angle),
CSSOffsetRotationNonInterpolableValue::Create(rotation.type));
}
@@ -99,8 +89,8 @@ InterpolationValue CSSOffsetRotateInterpolationType::MaybeConvertNeutral(
ToCSSOffsetRotationNonInterpolableValue(
*underlying.non_interpolable_value)
.RotationType();
- conversion_checkers.push_back(
- UnderlyingRotationTypeChecker::Create(underlying_rotation_type));
+ conversion_checkers.push_back(std::make_unique<UnderlyingRotationTypeChecker>(
+ underlying_rotation_type));
return ConvertOffsetRotate(StyleOffsetRotation(0, underlying_rotation_type));
}
@@ -116,7 +106,7 @@ InterpolationValue CSSOffsetRotateInterpolationType::MaybeConvertInherit(
const StyleOffsetRotation& inherited_rotation =
state.ParentStyle()->OffsetRotate();
conversion_checkers.push_back(
- InheritedOffsetRotationChecker::Create(inherited_rotation));
+ std::make_unique<InheritedOffsetRotationChecker>(inherited_rotation));
return ConvertOffsetRotate(inherited_rotation);
}
diff --git a/chromium/third_party/blink/renderer/core/animation/css_offset_rotate_interpolation_type.h b/chromium/third_party/blink/renderer/core/animation/css_offset_rotate_interpolation_type.h
index 2a20c75a11d..779451dc979 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_offset_rotate_interpolation_type.h
+++ b/chromium/third_party/blink/renderer/core/animation/css_offset_rotate_interpolation_type.h
@@ -13,7 +13,7 @@ class CSSOffsetRotateInterpolationType : public CSSInterpolationType {
public:
CSSOffsetRotateInterpolationType(PropertyHandle property)
: CSSInterpolationType(property) {
- DCHECK(CssProperty().PropertyID() == CSSPropertyOffsetRotate);
+ DCHECK(CssProperty().PropertyID() == CSSPropertyID::kOffsetRotate);
}
InterpolationValue MaybeConvertStandardPropertyUnderlyingValue(
diff --git a/chromium/third_party/blink/renderer/core/animation/css_paint_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_paint_interpolation_type.cc
index b3e637382fd..7ca959a39fe 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_paint_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css_paint_interpolation_type.cc
@@ -32,9 +32,9 @@ bool GetColor(const CSSProperty& property,
const ComputedStyle& style,
StyleColor& result) {
switch (property.PropertyID()) {
- case CSSPropertyFill:
+ case CSSPropertyID::kFill:
return GetColorFromPaint(style.SvgStyle().FillPaint(), result);
- case CSSPropertyStroke:
+ case CSSPropertyID::kStroke:
return GetColorFromPaint(style.SvgStyle().StrokePaint(), result);
default:
NOTREACHED();
@@ -64,22 +64,12 @@ InterpolationValue CSSPaintInterpolationType::MaybeConvertInitial(
class InheritedPaintChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
- static std::unique_ptr<InheritedPaintChecker> Create(
- const CSSProperty& property,
- const StyleColor& color) {
- return base::WrapUnique(new InheritedPaintChecker(property, color));
- }
- static std::unique_ptr<InheritedPaintChecker> Create(
- const CSSProperty& property) {
- return base::WrapUnique(new InheritedPaintChecker(property));
- }
-
- private:
InheritedPaintChecker(const CSSProperty& property)
: property_(property), valid_color_(false) {}
InheritedPaintChecker(const CSSProperty& property, const StyleColor& color)
: property_(property), valid_color_(true), color_(color) {}
+ private:
bool IsValid(const StyleResolverState& state,
const InterpolationValue& underlying) const final {
StyleColor parent_color;
@@ -100,11 +90,12 @@ InterpolationValue CSSPaintInterpolationType::MaybeConvertInherit(
return nullptr;
StyleColor parent_color;
if (!GetColor(CssProperty(), *state.ParentStyle(), parent_color)) {
- conversion_checkers.push_back(InheritedPaintChecker::Create(CssProperty()));
+ conversion_checkers.push_back(
+ std::make_unique<InheritedPaintChecker>(CssProperty()));
return nullptr;
}
conversion_checkers.push_back(
- InheritedPaintChecker::Create(CssProperty(), parent_color));
+ std::make_unique<InheritedPaintChecker>(CssProperty(), parent_color));
return InterpolationValue(
CSSColorInterpolationType::CreateInterpolableColor(parent_color));
}
@@ -140,11 +131,11 @@ void CSSPaintInterpolationType::ApplyStandardPropertyValue(
interpolable_color, state);
SVGComputedStyle& mutable_svg_style = state.Style()->AccessSVGStyle();
switch (CssProperty().PropertyID()) {
- case CSSPropertyFill:
+ case CSSPropertyID::kFill:
mutable_svg_style.SetFillPaint(SVGPaint(color));
mutable_svg_style.SetVisitedLinkFillPaint(SVGPaint(color));
break;
- case CSSPropertyStroke:
+ case CSSPropertyID::kStroke:
mutable_svg_style.SetStrokePaint(SVGPaint(color));
mutable_svg_style.SetVisitedLinkStrokePaint(SVGPaint(color));
break;
diff --git a/chromium/third_party/blink/renderer/core/animation/css_path_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_path_interpolation_type.cc
index 0226608a375..f10330b1cbb 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_path_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css_path_interpolation_type.cc
@@ -21,13 +21,13 @@ namespace {
// If the property's value is not a path(), returns nullptr.
StylePath* GetPath(const CSSProperty& property, const ComputedStyle& style) {
switch (property.PropertyID()) {
- case CSSPropertyD:
+ case CSSPropertyID::kD:
return style.SvgStyle().D();
- case CSSPropertyOffsetPath: {
+ case CSSPropertyID::kOffsetPath: {
BasicShape* offset_path = style.OffsetPath();
if (!offset_path || offset_path->GetType() != BasicShape::kStylePathType)
return nullptr;
- return ToStylePath(style.OffsetPath());
+ return To<StylePath>(style.OffsetPath());
}
default:
NOTREACHED();
@@ -40,10 +40,10 @@ void SetPath(const CSSProperty& property,
ComputedStyle& style,
scoped_refptr<blink::StylePath> path) {
switch (property.PropertyID()) {
- case CSSPropertyD:
+ case CSSPropertyID::kD:
style.SetD(std::move(path));
return;
- case CSSPropertyOffsetPath:
+ case CSSPropertyID::kOffsetPath:
style.SetOffsetPath(std::move(path));
return;
default:
@@ -94,18 +94,11 @@ InterpolationValue CSSPathInterpolationType::MaybeConvertInitial(
class InheritedPathChecker : public CSSInterpolationType::CSSConversionChecker {
public:
- static std::unique_ptr<InheritedPathChecker> Create(
- const CSSProperty& property,
- scoped_refptr<StylePath> style_path) {
- return base::WrapUnique(
- new InheritedPathChecker(property, std::move(style_path)));
- }
-
- private:
InheritedPathChecker(const CSSProperty& property,
scoped_refptr<StylePath> style_path)
: property_(property), style_path_(std::move(style_path)) {}
+ private:
bool IsValid(const StyleResolverState& state,
const InterpolationValue& underlying) const final {
return GetPath(property_, *state.ParentStyle()) == style_path_.get();
@@ -121,7 +114,7 @@ InterpolationValue CSSPathInterpolationType::MaybeConvertInherit(
if (!state.ParentStyle())
return nullptr;
- conversion_checkers.push_back(InheritedPathChecker::Create(
+ conversion_checkers.push_back(std::make_unique<InheritedPathChecker>(
CssProperty(), GetPath(CssProperty(), *state.ParentStyle())));
return PathInterpolationFunctions::ConvertValue(
GetPath(CssProperty(), *state.ParentStyle()),
@@ -132,12 +125,12 @@ InterpolationValue CSSPathInterpolationType::MaybeConvertValue(
const CSSValue& value,
const StyleResolverState*,
ConversionCheckers& conversion_checkers) const {
- if (!value.IsPathValue()) {
+ auto* path_value = DynamicTo<cssvalue::CSSPathValue>(value);
+ if (!path_value) {
return nullptr;
}
return PathInterpolationFunctions::ConvertValue(
- cssvalue::ToCSSPathValue(value).ByteStream(),
- PathInterpolationFunctions::ForceAbsolute);
+ path_value->ByteStream(), PathInterpolationFunctions::ForceAbsolute);
}
InterpolationValue
diff --git a/chromium/third_party/blink/renderer/core/animation/css_position_axis_list_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_position_axis_list_interpolation_type.cc
index 0d2a49afa50..87221221200 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_position_axis_list_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css_position_axis_list_interpolation_type.cc
@@ -15,12 +15,11 @@ namespace blink {
InterpolationValue
CSSPositionAxisListInterpolationType::ConvertPositionAxisCSSValue(
const CSSValue& value) {
- if (value.IsValuePair()) {
- const CSSValuePair& pair = ToCSSValuePair(value);
+ if (const auto* pair = DynamicTo<CSSValuePair>(value)) {
InterpolationValue result =
- LengthInterpolationFunctions::MaybeConvertCSSValue(pair.Second());
- CSSValueID side = ToCSSIdentifierValue(pair.First()).GetValueID();
- if (side == CSSValueRight || side == CSSValueBottom)
+ LengthInterpolationFunctions::MaybeConvertCSSValue(pair->Second());
+ CSSValueID side = To<CSSIdentifierValue>(pair->First()).GetValueID();
+ if (side == CSSValueID::kRight || side == CSSValueID::kBottom)
LengthInterpolationFunctions::SubtractFromOneHundredPercent(result);
return result;
}
@@ -28,18 +27,18 @@ CSSPositionAxisListInterpolationType::ConvertPositionAxisCSSValue(
if (value.IsPrimitiveValue())
return LengthInterpolationFunctions::MaybeConvertCSSValue(value);
- if (!value.IsIdentifierValue())
+ const auto* ident = DynamicTo<CSSIdentifierValue>(value);
+ if (!ident)
return nullptr;
- const CSSIdentifierValue& ident = ToCSSIdentifierValue(value);
- switch (ident.GetValueID()) {
- case CSSValueLeft:
- case CSSValueTop:
+ switch (ident->GetValueID()) {
+ case CSSValueID::kLeft:
+ case CSSValueID::kTop:
return LengthInterpolationFunctions::CreateInterpolablePercent(0);
- case CSSValueRight:
- case CSSValueBottom:
+ case CSSValueID::kRight:
+ case CSSValueID::kBottom:
return LengthInterpolationFunctions::CreateInterpolablePercent(100);
- case CSSValueCenter:
+ case CSSValueID::kCenter:
return LengthInterpolationFunctions::CreateInterpolablePercent(50);
default:
NOTREACHED();
@@ -56,7 +55,7 @@ InterpolationValue CSSPositionAxisListInterpolationType::MaybeConvertValue(
1, [&value](size_t) { return ConvertPositionAxisCSSValue(value); });
}
- const CSSValueList& list = ToCSSValueList(value);
+ const auto& list = To<CSSValueList>(value);
return ListInterpolationFunctions::CreateList(
list.length(), [&list](wtf_size_t index) {
return ConvertPositionAxisCSSValue(list.Item(index));
diff --git a/chromium/third_party/blink/renderer/core/animation/css_position_interpolation_type.h b/chromium/third_party/blink/renderer/core/animation/css_position_interpolation_type.h
index 30a302472cf..c87862490c8 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_position_interpolation_type.h
+++ b/chromium/third_party/blink/renderer/core/animation/css_position_interpolation_type.h
@@ -23,13 +23,13 @@ class CSSPositionInterpolationType : public CSSLengthListInterpolationType {
InterpolationValue MaybeConvertValue(const CSSValue& value,
const StyleResolverState*,
ConversionCheckers&) const final {
- if (!value.IsValuePair()) {
+ const auto* pair = DynamicTo<CSSValuePair>(value);
+ if (!pair) {
return nullptr;
}
- const CSSValuePair& pair = ToCSSValuePair(value);
- return ListInterpolationFunctions::CreateList(2, [&pair](size_t index) {
+ return ListInterpolationFunctions::CreateList(2, [pair](size_t index) {
return CSSPositionAxisListInterpolationType::ConvertPositionAxisCSSValue(
- index == 0 ? pair.First() : pair.Second());
+ index == 0 ? pair->First() : pair->Second());
});
}
};
diff --git a/chromium/third_party/blink/renderer/core/animation/css_ray_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_ray_interpolation_type.cc
index c65204eb7f3..76f6140f6f2 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_ray_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css_ray_interpolation_type.cc
@@ -67,15 +67,13 @@ StyleRay* GetRay(const ComputedStyle& style) {
BasicShape* offset_path = style.OffsetPath();
if (!offset_path || offset_path->GetType() != BasicShape::kStyleRayType)
return nullptr;
- return ToStyleRay(style.OffsetPath());
+ return To<StyleRay>(style.OffsetPath());
}
class UnderlyingRayModeChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
- static std::unique_ptr<UnderlyingRayModeChecker> Create(const RayMode& mode) {
- return base::WrapUnique(new UnderlyingRayModeChecker(mode));
- }
+ explicit UnderlyingRayModeChecker(const RayMode& mode) : mode_(mode) {}
bool IsValid(const StyleResolverState&,
const InterpolationValue& underlying) const final {
@@ -85,24 +83,17 @@ class UnderlyingRayModeChecker
}
private:
- UnderlyingRayModeChecker(const RayMode& mode) : mode_(mode) {}
-
const RayMode mode_;
};
class InheritedRayChecker : public CSSInterpolationType::CSSConversionChecker {
public:
- static std::unique_ptr<InheritedRayChecker> Create(
- scoped_refptr<StyleRay> style_ray) {
- return base::WrapUnique(new InheritedRayChecker(std::move(style_ray)));
- }
-
- private:
InheritedRayChecker(scoped_refptr<StyleRay> style_ray)
: style_ray_(std::move(style_ray)) {
DCHECK(style_ray_);
}
+ private:
bool IsValid(const StyleResolverState& state,
const InterpolationValue&) const final {
return GetRay(*state.ParentStyle()) == style_ray_.get();
@@ -112,7 +103,7 @@ class InheritedRayChecker : public CSSInterpolationType::CSSConversionChecker {
};
InterpolationValue CreateValue(float angle, const RayMode& mode) {
- return InterpolationValue(InterpolableNumber::Create(angle),
+ return InterpolationValue(std::make_unique<InterpolableNumber>(angle),
CSSRayNonInterpolableValue::Create(mode));
}
@@ -155,7 +146,7 @@ InterpolationValue CSSRayInterpolationType::MaybeConvertNeutral(
const RayMode& underlying_mode =
ToCSSRayNonInterpolableValue(*underlying.non_interpolable_value).Mode();
conversion_checkers.push_back(
- UnderlyingRayModeChecker::Create(underlying_mode));
+ std::make_unique<UnderlyingRayModeChecker>(underlying_mode));
return CreateValue(0, underlying_mode);
}
@@ -176,7 +167,8 @@ InterpolationValue CSSRayInterpolationType::MaybeConvertInherit(
if (!inherited_ray)
return nullptr;
- conversion_checkers.push_back(InheritedRayChecker::Create(inherited_ray));
+ conversion_checkers.push_back(
+ std::make_unique<InheritedRayChecker>(inherited_ray));
return CreateValue(inherited_ray->Angle(), RayMode(*inherited_ray));
}
@@ -213,7 +205,8 @@ InterpolationValue CSSRayInterpolationType::MaybeConvertValue(
return nullptr;
scoped_refptr<BasicShape> shape = BasicShapeForValue(*state, value);
- return CreateValue(ToStyleRay(*shape).Angle(), RayMode(ToStyleRay(*shape)));
+ return CreateValue(To<StyleRay>(*shape).Angle(),
+ RayMode(To<StyleRay>(*shape)));
}
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/animation/css_ray_interpolation_type.h b/chromium/third_party/blink/renderer/core/animation/css_ray_interpolation_type.h
index bf307db5700..bc4cad87e80 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_ray_interpolation_type.h
+++ b/chromium/third_party/blink/renderer/core/animation/css_ray_interpolation_type.h
@@ -13,7 +13,7 @@ class CSSRayInterpolationType : public CSSInterpolationType {
public:
CSSRayInterpolationType(PropertyHandle property)
: CSSInterpolationType(property) {
- DCHECK(CssProperty().PropertyID() == CSSPropertyOffsetPath);
+ DCHECK(CssProperty().PropertyID() == CSSPropertyID::kOffsetPath);
}
void ApplyStandardPropertyValue(const InterpolableValue&,
diff --git a/chromium/third_party/blink/renderer/core/animation/css_resolution_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_resolution_interpolation_type.cc
index eddd41d4401..af862cd3517 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_resolution_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css_resolution_interpolation_type.cc
@@ -11,19 +11,19 @@ namespace blink {
InterpolationValue CSSResolutionInterpolationType::MaybeConvertNeutral(
const InterpolationValue&,
ConversionCheckers&) const {
- return InterpolationValue(InterpolableNumber::Create(0));
+ return InterpolationValue(std::make_unique<InterpolableNumber>(0));
}
InterpolationValue CSSResolutionInterpolationType::MaybeConvertValue(
const CSSValue& value,
const StyleResolverState*,
ConversionCheckers&) const {
- if (!value.IsPrimitiveValue() ||
- !CSSPrimitiveValue::IsResolution(
- ToCSSPrimitiveValue(value).TypeWithCalcResolved()))
+ auto* primitive_value = DynamicTo<CSSPrimitiveValue>(value);
+ if (!primitive_value ||
+ !CSSPrimitiveValue::IsResolution(primitive_value->TypeWithCalcResolved()))
return nullptr;
- return InterpolationValue(InterpolableNumber::Create(
- ToCSSPrimitiveValue(value).ComputeDotsPerPixel()));
+ return InterpolationValue(std::make_unique<InterpolableNumber>(
+ primitive_value->ComputeDotsPerPixel()));
}
const CSSValue* CSSResolutionInterpolationType::CreateCSSValue(
diff --git a/chromium/third_party/blink/renderer/core/animation/css_rotate_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_rotate_interpolation_type.cc
index 73f2e2e7738..8b0e83626d2 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_rotate_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css_rotate_interpolation_type.cc
@@ -148,17 +148,15 @@ OptionalRotation GetRotation(const ComputedStyle& style) {
}
InterpolationValue ConvertRotation(const OptionalRotation& rotation) {
- return InterpolationValue(InterpolableNumber::Create(0),
+ return InterpolationValue(std::make_unique<InterpolableNumber>(0),
CSSRotateNonInterpolableValue::Create(rotation));
}
class InheritedRotationChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
- static std::unique_ptr<InheritedRotationChecker> Create(
- const OptionalRotation& inherited_rotation) {
- return base::WrapUnique(new InheritedRotationChecker(inherited_rotation));
- }
+ explicit InheritedRotationChecker(const OptionalRotation& inherited_rotation)
+ : inherited_rotation_(inherited_rotation) {}
bool IsValid(const StyleResolverState& state,
const InterpolationValue& underlying) const final {
@@ -172,9 +170,6 @@ class InheritedRotationChecker
}
private:
- InheritedRotationChecker(const OptionalRotation& inherited_rotation)
- : inherited_rotation_(inherited_rotation) {}
-
const OptionalRotation inherited_rotation_;
};
@@ -197,7 +192,7 @@ InterpolationValue CSSRotateInterpolationType::MaybeConvertInherit(
ConversionCheckers& conversion_checkers) const {
OptionalRotation inherited_rotation = GetRotation(*state.ParentStyle());
conversion_checkers.push_back(
- InheritedRotationChecker::Create(inherited_rotation));
+ std::make_unique<InheritedRotationChecker>(inherited_rotation));
return ConvertRotation(inherited_rotation);
}
@@ -223,7 +218,8 @@ PairwiseInterpolationValue CSSRotateInterpolationType::MaybeMergeSingles(
InterpolationValue&& start,
InterpolationValue&& end) const {
return PairwiseInterpolationValue(
- InterpolableNumber::Create(0), InterpolableNumber::Create(1),
+ std::make_unique<InterpolableNumber>(0),
+ std::make_unique<InterpolableNumber>(1),
CSSRotateNonInterpolableValue::Create(
ToCSSRotateNonInterpolableValue(*start.non_interpolable_value),
ToCSSRotateNonInterpolableValue(*end.non_interpolable_value)));
diff --git a/chromium/third_party/blink/renderer/core/animation/css_rotate_interpolation_type.h b/chromium/third_party/blink/renderer/core/animation/css_rotate_interpolation_type.h
index e49783b08d3..15678f354b4 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_rotate_interpolation_type.h
+++ b/chromium/third_party/blink/renderer/core/animation/css_rotate_interpolation_type.h
@@ -13,7 +13,7 @@ class CSSRotateInterpolationType : public CSSInterpolationType {
public:
CSSRotateInterpolationType(PropertyHandle property)
: CSSInterpolationType(property) {
- DCHECK_EQ(CssProperty().PropertyID(), CSSPropertyRotate);
+ DCHECK_EQ(CssProperty().PropertyID(), CSSPropertyID::kRotate);
}
InterpolationValue MaybeConvertStandardPropertyUnderlyingValue(
diff --git a/chromium/third_party/blink/renderer/core/animation/css_scale_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_scale_interpolation_type.cc
index d5fa97b7069..6229fa89034 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_scale_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css_scale_interpolation_type.cc
@@ -59,22 +59,18 @@ struct Scale {
};
std::unique_ptr<InterpolableValue> CreateScaleIdentity() {
- std::unique_ptr<InterpolableList> list = InterpolableList::Create(3);
+ auto list = std::make_unique<InterpolableList>(3);
for (wtf_size_t i = 0; i < 3; i++)
- list->Set(i, InterpolableNumber::Create(1));
+ list->Set(i, std::make_unique<InterpolableNumber>(1));
return std::move(list);
}
class InheritedScaleChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
- static std::unique_ptr<InheritedScaleChecker> Create(const Scale& scale) {
- return base::WrapUnique(new InheritedScaleChecker(scale));
- }
+ explicit InheritedScaleChecker(const Scale& scale) : scale_(scale) {}
private:
- InheritedScaleChecker(const Scale& scale) : scale_(scale) {}
-
bool IsValid(const StyleResolverState& state,
const InterpolationValue&) const final {
return scale_ == Scale(state.ParentStyle()->Scale());
@@ -136,13 +132,13 @@ DEFINE_NON_INTERPOLABLE_VALUE_TYPE_CASTS(CSSScaleNonInterpolableValue);
InterpolationValue Scale::CreateInterpolationValue() const {
if (is_none) {
- return InterpolationValue(InterpolableList::Create(0),
+ return InterpolationValue(std::make_unique<InterpolableList>(0),
CSSScaleNonInterpolableValue::Create(*this));
}
- std::unique_ptr<InterpolableList> list = InterpolableList::Create(3);
+ auto list = std::make_unique<InterpolableList>(3);
for (wtf_size_t i = 0; i < 3; i++)
- list->Set(i, InterpolableNumber::Create(array[i]));
+ list->Set(i, std::make_unique<InterpolableNumber>(array[i]));
return InterpolationValue(std::move(list),
CSSScaleNonInterpolableValue::Create(*this));
}
@@ -163,7 +159,8 @@ InterpolationValue CSSScaleInterpolationType::MaybeConvertInherit(
const StyleResolverState& state,
ConversionCheckers& conversion_checkers) const {
Scale inherited_scale(state.ParentStyle()->Scale());
- conversion_checkers.push_back(InheritedScaleChecker::Create(inherited_scale));
+ conversion_checkers.push_back(
+ std::make_unique<InheritedScaleChecker>(inherited_scale));
return inherited_scale.CreateInterpolationValue();
}
@@ -174,13 +171,13 @@ InterpolationValue CSSScaleInterpolationType::MaybeConvertValue(
if (!value.IsBaseValueList())
return Scale().CreateInterpolationValue();
- const CSSValueList& list = ToCSSValueList(value);
+ const auto& list = To<CSSValueList>(value);
DCHECK(list.length() >= 1 && list.length() <= 3);
Scale scale(1, 1, 1);
for (wtf_size_t i = 0; i < list.length(); i++) {
const CSSValue& item = list.Item(i);
- scale.array[i] = ToCSSPrimitiveValue(item).GetDoubleValue();
+ scale.array[i] = To<CSSPrimitiveValue>(item).GetDoubleValue();
}
return scale.CreateInterpolationValue();
diff --git a/chromium/third_party/blink/renderer/core/animation/css_scale_interpolation_type.h b/chromium/third_party/blink/renderer/core/animation/css_scale_interpolation_type.h
index c161564fa71..e7240b648a6 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_scale_interpolation_type.h
+++ b/chromium/third_party/blink/renderer/core/animation/css_scale_interpolation_type.h
@@ -13,7 +13,7 @@ class CSSScaleInterpolationType : public CSSInterpolationType {
public:
CSSScaleInterpolationType(PropertyHandle property)
: CSSInterpolationType(property) {
- DCHECK_EQ(CssProperty().PropertyID(), CSSPropertyScale);
+ DCHECK_EQ(CssProperty().PropertyID(), CSSPropertyID::kScale);
}
InterpolationValue MaybeConvertStandardPropertyUnderlyingValue(
diff --git a/chromium/third_party/blink/renderer/core/animation/css_shadow_list_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_shadow_list_interpolation_type.cc
index e3018530ffa..463cf6f643d 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_shadow_list_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css_shadow_list_interpolation_type.cc
@@ -25,9 +25,9 @@ namespace {
const ShadowList* GetShadowList(const CSSProperty& property,
const ComputedStyle& style) {
switch (property.PropertyID()) {
- case CSSPropertyBoxShadow:
+ case CSSPropertyID::kBoxShadow:
return style.BoxShadow();
- case CSSPropertyTextShadow:
+ case CSSPropertyID::kTextShadow:
return style.TextShadow();
default:
NOTREACHED();
@@ -68,18 +68,11 @@ InterpolationValue CSSShadowListInterpolationType::MaybeConvertInitial(
class InheritedShadowListChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
- static std::unique_ptr<InheritedShadowListChecker> Create(
- const CSSProperty& property,
- scoped_refptr<ShadowList> shadow_list) {
- return base::WrapUnique(
- new InheritedShadowListChecker(property, std::move(shadow_list)));
- }
-
- private:
InheritedShadowListChecker(const CSSProperty& property,
scoped_refptr<ShadowList> shadow_list)
: property_(property), shadow_list_(std::move(shadow_list)) {}
+ private:
bool IsValid(const StyleResolverState& state,
const InterpolationValue& underlying) const final {
const ShadowList* inherited_shadow_list =
@@ -102,7 +95,7 @@ InterpolationValue CSSShadowListInterpolationType::MaybeConvertInherit(
return nullptr;
const ShadowList* inherited_shadow_list =
GetShadowList(CssProperty(), *state.ParentStyle());
- conversion_checkers.push_back(InheritedShadowListChecker::Create(
+ conversion_checkers.push_back(std::make_unique<InheritedShadowListChecker>(
CssProperty(),
const_cast<ShadowList*>(inherited_shadow_list))); // Take ref.
return ConvertShadowList(inherited_shadow_list,
@@ -113,14 +106,14 @@ InterpolationValue CSSShadowListInterpolationType::MaybeConvertValue(
const CSSValue& value,
const StyleResolverState*,
ConversionCheckers&) const {
- if (value.IsIdentifierValue() &&
- ToCSSIdentifierValue(value).GetValueID() == CSSValueNone)
+ auto* identifier_value = DynamicTo<CSSIdentifierValue>(value);
+ if (identifier_value && identifier_value->GetValueID() == CSSValueID::kNone)
return CreateNeutralValue();
if (!value.IsBaseValueList())
return nullptr;
- const CSSValueList& value_list = ToCSSValueList(value);
+ const auto& value_list = To<CSSValueList>(value);
return ListInterpolationFunctions::CreateList(
value_list.length(), [&value_list](wtf_size_t index) {
return ShadowInterpolationFunctions::MaybeConvertCSSValue(
@@ -182,10 +175,10 @@ void CSSShadowListInterpolationType::ApplyStandardPropertyValue(
scoped_refptr<ShadowList> shadow_list =
CreateShadowList(interpolable_value, non_interpolable_value, state);
switch (CssProperty().PropertyID()) {
- case CSSPropertyBoxShadow:
+ case CSSPropertyID::kBoxShadow:
state.Style()->SetBoxShadow(std::move(shadow_list));
return;
- case CSSPropertyTextShadow:
+ case CSSPropertyID::kTextShadow:
state.Style()->SetTextShadow(std::move(shadow_list));
return;
default:
diff --git a/chromium/third_party/blink/renderer/core/animation/css_size_list_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_size_list_interpolation_type.cc
index ddeaef26ff2..181f65efd3c 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_size_list_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css_size_list_interpolation_type.cc
@@ -21,17 +21,12 @@ namespace blink {
class UnderlyingSizeListChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
- ~UnderlyingSizeListChecker() final = default;
+ explicit UnderlyingSizeListChecker(const NonInterpolableList& underlying_list)
+ : underlying_list_(&underlying_list) {}
- static std::unique_ptr<UnderlyingSizeListChecker> Create(
- const NonInterpolableList& underlying_list) {
- return base::WrapUnique(new UnderlyingSizeListChecker(underlying_list));
- }
+ ~UnderlyingSizeListChecker() final = default;
private:
- UnderlyingSizeListChecker(const NonInterpolableList& underlying_list)
- : underlying_list_(&underlying_list) {}
-
bool IsValid(const StyleResolverState&,
const InterpolationValue& underlying) const final {
const auto& underlying_list =
@@ -55,20 +50,12 @@ class UnderlyingSizeListChecker
class InheritedSizeListChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
- ~InheritedSizeListChecker() final = default;
-
- static std::unique_ptr<InheritedSizeListChecker> Create(
- const CSSProperty& property,
- const SizeList& inherited_size_list) {
- return base::WrapUnique(
- new InheritedSizeListChecker(property, inherited_size_list));
- }
-
- private:
InheritedSizeListChecker(const CSSProperty& property,
const SizeList& inherited_size_list)
: property_(property), inherited_size_list_(inherited_size_list) {}
+ ~InheritedSizeListChecker() final = default;
+ private:
bool IsValid(const StyleResolverState& state,
const InterpolationValue&) const final {
return inherited_size_list_ == SizeListPropertyFunctions::GetSizeList(
@@ -100,7 +87,7 @@ InterpolationValue MaybeConvertCSSSizeList(const CSSValue& value) {
temp_list->Append(value);
list = temp_list;
} else {
- list = ToCSSValueList(&value);
+ list = To<CSSValueList>(&value);
}
// Flatten pairs of width/height into individual items, even for contain and
@@ -120,7 +107,7 @@ InterpolationValue CSSSizeListInterpolationType::MaybeConvertNeutral(
const auto& underlying_list =
ToNonInterpolableList(*underlying.non_interpolable_value);
conversion_checkers.push_back(
- UnderlyingSizeListChecker::Create(underlying_list));
+ std::make_unique<UnderlyingSizeListChecker>(underlying_list));
return ListInterpolationFunctions::CreateList(
underlying_list.length(), [&underlying_list](wtf_size_t index) {
return SizeInterpolationFunctions::CreateNeutralValue(
@@ -140,8 +127,8 @@ InterpolationValue CSSSizeListInterpolationType::MaybeConvertInherit(
ConversionCheckers& conversion_checkers) const {
SizeList inherited_size_list = SizeListPropertyFunctions::GetSizeList(
CssProperty(), *state.ParentStyle());
- conversion_checkers.push_back(
- InheritedSizeListChecker::Create(CssProperty(), inherited_size_list));
+ conversion_checkers.push_back(std::make_unique<InheritedSizeListChecker>(
+ CssProperty(), inherited_size_list));
return ConvertSizeList(inherited_size_list, state.Style()->EffectiveZoom());
}
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 f94809b82ff..102d35ebdf7 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
@@ -75,10 +75,7 @@ namespace {
class UnderlyingIndentModeChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
- static std::unique_ptr<UnderlyingIndentModeChecker> Create(
- const IndentMode& mode) {
- return base::WrapUnique(new UnderlyingIndentModeChecker(mode));
- }
+ explicit UnderlyingIndentModeChecker(const IndentMode& mode) : mode_(mode) {}
bool IsValid(const StyleResolverState&,
const InterpolationValue& underlying) const final {
@@ -88,19 +85,14 @@ class UnderlyingIndentModeChecker
}
private:
- UnderlyingIndentModeChecker(const IndentMode& mode) : mode_(mode) {}
-
const IndentMode mode_;
};
class InheritedIndentChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
- static std::unique_ptr<InheritedIndentChecker> Create(
- const Length& length,
- const IndentMode& mode) {
- return base::WrapUnique(new InheritedIndentChecker(length, mode));
- }
+ InheritedIndentChecker(const Length& length, const IndentMode& mode)
+ : length_(length), mode_(mode) {}
bool IsValid(const StyleResolverState& state,
const InterpolationValue&) const final {
@@ -109,9 +101,6 @@ class InheritedIndentChecker
}
private:
- InheritedIndentChecker(const Length& length, const IndentMode& mode)
- : length_(length), mode_(mode) {}
-
const Length length_;
const IndentMode mode_;
};
@@ -136,7 +125,8 @@ InterpolationValue CSSTextIndentInterpolationType::MaybeConvertNeutral(
IndentMode mode =
ToCSSTextIndentNonInterpolableValue(*underlying.non_interpolable_value)
.Mode();
- conversion_checkers.push_back(UnderlyingIndentModeChecker::Create(mode));
+ conversion_checkers.push_back(
+ std::make_unique<UnderlyingIndentModeChecker>(mode));
return CreateValue(Length::Fixed(0), mode, 1);
}
@@ -153,8 +143,8 @@ InterpolationValue CSSTextIndentInterpolationType::MaybeConvertInherit(
ConversionCheckers& conversion_checkers) const {
const ComputedStyle& parent_style = *state.ParentStyle();
IndentMode mode(parent_style);
- conversion_checkers.push_back(
- InheritedIndentChecker::Create(parent_style.TextIndent(), mode));
+ conversion_checkers.push_back(std::make_unique<InheritedIndentChecker>(
+ parent_style.TextIndent(), mode));
return CreateValue(parent_style.TextIndent(), mode,
parent_style.EffectiveZoom());
}
@@ -167,12 +157,13 @@ InterpolationValue CSSTextIndentInterpolationType::MaybeConvertValue(
TextIndentLine line = ComputedStyleInitialValues::InitialTextIndentLine();
TextIndentType type = ComputedStyleInitialValues::InitialTextIndentType();
- for (const auto& item : ToCSSValueList(value)) {
- if (item->IsIdentifierValue() &&
- ToCSSIdentifierValue(*item).GetValueID() == CSSValueEachLine)
+ for (const auto& item : To<CSSValueList>(value)) {
+ auto* identifier_value = DynamicTo<CSSIdentifierValue>(item.Get());
+ if (identifier_value &&
+ identifier_value->GetValueID() == CSSValueID::kEachLine)
line = TextIndentLine::kEachLine;
- else if (item->IsIdentifierValue() &&
- ToCSSIdentifierValue(*item).GetValueID() == CSSValueHanging)
+ else if (identifier_value &&
+ identifier_value->GetValueID() == CSSValueID::kHanging)
type = TextIndentType::kHanging;
else
length = LengthInterpolationFunctions::MaybeConvertCSSValue(*item);
diff --git a/chromium/third_party/blink/renderer/core/animation/css_text_indent_interpolation_type.h b/chromium/third_party/blink/renderer/core/animation/css_text_indent_interpolation_type.h
index bda657e34f9..9b5fed72e9b 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_text_indent_interpolation_type.h
+++ b/chromium/third_party/blink/renderer/core/animation/css_text_indent_interpolation_type.h
@@ -13,7 +13,7 @@ class CSSTextIndentInterpolationType : public CSSInterpolationType {
public:
CSSTextIndentInterpolationType(PropertyHandle property)
: CSSInterpolationType(property) {
- DCHECK_EQ(CssProperty().PropertyID(), CSSPropertyTextIndent);
+ DCHECK_EQ(CssProperty().PropertyID(), CSSPropertyID::kTextIndent);
}
InterpolationValue MaybeConvertStandardPropertyUnderlyingValue(
diff --git a/chromium/third_party/blink/renderer/core/animation/css_time_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_time_interpolation_type.cc
index b8f613b54dd..1b1980ddc39 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_time_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css_time_interpolation_type.cc
@@ -11,17 +11,18 @@ namespace blink {
InterpolationValue CSSTimeInterpolationType::MaybeConvertNeutral(
const InterpolationValue&,
ConversionCheckers&) const {
- return InterpolationValue(InterpolableNumber::Create(0));
+ return InterpolationValue(std::make_unique<InterpolableNumber>(0));
}
InterpolationValue CSSTimeInterpolationType::MaybeConvertValue(
const CSSValue& value,
const StyleResolverState*,
ConversionCheckers&) const {
- if (!value.IsPrimitiveValue() || !ToCSSPrimitiveValue(value).IsTime())
+ auto* primitive_value = DynamicTo<CSSPrimitiveValue>(value);
+ if (!primitive_value || !primitive_value->IsTime())
return nullptr;
return InterpolationValue(
- InterpolableNumber::Create(ToCSSPrimitiveValue(value).ComputeSeconds()));
+ std::make_unique<InterpolableNumber>(primitive_value->ComputeSeconds()));
}
const CSSValue* CSSTimeInterpolationType::CreateCSSValue(
diff --git a/chromium/third_party/blink/renderer/core/animation/css_transform_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_transform_interpolation_type.cc
index ed715bac23f..7530c17e6ce 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_transform_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css_transform_interpolation_type.cc
@@ -125,7 +125,7 @@ namespace {
InterpolationValue ConvertTransform(TransformOperations&& transform) {
return InterpolationValue(
- InterpolableNumber::Create(0),
+ std::make_unique<InterpolableNumber>(0),
CSSTransformNonInterpolableValue::Create(std::move(transform)));
}
@@ -136,10 +136,8 @@ InterpolationValue ConvertTransform(const TransformOperations& transform) {
class InheritedTransformChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
- static std::unique_ptr<InheritedTransformChecker> Create(
- const TransformOperations& inherited_transform) {
- return base::WrapUnique(new InheritedTransformChecker(inherited_transform));
- }
+ InheritedTransformChecker(const TransformOperations& inherited_transform)
+ : inherited_transform_(inherited_transform) {}
bool IsValid(const StyleResolverState& state,
const InterpolationValue& underlying) const final {
@@ -147,9 +145,6 @@ class InheritedTransformChecker
}
private:
- InheritedTransformChecker(const TransformOperations& inherited_transform)
- : inherited_transform_(inherited_transform) {}
-
const TransformOperations inherited_transform_;
};
@@ -173,7 +168,7 @@ InterpolationValue CSSTransformInterpolationType::MaybeConvertInherit(
const TransformOperations& inherited_transform =
state.ParentStyle()->Transform();
conversion_checkers.push_back(
- InheritedTransformChecker::Create(inherited_transform));
+ std::make_unique<InheritedTransformChecker>(inherited_transform));
return ConvertTransform(inherited_transform);
}
@@ -182,18 +177,17 @@ InterpolationValue CSSTransformInterpolationType::MaybeConvertValue(
const StyleResolverState* state,
ConversionCheckers& conversion_checkers) const {
DCHECK(state);
- if (value.IsValueList()) {
+ if (auto* list_value = DynamicTo<CSSValueList>(value)) {
CSSLengthArray length_array;
- for (const CSSValue* item : ToCSSValueList(value)) {
- const CSSFunctionValue& transform_function = ToCSSFunctionValue(*item);
- if (transform_function.FunctionType() == CSSValueMatrix ||
- transform_function.FunctionType() == CSSValueMatrix3d) {
+ for (const CSSValue* item : *list_value) {
+ const auto& transform_function = To<CSSFunctionValue>(*item);
+ if (transform_function.FunctionType() == CSSValueID::kMatrix ||
+ transform_function.FunctionType() == CSSValueID::kMatrix3d) {
length_array.type_flags.Set(CSSPrimitiveValue::kUnitTypePixels);
continue;
}
for (const CSSValue* argument : transform_function) {
- const CSSPrimitiveValue& primitive_value =
- ToCSSPrimitiveValue(*argument);
+ const auto& primitive_value = To<CSSPrimitiveValue>(*argument);
if (!primitive_value.IsLength())
continue;
primitive_value.AccumulateLengthArray(length_array);
@@ -225,7 +219,8 @@ PairwiseInterpolationValue CSSTransformInterpolationType::MaybeMergeSingles(
ToInterpolableNumber(*start.interpolable_value).Value();
double end_fraction = ToInterpolableNumber(*end.interpolable_value).Value();
return PairwiseInterpolationValue(
- InterpolableNumber::Create(0), InterpolableNumber::Create(1),
+ std::make_unique<InterpolableNumber>(0),
+ std::make_unique<InterpolableNumber>(1),
CSSTransformNonInterpolableValue::Create(
std::move(ToCSSTransformNonInterpolableValue(
*start.non_interpolable_value)),
diff --git a/chromium/third_party/blink/renderer/core/animation/css_transform_interpolation_type.h b/chromium/third_party/blink/renderer/core/animation/css_transform_interpolation_type.h
index 99a9128ad05..9771c0844c6 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_transform_interpolation_type.h
+++ b/chromium/third_party/blink/renderer/core/animation/css_transform_interpolation_type.h
@@ -13,7 +13,7 @@ class CSSTransformInterpolationType : public CSSInterpolationType {
public:
CSSTransformInterpolationType(PropertyHandle property)
: CSSInterpolationType(property) {
- DCHECK_EQ(CssProperty().PropertyID(), CSSPropertyTransform);
+ DCHECK_EQ(CssProperty().PropertyID(), CSSPropertyID::kTransform);
}
InterpolationValue MaybeConvertStandardPropertyUnderlyingValue(
diff --git a/chromium/third_party/blink/renderer/core/animation/css_transform_origin_interpolation_type.h b/chromium/third_party/blink/renderer/core/animation/css_transform_origin_interpolation_type.h
index 98779ab5359..1dd8f99ddd8 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_transform_origin_interpolation_type.h
+++ b/chromium/third_party/blink/renderer/core/animation/css_transform_origin_interpolation_type.h
@@ -23,7 +23,7 @@ class CSSTransformOriginInterpolationType
InterpolationValue MaybeConvertValue(const CSSValue& value,
const StyleResolverState*,
ConversionCheckers&) const final {
- const CSSValueList& list = ToCSSValueList(value);
+ const CSSValueList& list = To<CSSValueList>(value);
DCHECK_GE(list.length(), 2u);
return ListInterpolationFunctions::CreateList(
3, [&list](wtf_size_t index) {
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 69a4e5ef97c..d763aa9b6db 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
@@ -19,7 +19,7 @@ namespace blink {
namespace {
InterpolationValue CreateNoneValue() {
- return InterpolationValue(InterpolableList::Create(0));
+ return InterpolationValue(std::make_unique<InterpolableList>(0));
}
bool IsNoneValue(const InterpolationValue& value) {
@@ -29,13 +29,11 @@ bool IsNoneValue(const InterpolationValue& value) {
class InheritedTranslateChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
+ InheritedTranslateChecker(
+ scoped_refptr<TranslateTransformOperation> inherited_translate)
+ : inherited_translate_(std::move(inherited_translate)) {}
~InheritedTranslateChecker() override = default;
- static std::unique_ptr<InheritedTranslateChecker> Create(
- scoped_refptr<TranslateTransformOperation> inherited_translate) {
- return base::WrapUnique(
- new InheritedTranslateChecker(std::move(inherited_translate)));
- }
bool IsValid(const StyleResolverState& state,
const InterpolationValue& underlying) const final {
@@ -49,10 +47,6 @@ class InheritedTranslateChecker
}
private:
- InheritedTranslateChecker(
- scoped_refptr<TranslateTransformOperation> inherited_translate)
- : inherited_translate_(std::move(inherited_translate)) {}
-
scoped_refptr<TransformOperation> inherited_translate_;
};
@@ -64,8 +58,8 @@ enum TranslateComponentIndex : unsigned {
};
std::unique_ptr<InterpolableValue> CreateTranslateIdentity() {
- std::unique_ptr<InterpolableList> result =
- InterpolableList::Create(kTranslateComponentIndexCount);
+ auto result =
+ std::make_unique<InterpolableList>(kTranslateComponentIndexCount);
result->Set(kTranslateX,
LengthInterpolationFunctions::CreateNeutralInterpolableValue());
result->Set(kTranslateY,
@@ -81,8 +75,8 @@ InterpolationValue ConvertTranslateOperation(
if (!translate)
return CreateNoneValue();
- std::unique_ptr<InterpolableList> result =
- InterpolableList::Create(kTranslateComponentIndexCount);
+ auto result =
+ std::make_unique<InterpolableList>(kTranslateComponentIndexCount);
result->Set(kTranslateX, LengthInterpolationFunctions::MaybeConvertLength(
translate->X(), zoom)
.interpolable_value);
@@ -115,7 +109,7 @@ InterpolationValue CSSTranslateInterpolationType::MaybeConvertInherit(
TranslateTransformOperation* inherited_translate =
state.ParentStyle()->Translate();
conversion_checkers.push_back(
- InheritedTranslateChecker::Create(inherited_translate));
+ std::make_unique<InheritedTranslateChecker>(inherited_translate));
return ConvertTranslateOperation(inherited_translate,
state.ParentStyle()->EffectiveZoom());
}
@@ -128,12 +122,12 @@ InterpolationValue CSSTranslateInterpolationType::MaybeConvertValue(
return CreateNoneValue();
}
- const CSSValueList& list = ToCSSValueList(value);
+ const auto& list = To<CSSValueList>(value);
if (list.length() < 1 || list.length() > 3)
return nullptr;
- std::unique_ptr<InterpolableList> result =
- InterpolableList::Create(kTranslateComponentIndexCount);
+ auto result =
+ std::make_unique<InterpolableList>(kTranslateComponentIndexCount);
for (wtf_size_t i = 0; i < kTranslateComponentIndexCount; i++) {
InterpolationValue component = nullptr;
if (i < list.length()) {
diff --git a/chromium/third_party/blink/renderer/core/animation/css_translate_interpolation_type.h b/chromium/third_party/blink/renderer/core/animation/css_translate_interpolation_type.h
index 37ccb00d19a..53c0540adbe 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_translate_interpolation_type.h
+++ b/chromium/third_party/blink/renderer/core/animation/css_translate_interpolation_type.h
@@ -13,7 +13,7 @@ class CSSTranslateInterpolationType : public CSSInterpolationType {
public:
CSSTranslateInterpolationType(PropertyHandle property)
: CSSInterpolationType(property) {
- DCHECK_EQ(CssProperty().PropertyID(), CSSPropertyTranslate);
+ DCHECK_EQ(CssProperty().PropertyID(), CSSPropertyID::kTranslate);
}
InterpolationValue MaybeConvertStandardPropertyUnderlyingValue(
diff --git a/chromium/third_party/blink/renderer/core/animation/css_var_cycle_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_var_cycle_interpolation_type.cc
index 5ade91cdd13..da36c0dd66c 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_var_cycle_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css_var_cycle_interpolation_type.cc
@@ -20,17 +20,11 @@ namespace blink {
class CycleChecker : public InterpolationType::ConversionChecker {
public:
- static std::unique_ptr<CycleChecker> Create(
- const CSSCustomPropertyDeclaration& declaration,
- bool cycle_detected) {
- return base::WrapUnique(new CycleChecker(declaration, cycle_detected));
- }
-
- private:
CycleChecker(const CSSCustomPropertyDeclaration& declaration,
bool cycle_detected)
: declaration_(declaration), cycle_detected_(cycle_detected) {}
+ private:
bool IsValid(const InterpolationEnvironment& environment,
const InterpolationValue&) const final {
DCHECK(ToCSSInterpolationEnvironment(environment).HasVariableResolver());
@@ -54,7 +48,7 @@ CSSVarCycleInterpolationType::CSSVarCycleInterpolationType(
}
static InterpolationValue CreateCycleDetectedValue() {
- return InterpolationValue(InterpolableList::Create(0));
+ return InterpolationValue(std::make_unique<InterpolableList>(0));
}
InterpolationValue CSSVarCycleInterpolationType::MaybeConvertSingle(
@@ -62,9 +56,8 @@ InterpolationValue CSSVarCycleInterpolationType::MaybeConvertSingle(
const InterpolationEnvironment& environment,
const InterpolationValue& underlying,
ConversionCheckers& conversion_checkers) const {
- const CSSCustomPropertyDeclaration& declaration =
- *ToCSSCustomPropertyDeclaration(
- ToCSSPropertySpecificKeyframe(keyframe).Value());
+ const auto& declaration = *To<CSSCustomPropertyDeclaration>(
+ ToCSSPropertySpecificKeyframe(keyframe).Value());
DCHECK_EQ(GetProperty().CustomPropertyName(), declaration.GetName());
if (!declaration.Value() || !declaration.Value()->NeedsVariableResolution()) {
return nullptr;
@@ -77,7 +70,7 @@ InterpolationValue CSSVarCycleInterpolationType::MaybeConvertSingle(
variable_resolver.ResolveCustomPropertyAnimationKeyframe(declaration,
cycle_detected);
conversion_checkers.push_back(
- CycleChecker::Create(declaration, cycle_detected));
+ std::make_unique<CycleChecker>(declaration, cycle_detected));
return cycle_detected ? CreateCycleDetectedValue() : nullptr;
}
@@ -127,8 +120,8 @@ void CSSVarCycleInterpolationType::Apply(
StyleBuilder::ApplyProperty(
GetProperty().GetCSSPropertyName(),
ToCSSInterpolationEnvironment(environment).GetState(),
- *CSSCustomPropertyDeclaration::Create(GetProperty().CustomPropertyName(),
- CSSValueUnset));
+ *MakeGarbageCollected<CSSCustomPropertyDeclaration>(
+ GetProperty().CustomPropertyName(), CSSValueID::kUnset));
}
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/animation/css_visibility_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/css_visibility_interpolation_type.cc
index 4aac7a767a1..d0153dd94a8 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_visibility_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/css_visibility_interpolation_type.cc
@@ -54,17 +54,13 @@ DEFINE_NON_INTERPOLABLE_VALUE_TYPE_CASTS(CSSVisibilityNonInterpolableValue);
class UnderlyingVisibilityChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
+ explicit UnderlyingVisibilityChecker(EVisibility visibility)
+ : visibility_(visibility) {}
+
~UnderlyingVisibilityChecker() final = default;
- static std::unique_ptr<UnderlyingVisibilityChecker> Create(
- EVisibility visibility) {
- return base::WrapUnique(new UnderlyingVisibilityChecker(visibility));
- }
private:
- UnderlyingVisibilityChecker(EVisibility visibility)
- : visibility_(visibility) {}
-
bool IsValid(const StyleResolverState&,
const InterpolationValue& underlying) const final {
double underlying_fraction =
@@ -81,15 +77,10 @@ class UnderlyingVisibilityChecker
class InheritedVisibilityChecker
: public CSSInterpolationType::CSSConversionChecker {
public:
- static std::unique_ptr<InheritedVisibilityChecker> Create(
- EVisibility visibility) {
- return base::WrapUnique(new InheritedVisibilityChecker(visibility));
- }
-
- private:
- InheritedVisibilityChecker(EVisibility visibility)
+ explicit InheritedVisibilityChecker(EVisibility visibility)
: visibility_(visibility) {}
+ private:
bool IsValid(const StyleResolverState& state,
const InterpolationValue& underlying) const final {
return visibility_ == state.ParentStyle()->Visibility();
@@ -101,7 +92,7 @@ class InheritedVisibilityChecker
InterpolationValue CSSVisibilityInterpolationType::CreateVisibilityValue(
EVisibility visibility) const {
return InterpolationValue(
- InterpolableNumber::Create(0),
+ std::make_unique<InterpolableNumber>(0),
CSSVisibilityNonInterpolableValue::Create(visibility, visibility));
}
@@ -114,7 +105,7 @@ InterpolationValue CSSVisibilityInterpolationType::MaybeConvertNeutral(
ToCSSVisibilityNonInterpolableValue(*underlying.non_interpolable_value)
.Visibility(underlying_fraction);
conversion_checkers.push_back(
- UnderlyingVisibilityChecker::Create(underlying_visibility));
+ std::make_unique<UnderlyingVisibilityChecker>(underlying_visibility));
return CreateVisibilityValue(underlying_visibility);
}
@@ -131,7 +122,7 @@ InterpolationValue CSSVisibilityInterpolationType::MaybeConvertInherit(
return nullptr;
EVisibility inherited_visibility = state.ParentStyle()->Visibility();
conversion_checkers.push_back(
- InheritedVisibilityChecker::Create(inherited_visibility));
+ std::make_unique<InheritedVisibilityChecker>(inherited_visibility));
return CreateVisibilityValue(inherited_visibility);
}
@@ -139,17 +130,17 @@ InterpolationValue CSSVisibilityInterpolationType::MaybeConvertValue(
const CSSValue& value,
const StyleResolverState*,
ConversionCheckers& conversion_checkers) const {
- if (!value.IsIdentifierValue())
+ const auto* identifier_value = DynamicTo<CSSIdentifierValue>(value);
+ if (!identifier_value)
return nullptr;
- const CSSIdentifierValue& identifier_value = ToCSSIdentifierValue(value);
- CSSValueID keyword = identifier_value.GetValueID();
+ CSSValueID keyword = identifier_value->GetValueID();
switch (keyword) {
- case CSSValueHidden:
- case CSSValueVisible:
- case CSSValueCollapse:
- return CreateVisibilityValue(identifier_value.ConvertTo<EVisibility>());
+ case CSSValueID::kHidden:
+ case CSSValueID::kVisible:
+ case CSSValueID::kCollapse:
+ return CreateVisibilityValue(identifier_value->ConvertTo<EVisibility>());
default:
return nullptr;
}
@@ -177,8 +168,8 @@ PairwiseInterpolationValue CSSVisibilityInterpolationType::MaybeMergeSingles(
end_visibility != EVisibility::kVisible) {
return nullptr;
}
- return PairwiseInterpolationValue(InterpolableNumber::Create(0),
- InterpolableNumber::Create(1),
+ return PairwiseInterpolationValue(std::make_unique<InterpolableNumber>(0),
+ std::make_unique<InterpolableNumber>(1),
CSSVisibilityNonInterpolableValue::Create(
start_visibility, end_visibility));
}
diff --git a/chromium/third_party/blink/renderer/core/animation/css_visibility_interpolation_type.h b/chromium/third_party/blink/renderer/core/animation/css_visibility_interpolation_type.h
index 5979c76d72d..dcc40701122 100644
--- a/chromium/third_party/blink/renderer/core/animation/css_visibility_interpolation_type.h
+++ b/chromium/third_party/blink/renderer/core/animation/css_visibility_interpolation_type.h
@@ -14,7 +14,7 @@ class CSSVisibilityInterpolationType : public CSSInterpolationType {
public:
CSSVisibilityInterpolationType(PropertyHandle property)
: CSSInterpolationType(property) {
- DCHECK_EQ(CssProperty().PropertyID(), CSSPropertyVisibility);
+ DCHECK_EQ(CssProperty().PropertyID(), CSSPropertyID::kVisibility);
}
InterpolationValue MaybeConvertStandardPropertyUnderlyingValue(
diff --git a/chromium/third_party/blink/renderer/core/animation/document_animations.h b/chromium/third_party/blink/renderer/core/animation/document_animations.h
index 024c5c4404a..12f52b252a0 100644
--- a/chromium/third_party/blink/renderer/core/animation/document_animations.h
+++ b/chromium/third_party/blink/renderer/core/animation/document_animations.h
@@ -35,12 +35,15 @@
#include "third_party/blink/renderer/core/css/css_property_names.h"
#include "third_party/blink/renderer/core/dom/document_lifecycle.h"
#include "third_party/blink/renderer/platform/graphics/compositor_element_id.h"
+#include "third_party/blink/renderer/platform/wtf/allocator.h"
namespace blink {
class Document;
class DocumentAnimations {
+ STATIC_ONLY(DocumentAnimations);
+
public:
static void UpdateAnimationTimingForAnimationFrame(Document&);
static bool NeedsAnimationTimingUpdate(const Document&);
@@ -53,9 +56,6 @@ class DocumentAnimations {
Document&,
DocumentLifecycle::LifecycleState required_lifecycle_state,
const base::Optional<CompositorElementIdSet>&);
-
- private:
- DocumentAnimations() = default;
};
} // namespace blink
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 43b8369dd76..920e8e8ddb7 100644
--- a/chromium/third_party/blink/renderer/core/animation/document_timeline.cc
+++ b/chromium/third_party/blink/renderer/core/animation/document_timeline.cc
@@ -88,12 +88,12 @@ DocumentTimeline::DocumentTimeline(Document* document,
timing_ = timing;
if (Platform::Current()->IsThreadedAnimationEnabled())
- compositor_timeline_ = CompositorAnimationTimeline::Create();
+ compositor_timeline_ = std::make_unique<CompositorAnimationTimeline>();
DCHECK(document);
}
-bool DocumentTimeline::IsActive() {
+bool DocumentTimeline::IsActive() const {
return document_->GetPage();
}
diff --git a/chromium/third_party/blink/renderer/core/animation/document_timeline.h b/chromium/third_party/blink/renderer/core/animation/document_timeline.h
index 5b46323014e..ce4350a6a60 100644
--- a/chromium/third_party/blink/renderer/core/animation/document_timeline.h
+++ b/chromium/third_party/blink/renderer/core/animation/document_timeline.h
@@ -89,7 +89,7 @@ class CORE_EXPORT DocumentTimeline : public AnimationTimeline {
void AnimationAttached(Animation&);
- bool IsActive();
+ bool IsActive() const override;
bool HasPendingUpdates() const {
return !animations_needing_update_.IsEmpty();
}
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 06f7774ba1b..d7b448b05aa 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
@@ -80,7 +80,7 @@ class AnimationDocumentTimelineTest : public PageTestBase {
document.Release();
element.Release();
timeline.Release();
- ThreadState::Current()->CollectAllGarbage();
+ ThreadState::Current()->CollectAllGarbageForTesting();
}
void UpdateClockAndService(double time) {
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 67af486cf41..4e15e0ffef7 100644
--- a/chromium/third_party/blink/renderer/core/animation/effect_input.cc
+++ b/chromium/third_party/blink/renderer/core/animation/effect_input.cc
@@ -51,8 +51,8 @@
#include "third_party/blink/renderer/core/frame/frame_console.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/inspector/console_message.h"
-#include "third_party/blink/renderer/platform/wtf/ascii_ctype.h"
#include "third_party/blink/renderer/platform/wtf/hash_set.h"
+#include "third_party/blink/renderer/platform/wtf/text/ascii_ctype.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
#include "v8/include/v8.h"
@@ -90,9 +90,9 @@ void SetKeyframeValue(Element* element,
StyleSheetContents* style_sheet_contents = document.ElementSheet().Contents();
CSSPropertyID css_property =
AnimationInputHelpers::KeyframeAttributeToCSSProperty(property, document);
- if (css_property != CSSPropertyInvalid) {
+ if (css_property != CSSPropertyID::kInvalid) {
MutableCSSPropertyValueSet::SetResult set_result =
- css_property == CSSPropertyVariable
+ css_property == CSSPropertyID::kVariable
? keyframe.SetCSSPropertyValue(
AtomicString(property), document.GetPropertyRegistry(), value,
document.GetSecureContextMode(), style_sheet_contents)
@@ -102,7 +102,8 @@ void SetKeyframeValue(Element* element,
if (!set_result.did_parse && execution_context) {
if (document.GetFrame()) {
document.GetFrame()->Console().AddMessage(ConsoleMessage::Create(
- kJSMessageSource, mojom::ConsoleMessageLevel::kWarning,
+ mojom::ConsoleMessageSource::kJavaScript,
+ mojom::ConsoleMessageLevel::kWarning,
"Invalid keyframe value for property " + property + ": " + value));
}
}
@@ -111,7 +112,7 @@ void SetKeyframeValue(Element* element,
css_property =
AnimationInputHelpers::KeyframeAttributeToPresentationAttribute(property,
element);
- if (css_property != CSSPropertyInvalid) {
+ if (css_property != CSSPropertyID::kInvalid) {
keyframe.SetPresentationAttributeValue(
CSSProperty::Get(css_property), value, document.GetSecureContextMode(),
style_sheet_contents);
@@ -190,7 +191,7 @@ bool IsAnimatableKeyframeAttribute(const String& property,
const Document& document) {
CSSPropertyID css_property =
AnimationInputHelpers::KeyframeAttributeToCSSProperty(property, document);
- if (css_property != CSSPropertyInvalid) {
+ if (css_property != CSSPropertyID::kInvalid) {
return !CSSAnimations::IsAnimationAffectingProperty(
CSSProperty::Get(css_property));
}
@@ -198,7 +199,7 @@ bool IsAnimatableKeyframeAttribute(const String& property,
css_property =
AnimationInputHelpers::KeyframeAttributeToPresentationAttribute(property,
element);
- if (css_property != CSSPropertyInvalid)
+ if (css_property != CSSPropertyID::kInvalid)
return true;
return !!AnimationInputHelpers::KeyframeAttributeToSVGAttribute(property,
diff --git a/chromium/third_party/blink/renderer/core/animation/effect_stack_test.cc b/chromium/third_party/blink/renderer/core/animation/effect_stack_test.cc
index 9cf45e94c32..8f4e6bc8ea5 100644
--- a/chromium/third_party/blink/renderer/core/animation/effect_stack_test.cc
+++ b/chromium/third_party/blink/renderer/core/animation/effect_stack_test.cc
@@ -109,9 +109,11 @@ class AnimationEffectStackTest : public PageTestBase {
};
TEST_F(AnimationEffectStackTest, ElementAnimationsSorted) {
- Play(MakeKeyframeEffect(MakeEffectModel(CSSPropertyFontSize, "1px")), 10);
- Play(MakeKeyframeEffect(MakeEffectModel(CSSPropertyFontSize, "2px")), 15);
- Play(MakeKeyframeEffect(MakeEffectModel(CSSPropertyFontSize, "3px")), 5);
+ Play(MakeKeyframeEffect(MakeEffectModel(CSSPropertyID::kFontSize, "1px")),
+ 10);
+ Play(MakeKeyframeEffect(MakeEffectModel(CSSPropertyID::kFontSize, "2px")),
+ 15);
+ Play(MakeKeyframeEffect(MakeEffectModel(CSSPropertyID::kFontSize, "3px")), 5);
ActiveInterpolationsMap result = EffectStack::ActiveInterpolations(
&element->GetElementAnimations()->GetEffectStack(), nullptr, nullptr,
KeyframeEffect::kDefaultPriority);
@@ -120,13 +122,14 @@ TEST_F(AnimationEffectStackTest, ElementAnimationsSorted) {
}
TEST_F(AnimationEffectStackTest, NewAnimations) {
- Play(MakeKeyframeEffect(MakeEffectModel(CSSPropertyFontSize, "1px")), 15);
- Play(MakeKeyframeEffect(MakeEffectModel(CSSPropertyZIndex, "2")), 10);
+ Play(MakeKeyframeEffect(MakeEffectModel(CSSPropertyID::kFontSize, "1px")),
+ 15);
+ Play(MakeKeyframeEffect(MakeEffectModel(CSSPropertyID::kZIndex, "2")), 10);
HeapVector<Member<const InertEffect>> new_animations;
InertEffect* inert1 =
- MakeInertEffect(MakeEffectModel(CSSPropertyFontSize, "3px"));
+ MakeInertEffect(MakeEffectModel(CSSPropertyID::kFontSize, "3px"));
InertEffect* inert2 =
- MakeInertEffect(MakeEffectModel(CSSPropertyZIndex, "4"));
+ MakeInertEffect(MakeEffectModel(CSSPropertyID::kZIndex, "4"));
new_animations.push_back(inert1);
new_animations.push_back(inert2);
ActiveInterpolationsMap result = EffectStack::ActiveInterpolations(
@@ -139,10 +142,10 @@ TEST_F(AnimationEffectStackTest, NewAnimations) {
TEST_F(AnimationEffectStackTest, CancelledAnimations) {
HeapHashSet<Member<const Animation>> cancelled_animations;
- Animation* animation =
- Play(MakeKeyframeEffect(MakeEffectModel(CSSPropertyFontSize, "1px")), 0);
+ Animation* animation = Play(
+ MakeKeyframeEffect(MakeEffectModel(CSSPropertyID::kFontSize, "1px")), 0);
cancelled_animations.insert(animation);
- Play(MakeKeyframeEffect(MakeEffectModel(CSSPropertyZIndex, "2")), 0);
+ Play(MakeKeyframeEffect(MakeEffectModel(CSSPropertyID::kZIndex, "2")), 0);
ActiveInterpolationsMap result = EffectStack::ActiveInterpolations(
&element->GetElementAnimations()->GetEffectStack(), nullptr,
&cancelled_animations, KeyframeEffect::kDefaultPriority);
@@ -151,8 +154,8 @@ TEST_F(AnimationEffectStackTest, CancelledAnimations) {
}
TEST_F(AnimationEffectStackTest, ClearedEffectsRemoved) {
- Animation* animation =
- Play(MakeKeyframeEffect(MakeEffectModel(CSSPropertyFontSize, "1px")), 10);
+ Animation* animation = Play(
+ MakeKeyframeEffect(MakeEffectModel(CSSPropertyID::kFontSize, "1px")), 10);
ActiveInterpolationsMap result = EffectStack::ActiveInterpolations(
&element->GetElementAnimations()->GetEffectStack(), nullptr, nullptr,
KeyframeEffect::kDefaultPriority);
@@ -167,9 +170,9 @@ TEST_F(AnimationEffectStackTest, ClearedEffectsRemoved) {
}
TEST_F(AnimationEffectStackTest, ForwardsFillDiscarding) {
- Play(MakeKeyframeEffect(MakeEffectModel(CSSPropertyFontSize, "1px")), 2);
- Play(MakeKeyframeEffect(MakeEffectModel(CSSPropertyFontSize, "2px")), 6);
- Play(MakeKeyframeEffect(MakeEffectModel(CSSPropertyFontSize, "3px")), 4);
+ Play(MakeKeyframeEffect(MakeEffectModel(CSSPropertyID::kFontSize, "1px")), 2);
+ Play(MakeKeyframeEffect(MakeEffectModel(CSSPropertyID::kFontSize, "2px")), 6);
+ Play(MakeKeyframeEffect(MakeEffectModel(CSSPropertyID::kFontSize, "3px")), 4);
GetDocument().GetPendingAnimations().Update(
base::Optional<CompositorElementIdSet>());
@@ -179,7 +182,7 @@ TEST_F(AnimationEffectStackTest, ForwardsFillDiscarding) {
Persistent<ActiveInterpolationsMap> interpolations;
UpdateTimeline(TimeDelta::FromSeconds(11));
- ThreadState::Current()->CollectAllGarbage();
+ ThreadState::Current()->CollectAllGarbageForTesting();
interpolations = MakeGarbageCollected<ActiveInterpolationsMap>(
EffectStack::ActiveInterpolations(
&element->GetElementAnimations()->GetEffectStack(), nullptr, nullptr,
@@ -189,7 +192,7 @@ TEST_F(AnimationEffectStackTest, ForwardsFillDiscarding) {
EXPECT_EQ(3u, SampledEffectCount());
UpdateTimeline(TimeDelta::FromSeconds(13));
- ThreadState::Current()->CollectAllGarbage();
+ ThreadState::Current()->CollectAllGarbageForTesting();
interpolations = MakeGarbageCollected<ActiveInterpolationsMap>(
EffectStack::ActiveInterpolations(
&element->GetElementAnimations()->GetEffectStack(), nullptr, nullptr,
@@ -199,7 +202,7 @@ TEST_F(AnimationEffectStackTest, ForwardsFillDiscarding) {
EXPECT_EQ(3u, SampledEffectCount());
UpdateTimeline(TimeDelta::FromSeconds(15));
- ThreadState::Current()->CollectAllGarbage();
+ ThreadState::Current()->CollectAllGarbageForTesting();
interpolations = MakeGarbageCollected<ActiveInterpolationsMap>(
EffectStack::ActiveInterpolations(
&element->GetElementAnimations()->GetEffectStack(), nullptr, nullptr,
@@ -209,7 +212,7 @@ TEST_F(AnimationEffectStackTest, ForwardsFillDiscarding) {
EXPECT_EQ(2u, SampledEffectCount());
UpdateTimeline(TimeDelta::FromSeconds(17));
- ThreadState::Current()->CollectAllGarbage();
+ ThreadState::Current()->CollectAllGarbageForTesting();
interpolations = MakeGarbageCollected<ActiveInterpolationsMap>(
EffectStack::ActiveInterpolations(
&element->GetElementAnimations()->GetEffectStack(), nullptr, nullptr,
diff --git a/chromium/third_party/blink/renderer/core/animation/element_animation.idl b/chromium/third_party/blink/renderer/core/animation/element_animation.idl
index 3e56e3d5510..1c596d36cd8 100644
--- a/chromium/third_party/blink/renderer/core/animation/element_animation.idl
+++ b/chromium/third_party/blink/renderer/core/animation/element_animation.idl
@@ -32,7 +32,7 @@
// https://drafts.csswg.org/web-animations/#extensions-to-the-element-interface
// TODO(dstockwell): This should be an Animatable interface, where Element
-// implements Animatable.
+// includes Animatable.
[
ImplementedAs=ElementAnimation
diff --git a/chromium/third_party/blink/renderer/core/animation/element_animations.cc b/chromium/third_party/blink/renderer/core/animation/element_animations.cc
index 9c202260257..91375f7ff72 100644
--- a/chromium/third_party/blink/renderer/core/animation/element_animations.cc
+++ b/chromium/third_party/blink/renderer/core/animation/element_animations.cc
@@ -65,7 +65,7 @@ bool ShouldCheckComputedStyles(const ComputedStyle& base_computed_style,
// Images use instance equality rather than value equality (see
// crbug.com/781461).
for (CSSPropertyID id :
- {CSSPropertyBackgroundImage, CSSPropertyWebkitMaskImage}) {
+ {CSSPropertyID::kBackgroundImage, CSSPropertyID::kWebkitMaskImage}) {
if (!CSSPropertyEquality::PropertiesEqual(
PropertyHandle(CSSProperty::Get(id)), base_computed_style,
computed_style)) {
diff --git a/chromium/third_party/blink/renderer/core/animation/filter_interpolation_functions.cc b/chromium/third_party/blink/renderer/core/animation/filter_interpolation_functions.cc
index 1e21c15e1c5..607e90a91b7 100644
--- a/chromium/third_party/blink/renderer/core/animation/filter_interpolation_functions.cc
+++ b/chromium/third_party/blink/renderer/core/animation/filter_interpolation_functions.cc
@@ -97,7 +97,7 @@ InterpolationValue filter_interpolation_functions::MaybeConvertCSSFilter(
if (value.IsURIValue())
return nullptr;
- const CSSFunctionValue& filter = ToCSSFunctionValue(value);
+ const auto& filter = To<CSSFunctionValue>(value);
DCHECK_LE(filter.length(), 1u);
FilterOperation::OperationType type =
FilterOperationResolver::FilterOperationForType(filter.FunctionType());
@@ -114,20 +114,20 @@ InterpolationValue filter_interpolation_functions::MaybeConvertCSSFilter(
double amount = DefaultParameter(type);
if (filter.length() == 1) {
const CSSPrimitiveValue& first_value =
- ToCSSPrimitiveValue(filter.Item(0));
+ To<CSSPrimitiveValue>(filter.Item(0));
amount = first_value.GetDoubleValue();
if (first_value.IsPercentage())
amount /= 100;
}
- result.interpolable_value = InterpolableNumber::Create(amount);
+ result.interpolable_value = std::make_unique<InterpolableNumber>(amount);
break;
}
case FilterOperation::HUE_ROTATE: {
double angle = DefaultParameter(type);
if (filter.length() == 1)
- angle = ToCSSPrimitiveValue(filter.Item(0)).ComputeDegrees();
- result.interpolable_value = InterpolableNumber::Create(angle);
+ angle = To<CSSPrimitiveValue>(filter.Item(0)).ComputeDegrees();
+ result.interpolable_value = std::make_unique<InterpolableNumber>(angle);
break;
}
@@ -170,26 +170,26 @@ InterpolationValue filter_interpolation_functions::MaybeConvertFilter(
case FilterOperation::HUE_ROTATE:
case FilterOperation::SATURATE:
case FilterOperation::SEPIA:
- result.interpolable_value = InterpolableNumber::Create(
- ToBasicColorMatrixFilterOperation(filter).Amount());
+ result.interpolable_value = std::make_unique<InterpolableNumber>(
+ To<BasicColorMatrixFilterOperation>(filter).Amount());
break;
case FilterOperation::BRIGHTNESS:
case FilterOperation::CONTRAST:
case FilterOperation::INVERT:
case FilterOperation::OPACITY:
- result.interpolable_value = InterpolableNumber::Create(
- ToBasicComponentTransferFilterOperation(filter).Amount());
+ result.interpolable_value = std::make_unique<InterpolableNumber>(
+ To<BasicComponentTransferFilterOperation>(filter).Amount());
break;
case FilterOperation::BLUR:
result = LengthInterpolationFunctions::MaybeConvertLength(
- ToBlurFilterOperation(filter).StdDeviation(), zoom);
+ To<BlurFilterOperation>(filter).StdDeviation(), zoom);
break;
case FilterOperation::DROP_SHADOW: {
result = ShadowInterpolationFunctions::ConvertShadowData(
- ToDropShadowFilterOperation(filter).Shadow(), zoom);
+ To<DropShadowFilterOperation>(filter).Shadow(), zoom);
break;
}
@@ -217,13 +217,13 @@ filter_interpolation_functions::CreateNoneValue(
case FilterOperation::INVERT:
case FilterOperation::SEPIA:
case FilterOperation::HUE_ROTATE:
- return InterpolableNumber::Create(0);
+ return std::make_unique<InterpolableNumber>(0);
case FilterOperation::BRIGHTNESS:
case FilterOperation::CONTRAST:
case FilterOperation::OPACITY:
case FilterOperation::SATURATE:
- return InterpolableNumber::Create(1);
+ return std::make_unique<InterpolableNumber>(1);
case FilterOperation::BLUR:
return LengthInterpolationFunctions::CreateNeutralInterpolableValue();
@@ -260,7 +260,7 @@ FilterOperation* filter_interpolation_functions::CreateFilter(
case FilterOperation::SEPIA: {
double value = ClampParameter(
ToInterpolableNumber(interpolable_value).Value(), type);
- return BasicColorMatrixFilterOperation::Create(value, type);
+ return MakeGarbageCollected<BasicColorMatrixFilterOperation>(value, type);
}
case FilterOperation::BRIGHTNESS:
@@ -269,14 +269,15 @@ FilterOperation* filter_interpolation_functions::CreateFilter(
case FilterOperation::OPACITY: {
double value = ClampParameter(
ToInterpolableNumber(interpolable_value).Value(), type);
- return BasicComponentTransferFilterOperation::Create(value, type);
+ return MakeGarbageCollected<BasicComponentTransferFilterOperation>(value,
+ type);
}
case FilterOperation::BLUR: {
Length std_deviation = LengthInterpolationFunctions::CreateLength(
interpolable_value, non_interpolable_value.TypeNonInterpolableValue(),
state.CssToLengthConversionData(), kValueRangeNonNegative);
- return BlurFilterOperation::Create(std_deviation);
+ return MakeGarbageCollected<BlurFilterOperation>(std_deviation);
}
case FilterOperation::DROP_SHADOW: {
diff --git a/chromium/third_party/blink/renderer/core/animation/image_list_property_functions.h b/chromium/third_party/blink/renderer/core/animation/image_list_property_functions.h
index 39071e66c74..2717ce8d49d 100644
--- a/chromium/third_party/blink/renderer/core/animation/image_list_property_functions.h
+++ b/chromium/third_party/blink/renderer/core/animation/image_list_property_functions.h
@@ -24,10 +24,10 @@ class ImageListPropertyFunctions {
StyleImageList* result) {
const FillLayer* fill_layer = nullptr;
switch (property.PropertyID()) {
- case CSSPropertyBackgroundImage:
+ case CSSPropertyID::kBackgroundImage:
fill_layer = &style.BackgroundLayers();
break;
- case CSSPropertyWebkitMaskImage:
+ case CSSPropertyID::kWebkitMaskImage:
fill_layer = &style.MaskLayers();
break;
default:
@@ -47,10 +47,10 @@ class ImageListPropertyFunctions {
const StyleImageList* image_list) {
FillLayer* fill_layer = nullptr;
switch (property.PropertyID()) {
- case CSSPropertyBackgroundImage:
+ case CSSPropertyID::kBackgroundImage:
fill_layer = &style.AccessBackgroundLayers();
break;
- case CSSPropertyWebkitMaskImage:
+ case CSSPropertyID::kWebkitMaskImage:
fill_layer = &style.AccessMaskLayers();
break;
default:
diff --git a/chromium/third_party/blink/renderer/core/animation/image_slice_property_functions.h b/chromium/third_party/blink/renderer/core/animation/image_slice_property_functions.h
index ca090999a94..35840e4e8be 100644
--- a/chromium/third_party/blink/renderer/core/animation/image_slice_property_functions.h
+++ b/chromium/third_party/blink/renderer/core/animation/image_slice_property_functions.h
@@ -7,6 +7,7 @@
#include "third_party/blink/renderer/core/css/css_property_names.h"
#include "third_party/blink/renderer/core/style/computed_style.h"
+#include "third_party/blink/renderer/platform/wtf/allocator.h"
namespace blink {
@@ -20,6 +21,8 @@ struct ImageSlice {
};
class ImageSlicePropertyFunctions {
+ STATIC_ONLY(ImageSlicePropertyFunctions);
+
public:
static ImageSlice GetInitialImageSlice(const CSSProperty& property) {
return GetImageSlice(property, ComputedStyle::InitialStyle());
@@ -31,10 +34,10 @@ class ImageSlicePropertyFunctions {
default:
NOTREACHED();
FALLTHROUGH;
- case CSSPropertyBorderImageSlice:
+ case CSSPropertyID::kBorderImageSlice:
return ImageSlice(style.BorderImageSlices(),
style.BorderImageSlicesFill());
- case CSSPropertyWebkitMaskBoxImageSlice:
+ case CSSPropertyID::kWebkitMaskBoxImageSlice:
return ImageSlice(style.MaskBoxImageSlices(),
style.MaskBoxImageSlicesFill());
}
@@ -44,11 +47,11 @@ class ImageSlicePropertyFunctions {
ComputedStyle& style,
const ImageSlice& slice) {
switch (property.PropertyID()) {
- case CSSPropertyBorderImageSlice:
+ case CSSPropertyID::kBorderImageSlice:
style.SetBorderImageSlices(slice.slices);
style.SetBorderImageSlicesFill(slice.fill);
break;
- case CSSPropertyWebkitMaskBoxImageSlice:
+ case CSSPropertyID::kWebkitMaskBoxImageSlice:
style.SetMaskBoxImageSlices(slice.slices);
style.SetMaskBoxImageSlicesFill(slice.fill);
break;
diff --git a/chromium/third_party/blink/renderer/core/animation/interpolable_value.cc b/chromium/third_party/blink/renderer/core/animation/interpolable_value.cc
index 56cd7111553..fbf0b6833e9 100644
--- a/chromium/third_party/blink/renderer/core/animation/interpolable_value.cc
+++ b/chromium/third_party/blink/renderer/core/animation/interpolable_value.cc
@@ -56,7 +56,7 @@ void InterpolableList::Interpolate(const InterpolableValue& to,
}
std::unique_ptr<InterpolableValue> InterpolableList::CloneAndZero() const {
- std::unique_ptr<InterpolableList> result = InterpolableList::Create(length());
+ auto result = std::make_unique<InterpolableList>(length());
for (wtf_size_t i = 0; i < length(); i++)
result->Set(i, values_[i]->CloneAndZero());
return std::move(result);
diff --git a/chromium/third_party/blink/renderer/core/animation/interpolable_value.h b/chromium/third_party/blink/renderer/core/animation/interpolable_value.h
index 71b0dd8d3be..652a2bade75 100644
--- a/chromium/third_party/blink/renderer/core/animation/interpolable_value.h
+++ b/chromium/third_party/blink/renderer/core/animation/interpolable_value.h
@@ -53,18 +53,16 @@ class CORE_EXPORT InterpolableValue {
class CORE_EXPORT InterpolableNumber final : public InterpolableValue {
public:
- static std::unique_ptr<InterpolableNumber> Create(double value) {
- return base::WrapUnique(new InterpolableNumber(value));
- }
+ explicit InterpolableNumber(double value) : value_(value) {}
bool IsNumber() const final { return true; }
double Value() const { return value_; }
bool Equals(const InterpolableValue& other) const final;
std::unique_ptr<InterpolableValue> Clone() const final {
- return Create(value_);
+ return std::make_unique<InterpolableNumber>(value_);
}
std::unique_ptr<InterpolableValue> CloneAndZero() const final {
- return Create(0);
+ return std::make_unique<InterpolableNumber>(0);
}
void Scale(double scale) final;
void ScaleAndAdd(double scale, const InterpolableValue& other) final;
@@ -75,8 +73,6 @@ class CORE_EXPORT InterpolableNumber final : public InterpolableValue {
const double progress,
InterpolableValue& result) const final;
double value_;
-
- explicit InterpolableNumber(double value) : value_(value) {}
};
class CORE_EXPORT InterpolableList : public InterpolableValue {
@@ -89,13 +85,11 @@ class CORE_EXPORT InterpolableList : public InterpolableValue {
// has its own copy constructor. So just delete operator= here.
InterpolableList& operator=(const InterpolableList&) = delete;
- static std::unique_ptr<InterpolableList> Create(
- const InterpolableList& other) {
- return base::WrapUnique(new InterpolableList(other));
- }
+ explicit InterpolableList(wtf_size_t size) : values_(size) {}
- static std::unique_ptr<InterpolableList> Create(wtf_size_t size) {
- return base::WrapUnique(new InterpolableList(size));
+ InterpolableList(const InterpolableList& other) : values_(other.length()) {
+ for (wtf_size_t i = 0; i < length(); i++)
+ Set(i, other.values_[i]->Clone());
}
bool IsList() const final { return true; }
@@ -111,7 +105,7 @@ class CORE_EXPORT InterpolableList : public InterpolableValue {
wtf_size_t length() const { return values_.size(); }
bool Equals(const InterpolableValue& other) const final;
std::unique_ptr<InterpolableValue> Clone() const final {
- return Create(*this);
+ return std::make_unique<InterpolableList>(*this);
}
std::unique_ptr<InterpolableValue> CloneAndZero() const final;
void Scale(double scale) final;
@@ -121,12 +115,6 @@ class CORE_EXPORT InterpolableList : public InterpolableValue {
void Interpolate(const InterpolableValue& to,
const double progress,
InterpolableValue& result) const final;
- explicit InterpolableList(wtf_size_t size) : values_(size) {}
-
- InterpolableList(const InterpolableList& other) : values_(other.length()) {
- for (wtf_size_t i = 0; i < length(); i++)
- Set(i, other.values_[i]->Clone());
- }
Vector<std::unique_ptr<InterpolableValue>> values_;
};
diff --git a/chromium/third_party/blink/renderer/core/animation/interpolable_value_test.cc b/chromium/third_party/blink/renderer/core/animation/interpolable_value_test.cc
index 89ab7f38725..5bbe52b7f90 100644
--- a/chromium/third_party/blink/renderer/core/animation/interpolable_value_test.cc
+++ b/chromium/third_party/blink/renderer/core/animation/interpolable_value_test.cc
@@ -22,8 +22,8 @@ class AnimationInterpolableValueTest : public testing::Test {
// the compositor (as z-index isn't compositor-compatible).
PropertyHandle property_handle(GetCSSPropertyZIndex());
CSSNumberInterpolationType interpolation_type(property_handle);
- InterpolationValue start(InterpolableNumber::Create(a));
- InterpolationValue end(InterpolableNumber::Create(b));
+ InterpolationValue start(std::make_unique<InterpolableNumber>(a));
+ InterpolationValue end(std::make_unique<InterpolableNumber>(b));
TransitionInterpolation* i = TransitionInterpolation::Create(
property_handle, interpolation_type, std::move(start), std::move(end),
nullptr, nullptr);
@@ -71,15 +71,15 @@ TEST_F(AnimationInterpolableValueTest, InterpolateNumbers) {
}
TEST_F(AnimationInterpolableValueTest, SimpleList) {
- std::unique_ptr<InterpolableList> list_a = InterpolableList::Create(3);
- list_a->Set(0, InterpolableNumber::Create(0));
- list_a->Set(1, InterpolableNumber::Create(42));
- list_a->Set(2, InterpolableNumber::Create(20.5));
+ auto list_a = std::make_unique<InterpolableList>(3);
+ list_a->Set(0, std::make_unique<InterpolableNumber>(0));
+ list_a->Set(1, std::make_unique<InterpolableNumber>(42));
+ list_a->Set(2, std::make_unique<InterpolableNumber>(20.5));
- std::unique_ptr<InterpolableList> list_b = InterpolableList::Create(3);
- list_b->Set(0, InterpolableNumber::Create(100));
- list_b->Set(1, InterpolableNumber::Create(-200));
- list_b->Set(2, InterpolableNumber::Create(300));
+ auto list_b = std::make_unique<InterpolableList>(3);
+ list_b->Set(0, std::make_unique<InterpolableNumber>(100));
+ list_b->Set(1, std::make_unique<InterpolableNumber>(-200));
+ list_b->Set(2, std::make_unique<InterpolableNumber>(300));
std::unique_ptr<TypedInterpolationValue> interpolated_value =
InterpolateLists(std::move(list_a), std::move(list_b), 0.3);
@@ -92,19 +92,19 @@ TEST_F(AnimationInterpolableValueTest, SimpleList) {
}
TEST_F(AnimationInterpolableValueTest, NestedList) {
- std::unique_ptr<InterpolableList> list_a = InterpolableList::Create(3);
- list_a->Set(0, InterpolableNumber::Create(0));
- std::unique_ptr<InterpolableList> sub_list_a = InterpolableList::Create(1);
- sub_list_a->Set(0, InterpolableNumber::Create(100));
+ auto list_a = std::make_unique<InterpolableList>(3);
+ list_a->Set(0, std::make_unique<InterpolableNumber>(0));
+ auto sub_list_a = std::make_unique<InterpolableList>(1);
+ sub_list_a->Set(0, std::make_unique<InterpolableNumber>(100));
list_a->Set(1, std::move(sub_list_a));
- list_a->Set(2, InterpolableNumber::Create(0));
+ list_a->Set(2, std::make_unique<InterpolableNumber>(0));
- std::unique_ptr<InterpolableList> list_b = InterpolableList::Create(3);
- list_b->Set(0, InterpolableNumber::Create(100));
- std::unique_ptr<InterpolableList> sub_list_b = InterpolableList::Create(1);
- sub_list_b->Set(0, InterpolableNumber::Create(50));
+ auto list_b = std::make_unique<InterpolableList>(3);
+ list_b->Set(0, std::make_unique<InterpolableNumber>(100));
+ auto sub_list_b = std::make_unique<InterpolableList>(1);
+ sub_list_b->Set(0, std::make_unique<InterpolableNumber>(50));
list_b->Set(1, std::move(sub_list_b));
- list_b->Set(2, InterpolableNumber::Create(1));
+ list_b->Set(2, std::make_unique<InterpolableNumber>(1));
std::unique_ptr<TypedInterpolationValue> interpolated_value =
InterpolateLists(std::move(list_a), std::move(list_b), 0.5);
@@ -119,28 +119,29 @@ TEST_F(AnimationInterpolableValueTest, NestedList) {
}
TEST_F(AnimationInterpolableValueTest, ScaleAndAddNumbers) {
- std::unique_ptr<InterpolableNumber> base = InterpolableNumber::Create(10);
- ScaleAndAdd(*base, 2, *InterpolableNumber::Create(1));
+ std::unique_ptr<InterpolableNumber> base =
+ std::make_unique<InterpolableNumber>(10);
+ ScaleAndAdd(*base, 2, *std::make_unique<InterpolableNumber>(1));
EXPECT_FLOAT_EQ(21, base->Value());
- base = InterpolableNumber::Create(10);
- ScaleAndAdd(*base, 0, *InterpolableNumber::Create(5));
+ base = std::make_unique<InterpolableNumber>(10);
+ ScaleAndAdd(*base, 0, *std::make_unique<InterpolableNumber>(5));
EXPECT_FLOAT_EQ(5, base->Value());
- base = InterpolableNumber::Create(10);
- ScaleAndAdd(*base, -1, *InterpolableNumber::Create(8));
+ base = std::make_unique<InterpolableNumber>(10);
+ ScaleAndAdd(*base, -1, *std::make_unique<InterpolableNumber>(8));
EXPECT_FLOAT_EQ(-2, base->Value());
}
TEST_F(AnimationInterpolableValueTest, ScaleAndAddLists) {
- std::unique_ptr<InterpolableList> base_list = InterpolableList::Create(3);
- base_list->Set(0, InterpolableNumber::Create(5));
- base_list->Set(1, InterpolableNumber::Create(10));
- base_list->Set(2, InterpolableNumber::Create(15));
- std::unique_ptr<InterpolableList> add_list = InterpolableList::Create(3);
- add_list->Set(0, InterpolableNumber::Create(1));
- add_list->Set(1, InterpolableNumber::Create(2));
- add_list->Set(2, InterpolableNumber::Create(3));
+ auto base_list = std::make_unique<InterpolableList>(3);
+ base_list->Set(0, std::make_unique<InterpolableNumber>(5));
+ base_list->Set(1, std::make_unique<InterpolableNumber>(10));
+ base_list->Set(2, std::make_unique<InterpolableNumber>(15));
+ auto add_list = std::make_unique<InterpolableList>(3);
+ add_list->Set(0, std::make_unique<InterpolableNumber>(1));
+ add_list->Set(1, std::make_unique<InterpolableNumber>(2));
+ add_list->Set(2, std::make_unique<InterpolableNumber>(3));
ScaleAndAdd(*base_list, 2, *add_list);
EXPECT_FLOAT_EQ(11, ToInterpolableNumber(base_list->Get(0))->Value());
EXPECT_FLOAT_EQ(22, ToInterpolableNumber(base_list->Get(1))->Value());
diff --git a/chromium/third_party/blink/renderer/core/animation/interpolation_effect_test.cc b/chromium/third_party/blink/renderer/core/animation/interpolation_effect_test.cc
index b7808c03833..2ed3176bda8 100644
--- a/chromium/third_party/blink/renderer/core/animation/interpolation_effect_test.cc
+++ b/chromium/third_party/blink/renderer/core/animation/interpolation_effect_test.cc
@@ -29,8 +29,8 @@ Interpolation* CreateInterpolation(int from, int to) {
// the compositor (as z-index isn't compositor-compatible).
PropertyHandle property_handle(GetCSSPropertyZIndex());
CSSNumberInterpolationType interpolation_type(property_handle);
- InterpolationValue start(InterpolableNumber::Create(from));
- InterpolationValue end(InterpolableNumber::Create(to));
+ InterpolationValue start(std::make_unique<InterpolableNumber>(from));
+ InterpolationValue end(std::make_unique<InterpolableNumber>(to));
return TransitionInterpolation::Create(property_handle, interpolation_type,
std::move(start), std::move(end),
nullptr, nullptr);
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 1f765f2761d..4b99e714690 100644
--- a/chromium/third_party/blink/renderer/core/animation/invalidatable_interpolation.cc
+++ b/chromium/third_party/blink/renderer/core/animation/invalidatable_interpolation.cc
@@ -45,7 +45,7 @@ InvalidatableInterpolation::MaybeConvertPairwise(
underlying_value_owner.Value(), conversion_checkers);
AddConversionCheckers(*interpolation_type, conversion_checkers);
if (result) {
- return PairwisePrimitiveInterpolation::Create(
+ return std::make_unique<PairwisePrimitiveInterpolation>(
*interpolation_type, std::move(result.start_interpolable_value),
std::move(result.end_interpolable_value),
std::move(result.non_interpolable_value));
@@ -71,7 +71,7 @@ InvalidatableInterpolation::ConvertSingleKeyframe(
conversion_checkers);
AddConversionCheckers(*interpolation_type, conversion_checkers);
if (result) {
- return TypedInterpolationValue::Create(
+ return std::make_unique<TypedInterpolationValue>(
*interpolation_type, std::move(result.interpolable_value),
std::move(result.non_interpolable_value));
}
@@ -96,7 +96,7 @@ InvalidatableInterpolation::MaybeConvertUnderlyingValue(
InterpolationValue result =
interpolation_type->MaybeConvertUnderlyingValue(environment);
if (result) {
- return TypedInterpolationValue::Create(
+ return std::make_unique<TypedInterpolationValue>(
*interpolation_type, std::move(result.interpolable_value),
std::move(result.non_interpolable_value));
}
@@ -167,7 +167,7 @@ InvalidatableInterpolation::EnsureValidConversion(
cached_value_ = pairwise_conversion->InitialValue();
cached_pair_conversion_ = std::move(pairwise_conversion);
} else {
- cached_pair_conversion_ = FlipPrimitiveInterpolation::Create(
+ cached_pair_conversion_ = std::make_unique<FlipPrimitiveInterpolation>(
ConvertSingleKeyframe(*start_keyframe_, environment,
underlying_value_owner),
ConvertSingleKeyframe(*end_keyframe_, environment,
diff --git a/chromium/third_party/blink/renderer/core/animation/keyframe_effect.cc b/chromium/third_party/blink/renderer/core/animation/keyframe_effect.cc
index 3a4339b1024..be54de7d072 100644
--- a/chromium/third_party/blink/renderer/core/animation/keyframe_effect.cc
+++ b/chromium/third_party/blink/renderer/core/animation/keyframe_effect.cc
@@ -63,7 +63,6 @@ KeyframeEffect* KeyframeEffect::Create(
const ScriptValue& keyframes,
const UnrestrictedDoubleOrKeyframeEffectOptions& options,
ExceptionState& exception_state) {
- DCHECK(RuntimeEnabledFeatures::WebAnimationsAPIEnabled());
if (element) {
UseCounter::Count(
element->GetDocument(),
@@ -92,7 +91,6 @@ KeyframeEffect* KeyframeEffect::Create(ScriptState* script_state,
Element* element,
const ScriptValue& keyframes,
ExceptionState& exception_state) {
- DCHECK(RuntimeEnabledFeatures::WebAnimationsAPIEnabled());
if (element) {
UseCounter::Count(
element->GetDocument(),
@@ -367,8 +365,8 @@ void KeyframeEffect::ApplyEffects() {
model_->Sample(clampTo<int>(iteration, 0), Progress().value(),
IterationDuration(), interpolations);
if (!interpolations.IsEmpty()) {
- SampledEffect* sampled_effect =
- SampledEffect::Create(this, owner_->SequenceNumber());
+ auto* sampled_effect =
+ MakeGarbageCollected<SampledEffect>(this, owner_->SequenceNumber());
sampled_effect->MutableInterpolations().swap(interpolations);
sampled_effect_ = sampled_effect;
target_->EnsureElementAnimations().GetEffectStack().Add(sampled_effect);
diff --git a/chromium/third_party/blink/renderer/core/animation/keyframe_effect.idl b/chromium/third_party/blink/renderer/core/animation/keyframe_effect.idl
index 79a90965ede..c1e196c6aee 100644
--- a/chromium/third_party/blink/renderer/core/animation/keyframe_effect.idl
+++ b/chromium/third_party/blink/renderer/core/animation/keyframe_effect.idl
@@ -28,19 +28,19 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-// https://drafts.csswg.org/web-animations/#the-keyframeeffect-interfaces
+// https://drafts.csswg.org/web-animations/#the-keyframeeffect-interface
enum CompositeOperation { "replace", "add", "accumulate" };
[
+ Exposed=Window,
Constructor(Element? target, object? keyframes, optional (unrestricted double or KeyframeEffectOptions) options),
Constructor(KeyframeEffect source),
ConstructorCallWith=ScriptState,
- RaisesException=Constructor,
- RuntimeEnabled=WebAnimationsAPI
+ RaisesException=Constructor
] interface KeyframeEffect : AnimationEffect {
attribute Element? target;
- attribute CompositeOperation composite;
- [CallWith=ScriptState] sequence<object> getKeyframes();
- [CallWith=ScriptState, RaisesException] void setKeyframes(object? keyframes);
+ [RuntimeEnabled=WebAnimationsAPI] attribute CompositeOperation composite;
+ [CallWith=ScriptState, RuntimeEnabled=WebAnimationsAPI] sequence<object> getKeyframes();
+ [CallWith=ScriptState, RaisesException, RuntimeEnabled=WebAnimationsAPI] void setKeyframes(object? keyframes);
};
diff --git a/chromium/third_party/blink/renderer/core/animation/keyframe_effect_model_test.cc b/chromium/third_party/blink/renderer/core/animation/keyframe_effect_model_test.cc
index 324be2c4071..c571ef1bd0c 100644
--- a/chromium/third_party/blink/renderer/core/animation/keyframe_effect_model_test.cc
+++ b/chromium/third_party/blink/renderer/core/animation/keyframe_effect_model_test.cc
@@ -152,19 +152,19 @@ Interpolation* FindValue(HeapVector<Member<Interpolation>>& values,
TEST_F(AnimationKeyframeEffectModel, BasicOperation) {
StringKeyframeVector keyframes =
- KeyframesAtZeroAndOne(CSSPropertyFontFamily, "serif", "cursive");
+ KeyframesAtZeroAndOne(CSSPropertyID::kFontFamily, "serif", "cursive");
StringKeyframeEffectModel* effect =
StringKeyframeEffectModel::Create(keyframes);
HeapVector<Member<Interpolation>> values;
effect->Sample(0, 0.6, kDuration, values);
ASSERT_EQ(1UL, values.size());
- ExpectProperty(CSSPropertyFontFamily, values.at(0));
+ ExpectProperty(CSSPropertyID::kFontFamily, values.at(0));
ExpectNonInterpolableValue("cursive", values.at(0));
}
TEST_F(AnimationKeyframeEffectModel, CompositeReplaceNonInterpolable) {
StringKeyframeVector keyframes =
- KeyframesAtZeroAndOne(CSSPropertyFontFamily, "serif", "cursive");
+ KeyframesAtZeroAndOne(CSSPropertyID::kFontFamily, "serif", "cursive");
keyframes[0]->SetComposite(EffectModel::kCompositeReplace);
keyframes[1]->SetComposite(EffectModel::kCompositeReplace);
StringKeyframeEffectModel* effect =
@@ -176,7 +176,7 @@ TEST_F(AnimationKeyframeEffectModel, CompositeReplaceNonInterpolable) {
TEST_F(AnimationKeyframeEffectModel, CompositeReplace) {
StringKeyframeVector keyframes =
- KeyframesAtZeroAndOne(CSSPropertyLeft, "3px", "5px");
+ KeyframesAtZeroAndOne(CSSPropertyID::kLeft, "3px", "5px");
keyframes[0]->SetComposite(EffectModel::kCompositeReplace);
keyframes[1]->SetComposite(EffectModel::kCompositeReplace);
StringKeyframeEffectModel* effect =
@@ -189,7 +189,7 @@ TEST_F(AnimationKeyframeEffectModel, CompositeReplace) {
// FIXME: Re-enable this test once compositing of CompositeAdd is supported.
TEST_F(AnimationKeyframeEffectModel, DISABLED_CompositeAdd) {
StringKeyframeVector keyframes =
- KeyframesAtZeroAndOne(CSSPropertyLeft, "3px", "5px");
+ KeyframesAtZeroAndOne(CSSPropertyID::kLeft, "3px", "5px");
keyframes[0]->SetComposite(EffectModel::kCompositeAdd);
keyframes[1]->SetComposite(EffectModel::kCompositeAdd);
StringKeyframeEffectModel* effect =
@@ -201,7 +201,7 @@ TEST_F(AnimationKeyframeEffectModel, DISABLED_CompositeAdd) {
TEST_F(AnimationKeyframeEffectModel, CompositeEaseIn) {
StringKeyframeVector keyframes =
- KeyframesAtZeroAndOne(CSSPropertyLeft, "3px", "5px");
+ KeyframesAtZeroAndOne(CSSPropertyID::kLeft, "3px", "5px");
keyframes[0]->SetComposite(EffectModel::kCompositeReplace);
keyframes[0]->SetEasing(CubicBezierTimingFunction::Preset(
CubicBezierTimingFunction::EaseType::EASE_IN));
@@ -217,7 +217,7 @@ TEST_F(AnimationKeyframeEffectModel, CompositeEaseIn) {
TEST_F(AnimationKeyframeEffectModel, CompositeCubicBezier) {
StringKeyframeVector keyframes =
- KeyframesAtZeroAndOne(CSSPropertyLeft, "3px", "5px");
+ KeyframesAtZeroAndOne(CSSPropertyID::kLeft, "3px", "5px");
keyframes[0]->SetComposite(EffectModel::kCompositeReplace);
keyframes[0]->SetEasing(CubicBezierTimingFunction::Create(0.42, 0, 0.58, 1));
keyframes[1]->SetComposite(EffectModel::kCompositeReplace);
@@ -232,7 +232,7 @@ TEST_F(AnimationKeyframeEffectModel, CompositeCubicBezier) {
TEST_F(AnimationKeyframeEffectModel, ExtrapolateReplaceNonInterpolable) {
StringKeyframeVector keyframes =
- KeyframesAtZeroAndOne(CSSPropertyFontFamily, "serif", "cursive");
+ KeyframesAtZeroAndOne(CSSPropertyID::kFontFamily, "serif", "cursive");
keyframes[0]->SetComposite(EffectModel::kCompositeReplace);
keyframes[1]->SetComposite(EffectModel::kCompositeReplace);
StringKeyframeEffectModel* effect =
@@ -244,7 +244,7 @@ TEST_F(AnimationKeyframeEffectModel, ExtrapolateReplaceNonInterpolable) {
TEST_F(AnimationKeyframeEffectModel, ExtrapolateReplace) {
StringKeyframeVector keyframes =
- KeyframesAtZeroAndOne(CSSPropertyLeft, "3px", "5px");
+ KeyframesAtZeroAndOne(CSSPropertyID::kLeft, "3px", "5px");
StringKeyframeEffectModel* effect =
StringKeyframeEffectModel::Create(keyframes);
keyframes[0]->SetComposite(EffectModel::kCompositeReplace);
@@ -257,7 +257,7 @@ TEST_F(AnimationKeyframeEffectModel, ExtrapolateReplace) {
// FIXME: Re-enable this test once compositing of CompositeAdd is supported.
TEST_F(AnimationKeyframeEffectModel, DISABLED_ExtrapolateAdd) {
StringKeyframeVector keyframes =
- KeyframesAtZeroAndOne(CSSPropertyLeft, "3px", "5px");
+ KeyframesAtZeroAndOne(CSSPropertyID::kLeft, "3px", "5px");
keyframes[0]->SetComposite(EffectModel::kCompositeAdd);
keyframes[1]->SetComposite(EffectModel::kCompositeAdd);
StringKeyframeEffectModel* effect =
@@ -280,7 +280,7 @@ TEST_F(AnimationKeyframeEffectModel, DISABLED_SingleKeyframeAtOffsetZero) {
StringKeyframeVector keyframes(1);
keyframes[0] = StringKeyframe::Create();
keyframes[0]->SetOffset(0.0);
- keyframes[0]->SetCSSPropertyValue(CSSPropertyFontFamily, "serif",
+ keyframes[0]->SetCSSPropertyValue(CSSPropertyID::kFontFamily, "serif",
SecureContextMode::kInsecureContext,
nullptr);
@@ -296,8 +296,9 @@ TEST_F(AnimationKeyframeEffectModel, DISABLED_SingleKeyframeAtOffsetOne) {
StringKeyframeVector keyframes(1);
keyframes[0] = StringKeyframe::Create();
keyframes[0]->SetOffset(1.0);
- keyframes[0]->SetCSSPropertyValue(
- CSSPropertyLeft, "5px", SecureContextMode::kInsecureContext, nullptr);
+ keyframes[0]->SetCSSPropertyValue(CSSPropertyID::kLeft, "5px",
+ SecureContextMode::kInsecureContext,
+ nullptr);
StringKeyframeEffectModel* effect =
StringKeyframeEffectModel::Create(keyframes);
@@ -310,17 +311,17 @@ TEST_F(AnimationKeyframeEffectModel, MoreThanTwoKeyframes) {
StringKeyframeVector keyframes(3);
keyframes[0] = StringKeyframe::Create();
keyframes[0]->SetOffset(0.0);
- keyframes[0]->SetCSSPropertyValue(CSSPropertyFontFamily, "serif",
+ keyframes[0]->SetCSSPropertyValue(CSSPropertyID::kFontFamily, "serif",
SecureContextMode::kInsecureContext,
nullptr);
keyframes[1] = StringKeyframe::Create();
keyframes[1]->SetOffset(0.5);
- keyframes[1]->SetCSSPropertyValue(CSSPropertyFontFamily, "sans-serif",
+ keyframes[1]->SetCSSPropertyValue(CSSPropertyID::kFontFamily, "sans-serif",
SecureContextMode::kInsecureContext,
nullptr);
keyframes[2] = StringKeyframe::Create();
keyframes[2]->SetOffset(1.0);
- keyframes[2]->SetCSSPropertyValue(CSSPropertyFontFamily, "cursive",
+ keyframes[2]->SetCSSPropertyValue(CSSPropertyID::kFontFamily, "cursive",
SecureContextMode::kInsecureContext,
nullptr);
@@ -336,16 +337,16 @@ TEST_F(AnimationKeyframeEffectModel, MoreThanTwoKeyframes) {
TEST_F(AnimationKeyframeEffectModel, EndKeyframeOffsetsUnspecified) {
StringKeyframeVector keyframes(3);
keyframes[0] = StringKeyframe::Create();
- keyframes[0]->SetCSSPropertyValue(CSSPropertyFontFamily, "serif",
+ keyframes[0]->SetCSSPropertyValue(CSSPropertyID::kFontFamily, "serif",
SecureContextMode::kInsecureContext,
nullptr);
keyframes[1] = StringKeyframe::Create();
keyframes[1]->SetOffset(0.5);
- keyframes[1]->SetCSSPropertyValue(CSSPropertyFontFamily, "cursive",
+ keyframes[1]->SetCSSPropertyValue(CSSPropertyID::kFontFamily, "cursive",
SecureContextMode::kInsecureContext,
nullptr);
keyframes[2] = StringKeyframe::Create();
- keyframes[2]->SetCSSPropertyValue(CSSPropertyFontFamily, "serif",
+ keyframes[2]->SetCSSPropertyValue(CSSPropertyID::kFontFamily, "serif",
SecureContextMode::kInsecureContext,
nullptr);
@@ -364,17 +365,17 @@ TEST_F(AnimationKeyframeEffectModel, SampleOnKeyframe) {
StringKeyframeVector keyframes(3);
keyframes[0] = StringKeyframe::Create();
keyframes[0]->SetOffset(0.0);
- keyframes[0]->SetCSSPropertyValue(CSSPropertyFontFamily, "serif",
+ keyframes[0]->SetCSSPropertyValue(CSSPropertyID::kFontFamily, "serif",
SecureContextMode::kInsecureContext,
nullptr);
keyframes[1] = StringKeyframe::Create();
keyframes[1]->SetOffset(0.5);
- keyframes[1]->SetCSSPropertyValue(CSSPropertyFontFamily, "cursive",
+ keyframes[1]->SetCSSPropertyValue(CSSPropertyID::kFontFamily, "cursive",
SecureContextMode::kInsecureContext,
nullptr);
keyframes[2] = StringKeyframe::Create();
keyframes[2]->SetOffset(1.0);
- keyframes[2]->SetCSSPropertyValue(CSSPropertyFontFamily, "serif",
+ keyframes[2]->SetCSSPropertyValue(CSSPropertyID::kFontFamily, "serif",
SecureContextMode::kInsecureContext,
nullptr);
@@ -393,47 +394,47 @@ TEST_F(AnimationKeyframeEffectModel, MultipleKeyframesWithSameOffset) {
StringKeyframeVector keyframes(9);
keyframes[0] = StringKeyframe::Create();
keyframes[0]->SetOffset(0.0);
- keyframes[0]->SetCSSPropertyValue(CSSPropertyFontFamily, "serif",
+ keyframes[0]->SetCSSPropertyValue(CSSPropertyID::kFontFamily, "serif",
SecureContextMode::kInsecureContext,
nullptr);
keyframes[1] = StringKeyframe::Create();
keyframes[1]->SetOffset(0.1);
- keyframes[1]->SetCSSPropertyValue(CSSPropertyFontFamily, "sans-serif",
+ keyframes[1]->SetCSSPropertyValue(CSSPropertyID::kFontFamily, "sans-serif",
SecureContextMode::kInsecureContext,
nullptr);
keyframes[2] = StringKeyframe::Create();
keyframes[2]->SetOffset(0.1);
- keyframes[2]->SetCSSPropertyValue(CSSPropertyFontFamily, "monospace",
+ keyframes[2]->SetCSSPropertyValue(CSSPropertyID::kFontFamily, "monospace",
SecureContextMode::kInsecureContext,
nullptr);
keyframes[3] = StringKeyframe::Create();
keyframes[3]->SetOffset(0.5);
- keyframes[3]->SetCSSPropertyValue(CSSPropertyFontFamily, "cursive",
+ keyframes[3]->SetCSSPropertyValue(CSSPropertyID::kFontFamily, "cursive",
SecureContextMode::kInsecureContext,
nullptr);
keyframes[4] = StringKeyframe::Create();
keyframes[4]->SetOffset(0.5);
- keyframes[4]->SetCSSPropertyValue(CSSPropertyFontFamily, "fantasy",
+ keyframes[4]->SetCSSPropertyValue(CSSPropertyID::kFontFamily, "fantasy",
SecureContextMode::kInsecureContext,
nullptr);
keyframes[5] = StringKeyframe::Create();
keyframes[5]->SetOffset(0.5);
- keyframes[5]->SetCSSPropertyValue(CSSPropertyFontFamily, "system-ui",
+ keyframes[5]->SetCSSPropertyValue(CSSPropertyID::kFontFamily, "system-ui",
SecureContextMode::kInsecureContext,
nullptr);
keyframes[6] = StringKeyframe::Create();
keyframes[6]->SetOffset(0.9);
- keyframes[6]->SetCSSPropertyValue(CSSPropertyFontFamily, "serif",
+ keyframes[6]->SetCSSPropertyValue(CSSPropertyID::kFontFamily, "serif",
SecureContextMode::kInsecureContext,
nullptr);
keyframes[7] = StringKeyframe::Create();
keyframes[7]->SetOffset(0.9);
- keyframes[7]->SetCSSPropertyValue(CSSPropertyFontFamily, "sans-serif",
+ keyframes[7]->SetCSSPropertyValue(CSSPropertyID::kFontFamily, "sans-serif",
SecureContextMode::kInsecureContext,
nullptr);
keyframes[8] = StringKeyframe::Create();
keyframes[8]->SetOffset(1.0);
- keyframes[8]->SetCSSPropertyValue(CSSPropertyFontFamily, "monospace",
+ keyframes[8]->SetCSSPropertyValue(CSSPropertyID::kFontFamily, "monospace",
SecureContextMode::kInsecureContext,
nullptr);
@@ -461,12 +462,14 @@ TEST_F(AnimationKeyframeEffectModel, DISABLED_PerKeyframeComposite) {
StringKeyframeVector keyframes(2);
keyframes[0] = StringKeyframe::Create();
keyframes[0]->SetOffset(0.0);
- keyframes[0]->SetCSSPropertyValue(
- CSSPropertyLeft, "3px", SecureContextMode::kInsecureContext, nullptr);
+ keyframes[0]->SetCSSPropertyValue(CSSPropertyID::kLeft, "3px",
+ SecureContextMode::kInsecureContext,
+ nullptr);
keyframes[1] = StringKeyframe::Create();
keyframes[1]->SetOffset(1.0);
- keyframes[1]->SetCSSPropertyValue(
- CSSPropertyLeft, "5px", SecureContextMode::kInsecureContext, nullptr);
+ keyframes[1]->SetCSSPropertyValue(CSSPropertyID::kLeft, "5px",
+ SecureContextMode::kInsecureContext,
+ nullptr);
keyframes[1]->SetComposite(EffectModel::kCompositeAdd);
StringKeyframeEffectModel* effect =
@@ -480,18 +483,18 @@ TEST_F(AnimationKeyframeEffectModel, MultipleProperties) {
StringKeyframeVector keyframes(2);
keyframes[0] = StringKeyframe::Create();
keyframes[0]->SetOffset(0.0);
- keyframes[0]->SetCSSPropertyValue(CSSPropertyFontFamily, "serif",
+ keyframes[0]->SetCSSPropertyValue(CSSPropertyID::kFontFamily, "serif",
SecureContextMode::kInsecureContext,
nullptr);
- keyframes[0]->SetCSSPropertyValue(CSSPropertyFontStyle, "normal",
+ keyframes[0]->SetCSSPropertyValue(CSSPropertyID::kFontStyle, "normal",
SecureContextMode::kInsecureContext,
nullptr);
keyframes[1] = StringKeyframe::Create();
keyframes[1]->SetOffset(1.0);
- keyframes[1]->SetCSSPropertyValue(CSSPropertyFontFamily, "cursive",
+ keyframes[1]->SetCSSPropertyValue(CSSPropertyID::kFontFamily, "cursive",
SecureContextMode::kInsecureContext,
nullptr);
- keyframes[1]->SetCSSPropertyValue(CSSPropertyFontStyle, "oblique",
+ keyframes[1]->SetCSSPropertyValue(CSSPropertyID::kFontStyle, "oblique",
SecureContextMode::kInsecureContext,
nullptr);
@@ -500,10 +503,10 @@ TEST_F(AnimationKeyframeEffectModel, MultipleProperties) {
HeapVector<Member<Interpolation>> values;
effect->Sample(0, 0.6, kDuration, values);
EXPECT_EQ(2UL, values.size());
- Interpolation* left_value = FindValue(values, CSSPropertyFontFamily);
+ Interpolation* left_value = FindValue(values, CSSPropertyID::kFontFamily);
ASSERT_TRUE(left_value);
ExpectNonInterpolableValue("cursive", left_value);
- Interpolation* right_value = FindValue(values, CSSPropertyFontStyle);
+ Interpolation* right_value = FindValue(values, CSSPropertyID::kFontStyle);
ASSERT_TRUE(right_value);
ExpectNonInterpolableValue("oblique", right_value);
}
@@ -511,7 +514,7 @@ TEST_F(AnimationKeyframeEffectModel, MultipleProperties) {
// FIXME: Re-enable this test once compositing of CompositeAdd is supported.
TEST_F(AnimationKeyframeEffectModel, DISABLED_RecompositeCompositableValue) {
StringKeyframeVector keyframes =
- KeyframesAtZeroAndOne(CSSPropertyLeft, "3px", "5px");
+ KeyframesAtZeroAndOne(CSSPropertyID::kLeft, "3px", "5px");
keyframes[0]->SetComposite(EffectModel::kCompositeAdd);
keyframes[1]->SetComposite(EffectModel::kCompositeAdd);
StringKeyframeEffectModel* effect =
@@ -524,7 +527,7 @@ TEST_F(AnimationKeyframeEffectModel, DISABLED_RecompositeCompositableValue) {
TEST_F(AnimationKeyframeEffectModel, MultipleIterations) {
StringKeyframeVector keyframes =
- KeyframesAtZeroAndOne(CSSPropertyLeft, "1px", "3px");
+ KeyframesAtZeroAndOne(CSSPropertyID::kLeft, "1px", "3px");
StringKeyframeEffectModel* effect =
StringKeyframeEffectModel::Create(keyframes);
HeapVector<Member<Interpolation>> values;
@@ -541,17 +544,20 @@ TEST_F(AnimationKeyframeEffectModel, DISABLED_DependsOnUnderlyingValue) {
StringKeyframeVector keyframes(3);
keyframes[0] = StringKeyframe::Create();
keyframes[0]->SetOffset(0.0);
- keyframes[0]->SetCSSPropertyValue(
- CSSPropertyLeft, "1px", SecureContextMode::kInsecureContext, nullptr);
+ keyframes[0]->SetCSSPropertyValue(CSSPropertyID::kLeft, "1px",
+ SecureContextMode::kInsecureContext,
+ nullptr);
keyframes[0]->SetComposite(EffectModel::kCompositeAdd);
keyframes[1] = StringKeyframe::Create();
keyframes[1]->SetOffset(0.5);
- keyframes[1]->SetCSSPropertyValue(
- CSSPropertyLeft, "1px", SecureContextMode::kInsecureContext, nullptr);
+ keyframes[1]->SetCSSPropertyValue(CSSPropertyID::kLeft, "1px",
+ SecureContextMode::kInsecureContext,
+ nullptr);
keyframes[2] = StringKeyframe::Create();
keyframes[2]->SetOffset(1.0);
- keyframes[2]->SetCSSPropertyValue(
- CSSPropertyLeft, "1px", SecureContextMode::kInsecureContext, nullptr);
+ keyframes[2]->SetCSSPropertyValue(CSSPropertyID::kLeft, "1px",
+ SecureContextMode::kInsecureContext,
+ nullptr);
StringKeyframeEffectModel* effect =
StringKeyframeEffectModel::Create(keyframes);
@@ -580,8 +586,9 @@ TEST_F(AnimationKeyframeEffectModel, AddSyntheticKeyframes) {
StringKeyframeVector keyframes(1);
keyframes[0] = StringKeyframe::Create();
keyframes[0]->SetOffset(0.5);
- keyframes[0]->SetCSSPropertyValue(
- CSSPropertyLeft, "4px", SecureContextMode::kInsecureContext, nullptr);
+ keyframes[0]->SetCSSPropertyValue(CSSPropertyID::kLeft, "4px",
+ SecureContextMode::kInsecureContext,
+ nullptr);
StringKeyframeEffectModel* effect =
StringKeyframeEffectModel::Create(keyframes);
@@ -605,7 +612,7 @@ TEST_F(AnimationKeyframeEffectModel, ToKeyframeEffectModel) {
TEST_F(AnimationKeyframeEffectModel, CompositorSnapshotUpdateBasic) {
StringKeyframeVector keyframes =
- KeyframesAtZeroAndOne(CSSPropertyOpacity, "0", "1");
+ KeyframesAtZeroAndOne(CSSPropertyID::kOpacity, "0", "1");
StringKeyframeEffectModel* effect =
StringKeyframeEffectModel::Create(keyframes);
@@ -643,7 +650,7 @@ TEST_F(AnimationKeyframeEffectModel, CompositorSnapshotUpdateBasic) {
TEST_F(AnimationKeyframeEffectModel,
CompositorSnapshotUpdateAfterKeyframeChange) {
StringKeyframeVector opacity_keyframes =
- KeyframesAtZeroAndOne(CSSPropertyOpacity, "0", "1");
+ KeyframesAtZeroAndOne(CSSPropertyID::kOpacity, "0", "1");
StringKeyframeEffectModel* effect =
StringKeyframeEffectModel::Create(opacity_keyframes);
@@ -661,7 +668,7 @@ TEST_F(AnimationKeyframeEffectModel,
EXPECT_TRUE(value->IsDouble());
StringKeyframeVector filter_keyframes =
- KeyframesAtZeroAndOne(CSSPropertyFilter, "blur(1px)", "blur(10px)");
+ KeyframesAtZeroAndOne(CSSPropertyID::kFilter, "blur(1px)", "blur(10px)");
effect->SetFrames(filter_keyframes);
// Snapshot should update after changing keyframes
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 bdf01cef458..84f713f8123 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
@@ -48,19 +48,17 @@ bool CSSLengthNonInterpolableValue::HasPercentage(
std::unique_ptr<InterpolableValue>
LengthInterpolationFunctions::CreateInterpolablePixels(double pixels) {
- std::unique_ptr<InterpolableList> interpolable_list =
- CreateNeutralInterpolableValue();
+ auto interpolable_list = CreateNeutralInterpolableValue();
interpolable_list->Set(CSSPrimitiveValue::kUnitTypePixels,
- InterpolableNumber::Create(pixels));
+ std::make_unique<InterpolableNumber>(pixels));
return std::move(interpolable_list);
}
InterpolationValue LengthInterpolationFunctions::CreateInterpolablePercent(
double percent) {
- std::unique_ptr<InterpolableList> interpolable_list =
- CreateNeutralInterpolableValue();
+ auto interpolable_list = CreateNeutralInterpolableValue();
interpolable_list->Set(CSSPrimitiveValue::kUnitTypePercentage,
- InterpolableNumber::Create(percent));
+ std::make_unique<InterpolableNumber>(percent));
return InterpolationValue(std::move(interpolable_list),
CSSLengthNonInterpolableValue::Create(true));
}
@@ -68,29 +66,31 @@ InterpolationValue LengthInterpolationFunctions::CreateInterpolablePercent(
std::unique_ptr<InterpolableList>
LengthInterpolationFunctions::CreateNeutralInterpolableValue() {
const size_t kLength = CSSPrimitiveValue::kLengthUnitTypeCount;
- std::unique_ptr<InterpolableList> values = InterpolableList::Create(kLength);
+ auto values = std::make_unique<InterpolableList>(kLength);
for (wtf_size_t i = 0; i < kLength; i++)
- values->Set(i, InterpolableNumber::Create(0));
+ values->Set(i, std::make_unique<InterpolableNumber>(0));
return values;
}
InterpolationValue LengthInterpolationFunctions::MaybeConvertCSSValue(
const CSSValue& value) {
- if (!value.IsPrimitiveValue())
+ const auto* primitive_value = DynamicTo<CSSPrimitiveValue>(value);
+ if (!primitive_value)
return nullptr;
- const CSSPrimitiveValue& primitive_value = ToCSSPrimitiveValue(value);
- if (!primitive_value.IsLength() && !primitive_value.IsPercentage() &&
- !primitive_value.IsCalculatedPercentageWithLength())
+ if (!primitive_value->IsLength() && !primitive_value->IsPercentage() &&
+ !primitive_value->IsCalculatedPercentageWithLength())
return nullptr;
CSSLengthArray length_array;
- primitive_value.AccumulateLengthArray(length_array);
+ primitive_value->AccumulateLengthArray(length_array);
- std::unique_ptr<InterpolableList> values =
- InterpolableList::Create(CSSPrimitiveValue::kLengthUnitTypeCount);
- for (wtf_size_t i = 0; i < CSSPrimitiveValue::kLengthUnitTypeCount; i++)
- values->Set(i, InterpolableNumber::Create(length_array.values[i]));
+ auto values = std::make_unique<InterpolableList>(
+ CSSPrimitiveValue::kLengthUnitTypeCount);
+ for (wtf_size_t i = 0; i < CSSPrimitiveValue::kLengthUnitTypeCount; i++) {
+ values->Set(i,
+ std::make_unique<InterpolableNumber>(length_array.values[i]));
+ }
bool has_percentage =
length_array.type_flags.Get(CSSPrimitiveValue::kUnitTypePercentage);
@@ -105,11 +105,12 @@ InterpolationValue LengthInterpolationFunctions::MaybeConvertLength(
return nullptr;
PixelsAndPercent pixels_and_percent = length.GetPixelsAndPercent();
- std::unique_ptr<InterpolableList> values = CreateNeutralInterpolableValue();
- values->Set(CSSPrimitiveValue::kUnitTypePixels,
- InterpolableNumber::Create(pixels_and_percent.pixels / zoom));
+ auto values = CreateNeutralInterpolableValue();
+ values->Set(
+ CSSPrimitiveValue::kUnitTypePixels,
+ std::make_unique<InterpolableNumber>(pixels_and_percent.pixels / zoom));
values->Set(CSSPrimitiveValue::kUnitTypePercentage,
- InterpolableNumber::Create(pixels_and_percent.percent));
+ std::make_unique<InterpolableNumber>(pixels_and_percent.percent));
return InterpolationValue(
std::move(values),
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 c5a2cc780ee..8f0e68e1425 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
@@ -13,11 +13,11 @@ namespace {
const FillLayer* GetFillLayerForPosition(const CSSProperty& property,
const ComputedStyle& style) {
switch (property.PropertyID()) {
- case CSSPropertyBackgroundPositionX:
- case CSSPropertyBackgroundPositionY:
+ case CSSPropertyID::kBackgroundPositionX:
+ case CSSPropertyID::kBackgroundPositionY:
return &style.BackgroundLayers();
- case CSSPropertyWebkitMaskPositionX:
- case CSSPropertyWebkitMaskPositionY:
+ case CSSPropertyID::kWebkitMaskPositionX:
+ case CSSPropertyID::kWebkitMaskPositionY:
return &style.MaskLayers();
default:
NOTREACHED();
@@ -28,11 +28,11 @@ const FillLayer* GetFillLayerForPosition(const CSSProperty& property,
FillLayer* AccessFillLayerForPosition(const CSSProperty& property,
ComputedStyle& style) {
switch (property.PropertyID()) {
- case CSSPropertyBackgroundPositionX:
- case CSSPropertyBackgroundPositionY:
+ case CSSPropertyID::kBackgroundPositionX:
+ case CSSPropertyID::kBackgroundPositionY:
return &style.AccessBackgroundLayers();
- case CSSPropertyWebkitMaskPositionX:
- case CSSPropertyWebkitMaskPositionY:
+ case CSSPropertyID::kWebkitMaskPositionX:
+ case CSSPropertyID::kWebkitMaskPositionY:
return &style.AccessMaskLayers();
default:
NOTREACHED();
@@ -43,16 +43,16 @@ FillLayer* AccessFillLayerForPosition(const CSSProperty& property,
struct FillLayerMethods {
FillLayerMethods(const CSSProperty& property) {
switch (property.PropertyID()) {
- case CSSPropertyBackgroundPositionX:
- case CSSPropertyWebkitMaskPositionX:
+ case CSSPropertyID::kBackgroundPositionX:
+ case CSSPropertyID::kWebkitMaskPositionX:
is_set = &FillLayer::IsPositionXSet;
get_length = &FillLayer::PositionX;
get_edge = &FillLayer::BackgroundXOrigin;
set_length = &FillLayer::SetPositionX;
clear = &FillLayer::ClearPositionX;
break;
- case CSSPropertyBackgroundPositionY:
- case CSSPropertyWebkitMaskPositionY:
+ case CSSPropertyID::kBackgroundPositionY:
+ case CSSPropertyID::kWebkitMaskPositionY:
is_set = &FillLayer::IsPositionYSet;
get_length = &FillLayer::PositionY;
get_edge = &FillLayer::BackgroundYOrigin;
@@ -77,22 +77,22 @@ struct FillLayerMethods {
ValueRange LengthListPropertyFunctions::GetValueRange(
const CSSProperty& property) {
switch (property.PropertyID()) {
- case CSSPropertyBackgroundPositionX:
- case CSSPropertyBackgroundPositionY:
- case CSSPropertyObjectPosition:
- case CSSPropertyOffsetAnchor:
- case CSSPropertyOffsetPosition:
- case CSSPropertyPerspectiveOrigin:
- case CSSPropertyTransformOrigin:
- case CSSPropertyWebkitMaskPositionX:
- case CSSPropertyWebkitMaskPositionY:
+ case CSSPropertyID::kBackgroundPositionX:
+ case CSSPropertyID::kBackgroundPositionY:
+ case CSSPropertyID::kObjectPosition:
+ case CSSPropertyID::kOffsetAnchor:
+ case CSSPropertyID::kOffsetPosition:
+ case CSSPropertyID::kPerspectiveOrigin:
+ case CSSPropertyID::kTransformOrigin:
+ case CSSPropertyID::kWebkitMaskPositionX:
+ case CSSPropertyID::kWebkitMaskPositionY:
return kValueRangeAll;
- case CSSPropertyBorderBottomLeftRadius:
- case CSSPropertyBorderBottomRightRadius:
- case CSSPropertyBorderTopLeftRadius:
- case CSSPropertyBorderTopRightRadius:
- case CSSPropertyStrokeDasharray:
+ case CSSPropertyID::kBorderBottomLeftRadius:
+ case CSSPropertyID::kBorderBottomRightRadius:
+ case CSSPropertyID::kBorderTopLeftRadius:
+ case CSSPropertyID::kBorderTopRightRadius:
+ case CSSPropertyID::kStrokeDasharray:
return kValueRangeNonNegative;
default:
@@ -133,35 +133,35 @@ bool LengthListPropertyFunctions::GetLengthList(const CSSProperty& property,
DCHECK(result.IsEmpty());
switch (property.PropertyID()) {
- case CSSPropertyStrokeDasharray: {
+ case CSSPropertyID::kStrokeDasharray: {
if (style.StrokeDashArray())
result.AppendVector(style.StrokeDashArray()->GetVector());
return true;
}
- case CSSPropertyObjectPosition:
+ case CSSPropertyID::kObjectPosition:
return AppendToVector(style.ObjectPosition(), result);
- case CSSPropertyOffsetAnchor:
+ case CSSPropertyID::kOffsetAnchor:
return AppendToVector(style.OffsetAnchor(), result);
- case CSSPropertyOffsetPosition:
+ case CSSPropertyID::kOffsetPosition:
return AppendToVector(style.OffsetPosition(), result);
- case CSSPropertyPerspectiveOrigin:
+ case CSSPropertyID::kPerspectiveOrigin:
return AppendToVector(style.PerspectiveOrigin(), result);
- case CSSPropertyBorderBottomLeftRadius:
+ case CSSPropertyID::kBorderBottomLeftRadius:
return AppendToVector(style.BorderBottomLeftRadius(), result);
- case CSSPropertyBorderBottomRightRadius:
+ case CSSPropertyID::kBorderBottomRightRadius:
return AppendToVector(style.BorderBottomRightRadius(), result);
- case CSSPropertyBorderTopLeftRadius:
+ case CSSPropertyID::kBorderTopLeftRadius:
return AppendToVector(style.BorderTopLeftRadius(), result);
- case CSSPropertyBorderTopRightRadius:
+ case CSSPropertyID::kBorderTopRightRadius:
return AppendToVector(style.BorderTopRightRadius(), result);
- case CSSPropertyTransformOrigin:
+ case CSSPropertyID::kTransformOrigin:
return AppendToVector(style.GetTransformOrigin(), result);
- case CSSPropertyBackgroundPositionX:
- case CSSPropertyBackgroundPositionY:
- case CSSPropertyWebkitMaskPositionX:
- case CSSPropertyWebkitMaskPositionY: {
+ case CSSPropertyID::kBackgroundPositionX:
+ case CSSPropertyID::kBackgroundPositionY:
+ case CSSPropertyID::kWebkitMaskPositionX:
+ case CSSPropertyID::kWebkitMaskPositionY: {
const FillLayer* fill_layer = GetFillLayerForPosition(property, style);
FillLayerMethods fill_layer_methods(property);
while (fill_layer && (fill_layer->*fill_layer_methods.is_set)()) {
@@ -204,47 +204,47 @@ void LengthListPropertyFunctions::SetLengthList(const CSSProperty& property,
ComputedStyle& style,
Vector<Length>&& length_list) {
switch (property.PropertyID()) {
- case CSSPropertyStrokeDasharray:
+ case CSSPropertyID::kStrokeDasharray:
style.SetStrokeDashArray(
length_list.IsEmpty()
? nullptr
: RefVector<Length>::Create(std::move(length_list)));
return;
- case CSSPropertyObjectPosition:
+ case CSSPropertyID::kObjectPosition:
style.SetObjectPosition(PointFromVector(length_list));
return;
- case CSSPropertyOffsetAnchor:
+ case CSSPropertyID::kOffsetAnchor:
style.SetOffsetAnchor(PointFromVector(length_list));
return;
- case CSSPropertyOffsetPosition:
+ case CSSPropertyID::kOffsetPosition:
style.SetOffsetPosition(PointFromVector(length_list));
return;
- case CSSPropertyPerspectiveOrigin:
+ case CSSPropertyID::kPerspectiveOrigin:
style.SetPerspectiveOrigin(PointFromVector(length_list));
return;
- case CSSPropertyBorderBottomLeftRadius:
+ case CSSPropertyID::kBorderBottomLeftRadius:
style.SetBorderBottomLeftRadius(SizeFromVector(length_list));
return;
- case CSSPropertyBorderBottomRightRadius:
+ case CSSPropertyID::kBorderBottomRightRadius:
style.SetBorderBottomRightRadius(SizeFromVector(length_list));
return;
- case CSSPropertyBorderTopLeftRadius:
+ case CSSPropertyID::kBorderTopLeftRadius:
style.SetBorderTopLeftRadius(SizeFromVector(length_list));
return;
- case CSSPropertyBorderTopRightRadius:
+ case CSSPropertyID::kBorderTopRightRadius:
style.SetBorderTopRightRadius(SizeFromVector(length_list));
return;
- case CSSPropertyTransformOrigin:
+ case CSSPropertyID::kTransformOrigin:
style.SetTransformOrigin(TransformOriginFromVector(length_list));
return;
- case CSSPropertyBackgroundPositionX:
- case CSSPropertyBackgroundPositionY:
- case CSSPropertyWebkitMaskPositionX:
- case CSSPropertyWebkitMaskPositionY: {
+ case CSSPropertyID::kBackgroundPositionX:
+ case CSSPropertyID::kBackgroundPositionY:
+ case CSSPropertyID::kWebkitMaskPositionX:
+ case CSSPropertyID::kWebkitMaskPositionY: {
FillLayer* fill_layer = AccessFillLayerForPosition(property, style);
FillLayer* prev = nullptr;
FillLayerMethods fill_layer_methods(property);
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 c11eb097316..4e26d395244 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
@@ -10,34 +10,34 @@ namespace blink {
ValueRange LengthPropertyFunctions::GetValueRange(const CSSProperty& property) {
switch (property.PropertyID()) {
- case CSSPropertyBorderBottomWidth:
- case CSSPropertyBorderLeftWidth:
- case CSSPropertyBorderRightWidth:
- case CSSPropertyBorderTopWidth:
- case CSSPropertyFlexBasis:
- case CSSPropertyHeight:
- case CSSPropertyLineHeight:
- case CSSPropertyMaxHeight:
- case CSSPropertyMaxWidth:
- case CSSPropertyMinHeight:
- case CSSPropertyMinWidth:
- case CSSPropertyOutlineWidth:
- case CSSPropertyPaddingBottom:
- case CSSPropertyPaddingLeft:
- case CSSPropertyPaddingRight:
- case CSSPropertyPaddingTop:
- case CSSPropertyPerspective:
- case CSSPropertyR:
- case CSSPropertyRx:
- case CSSPropertyRy:
- case CSSPropertyShapeMargin:
- case CSSPropertyStrokeWidth:
- case CSSPropertyWebkitBorderHorizontalSpacing:
- case CSSPropertyWebkitBorderVerticalSpacing:
- case CSSPropertyColumnGap:
- case CSSPropertyRowGap:
- case CSSPropertyColumnWidth:
- case CSSPropertyWidth:
+ case CSSPropertyID::kBorderBottomWidth:
+ case CSSPropertyID::kBorderLeftWidth:
+ case CSSPropertyID::kBorderRightWidth:
+ case CSSPropertyID::kBorderTopWidth:
+ case CSSPropertyID::kFlexBasis:
+ case CSSPropertyID::kHeight:
+ case CSSPropertyID::kLineHeight:
+ case CSSPropertyID::kMaxHeight:
+ case CSSPropertyID::kMaxWidth:
+ case CSSPropertyID::kMinHeight:
+ case CSSPropertyID::kMinWidth:
+ case CSSPropertyID::kOutlineWidth:
+ case CSSPropertyID::kPaddingBottom:
+ case CSSPropertyID::kPaddingLeft:
+ case CSSPropertyID::kPaddingRight:
+ case CSSPropertyID::kPaddingTop:
+ case CSSPropertyID::kPerspective:
+ case CSSPropertyID::kR:
+ case CSSPropertyID::kRx:
+ case CSSPropertyID::kRy:
+ case CSSPropertyID::kShapeMargin:
+ case CSSPropertyID::kStrokeWidth:
+ case CSSPropertyID::kWebkitBorderHorizontalSpacing:
+ case CSSPropertyID::kWebkitBorderVerticalSpacing:
+ case CSSPropertyID::kColumnGap:
+ case CSSPropertyID::kRowGap:
+ case CSSPropertyID::kColumnWidth:
+ case CSSPropertyID::kWidth:
return kValueRangeNonNegative;
default:
return kValueRangeAll;
@@ -45,41 +45,41 @@ ValueRange LengthPropertyFunctions::GetValueRange(const CSSProperty& property) {
}
bool LengthPropertyFunctions::IsZoomedLength(const CSSProperty& property) {
- return property.PropertyID() != CSSPropertyStrokeWidth;
+ return property.PropertyID() != CSSPropertyID::kStrokeWidth;
}
bool LengthPropertyFunctions::GetPixelsForKeyword(const CSSProperty& property,
CSSValueID value_id,
double& result) {
switch (property.PropertyID()) {
- case CSSPropertyBaselineShift:
- if (value_id == CSSValueBaseline) {
+ case CSSPropertyID::kBaselineShift:
+ if (value_id == CSSValueID::kBaseline) {
result = 0;
return true;
}
return false;
- case CSSPropertyBorderBottomWidth:
- case CSSPropertyBorderLeftWidth:
- case CSSPropertyBorderRightWidth:
- case CSSPropertyBorderTopWidth:
- case CSSPropertyColumnRuleWidth:
- case CSSPropertyOutlineWidth:
- if (value_id == CSSValueThin) {
+ case CSSPropertyID::kBorderBottomWidth:
+ case CSSPropertyID::kBorderLeftWidth:
+ case CSSPropertyID::kBorderRightWidth:
+ case CSSPropertyID::kBorderTopWidth:
+ case CSSPropertyID::kColumnRuleWidth:
+ case CSSPropertyID::kOutlineWidth:
+ if (value_id == CSSValueID::kThin) {
result = 1;
return true;
}
- if (value_id == CSSValueMedium) {
+ if (value_id == CSSValueID::kMedium) {
result = 3;
return true;
}
- if (value_id == CSSValueThick) {
+ if (value_id == CSSValueID::kThick) {
result = 5;
return true;
}
return false;
- case CSSPropertyLetterSpacing:
- case CSSPropertyWordSpacing:
- if (value_id == CSSValueNormal) {
+ case CSSPropertyID::kLetterSpacing:
+ case CSSPropertyID::kWordSpacing:
+ if (value_id == CSSValueID::kNormal) {
result = 0;
return true;
}
@@ -102,16 +102,16 @@ bool LengthPropertyFunctions::GetInitialLength(const CSSProperty& property,
// for hidden widths to avoid having to restart our animations based on the
// computed *-style values. This is acceptable since animations running on
// hidden widths are unobservable to the user, even via getComputedStyle().
- case CSSPropertyBorderBottomWidth:
- case CSSPropertyBorderLeftWidth:
- case CSSPropertyBorderRightWidth:
- case CSSPropertyBorderTopWidth:
+ case CSSPropertyID::kBorderBottomWidth:
+ case CSSPropertyID::kBorderLeftWidth:
+ case CSSPropertyID::kBorderRightWidth:
+ case CSSPropertyID::kBorderTopWidth:
result = Length::Fixed(ComputedStyleInitialValues::InitialBorderWidth());
return true;
- case CSSPropertyOutlineWidth:
+ case CSSPropertyID::kOutlineWidth:
result = Length::Fixed(ComputedStyleInitialValues::InitialOutlineWidth());
return true;
- case CSSPropertyColumnRuleWidth:
+ case CSSPropertyID::kColumnRuleWidth:
result =
Length::Fixed(ComputedStyleInitialValues::InitialColumnRuleWidth());
return true;
@@ -125,182 +125,182 @@ bool LengthPropertyFunctions::GetLength(const CSSProperty& property,
const ComputedStyle& style,
Length& result) {
switch (property.PropertyID()) {
- case CSSPropertyBottom:
+ case CSSPropertyID::kBottom:
result = style.Bottom();
return true;
- case CSSPropertyCx:
+ case CSSPropertyID::kCx:
result = style.SvgStyle().Cx();
return true;
- case CSSPropertyCy:
+ case CSSPropertyID::kCy:
result = style.SvgStyle().Cy();
return true;
- case CSSPropertyFlexBasis:
+ case CSSPropertyID::kFlexBasis:
result = style.FlexBasis();
return true;
- case CSSPropertyHeight:
+ case CSSPropertyID::kHeight:
result = style.Height();
return true;
- case CSSPropertyLeft:
+ case CSSPropertyID::kLeft:
result = style.Left();
return true;
- case CSSPropertyMarginBottom:
+ case CSSPropertyID::kMarginBottom:
result = style.MarginBottom();
return true;
- case CSSPropertyMarginLeft:
+ case CSSPropertyID::kMarginLeft:
result = style.MarginLeft();
return true;
- case CSSPropertyMarginRight:
+ case CSSPropertyID::kMarginRight:
result = style.MarginRight();
return true;
- case CSSPropertyMarginTop:
+ case CSSPropertyID::kMarginTop:
result = style.MarginTop();
return true;
- case CSSPropertyMaxHeight:
+ case CSSPropertyID::kMaxHeight:
result = style.MaxHeight();
return true;
- case CSSPropertyMaxWidth:
+ case CSSPropertyID::kMaxWidth:
result = style.MaxWidth();
return true;
- case CSSPropertyMinHeight:
+ case CSSPropertyID::kMinHeight:
result = style.MinHeight();
return true;
- case CSSPropertyMinWidth:
+ case CSSPropertyID::kMinWidth:
result = style.MinWidth();
return true;
- case CSSPropertyOffsetDistance:
+ case CSSPropertyID::kOffsetDistance:
result = style.OffsetDistance();
return true;
- case CSSPropertyPaddingBottom:
+ case CSSPropertyID::kPaddingBottom:
result = style.PaddingBottom();
return true;
- case CSSPropertyPaddingLeft:
+ case CSSPropertyID::kPaddingLeft:
result = style.PaddingLeft();
return true;
- case CSSPropertyPaddingRight:
+ case CSSPropertyID::kPaddingRight:
result = style.PaddingRight();
return true;
- case CSSPropertyPaddingTop:
+ case CSSPropertyID::kPaddingTop:
result = style.PaddingTop();
return true;
- case CSSPropertyR:
+ case CSSPropertyID::kR:
result = style.SvgStyle().R();
return true;
- case CSSPropertyRight:
+ case CSSPropertyID::kRight:
result = style.Right();
return true;
- case CSSPropertyRx:
+ case CSSPropertyID::kRx:
result = style.SvgStyle().Rx();
return true;
- case CSSPropertyRy:
+ case CSSPropertyID::kRy:
result = style.SvgStyle().Ry();
return true;
- case CSSPropertyShapeMargin:
+ case CSSPropertyID::kShapeMargin:
result = style.ShapeMargin();
return true;
- case CSSPropertyStrokeDashoffset:
+ case CSSPropertyID::kStrokeDashoffset:
result = style.StrokeDashOffset();
return true;
- case CSSPropertyTextIndent:
+ case CSSPropertyID::kTextIndent:
result = style.TextIndent();
return true;
- case CSSPropertyTop:
+ case CSSPropertyID::kTop:
result = style.Top();
return true;
- case CSSPropertyWebkitPerspectiveOriginX:
+ case CSSPropertyID::kWebkitPerspectiveOriginX:
result = style.PerspectiveOriginX();
return true;
- case CSSPropertyWebkitPerspectiveOriginY:
+ case CSSPropertyID::kWebkitPerspectiveOriginY:
result = style.PerspectiveOriginY();
return true;
- case CSSPropertyWebkitTransformOriginX:
+ case CSSPropertyID::kWebkitTransformOriginX:
result = style.TransformOriginX();
return true;
- case CSSPropertyWebkitTransformOriginY:
+ case CSSPropertyID::kWebkitTransformOriginY:
result = style.TransformOriginY();
return true;
- case CSSPropertyWidth:
+ case CSSPropertyID::kWidth:
result = style.Width();
return true;
- case CSSPropertyX:
+ case CSSPropertyID::kX:
result = style.SvgStyle().X();
return true;
- case CSSPropertyY:
+ case CSSPropertyID::kY:
result = style.SvgStyle().Y();
return true;
- case CSSPropertyBorderBottomWidth:
+ case CSSPropertyID::kBorderBottomWidth:
result = Length::Fixed(style.BorderBottomWidth());
return true;
- case CSSPropertyBorderLeftWidth:
+ case CSSPropertyID::kBorderLeftWidth:
result = Length::Fixed(style.BorderLeftWidth());
return true;
- case CSSPropertyBorderRightWidth:
+ case CSSPropertyID::kBorderRightWidth:
result = Length::Fixed(style.BorderRightWidth());
return true;
- case CSSPropertyBorderTopWidth:
+ case CSSPropertyID::kBorderTopWidth:
result = Length::Fixed(style.BorderTopWidth());
return true;
- case CSSPropertyLetterSpacing:
+ case CSSPropertyID::kLetterSpacing:
result = Length::Fixed(style.LetterSpacing());
return true;
- case CSSPropertyOutlineOffset:
+ case CSSPropertyID::kOutlineOffset:
result = Length::Fixed(style.OutlineOffset());
return true;
- case CSSPropertyOutlineWidth:
+ case CSSPropertyID::kOutlineWidth:
result = Length::Fixed(style.OutlineWidth());
return true;
- case CSSPropertyWebkitBorderHorizontalSpacing:
+ case CSSPropertyID::kWebkitBorderHorizontalSpacing:
result = Length::Fixed(style.HorizontalBorderSpacing());
return true;
- case CSSPropertyWebkitBorderVerticalSpacing:
+ case CSSPropertyID::kWebkitBorderVerticalSpacing:
result = Length::Fixed(style.VerticalBorderSpacing());
return true;
- case CSSPropertyRowGap:
+ case CSSPropertyID::kRowGap:
if (style.RowGap().IsNormal())
return false;
result = style.RowGap().GetLength();
return true;
- case CSSPropertyColumnGap:
+ case CSSPropertyID::kColumnGap:
if (style.ColumnGap().IsNormal())
return false;
result = style.ColumnGap().GetLength();
return true;
- case CSSPropertyColumnRuleWidth:
+ case CSSPropertyID::kColumnRuleWidth:
result = Length::Fixed(style.ColumnRuleWidth());
return true;
- case CSSPropertyWebkitTransformOriginZ:
+ case CSSPropertyID::kWebkitTransformOriginZ:
result = Length::Fixed(style.TransformOriginZ());
return true;
- case CSSPropertyWordSpacing:
+ case CSSPropertyID::kWordSpacing:
result = Length::Fixed(style.WordSpacing());
return true;
- case CSSPropertyBaselineShift:
+ case CSSPropertyID::kBaselineShift:
if (style.BaselineShift() != BS_LENGTH)
return false;
result = style.BaselineShiftValue();
return true;
- case CSSPropertyLineHeight:
+ case CSSPropertyID::kLineHeight:
// Percent Lengths are used to represent numbers on line-height.
if (style.SpecifiedLineHeight().IsPercentOrCalc())
return false;
result = style.SpecifiedLineHeight();
return true;
- case CSSPropertyPerspective:
+ case CSSPropertyID::kPerspective:
if (!style.HasPerspective())
return false;
result = Length::Fixed(style.Perspective());
return true;
- case CSSPropertyStrokeWidth:
- DCHECK(!IsZoomedLength(CSSProperty::Get(CSSPropertyStrokeWidth)));
+ case CSSPropertyID::kStrokeWidth:
+ DCHECK(!IsZoomedLength(CSSProperty::Get(CSSPropertyID::kStrokeWidth)));
result = style.StrokeWidth().length();
return true;
- case CSSPropertyVerticalAlign:
+ case CSSPropertyID::kVerticalAlign:
if (style.VerticalAlign() != EVerticalAlign::kLength)
return false;
result = style.GetVerticalAlignLength();
return true;
- case CSSPropertyColumnWidth:
+ case CSSPropertyID::kColumnWidth:
if (style.HasAutoColumnWidth())
return false;
result = Length::Fixed(style.ColumnWidth());
@@ -315,110 +315,110 @@ bool LengthPropertyFunctions::SetLength(const CSSProperty& property,
const Length& value) {
switch (property.PropertyID()) {
// Setters that take a Length value.
- case CSSPropertyBaselineShift:
+ case CSSPropertyID::kBaselineShift:
style.SetBaselineShiftValue(value);
return true;
- case CSSPropertyBottom:
+ case CSSPropertyID::kBottom:
style.SetBottom(value);
return true;
- case CSSPropertyCx:
+ case CSSPropertyID::kCx:
style.SetCx(value);
return true;
- case CSSPropertyCy:
+ case CSSPropertyID::kCy:
style.SetCy(value);
return true;
- case CSSPropertyFlexBasis:
+ case CSSPropertyID::kFlexBasis:
style.SetFlexBasis(value);
return true;
- case CSSPropertyHeight:
+ case CSSPropertyID::kHeight:
style.SetHeight(value);
return true;
- case CSSPropertyLeft:
+ case CSSPropertyID::kLeft:
style.SetLeft(value);
return true;
- case CSSPropertyMarginBottom:
+ case CSSPropertyID::kMarginBottom:
style.SetMarginBottom(value);
return true;
- case CSSPropertyMarginLeft:
+ case CSSPropertyID::kMarginLeft:
style.SetMarginLeft(value);
return true;
- case CSSPropertyMarginRight:
+ case CSSPropertyID::kMarginRight:
style.SetMarginRight(value);
return true;
- case CSSPropertyMarginTop:
+ case CSSPropertyID::kMarginTop:
style.SetMarginTop(value);
return true;
- case CSSPropertyMaxHeight:
+ case CSSPropertyID::kMaxHeight:
style.SetMaxHeight(value);
return true;
- case CSSPropertyMaxWidth:
+ case CSSPropertyID::kMaxWidth:
style.SetMaxWidth(value);
return true;
- case CSSPropertyMinHeight:
+ case CSSPropertyID::kMinHeight:
style.SetMinHeight(value);
return true;
- case CSSPropertyMinWidth:
+ case CSSPropertyID::kMinWidth:
style.SetMinWidth(value);
return true;
- case CSSPropertyOffsetDistance:
+ case CSSPropertyID::kOffsetDistance:
style.SetOffsetDistance(value);
return true;
- case CSSPropertyPaddingBottom:
+ case CSSPropertyID::kPaddingBottom:
style.SetPaddingBottom(value);
return true;
- case CSSPropertyPaddingLeft:
+ case CSSPropertyID::kPaddingLeft:
style.SetPaddingLeft(value);
return true;
- case CSSPropertyPaddingRight:
+ case CSSPropertyID::kPaddingRight:
style.SetPaddingRight(value);
return true;
- case CSSPropertyPaddingTop:
+ case CSSPropertyID::kPaddingTop:
style.SetPaddingTop(value);
return true;
- case CSSPropertyR:
+ case CSSPropertyID::kR:
style.SetR(value);
return true;
- case CSSPropertyRx:
+ case CSSPropertyID::kRx:
style.SetRx(value);
return true;
- case CSSPropertyRy:
+ case CSSPropertyID::kRy:
style.SetRy(value);
return true;
- case CSSPropertyRight:
+ case CSSPropertyID::kRight:
style.SetRight(value);
return true;
- case CSSPropertyShapeMargin:
+ case CSSPropertyID::kShapeMargin:
style.SetShapeMargin(value);
return true;
- case CSSPropertyStrokeDashoffset:
+ case CSSPropertyID::kStrokeDashoffset:
style.SetStrokeDashOffset(value);
return true;
- case CSSPropertyTop:
+ case CSSPropertyID::kTop:
style.SetTop(value);
return true;
- case CSSPropertyWidth:
+ case CSSPropertyID::kWidth:
style.SetWidth(value);
return true;
- case CSSPropertyWebkitPerspectiveOriginX:
+ case CSSPropertyID::kWebkitPerspectiveOriginX:
style.SetPerspectiveOriginX(value);
return true;
- case CSSPropertyWebkitPerspectiveOriginY:
+ case CSSPropertyID::kWebkitPerspectiveOriginY:
style.SetPerspectiveOriginY(value);
return true;
- case CSSPropertyWebkitTransformOriginX:
+ case CSSPropertyID::kWebkitTransformOriginX:
style.SetTransformOriginX(value);
return true;
- case CSSPropertyWebkitTransformOriginY:
+ case CSSPropertyID::kWebkitTransformOriginY:
style.SetTransformOriginY(value);
return true;
- case CSSPropertyX:
+ case CSSPropertyID::kX:
style.SetX(value);
return true;
- case CSSPropertyY:
+ case CSSPropertyID::kY:
style.SetY(value);
return true;
- case CSSPropertyLineHeight:
+ case CSSPropertyID::kLineHeight:
// Percent Lengths are used to represent numbers on line-height.
if (value.IsPercentOrCalc())
return false;
@@ -427,24 +427,24 @@ bool LengthPropertyFunctions::SetLength(const CSSProperty& property,
// TODO(alancutter): Support setters that take a numeric value (need to
// resolve percentages).
- case CSSPropertyBorderBottomWidth:
- case CSSPropertyBorderLeftWidth:
- case CSSPropertyBorderRightWidth:
- case CSSPropertyBorderTopWidth:
- case CSSPropertyLetterSpacing:
- case CSSPropertyOutlineOffset:
- case CSSPropertyOutlineWidth:
- case CSSPropertyPerspective:
- case CSSPropertyStrokeWidth:
- case CSSPropertyVerticalAlign:
- case CSSPropertyWebkitBorderHorizontalSpacing:
- case CSSPropertyWebkitBorderVerticalSpacing:
- case CSSPropertyColumnGap:
- case CSSPropertyRowGap:
- case CSSPropertyColumnRuleWidth:
- case CSSPropertyColumnWidth:
- case CSSPropertyWebkitTransformOriginZ:
- case CSSPropertyWordSpacing:
+ case CSSPropertyID::kBorderBottomWidth:
+ case CSSPropertyID::kBorderLeftWidth:
+ case CSSPropertyID::kBorderRightWidth:
+ case CSSPropertyID::kBorderTopWidth:
+ case CSSPropertyID::kLetterSpacing:
+ case CSSPropertyID::kOutlineOffset:
+ case CSSPropertyID::kOutlineWidth:
+ case CSSPropertyID::kPerspective:
+ case CSSPropertyID::kStrokeWidth:
+ case CSSPropertyID::kVerticalAlign:
+ case CSSPropertyID::kWebkitBorderHorizontalSpacing:
+ case CSSPropertyID::kWebkitBorderVerticalSpacing:
+ case CSSPropertyID::kColumnGap:
+ case CSSPropertyID::kRowGap:
+ case CSSPropertyID::kColumnRuleWidth:
+ case CSSPropertyID::kColumnWidth:
+ case CSSPropertyID::kWebkitTransformOriginZ:
+ case CSSPropertyID::kWordSpacing:
return false;
default:
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 09bfde3ab4b..50259559bf9 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
@@ -118,10 +118,10 @@ PairwiseInterpolationValue ListInterpolationFunctions::MaybeMergeSingles(
const wtf_size_t final_length =
MatchLengths(start_length, end_length, length_matching_strategy);
- std::unique_ptr<InterpolableList> result_start_interpolable_list =
- InterpolableList::Create(final_length);
- std::unique_ptr<InterpolableList> result_end_interpolable_list =
- InterpolableList::Create(final_length);
+ auto result_start_interpolable_list =
+ std::make_unique<InterpolableList>(final_length);
+ auto result_end_interpolable_list =
+ std::make_unique<InterpolableList>(final_length);
Vector<scoped_refptr<NonInterpolableValue>> result_non_interpolable_values(
final_length);
@@ -190,8 +190,7 @@ static void RepeatToLength(InterpolationValue& value, wtf_size_t length) {
if (current_length == length)
return;
DCHECK_LT(current_length, length);
- std::unique_ptr<InterpolableList> new_interpolable_list =
- InterpolableList::Create(length);
+ auto new_interpolable_list = std::make_unique<InterpolableList>(length);
Vector<scoped_refptr<NonInterpolableValue>> new_non_interpolable_values(
length);
for (wtf_size_t i = length; i-- > 0;) {
@@ -222,8 +221,8 @@ static void PadToSameLength(InterpolationValue& value,
ToNonInterpolableList(*length_value.non_interpolable_value);
const wtf_size_t target_length = target_interpolable_list.length();
DCHECK_LT(current_length, target_length);
- std::unique_ptr<InterpolableList> new_interpolable_list =
- InterpolableList::Create(target_length);
+ auto new_interpolable_list =
+ std::make_unique<InterpolableList>(target_length);
Vector<scoped_refptr<NonInterpolableValue>> new_non_interpolable_values(
target_length);
wtf_size_t index = 0;
diff --git a/chromium/third_party/blink/renderer/core/animation/list_interpolation_functions.h b/chromium/third_party/blink/renderer/core/animation/list_interpolation_functions.h
index a263b94b66e..15491312b9d 100644
--- a/chromium/third_party/blink/renderer/core/animation/list_interpolation_functions.h
+++ b/chromium/third_party/blink/renderer/core/animation/list_interpolation_functions.h
@@ -8,6 +8,7 @@
#include <memory>
#include "third_party/blink/renderer/core/animation/interpolation_value.h"
#include "third_party/blink/renderer/core/animation/pairwise_interpolation_value.h"
+#include "third_party/blink/renderer/platform/wtf/allocator.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"
namespace blink {
@@ -16,11 +17,13 @@ class UnderlyingValueOwner;
class InterpolationType;
class CORE_EXPORT ListInterpolationFunctions {
+ STACK_ALLOCATED();
+
public:
template <typename CreateItemCallback>
static InterpolationValue CreateList(wtf_size_t length, CreateItemCallback);
static InterpolationValue CreateEmptyList() {
- return InterpolationValue(InterpolableList::Create(0));
+ return InterpolationValue(std::make_unique<InterpolableList>(0));
}
enum class LengthMatchingStrategy {
@@ -102,8 +105,7 @@ InterpolationValue ListInterpolationFunctions::CreateList(
CreateItemCallback create_item) {
if (length == 0)
return CreateEmptyList();
- std::unique_ptr<InterpolableList> interpolable_list =
- InterpolableList::Create(length);
+ auto interpolable_list = std::make_unique<InterpolableList>(length);
Vector<scoped_refptr<NonInterpolableValue>> non_interpolable_values(length);
for (wtf_size_t i = 0; i < length; i++) {
InterpolationValue item = create_item(i);
diff --git a/chromium/third_party/blink/renderer/core/animation/list_interpolation_functions_test.cc b/chromium/third_party/blink/renderer/core/animation/list_interpolation_functions_test.cc
index d049473f14b..22ca8a75f93 100644
--- a/chromium/third_party/blink/renderer/core/animation/list_interpolation_functions_test.cc
+++ b/chromium/third_party/blink/renderer/core/animation/list_interpolation_functions_test.cc
@@ -51,7 +51,7 @@ InterpolationValue CreateInterpolableList(
return ListInterpolationFunctions::CreateList(
values.size(), [&values](size_t i) {
return InterpolationValue(
- InterpolableNumber::Create(values[i].first),
+ std::make_unique<InterpolableNumber>(values[i].first),
TestNonInterpolableValue::Create(values[i].second));
});
}
@@ -59,10 +59,11 @@ InterpolationValue CreateInterpolableList(
// Creates an InterpolationValue which contains a list of interpolable values,
// but a non-interpolable list of nullptrs.
InterpolationValue CreateInterpolableList(const std::vector<double>& values) {
- return ListInterpolationFunctions::CreateList(values.size(), [&values](
- size_t i) {
- return InterpolationValue(InterpolableNumber::Create(values[i]), nullptr);
- });
+ return ListInterpolationFunctions::CreateList(
+ values.size(), [&values](size_t i) {
+ return InterpolationValue(
+ std::make_unique<InterpolableNumber>(values[i]), nullptr);
+ });
}
bool NonInterpolableValuesAreCompatible(const NonInterpolableValue* a,
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 467a58fb2a6..d83363c155e 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
@@ -17,52 +17,52 @@ base::Optional<double> NumberPropertyFunctions::GetNumber(
const CSSProperty& property,
const ComputedStyle& style) {
switch (property.PropertyID()) {
- case CSSPropertyFillOpacity:
+ case CSSPropertyID::kFillOpacity:
return style.FillOpacity();
- case CSSPropertyFlexGrow:
+ case CSSPropertyID::kFlexGrow:
return style.FlexGrow();
- case CSSPropertyFlexShrink:
+ case CSSPropertyID::kFlexShrink:
return style.FlexShrink();
- case CSSPropertyFloodOpacity:
+ case CSSPropertyID::kFloodOpacity:
return style.FloodOpacity();
- case CSSPropertyOpacity:
+ case CSSPropertyID::kOpacity:
return style.Opacity();
- case CSSPropertyOrder:
+ case CSSPropertyID::kOrder:
return style.Order();
- case CSSPropertyOrphans:
+ case CSSPropertyID::kOrphans:
return style.Orphans();
- case CSSPropertyShapeImageThreshold:
+ case CSSPropertyID::kShapeImageThreshold:
return style.ShapeImageThreshold();
- case CSSPropertyStopOpacity:
+ case CSSPropertyID::kStopOpacity:
return style.StopOpacity();
- case CSSPropertyStrokeMiterlimit:
+ case CSSPropertyID::kStrokeMiterlimit:
return style.StrokeMiterLimit();
- case CSSPropertyStrokeOpacity:
+ case CSSPropertyID::kStrokeOpacity:
return style.StrokeOpacity();
- case CSSPropertyWidows:
+ case CSSPropertyID::kWidows:
return style.Widows();
- case CSSPropertyFontSizeAdjust:
+ case CSSPropertyID::kFontSizeAdjust:
if (!style.HasFontSizeAdjust())
return base::Optional<double>();
return style.FontSizeAdjust();
- case CSSPropertyColumnCount:
+ case CSSPropertyID::kColumnCount:
if (style.HasAutoColumnCount())
return base::Optional<double>();
return style.ColumnCount();
- case CSSPropertyZIndex:
+ case CSSPropertyID::kZIndex:
if (style.HasAutoZIndex())
return base::Optional<double>();
return style.ZIndex();
- case CSSPropertyTextSizeAdjust: {
+ case CSSPropertyID::kTextSizeAdjust: {
const TextSizeAdjust& text_size_adjust = style.GetTextSizeAdjust();
if (text_size_adjust.IsAuto())
return base::Optional<double>();
return text_size_adjust.Multiplier() * 100;
}
- case CSSPropertyLineHeight: {
+ case CSSPropertyID::kLineHeight: {
const Length& length = style.SpecifiedLineHeight();
// Numbers are represented by percentages.
if (!length.IsPercent())
@@ -82,38 +82,38 @@ base::Optional<double> NumberPropertyFunctions::GetNumber(
double NumberPropertyFunctions::ClampNumber(const CSSProperty& property,
double value) {
switch (property.PropertyID()) {
- case CSSPropertyStrokeMiterlimit:
+ case CSSPropertyID::kStrokeMiterlimit:
return clampTo<float>(value, 1);
- case CSSPropertyFloodOpacity:
- case CSSPropertyStopOpacity:
- case CSSPropertyStrokeOpacity:
- case CSSPropertyShapeImageThreshold:
+ case CSSPropertyID::kFloodOpacity:
+ case CSSPropertyID::kStopOpacity:
+ case CSSPropertyID::kStrokeOpacity:
+ case CSSPropertyID::kShapeImageThreshold:
return clampTo<float>(value, 0, 1);
- case CSSPropertyFillOpacity:
- case CSSPropertyOpacity:
+ case CSSPropertyID::kFillOpacity:
+ case CSSPropertyID::kOpacity:
return clampTo<float>(value, 0, nextafterf(1, 0));
- case CSSPropertyFlexGrow:
- case CSSPropertyFlexShrink:
- case CSSPropertyFontSizeAdjust:
- case CSSPropertyLineHeight:
- case CSSPropertyTextSizeAdjust:
+ case CSSPropertyID::kFlexGrow:
+ case CSSPropertyID::kFlexShrink:
+ case CSSPropertyID::kFontSizeAdjust:
+ case CSSPropertyID::kLineHeight:
+ case CSSPropertyID::kTextSizeAdjust:
return clampTo<float>(value, 0);
- case CSSPropertyOrphans:
- case CSSPropertyWidows:
+ case CSSPropertyID::kOrphans:
+ case CSSPropertyID::kWidows:
return clampTo<int16_t>(round(value), 1);
- case CSSPropertyColumnCount:
+ case CSSPropertyID::kColumnCount:
return clampTo<uint16_t>(round(value), 1);
- case CSSPropertyColumnRuleWidth:
+ case CSSPropertyID::kColumnRuleWidth:
return clampTo<uint16_t>(round(value));
- case CSSPropertyOrder:
- case CSSPropertyZIndex:
+ case CSSPropertyID::kOrder:
+ case CSSPropertyID::kZIndex:
return clampTo<int>(round(value));
default:
@@ -127,52 +127,52 @@ bool NumberPropertyFunctions::SetNumber(const CSSProperty& property,
double value) {
DCHECK_EQ(value, ClampNumber(property, value));
switch (property.PropertyID()) {
- case CSSPropertyFillOpacity:
+ case CSSPropertyID::kFillOpacity:
style.SetFillOpacity(value);
return true;
- case CSSPropertyFlexGrow:
+ case CSSPropertyID::kFlexGrow:
style.SetFlexGrow(value);
return true;
- case CSSPropertyFlexShrink:
+ case CSSPropertyID::kFlexShrink:
style.SetFlexShrink(value);
return true;
- case CSSPropertyFloodOpacity:
+ case CSSPropertyID::kFloodOpacity:
style.SetFloodOpacity(value);
return true;
- case CSSPropertyLineHeight:
+ case CSSPropertyID::kLineHeight:
style.SetLineHeight(Length::Percent(value * 100));
return true;
- case CSSPropertyOpacity:
+ case CSSPropertyID::kOpacity:
style.SetOpacity(value);
return true;
- case CSSPropertyOrder:
+ case CSSPropertyID::kOrder:
style.SetOrder(value);
return true;
- case CSSPropertyOrphans:
+ case CSSPropertyID::kOrphans:
style.SetOrphans(value);
return true;
- case CSSPropertyShapeImageThreshold:
+ case CSSPropertyID::kShapeImageThreshold:
style.SetShapeImageThreshold(value);
return true;
- case CSSPropertyStopOpacity:
+ case CSSPropertyID::kStopOpacity:
style.SetStopOpacity(value);
return true;
- case CSSPropertyStrokeMiterlimit:
+ case CSSPropertyID::kStrokeMiterlimit:
style.SetStrokeMiterLimit(value);
return true;
- case CSSPropertyStrokeOpacity:
+ case CSSPropertyID::kStrokeOpacity:
style.SetStrokeOpacity(value);
return true;
- case CSSPropertyColumnCount:
+ case CSSPropertyID::kColumnCount:
style.SetColumnCount(value);
return true;
- case CSSPropertyTextSizeAdjust:
+ case CSSPropertyID::kTextSizeAdjust:
style.SetTextSizeAdjust(value / 100.);
return true;
- case CSSPropertyWidows:
+ case CSSPropertyID::kWidows:
style.SetWidows(value);
return true;
- case CSSPropertyZIndex:
+ case CSSPropertyID::kZIndex:
style.SetZIndex(value);
return true;
default:
diff --git a/chromium/third_party/blink/renderer/core/animation/number_property_functions.h b/chromium/third_party/blink/renderer/core/animation/number_property_functions.h
index 4b32e30745e..759658147ea 100644
--- a/chromium/third_party/blink/renderer/core/animation/number_property_functions.h
+++ b/chromium/third_party/blink/renderer/core/animation/number_property_functions.h
@@ -7,6 +7,7 @@
#include "base/optional.h"
#include "third_party/blink/renderer/core/css/css_property_names.h"
+#include "third_party/blink/renderer/platform/wtf/allocator.h"
namespace blink {
@@ -14,6 +15,8 @@ class ComputedStyle;
class CSSProperty;
class NumberPropertyFunctions {
+ STATIC_ONLY(NumberPropertyFunctions);
+
public:
static base::Optional<double> GetInitialNumber(const CSSProperty&);
static base::Optional<double> GetNumber(const CSSProperty&,
diff --git a/chromium/third_party/blink/renderer/core/animation/path_interpolation_functions.cc b/chromium/third_party/blink/renderer/core/animation/path_interpolation_functions.cc
index 1a7007837ba..3260e29303b 100644
--- a/chromium/third_party/blink/renderer/core/animation/path_interpolation_functions.cc
+++ b/chromium/third_party/blink/renderer/core/animation/path_interpolation_functions.cc
@@ -70,15 +70,13 @@ InterpolationValue PathInterpolationFunctions::ConvertValue(
length++;
}
- std::unique_ptr<InterpolableList> path_args =
- InterpolableList::Create(length);
+ auto path_args = std::make_unique<InterpolableList>(length);
for (wtf_size_t i = 0; i < interpolable_path_segs.size(); i++)
path_args->Set(i, std::move(interpolable_path_segs[i]));
- std::unique_ptr<InterpolableList> result =
- InterpolableList::Create(kPathComponentIndexCount);
+ auto result = std::make_unique<InterpolableList>(kPathComponentIndexCount);
result->Set(kPathArgsIndex, std::move(path_args));
- result->Set(kPathNeutralIndex, InterpolableNumber::Create(0));
+ result->Set(kPathNeutralIndex, std::make_unique<InterpolableNumber>(0));
return InterpolationValue(
std::move(result), SVGPathNonInterpolableValue::Create(path_seg_types));
@@ -90,7 +88,8 @@ InterpolationValue PathInterpolationFunctions::ConvertValue(
if (style_path)
return ConvertValue(style_path->ByteStream(), coordinateConversion);
- std::unique_ptr<SVGPathByteStream> empty_path = SVGPathByteStream::Create();
+ std::unique_ptr<SVGPathByteStream> empty_path =
+ std::make_unique<SVGPathByteStream>();
return ConvertValue(*empty_path, ForceAbsolute);
}
@@ -128,12 +127,11 @@ InterpolationValue PathInterpolationFunctions::MaybeConvertNeutral(
InterpolationType::ConversionCheckers& conversion_checkers) {
conversion_checkers.push_back(
UnderlyingPathSegTypesChecker::Create(underlying));
- std::unique_ptr<InterpolableList> result =
- InterpolableList::Create(kPathComponentIndexCount);
+ auto result = std::make_unique<InterpolableList>(kPathComponentIndexCount);
result->Set(kPathArgsIndex, ToInterpolableList(*underlying.interpolable_value)
.Get(kPathArgsIndex)
->CloneAndZero());
- result->Set(kPathNeutralIndex, InterpolableNumber::Create(1));
+ result->Set(kPathNeutralIndex, std::make_unique<InterpolableNumber>(1));
return InterpolationValue(std::move(result),
underlying.non_interpolable_value.get());
}
@@ -197,7 +195,7 @@ std::unique_ptr<SVGPathByteStream> PathInterpolationFunctions::AppliedValue(
const InterpolableValue& interpolable_value,
const NonInterpolableValue* non_interpolable_value) {
std::unique_ptr<SVGPathByteStream> path_byte_stream =
- SVGPathByteStream::Create();
+ std::make_unique<SVGPathByteStream>();
InterpolatedSVGPathSource source(
ToInterpolableList(
*ToInterpolableList(interpolable_value).Get(kPathArgsIndex)),
diff --git a/chromium/third_party/blink/renderer/core/animation/path_interpolation_functions.h b/chromium/third_party/blink/renderer/core/animation/path_interpolation_functions.h
index 93f87525a5e..96b91cc8b36 100644
--- a/chromium/third_party/blink/renderer/core/animation/path_interpolation_functions.h
+++ b/chromium/third_party/blink/renderer/core/animation/path_interpolation_functions.h
@@ -8,12 +8,15 @@
#include <memory>
#include "third_party/blink/renderer/core/animation/interpolation_type.h"
#include "third_party/blink/renderer/core/svg/svg_path_byte_stream.h"
+#include "third_party/blink/renderer/platform/wtf/allocator.h"
namespace blink {
class StylePath;
class PathInterpolationFunctions {
+ STATIC_ONLY(PathInterpolationFunctions);
+
public:
enum CoordinateConversion { PreserveCoordinates, ForceAbsolute };
diff --git a/chromium/third_party/blink/renderer/core/animation/primitive_interpolation.h b/chromium/third_party/blink/renderer/core/animation/primitive_interpolation.h
index 90dc5ef8d8f..0caf5e2fe51 100644
--- a/chromium/third_party/blink/renderer/core/animation/primitive_interpolation.h
+++ b/chromium/third_party/blink/renderer/core/animation/primitive_interpolation.h
@@ -44,26 +44,6 @@ class PrimitiveInterpolation {
// eg. "0px" and "100px".
class PairwisePrimitiveInterpolation : public PrimitiveInterpolation {
public:
- ~PairwisePrimitiveInterpolation() override = default;
-
- static std::unique_ptr<PairwisePrimitiveInterpolation> Create(
- const InterpolationType& type,
- std::unique_ptr<InterpolableValue> start,
- std::unique_ptr<InterpolableValue> end,
- scoped_refptr<NonInterpolableValue> non_interpolable_value) {
- return base::WrapUnique(new PairwisePrimitiveInterpolation(
- type, std::move(start), std::move(end),
- std::move(non_interpolable_value)));
- }
-
- const InterpolationType& GetType() const { return type_; }
-
- std::unique_ptr<TypedInterpolationValue> InitialValue() const {
- return TypedInterpolationValue::Create(type_, start_->Clone(),
- non_interpolable_value_);
- }
-
- private:
PairwisePrimitiveInterpolation(
const InterpolationType& type,
std::unique_ptr<InterpolableValue> start,
@@ -77,6 +57,16 @@ class PairwisePrimitiveInterpolation : public PrimitiveInterpolation {
DCHECK(end_);
}
+ ~PairwisePrimitiveInterpolation() override = default;
+
+ const InterpolationType& GetType() const { return type_; }
+
+ std::unique_ptr<TypedInterpolationValue> InitialValue() const {
+ return std::make_unique<TypedInterpolationValue>(type_, start_->Clone(),
+ non_interpolable_value_);
+ }
+
+ private:
void InterpolateValue(
double fraction,
std::unique_ptr<TypedInterpolationValue>& result) const final {
@@ -103,22 +93,15 @@ class PairwisePrimitiveInterpolation : public PrimitiveInterpolation {
// behaviour eg. "auto" and "0px".
class FlipPrimitiveInterpolation : public PrimitiveInterpolation {
public:
- ~FlipPrimitiveInterpolation() override = default;
-
- static std::unique_ptr<FlipPrimitiveInterpolation> Create(
- std::unique_ptr<TypedInterpolationValue> start,
- std::unique_ptr<TypedInterpolationValue> end) {
- return base::WrapUnique(
- new FlipPrimitiveInterpolation(std::move(start), std::move(end)));
- }
-
- private:
FlipPrimitiveInterpolation(std::unique_ptr<TypedInterpolationValue> start,
std::unique_ptr<TypedInterpolationValue> end)
: start_(std::move(start)),
end_(std::move(end)),
last_fraction_(std::numeric_limits<double>::quiet_NaN()) {}
+ ~FlipPrimitiveInterpolation() override = default;
+
+ private:
void InterpolateValue(
double fraction,
std::unique_ptr<TypedInterpolationValue>& result) const final {
diff --git a/chromium/third_party/blink/renderer/core/animation/property_handle.cc b/chromium/third_party/blink/renderer/core/animation/property_handle.cc
index 7b39fe7a512..66687e28852 100644
--- a/chromium/third_party/blink/renderer/core/animation/property_handle.cc
+++ b/chromium/third_party/blink/renderer/core/animation/property_handle.cc
@@ -28,11 +28,11 @@ bool PropertyHandle::operator==(const PropertyHandle& other) const {
unsigned PropertyHandle::GetHash() const {
switch (handle_type_) {
case kHandleCSSProperty:
- return css_property_->PropertyID();
+ return static_cast<int>(css_property_->PropertyID());
case kHandleCSSCustomProperty:
return AtomicStringHash::GetHash(property_name_);
case kHandlePresentationAttribute:
- return -css_property_->PropertyID();
+ return -static_cast<int>(css_property_->PropertyID());
case kHandleSVGAttribute:
return QualifiedNameHash::GetHash(*svg_attribute_);
default:
diff --git a/chromium/third_party/blink/renderer/core/animation/property_handle.h b/chromium/third_party/blink/renderer/core/animation/property_handle.h
index eeca4b7bf7b..39fb5a06787 100644
--- a/chromium/third_party/blink/renderer/core/animation/property_handle.h
+++ b/chromium/third_party/blink/renderer/core/animation/property_handle.h
@@ -24,7 +24,7 @@ class CORE_EXPORT PropertyHandle {
: handle_type_(is_presentation_attribute ? kHandlePresentationAttribute
: kHandleCSSProperty),
css_property_(&property) {
- DCHECK_NE(CSSPropertyVariable, property.PropertyID());
+ DCHECK_NE(CSSPropertyID::kVariable, property.PropertyID());
}
explicit PropertyHandle(const AtomicString& property_name)
diff --git a/chromium/third_party/blink/renderer/core/animation/property_handle_test.cc b/chromium/third_party/blink/renderer/core/animation/property_handle_test.cc
index 7d2187eaae7..5348c19d696 100644
--- a/chromium/third_party/blink/renderer/core/animation/property_handle_test.cc
+++ b/chromium/third_party/blink/renderer/core/animation/property_handle_test.cc
@@ -111,18 +111,18 @@ TEST_F(PropertyHandleTest, Accessors) {
EXPECT_FALSE(PropertyHandle(kAmplitudeAttr).IsCSSCustomProperty());
EXPECT_EQ(
- CSSPropertyOpacity,
+ CSSPropertyID::kOpacity,
PropertyHandle(GetCSSPropertyOpacity()).GetCSSProperty().PropertyID());
- EXPECT_EQ(CSSPropertyVariable,
+ EXPECT_EQ(CSSPropertyID::kVariable,
PropertyHandle(name).GetCSSProperty().PropertyID());
EXPECT_EQ(name, PropertyHandle(name).CustomPropertyName());
EXPECT_EQ(kAmplitudeAttr, PropertyHandle(kAmplitudeAttr).SvgAttribute());
EXPECT_EQ(name, PropertyHandle(name).GetCSSPropertyName().ToAtomicString());
- EXPECT_EQ(CSSPropertyOpacity,
+ EXPECT_EQ(CSSPropertyID::kOpacity,
PropertyHandle(GetCSSPropertyOpacity()).GetCSSPropertyName().Id());
EXPECT_EQ(
- CSSPropertyColor,
+ CSSPropertyID::kColor,
PropertyHandle(GetCSSPropertyColor(), true).GetCSSPropertyName().Id());
}
diff --git a/chromium/third_party/blink/renderer/core/animation/sampled_effect.h b/chromium/third_party/blink/renderer/core/animation/sampled_effect.h
index 057d96d461c..cefbba9571c 100644
--- a/chromium/third_party/blink/renderer/core/animation/sampled_effect.h
+++ b/chromium/third_party/blink/renderer/core/animation/sampled_effect.h
@@ -18,11 +18,6 @@ namespace blink {
// effect ordering and managing composited animations.
class SampledEffect : public GarbageCollectedFinalized<SampledEffect> {
public:
- static SampledEffect* Create(KeyframeEffect* effect,
- unsigned sequence_number) {
- return MakeGarbageCollected<SampledEffect>(effect, sequence_number);
- }
-
SampledEffect(KeyframeEffect*, unsigned sequence_number);
void Clear();
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 b0e82a3c050..1e7b10f4850 100644
--- a/chromium/third_party/blink/renderer/core/animation/scroll_timeline.cc
+++ b/chromium/third_party/blink/renderer/core/animation/scroll_timeline.cc
@@ -56,7 +56,7 @@ bool StringToScrollOffset(String scroll_offset, CSSPrimitiveValue** result) {
return false;
// We support 'auto', but for simplicity just store it as nullptr.
- *result = value->IsIdentifierValue() ? nullptr : ToCSSPrimitiveValue(value);
+ *result = DynamicTo<CSSPrimitiveValue>(value);
return true;
}
@@ -128,18 +128,23 @@ ScrollTimeline::ScrollTimeline(Element* scroll_source,
time_range_(time_range),
fill_(fill) {}
-double ScrollTimeline::currentTime(bool& is_null) {
- is_null = true;
-
- // 1. If scrollSource is null, does not currently have a CSS layout box, or if
- // its layout box is not a scroll container, return an unresolved time value.
+bool ScrollTimeline::IsActive() const {
LayoutBox* layout_box = resolved_scroll_source_
? resolved_scroll_source_->GetLayoutBox()
: nullptr;
- if (!layout_box || !layout_box->HasOverflowClip()) {
+ return layout_box && layout_box->HasOverflowClip();
+}
+
+double ScrollTimeline::currentTime(bool& is_null) {
+ is_null = true;
+
+ // 1. If scroll timeline is inactive, return an unresolved time value.
+ // https://github.com/WICG/scroll-animations/issues/31
+ // https://wicg.github.io/scroll-animations/#current-time-algorithm
+ if (!IsActive()) {
return std::numeric_limits<double>::quiet_NaN();
}
-
+ LayoutBox* layout_box = resolved_scroll_source_->GetLayoutBox();
// 2. Otherwise, let current scroll offset be the current scroll offset of
// scrollSource in the direction specified by orientation.
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 5a468ee5b58..e71e10f8845 100644
--- a/chromium/third_party/blink/renderer/core/animation/scroll_timeline.h
+++ b/chromium/third_party/blink/renderer/core/animation/scroll_timeline.h
@@ -50,6 +50,10 @@ class CORE_EXPORT ScrollTimeline final : public AnimationTimeline {
// AnimationTimeline implementation.
double currentTime(bool& is_null) final;
bool IsScrollTimeline() const override { return true; }
+ // ScrollTimeline is not active if scrollSource is null, does not currently
+ // have a CSS layout box, or if its layout box is not a scroll container.
+ // https://github.com/WICG/scroll-animations/issues/31
+ bool IsActive() const override;
// IDL API implementation.
Element* scrollSource();
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 91fad5c521a..329f260f86b 100644
--- a/chromium/third_party/blink/renderer/core/animation/scroll_timeline.idl
+++ b/chromium/third_party/blink/renderer/core/animation/scroll_timeline.idl
@@ -9,7 +9,7 @@
ConstructorCallWith=Document,
MeasureAs=ScrollTimelineConstructor,
RaisesException=Constructor,
- OriginTrialEnabled=AnimationWorklet
+ RuntimeEnabled=AnimationWorklet
] interface ScrollTimeline : AnimationTimeline {
readonly attribute Element? scrollSource;
readonly attribute ScrollDirection orientation;
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 92bbbb92061..0ea38b93c9a 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
@@ -80,6 +80,7 @@ TEST_F(ScrollTimelineTest, CurrentTimeIsNullIfScrollSourceIsNotScrollable) {
bool current_time_is_null = false;
scroll_timeline->currentTime(current_time_is_null);
EXPECT_TRUE(current_time_is_null);
+ EXPECT_FALSE(scroll_timeline->IsActive());
}
TEST_F(ScrollTimelineTest,
@@ -124,6 +125,7 @@ TEST_F(ScrollTimelineTest,
scrollable_area->SetScrollOffset(ScrollOffset(0, 100), kProgrammaticScroll);
scroll_timeline->currentTime(current_time_is_null);
EXPECT_TRUE(current_time_is_null);
+ EXPECT_TRUE(scroll_timeline->IsActive());
}
TEST_F(ScrollTimelineTest,
@@ -158,6 +160,7 @@ TEST_F(ScrollTimelineTest,
scrollable_area->SetScrollOffset(ScrollOffset(0, 50), kProgrammaticScroll);
scroll_timeline->currentTime(current_time_is_null);
EXPECT_TRUE(current_time_is_null);
+ EXPECT_TRUE(scroll_timeline->IsActive());
}
TEST_F(ScrollTimelineTest,
diff --git a/chromium/third_party/blink/renderer/core/animation/shadow_interpolation_functions.cc b/chromium/third_party/blink/renderer/core/animation/shadow_interpolation_functions.cc
index 81ae5bd8a5b..0ab9c741d57 100644
--- a/chromium/third_party/blink/renderer/core/animation/shadow_interpolation_functions.cc
+++ b/chromium/third_party/blink/renderer/core/animation/shadow_interpolation_functions.cc
@@ -69,8 +69,8 @@ PairwiseInterpolationValue ShadowInterpolationFunctions::MaybeMergeSingles(
InterpolationValue ShadowInterpolationFunctions::ConvertShadowData(
const ShadowData& shadow_data,
double zoom) {
- std::unique_ptr<InterpolableList> interpolable_list =
- InterpolableList::Create(kShadowComponentIndexCount);
+ auto interpolable_list =
+ std::make_unique<InterpolableList>(kShadowComponentIndexCount);
interpolable_list->Set(kShadowX,
LengthInterpolationFunctions::CreateInterpolablePixels(
shadow_data.X() / zoom));
@@ -93,26 +93,29 @@ InterpolationValue ShadowInterpolationFunctions::ConvertShadowData(
InterpolationValue ShadowInterpolationFunctions::MaybeConvertCSSValue(
const CSSValue& value) {
- if (!value.IsShadowValue())
+ const auto* shadow = DynamicTo<CSSShadowValue>(value);
+ if (!shadow)
return nullptr;
- const CSSShadowValue& shadow = ToCSSShadowValue(value);
ShadowStyle style = kNormal;
- if (shadow.style) {
- if (shadow.style->GetValueID() == CSSValueInset)
+ if (shadow->style) {
+ if (shadow->style->GetValueID() == CSSValueID::kInset)
style = kInset;
else
return nullptr;
}
- std::unique_ptr<InterpolableList> interpolable_list =
- InterpolableList::Create(kShadowComponentIndexCount);
+ auto interpolable_list =
+ std::make_unique<InterpolableList>(kShadowComponentIndexCount);
static_assert(kShadowX == 0, "Enum ordering check.");
static_assert(kShadowY == 1, "Enum ordering check.");
static_assert(kShadowBlur == 2, "Enum ordering check.");
static_assert(kShadowSpread == 3, "Enum ordering check.");
const CSSPrimitiveValue* lengths[] = {
- shadow.x.Get(), shadow.y.Get(), shadow.blur.Get(), shadow.spread.Get(),
+ shadow->x.Get(),
+ shadow->y.Get(),
+ shadow->blur.Get(),
+ shadow->spread.Get(),
};
for (wtf_size_t i = 0; i < base::size(lengths); i++) {
if (lengths[i]) {
@@ -128,9 +131,9 @@ InterpolationValue ShadowInterpolationFunctions::MaybeConvertCSSValue(
}
}
- if (shadow.color) {
+ if (shadow->color) {
std::unique_ptr<InterpolableValue> interpolable_color =
- CSSColorInterpolationType::MaybeCreateInterpolableColor(*shadow.color);
+ CSSColorInterpolationType::MaybeCreateInterpolableColor(*shadow->color);
if (!interpolable_color)
return nullptr;
interpolable_list->Set(kShadowColor, std::move(interpolable_color));
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 6488247fa13..aaf4c7f8952 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
@@ -24,7 +24,7 @@ class CSSSizeNonInterpolableValue : public NonInterpolableValue {
std::move(length_non_interpolable_value)));
}
- bool IsKeyword() const { return keyword_ != CSSValueInvalid; }
+ bool IsKeyword() const { return IsValidCSSValueID(keyword_); }
CSSValueID Keyword() const {
DCHECK(IsKeyword());
return keyword_;
@@ -44,12 +44,12 @@ class CSSSizeNonInterpolableValue : public NonInterpolableValue {
private:
CSSSizeNonInterpolableValue(CSSValueID keyword)
: keyword_(keyword), length_non_interpolable_value_(nullptr) {
- DCHECK_NE(keyword, CSSValueInvalid);
+ DCHECK_NE(keyword, CSSValueID::kInvalid);
}
CSSSizeNonInterpolableValue(
scoped_refptr<NonInterpolableValue> length_non_interpolable_value)
- : keyword_(CSSValueInvalid),
+ : keyword_(CSSValueID::kInvalid),
length_non_interpolable_value_(
std::move(length_non_interpolable_value)) {}
@@ -61,7 +61,7 @@ DEFINE_NON_INTERPOLABLE_VALUE_TYPE(CSSSizeNonInterpolableValue);
DEFINE_NON_INTERPOLABLE_VALUE_TYPE_CASTS(CSSSizeNonInterpolableValue);
static InterpolationValue ConvertKeyword(CSSValueID keyword) {
- return InterpolationValue(InterpolableList::Create(0),
+ return InterpolationValue(std::make_unique<InterpolableList>(0),
CSSSizeNonInterpolableValue::Create(keyword));
}
@@ -83,14 +83,14 @@ InterpolationValue SizeInterpolationFunctions::ConvertFillSizeSide(
const Length& side =
convert_width ? fill_size.size.Width() : fill_size.size.Height();
if (side.IsAuto())
- return ConvertKeyword(CSSValueAuto);
+ return ConvertKeyword(CSSValueID::kAuto);
return WrapConvertedLength(
LengthInterpolationFunctions::MaybeConvertLength(side, zoom));
}
case EFillSizeType::kContain:
- return ConvertKeyword(CSSValueContain);
+ return ConvertKeyword(CSSValueID::kContain);
case EFillSizeType::kCover:
- return ConvertKeyword(CSSValueCover);
+ return ConvertKeyword(CSSValueID::kCover);
case EFillSizeType::kSizeNone:
default:
NOTREACHED();
@@ -101,26 +101,27 @@ InterpolationValue SizeInterpolationFunctions::ConvertFillSizeSide(
InterpolationValue SizeInterpolationFunctions::MaybeConvertCSSSizeSide(
const CSSValue& value,
bool convert_width) {
- if (value.IsValuePair()) {
- const CSSValuePair& pair = ToCSSValuePair(value);
- const CSSValue& side = convert_width ? pair.First() : pair.Second();
- if (side.IsIdentifierValue() &&
- ToCSSIdentifierValue(side).GetValueID() == CSSValueAuto)
- return ConvertKeyword(CSSValueAuto);
+ if (const auto* pair = DynamicTo<CSSValuePair>(value)) {
+ const CSSValue& side = convert_width ? pair->First() : pair->Second();
+ auto* side_identifier_value = DynamicTo<CSSIdentifierValue>(side);
+ if (side_identifier_value &&
+ side_identifier_value->GetValueID() == CSSValueID::kAuto)
+ return ConvertKeyword(CSSValueID::kAuto);
return WrapConvertedLength(
LengthInterpolationFunctions::MaybeConvertCSSValue(side));
}
- if (!value.IsIdentifierValue() && !value.IsPrimitiveValue())
+ auto* identifier_value = DynamicTo<CSSIdentifierValue>(value);
+ if (!identifier_value && !value.IsPrimitiveValue())
return nullptr;
- if (value.IsIdentifierValue())
- return ConvertKeyword(ToCSSIdentifierValue(value).GetValueID());
+ if (identifier_value)
+ return ConvertKeyword(identifier_value->GetValueID());
// A single length is equivalent to "<length> auto".
if (convert_width)
return WrapConvertedLength(
LengthInterpolationFunctions::MaybeConvertCSSValue(value));
- return ConvertKeyword(CSSValueAuto);
+ return ConvertKeyword(CSSValueID::kAuto);
}
PairwiseInterpolationValue SizeInterpolationFunctions::MaybeMergeSingles(
@@ -179,7 +180,7 @@ static Length CreateLength(
const CSSSizeNonInterpolableValue& non_interpolable_value,
const CSSToLengthConversionData& conversion_data) {
if (non_interpolable_value.IsKeyword()) {
- DCHECK_EQ(non_interpolable_value.Keyword(), CSSValueAuto);
+ DCHECK_EQ(non_interpolable_value.Keyword(), CSSValueID::kAuto);
return Length::Auto();
}
return LengthInterpolationFunctions::CreateLength(
@@ -197,13 +198,13 @@ FillSize SizeInterpolationFunctions::CreateFillSize(
const auto& side_b = ToCSSSizeNonInterpolableValue(*non_interpolable_value_b);
if (side_a.IsKeyword()) {
switch (side_a.Keyword()) {
- case CSSValueCover:
+ case CSSValueID::kCover:
DCHECK_EQ(side_a.Keyword(), side_b.Keyword());
return FillSize(EFillSizeType::kCover, LengthSize());
- case CSSValueContain:
+ case CSSValueID::kContain:
DCHECK_EQ(side_a.Keyword(), side_b.Keyword());
return FillSize(EFillSizeType::kContain, LengthSize());
- case CSSValueAuto:
+ case CSSValueID::kAuto:
break;
default:
NOTREACHED();
diff --git a/chromium/third_party/blink/renderer/core/animation/size_list_property_functions.cc b/chromium/third_party/blink/renderer/core/animation/size_list_property_functions.cc
index 9c140c02faf..67712f653ff 100644
--- a/chromium/third_party/blink/renderer/core/animation/size_list_property_functions.cc
+++ b/chromium/third_party/blink/renderer/core/animation/size_list_property_functions.cc
@@ -11,9 +11,9 @@ namespace blink {
static const FillLayer* GetFillLayerForSize(const CSSProperty& property,
const ComputedStyle& style) {
switch (property.PropertyID()) {
- case CSSPropertyBackgroundSize:
+ case CSSPropertyID::kBackgroundSize:
return &style.BackgroundLayers();
- case CSSPropertyWebkitMaskSize:
+ case CSSPropertyID::kWebkitMaskSize:
return &style.MaskLayers();
default:
NOTREACHED();
@@ -24,9 +24,9 @@ static const FillLayer* GetFillLayerForSize(const CSSProperty& property,
static FillLayer* AccessFillLayerForSize(const CSSProperty& property,
ComputedStyle& style) {
switch (property.PropertyID()) {
- case CSSPropertyBackgroundSize:
+ case CSSPropertyID::kBackgroundSize:
return &style.AccessBackgroundLayers();
- case CSSPropertyWebkitMaskSize:
+ case CSSPropertyID::kWebkitMaskSize:
return &style.AccessMaskLayers();
default:
NOTREACHED();
diff --git a/chromium/third_party/blink/renderer/core/animation/string_keyframe.cc b/chromium/third_party/blink/renderer/core/animation/string_keyframe.cc
index d696d002dee..cc805aa3a08 100644
--- a/chromium/third_party/blink/renderer/core/animation/string_keyframe.cc
+++ b/chromium/third_party/blink/renderer/core/animation/string_keyframe.cc
@@ -38,7 +38,7 @@ MutableCSSPropertyValueSet::SetResult StringKeyframe::SetCSSPropertyValue(
const String& value,
SecureContextMode secure_context_mode,
StyleSheetContents* style_sheet_contents) {
- DCHECK_NE(property, CSSPropertyInvalid);
+ DCHECK_NE(property, CSSPropertyID::kInvalid);
if (CSSAnimations::IsAnimationAffectingProperty(CSSProperty::Get(property))) {
bool did_parse = true;
bool did_change = false;
@@ -50,7 +50,7 @@ MutableCSSPropertyValueSet::SetResult StringKeyframe::SetCSSPropertyValue(
void StringKeyframe::SetCSSPropertyValue(const CSSProperty& property,
const CSSValue& value) {
- DCHECK_NE(property.PropertyID(), CSSPropertyInvalid);
+ DCHECK_NE(property.PropertyID(), CSSPropertyID::kInvalid);
DCHECK(!CSSAnimations::IsAnimationAffectingProperty(property));
css_property_map_->SetProperty(property.PropertyID(), value, false);
}
@@ -60,7 +60,7 @@ void StringKeyframe::SetPresentationAttributeValue(
const String& value,
SecureContextMode secure_context_mode,
StyleSheetContents* style_sheet_contents) {
- DCHECK_NE(property.PropertyID(), CSSPropertyInvalid);
+ DCHECK_NE(property.PropertyID(), CSSPropertyID::kInvalid);
if (!CSSAnimations::IsAnimationAffectingProperty(property)) {
presentation_attribute_map_->SetProperty(property.PropertyID(), value,
false, secure_context_mode,
@@ -83,10 +83,10 @@ PropertyHandleSet StringKeyframe::Properties() const {
const CSSProperty& property = property_reference.Property();
DCHECK(!property.IsShorthand())
<< "Web Animations: Encountered unexpanded shorthand CSS property ("
- << property.PropertyID() << ").";
- if (property.IDEquals(CSSPropertyVariable)) {
+ << static_cast<int>(property.PropertyID()) << ").";
+ if (property.IDEquals(CSSPropertyID::kVariable)) {
properties.insert(PropertyHandle(
- ToCSSCustomPropertyDeclaration(property_reference.Value())
+ To<CSSCustomPropertyDeclaration>(property_reference.Value())
.GetName()));
} else {
properties.insert(PropertyHandle(property, false));
diff --git a/chromium/third_party/blink/renderer/core/animation/svg_angle_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/svg_angle_interpolation_type.cc
index e0c7b9f6000..053572bd423 100644
--- a/chromium/third_party/blink/renderer/core/animation/svg_angle_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/svg_angle_interpolation_type.cc
@@ -7,13 +7,14 @@
#include "third_party/blink/renderer/core/animation/interpolation_environment.h"
#include "third_party/blink/renderer/core/animation/string_keyframe.h"
#include "third_party/blink/renderer/core/svg/svg_angle.h"
+#include "third_party/blink/renderer/platform/heap/heap.h"
namespace blink {
InterpolationValue SVGAngleInterpolationType::MaybeConvertNeutral(
const InterpolationValue&,
ConversionCheckers&) const {
- return InterpolationValue(InterpolableNumber::Create(0));
+ return InterpolationValue(std::make_unique<InterpolableNumber>(0));
}
InterpolationValue SVGAngleInterpolationType::MaybeConvertSVGValue(
@@ -21,14 +22,14 @@ InterpolationValue SVGAngleInterpolationType::MaybeConvertSVGValue(
if (ToSVGAngle(svg_value).OrientType()->EnumValue() != kSVGMarkerOrientAngle)
return nullptr;
return InterpolationValue(
- InterpolableNumber::Create(ToSVGAngle(svg_value).Value()));
+ std::make_unique<InterpolableNumber>(ToSVGAngle(svg_value).Value()));
}
SVGPropertyBase* SVGAngleInterpolationType::AppliedSVGValue(
const InterpolableValue& interpolable_value,
const NonInterpolableValue*) const {
double double_value = ToInterpolableNumber(interpolable_value).Value();
- SVGAngle* result = SVGAngle::Create();
+ auto* result = MakeGarbageCollected<SVGAngle>();
result->NewValueSpecifiedUnits(SVGAngle::kSvgAngletypeDeg, double_value);
return result;
}
diff --git a/chromium/third_party/blink/renderer/core/animation/svg_integer_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/svg_integer_interpolation_type.cc
index 0859bd5efeb..a7ca4bc446a 100644
--- a/chromium/third_party/blink/renderer/core/animation/svg_integer_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/svg_integer_interpolation_type.cc
@@ -6,13 +6,14 @@
#include "third_party/blink/renderer/core/animation/interpolation_environment.h"
#include "third_party/blink/renderer/core/svg/svg_integer.h"
+#include "third_party/blink/renderer/platform/heap/heap.h"
namespace blink {
InterpolationValue SVGIntegerInterpolationType::MaybeConvertNeutral(
const InterpolationValue&,
ConversionCheckers&) const {
- return InterpolationValue(InterpolableNumber::Create(0));
+ return InterpolationValue(std::make_unique<InterpolableNumber>(0));
}
InterpolationValue SVGIntegerInterpolationType::MaybeConvertSVGValue(
@@ -20,14 +21,14 @@ InterpolationValue SVGIntegerInterpolationType::MaybeConvertSVGValue(
if (svg_value.GetType() != kAnimatedInteger)
return nullptr;
return InterpolationValue(
- InterpolableNumber::Create(ToSVGInteger(svg_value).Value()));
+ std::make_unique<InterpolableNumber>(ToSVGInteger(svg_value).Value()));
}
SVGPropertyBase* SVGIntegerInterpolationType::AppliedSVGValue(
const InterpolableValue& interpolable_value,
const NonInterpolableValue*) const {
double value = ToInterpolableNumber(interpolable_value).Value();
- return SVGInteger::Create(round(value));
+ return MakeGarbageCollected<SVGInteger>(round(value));
}
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/animation/svg_integer_optional_integer_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/svg_integer_optional_integer_interpolation_type.cc
index d048c7d8e85..9e93285ba79 100644
--- a/chromium/third_party/blink/renderer/core/animation/svg_integer_optional_integer_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/svg_integer_optional_integer_interpolation_type.cc
@@ -5,8 +5,11 @@
#include "third_party/blink/renderer/core/animation/svg_integer_optional_integer_interpolation_type.h"
#include <memory>
+#include <utility>
+
#include "third_party/blink/renderer/core/animation/interpolation_environment.h"
#include "third_party/blink/renderer/core/svg/svg_integer_optional_integer.h"
+#include "third_party/blink/renderer/platform/heap/heap.h"
namespace blink {
@@ -14,9 +17,9 @@ InterpolationValue
SVGIntegerOptionalIntegerInterpolationType::MaybeConvertNeutral(
const InterpolationValue&,
ConversionCheckers&) const {
- std::unique_ptr<InterpolableList> result = InterpolableList::Create(2);
- result->Set(0, InterpolableNumber::Create(0));
- result->Set(1, InterpolableNumber::Create(0));
+ auto result = std::make_unique<InterpolableList>(2);
+ result->Set(0, std::make_unique<InterpolableNumber>(0));
+ result->Set(1, std::make_unique<InterpolableNumber>(0));
return InterpolationValue(std::move(result));
}
@@ -28,16 +31,16 @@ SVGIntegerOptionalIntegerInterpolationType::MaybeConvertSVGValue(
const SVGIntegerOptionalInteger& integer_optional_integer =
ToSVGIntegerOptionalInteger(svg_value);
- std::unique_ptr<InterpolableList> result = InterpolableList::Create(2);
- result->Set(0, InterpolableNumber::Create(
+ auto result = std::make_unique<InterpolableList>(2);
+ result->Set(0, std::make_unique<InterpolableNumber>(
integer_optional_integer.FirstInteger()->Value()));
- result->Set(1, InterpolableNumber::Create(
+ result->Set(1, std::make_unique<InterpolableNumber>(
integer_optional_integer.SecondInteger()->Value()));
return InterpolationValue(std::move(result));
}
static SVGInteger* ToPositiveInteger(const InterpolableValue* number) {
- return SVGInteger::Create(
+ return MakeGarbageCollected<SVGInteger>(
clampTo<int>(roundf(ToInterpolableNumber(number)->Value()), 1));
}
@@ -45,8 +48,8 @@ SVGPropertyBase* SVGIntegerOptionalIntegerInterpolationType::AppliedSVGValue(
const InterpolableValue& interpolable_value,
const NonInterpolableValue*) const {
const InterpolableList& list = ToInterpolableList(interpolable_value);
- return SVGIntegerOptionalInteger::Create(ToPositiveInteger(list.Get(0)),
- ToPositiveInteger(list.Get(1)));
+ return MakeGarbageCollected<SVGIntegerOptionalInteger>(
+ ToPositiveInteger(list.Get(0)), ToPositiveInteger(list.Get(1)));
}
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/animation/svg_length_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/svg_length_interpolation_type.cc
index 754e072fb4a..4f9fbedb2b3 100644
--- a/chromium/third_party/blink/renderer/core/animation/svg_length_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/svg_length_interpolation_type.cc
@@ -5,21 +5,24 @@
#include "third_party/blink/renderer/core/animation/svg_length_interpolation_type.h"
#include <memory>
+#include <utility>
+
#include "third_party/blink/renderer/core/animation/string_keyframe.h"
#include "third_party/blink/renderer/core/animation/svg_interpolation_environment.h"
#include "third_party/blink/renderer/core/css/css_resolution_units.h"
#include "third_party/blink/renderer/core/svg/svg_element.h"
#include "third_party/blink/renderer/core/svg/svg_length.h"
#include "third_party/blink/renderer/core/svg/svg_length_context.h"
+#include "third_party/blink/renderer/platform/heap/heap.h"
namespace blink {
std::unique_ptr<InterpolableValue>
SVGLengthInterpolationType::NeutralInterpolableValue() {
- std::unique_ptr<InterpolableList> list_of_values =
- InterpolableList::Create(CSSPrimitiveValue::kLengthUnitTypeCount);
+ auto list_of_values = std::make_unique<InterpolableList>(
+ CSSPrimitiveValue::kLengthUnitTypeCount);
for (wtf_size_t i = 0; i < CSSPrimitiveValue::kLengthUnitTypeCount; ++i)
- list_of_values->Set(i, InterpolableNumber::Create(0));
+ list_of_values->Set(i, std::make_unique<InterpolableNumber>(0));
return std::move(list_of_values);
}
@@ -31,10 +34,12 @@ InterpolationValue SVGLengthInterpolationType::ConvertSVGLength(
CSSLengthArray length_array;
primitive_value.AccumulateLengthArray(length_array);
- std::unique_ptr<InterpolableList> list_of_values =
- InterpolableList::Create(CSSPrimitiveValue::kLengthUnitTypeCount);
- for (wtf_size_t i = 0; i < CSSPrimitiveValue::kLengthUnitTypeCount; ++i)
- list_of_values->Set(i, InterpolableNumber::Create(length_array.values[i]));
+ auto list_of_values = std::make_unique<InterpolableList>(
+ CSSPrimitiveValue::kLengthUnitTypeCount);
+ for (wtf_size_t i = 0; i < CSSPrimitiveValue::kLengthUnitTypeCount; ++i) {
+ list_of_values->Set(
+ i, std::make_unique<InterpolableNumber>(length_array.values[i]));
+ }
return InterpolationValue(std::move(list_of_values));
}
@@ -84,7 +89,8 @@ SVGLength* SVGLengthInterpolationType::ResolveInterpolableSVGLength(
if (negative_values_forbidden && value < 0)
value = 0;
- SVGLength* result = SVGLength::Create(unit_mode); // defaults to the length 0
+ auto* result =
+ MakeGarbageCollected<SVGLength>(unit_mode); // defaults to the length 0
result->NewValueSpecifiedUnits(unit_type, value);
return result;
}
diff --git a/chromium/third_party/blink/renderer/core/animation/svg_length_list_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/svg_length_list_interpolation_type.cc
index 04751bb7c03..c3b58361026 100644
--- a/chromium/third_party/blink/renderer/core/animation/svg_length_list_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/svg_length_list_interpolation_type.cc
@@ -5,10 +5,13 @@
#include "third_party/blink/renderer/core/animation/svg_length_list_interpolation_type.h"
#include <memory>
+#include <utility>
+
#include "third_party/blink/renderer/core/animation/svg_interpolation_environment.h"
#include "third_party/blink/renderer/core/animation/svg_length_interpolation_type.h"
#include "third_party/blink/renderer/core/animation/underlying_length_checker.h"
#include "third_party/blink/renderer/core/svg/svg_length_list.h"
+#include "third_party/blink/renderer/platform/heap/heap.h"
namespace blink {
@@ -18,13 +21,12 @@ InterpolationValue SVGLengthListInterpolationType::MaybeConvertNeutral(
wtf_size_t underlying_length =
UnderlyingLengthChecker::GetUnderlyingLength(underlying);
conversion_checkers.push_back(
- UnderlyingLengthChecker::Create(underlying_length));
+ std::make_unique<UnderlyingLengthChecker>(underlying_length));
if (underlying_length == 0)
return nullptr;
- std::unique_ptr<InterpolableList> result =
- InterpolableList::Create(underlying_length);
+ auto result = std::make_unique<InterpolableList>(underlying_length);
for (wtf_size_t i = 0; i < underlying_length; i++)
result->Set(i, SVGLengthInterpolationType::NeutralInterpolableValue());
return InterpolationValue(std::move(result));
@@ -36,8 +38,7 @@ InterpolationValue SVGLengthListInterpolationType::MaybeConvertSVGValue(
return nullptr;
const SVGLengthList& length_list = ToSVGLengthList(svg_value);
- std::unique_ptr<InterpolableList> result =
- InterpolableList::Create(length_list.length());
+ auto result = std::make_unique<InterpolableList>(length_list.length());
for (wtf_size_t i = 0; i < length_list.length(); i++) {
InterpolationValue component =
SVGLengthInterpolationType::ConvertSVGLength(*length_list.at(i));
@@ -90,7 +91,7 @@ void SVGLengthListInterpolationType::Apply(
SVGElement& element = ToSVGInterpolationEnvironment(environment).SvgElement();
SVGLengthContext length_context(&element);
- SVGLengthList* result = SVGLengthList::Create(unit_mode_);
+ auto* result = MakeGarbageCollected<SVGLengthList>(unit_mode_);
const InterpolableList& list = ToInterpolableList(interpolable_value);
for (wtf_size_t i = 0; i < list.length(); i++) {
result->Append(SVGLengthInterpolationType::ResolveInterpolableSVGLength(
diff --git a/chromium/third_party/blink/renderer/core/animation/svg_number_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/svg_number_interpolation_type.cc
index f000fb084a3..9a8dad768fd 100644
--- a/chromium/third_party/blink/renderer/core/animation/svg_number_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/svg_number_interpolation_type.cc
@@ -4,17 +4,20 @@
#include "third_party/blink/renderer/core/animation/svg_number_interpolation_type.h"
+#include <memory>
+
#include "third_party/blink/renderer/core/animation/interpolation_environment.h"
#include "third_party/blink/renderer/core/animation/string_keyframe.h"
#include "third_party/blink/renderer/core/svg/properties/svg_animated_property.h"
#include "third_party/blink/renderer/core/svg/svg_number.h"
+#include "third_party/blink/renderer/platform/heap/heap.h"
namespace blink {
InterpolationValue SVGNumberInterpolationType::MaybeConvertNeutral(
const InterpolationValue&,
ConversionCheckers&) const {
- return InterpolationValue(InterpolableNumber::Create(0));
+ return InterpolationValue(std::make_unique<InterpolableNumber>(0));
}
InterpolationValue SVGNumberInterpolationType::MaybeConvertSVGValue(
@@ -22,14 +25,15 @@ InterpolationValue SVGNumberInterpolationType::MaybeConvertSVGValue(
if (svg_value.GetType() != kAnimatedNumber)
return nullptr;
return InterpolationValue(
- InterpolableNumber::Create(ToSVGNumber(svg_value).Value()));
+ std::make_unique<InterpolableNumber>(ToSVGNumber(svg_value).Value()));
}
SVGPropertyBase* SVGNumberInterpolationType::AppliedSVGValue(
const InterpolableValue& interpolable_value,
const NonInterpolableValue*) const {
double value = ToInterpolableNumber(interpolable_value).Value();
- return SVGNumber::Create(is_non_negative_ && value < 0 ? 0 : value);
+ return MakeGarbageCollected<SVGNumber>(is_non_negative_ && value < 0 ? 0
+ : value);
}
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/animation/svg_number_list_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/svg_number_list_interpolation_type.cc
index c012c1645ca..a20d97e7137 100644
--- a/chromium/third_party/blink/renderer/core/animation/svg_number_list_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/svg_number_list_interpolation_type.cc
@@ -5,9 +5,12 @@
#include "third_party/blink/renderer/core/animation/svg_number_list_interpolation_type.h"
#include <memory>
+#include <utility>
+
#include "third_party/blink/renderer/core/animation/interpolation_environment.h"
#include "third_party/blink/renderer/core/animation/underlying_length_checker.h"
#include "third_party/blink/renderer/core/svg/svg_number_list.h"
+#include "third_party/blink/renderer/platform/heap/heap.h"
namespace blink {
@@ -17,15 +20,14 @@ InterpolationValue SVGNumberListInterpolationType::MaybeConvertNeutral(
wtf_size_t underlying_length =
UnderlyingLengthChecker::GetUnderlyingLength(underlying);
conversion_checkers.push_back(
- UnderlyingLengthChecker::Create(underlying_length));
+ std::make_unique<UnderlyingLengthChecker>(underlying_length));
if (underlying_length == 0)
return nullptr;
- std::unique_ptr<InterpolableList> result =
- InterpolableList::Create(underlying_length);
+ auto result = std::make_unique<InterpolableList>(underlying_length);
for (wtf_size_t i = 0; i < underlying_length; i++)
- result->Set(i, InterpolableNumber::Create(0));
+ result->Set(i, std::make_unique<InterpolableNumber>(0));
return InterpolationValue(std::move(result));
}
@@ -35,10 +37,11 @@ InterpolationValue SVGNumberListInterpolationType::MaybeConvertSVGValue(
return nullptr;
const SVGNumberList& number_list = ToSVGNumberList(svg_value);
- std::unique_ptr<InterpolableList> result =
- InterpolableList::Create(number_list.length());
- for (wtf_size_t i = 0; i < number_list.length(); i++)
- result->Set(i, InterpolableNumber::Create(number_list.at(i)->Value()));
+ auto result = std::make_unique<InterpolableList>(number_list.length());
+ for (wtf_size_t i = 0; i < number_list.length(); i++) {
+ result->Set(
+ i, std::make_unique<InterpolableNumber>(number_list.at(i)->Value()));
+ }
return InterpolationValue(std::move(result));
}
@@ -59,13 +62,12 @@ static void PadWithZeroes(std::unique_ptr<InterpolableValue>& list_pointer,
if (list.length() >= padded_length)
return;
- std::unique_ptr<InterpolableList> result =
- InterpolableList::Create(padded_length);
+ auto result = std::make_unique<InterpolableList>(padded_length);
wtf_size_t i = 0;
for (; i < list.length(); i++)
result->Set(i, std::move(list.GetMutable(i)));
for (; i < padded_length; i++)
- result->Set(i, InterpolableNumber::Create(0));
+ result->Set(i, std::make_unique<InterpolableNumber>(0));
list_pointer = std::move(result);
}
@@ -96,11 +98,12 @@ void SVGNumberListInterpolationType::Composite(
SVGPropertyBase* SVGNumberListInterpolationType::AppliedSVGValue(
const InterpolableValue& interpolable_value,
const NonInterpolableValue*) const {
- SVGNumberList* result = SVGNumberList::Create();
+ auto* result = MakeGarbageCollected<SVGNumberList>();
const InterpolableList& list = ToInterpolableList(interpolable_value);
- for (wtf_size_t i = 0; i < list.length(); i++)
- result->Append(
- SVGNumber::Create(ToInterpolableNumber(list.Get(i))->Value()));
+ for (wtf_size_t i = 0; i < list.length(); i++) {
+ result->Append(MakeGarbageCollected<SVGNumber>(
+ ToInterpolableNumber(list.Get(i))->Value()));
+ }
return result;
}
diff --git a/chromium/third_party/blink/renderer/core/animation/svg_number_optional_number_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/svg_number_optional_number_interpolation_type.cc
index 78f292a04be..ca685ba6eb7 100644
--- a/chromium/third_party/blink/renderer/core/animation/svg_number_optional_number_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/svg_number_optional_number_interpolation_type.cc
@@ -5,8 +5,11 @@
#include "third_party/blink/renderer/core/animation/svg_number_optional_number_interpolation_type.h"
#include <memory>
+#include <utility>
+
#include "third_party/blink/renderer/core/animation/interpolation_environment.h"
#include "third_party/blink/renderer/core/svg/svg_number_optional_number.h"
+#include "third_party/blink/renderer/platform/heap/heap.h"
namespace blink {
@@ -14,9 +17,9 @@ InterpolationValue
SVGNumberOptionalNumberInterpolationType::MaybeConvertNeutral(
const InterpolationValue&,
ConversionCheckers&) const {
- std::unique_ptr<InterpolableList> result = InterpolableList::Create(2);
- result->Set(0, InterpolableNumber::Create(0));
- result->Set(1, InterpolableNumber::Create(0));
+ auto result = std::make_unique<InterpolableList>(2);
+ result->Set(0, std::make_unique<InterpolableNumber>(0));
+ result->Set(1, std::make_unique<InterpolableNumber>(0));
return InterpolationValue(std::move(result));
}
@@ -28,10 +31,10 @@ SVGNumberOptionalNumberInterpolationType::MaybeConvertSVGValue(
const SVGNumberOptionalNumber& number_optional_number =
ToSVGNumberOptionalNumber(svg_value);
- std::unique_ptr<InterpolableList> result = InterpolableList::Create(2);
- result->Set(0, InterpolableNumber::Create(
+ auto result = std::make_unique<InterpolableList>(2);
+ result->Set(0, std::make_unique<InterpolableNumber>(
number_optional_number.FirstNumber()->Value()));
- result->Set(1, InterpolableNumber::Create(
+ result->Set(1, std::make_unique<InterpolableNumber>(
number_optional_number.SecondNumber()->Value()));
return InterpolationValue(std::move(result));
}
@@ -40,9 +43,11 @@ SVGPropertyBase* SVGNumberOptionalNumberInterpolationType::AppliedSVGValue(
const InterpolableValue& interpolable_value,
const NonInterpolableValue*) const {
const InterpolableList& list = ToInterpolableList(interpolable_value);
- return SVGNumberOptionalNumber::Create(
- SVGNumber::Create(ToInterpolableNumber(list.Get(0))->Value()),
- SVGNumber::Create(ToInterpolableNumber(list.Get(1))->Value()));
+ return MakeGarbageCollected<SVGNumberOptionalNumber>(
+ MakeGarbageCollected<SVGNumber>(
+ ToInterpolableNumber(list.Get(0))->Value()),
+ MakeGarbageCollected<SVGNumber>(
+ ToInterpolableNumber(list.Get(1))->Value()));
}
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/animation/svg_path_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/svg_path_interpolation_type.cc
index 4987dbbff9b..04c2674ac60 100644
--- a/chromium/third_party/blink/renderer/core/animation/svg_path_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/svg_path_interpolation_type.cc
@@ -5,8 +5,8 @@
#include "third_party/blink/renderer/core/animation/svg_path_interpolation_type.h"
#include "third_party/blink/renderer/core/animation/path_interpolation_functions.h"
-
#include "third_party/blink/renderer/core/svg/svg_path.h"
+#include "third_party/blink/renderer/platform/heap/heap.h"
namespace blink {
@@ -46,7 +46,7 @@ void SVGPathInterpolationType::Composite(
SVGPropertyBase* SVGPathInterpolationType::AppliedSVGValue(
const InterpolableValue& interpolable_value,
const NonInterpolableValue* non_interpolable_value) const {
- return SVGPath::Create(
+ return MakeGarbageCollected<SVGPath>(
cssvalue::CSSPathValue::Create(PathInterpolationFunctions::AppliedValue(
interpolable_value, non_interpolable_value)));
}
diff --git a/chromium/third_party/blink/renderer/core/animation/svg_path_seg_interpolation_functions.cc b/chromium/third_party/blink/renderer/core/animation/svg_path_seg_interpolation_functions.cc
index f138627723b..2ca6d9e0c9c 100644
--- a/chromium/third_party/blink/renderer/core/animation/svg_path_seg_interpolation_functions.cc
+++ b/chromium/third_party/blink/renderer/core/animation/svg_path_seg_interpolation_functions.cc
@@ -11,8 +11,8 @@ namespace blink {
std::unique_ptr<InterpolableNumber> ConsumeControlAxis(double value,
bool is_absolute,
double current_value) {
- return InterpolableNumber::Create(is_absolute ? value
- : current_value + value);
+ return std::make_unique<InterpolableNumber>(
+ is_absolute ? value : current_value + value);
}
double ConsumeInterpolableControlAxis(const InterpolableValue* number,
@@ -28,7 +28,7 @@ ConsumeCoordinateAxis(double value, bool is_absolute, double& current_value) {
current_value = value;
else
current_value += value;
- return InterpolableNumber::Create(current_value);
+ return std::make_unique<InterpolableNumber>(current_value);
}
double ConsumeInterpolableCoordinateAxis(const InterpolableValue* number,
@@ -44,7 +44,7 @@ std::unique_ptr<InterpolableValue> ConsumeClosePath(
PathCoordinates& coordinates) {
coordinates.current_x = coordinates.initial_x;
coordinates.current_y = coordinates.initial_y;
- return InterpolableList::Create(0);
+ return std::make_unique<InterpolableList>(0);
}
PathSegmentData ConsumeInterpolableClosePath(const InterpolableValue&,
@@ -62,7 +62,7 @@ std::unique_ptr<InterpolableValue> ConsumeSingleCoordinate(
const PathSegmentData& segment,
PathCoordinates& coordinates) {
bool is_absolute = IsAbsolutePathSegType(segment.command);
- std::unique_ptr<InterpolableList> result = InterpolableList::Create(2);
+ auto result = std::make_unique<InterpolableList>(2);
result->Set(0, ConsumeCoordinateAxis(segment.X(), is_absolute,
coordinates.current_x));
result->Set(1, ConsumeCoordinateAxis(segment.Y(), is_absolute,
@@ -105,7 +105,7 @@ std::unique_ptr<InterpolableValue> ConsumeCurvetoCubic(
const PathSegmentData& segment,
PathCoordinates& coordinates) {
bool is_absolute = IsAbsolutePathSegType(segment.command);
- std::unique_ptr<InterpolableList> result = InterpolableList::Create(6);
+ auto result = std::make_unique<InterpolableList>(6);
result->Set(
0, ConsumeControlAxis(segment.X1(), is_absolute, coordinates.current_x));
result->Set(
@@ -147,7 +147,7 @@ std::unique_ptr<InterpolableValue> ConsumeCurvetoQuadratic(
const PathSegmentData& segment,
PathCoordinates& coordinates) {
bool is_absolute = IsAbsolutePathSegType(segment.command);
- std::unique_ptr<InterpolableList> result = InterpolableList::Create(4);
+ auto result = std::make_unique<InterpolableList>(4);
result->Set(
0, ConsumeControlAxis(segment.X1(), is_absolute, coordinates.current_x));
result->Set(
@@ -181,17 +181,17 @@ PathSegmentData ConsumeInterpolableCurvetoQuadratic(
std::unique_ptr<InterpolableValue> ConsumeArc(const PathSegmentData& segment,
PathCoordinates& coordinates) {
bool is_absolute = IsAbsolutePathSegType(segment.command);
- std::unique_ptr<InterpolableList> result = InterpolableList::Create(7);
+ auto result = std::make_unique<InterpolableList>(7);
result->Set(0, ConsumeCoordinateAxis(segment.X(), is_absolute,
coordinates.current_x));
result->Set(1, ConsumeCoordinateAxis(segment.Y(), is_absolute,
coordinates.current_y));
- result->Set(2, InterpolableNumber::Create(segment.R1()));
- result->Set(3, InterpolableNumber::Create(segment.R2()));
- result->Set(4, InterpolableNumber::Create(segment.ArcAngle()));
+ result->Set(2, std::make_unique<InterpolableNumber>(segment.R1()));
+ result->Set(3, std::make_unique<InterpolableNumber>(segment.R2()));
+ result->Set(4, std::make_unique<InterpolableNumber>(segment.ArcAngle()));
// TODO(alancutter): Make these flags part of the NonInterpolableValue.
- result->Set(5, InterpolableNumber::Create(segment.LargeArcFlag()));
- result->Set(6, InterpolableNumber::Create(segment.SweepFlag()));
+ result->Set(5, std::make_unique<InterpolableNumber>(segment.LargeArcFlag()));
+ result->Set(6, std::make_unique<InterpolableNumber>(segment.SweepFlag()));
return std::move(result);
}
@@ -256,7 +256,7 @@ std::unique_ptr<InterpolableValue> ConsumeCurvetoCubicSmooth(
const PathSegmentData& segment,
PathCoordinates& coordinates) {
bool is_absolute = IsAbsolutePathSegType(segment.command);
- std::unique_ptr<InterpolableList> result = InterpolableList::Create(4);
+ auto result = std::make_unique<InterpolableList>(4);
result->Set(
0, ConsumeControlAxis(segment.X2(), is_absolute, coordinates.current_x));
result->Set(
diff --git a/chromium/third_party/blink/renderer/core/animation/svg_point_list_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/svg_point_list_interpolation_type.cc
index a023d14908d..86b32f0abb8 100644
--- a/chromium/third_party/blink/renderer/core/animation/svg_point_list_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/svg_point_list_interpolation_type.cc
@@ -5,10 +5,13 @@
#include "third_party/blink/renderer/core/animation/svg_point_list_interpolation_type.h"
#include <memory>
+#include <utility>
+
#include "third_party/blink/renderer/core/animation/interpolation_environment.h"
#include "third_party/blink/renderer/core/animation/string_keyframe.h"
#include "third_party/blink/renderer/core/animation/underlying_length_checker.h"
#include "third_party/blink/renderer/core/svg/svg_point_list.h"
+#include "third_party/blink/renderer/platform/heap/heap.h"
namespace blink {
@@ -18,15 +21,14 @@ InterpolationValue SVGPointListInterpolationType::MaybeConvertNeutral(
wtf_size_t underlying_length =
UnderlyingLengthChecker::GetUnderlyingLength(underlying);
conversion_checkers.push_back(
- UnderlyingLengthChecker::Create(underlying_length));
+ std::make_unique<UnderlyingLengthChecker>(underlying_length));
if (underlying_length == 0)
return nullptr;
- std::unique_ptr<InterpolableList> result =
- InterpolableList::Create(underlying_length);
+ auto result = std::make_unique<InterpolableList>(underlying_length);
for (wtf_size_t i = 0; i < underlying_length; i++)
- result->Set(i, InterpolableNumber::Create(0));
+ result->Set(i, std::make_unique<InterpolableNumber>(0));
return InterpolationValue(std::move(result));
}
@@ -36,12 +38,11 @@ InterpolationValue SVGPointListInterpolationType::MaybeConvertSVGValue(
return nullptr;
const SVGPointList& point_list = ToSVGPointList(svg_value);
- std::unique_ptr<InterpolableList> result =
- InterpolableList::Create(point_list.length() * 2);
+ auto result = std::make_unique<InterpolableList>(point_list.length() * 2);
for (wtf_size_t i = 0; i < point_list.length(); i++) {
const SVGPoint& point = *point_list.at(i);
- result->Set(2 * i, InterpolableNumber::Create(point.X()));
- result->Set(2 * i + 1, InterpolableNumber::Create(point.Y()));
+ result->Set(2 * i, std::make_unique<InterpolableNumber>(point.X()));
+ result->Set(2 * i + 1, std::make_unique<InterpolableNumber>(point.Y()));
}
return InterpolationValue(std::move(result));
@@ -79,7 +80,7 @@ void SVGPointListInterpolationType::Composite(
SVGPropertyBase* SVGPointListInterpolationType::AppliedSVGValue(
const InterpolableValue& interpolable_value,
const NonInterpolableValue*) const {
- SVGPointList* result = SVGPointList::Create();
+ auto* result = MakeGarbageCollected<SVGPointList>();
const InterpolableList& list = ToInterpolableList(interpolable_value);
DCHECK_EQ(list.length() % 2, 0U);
@@ -87,7 +88,7 @@ SVGPropertyBase* SVGPointListInterpolationType::AppliedSVGValue(
FloatPoint point =
FloatPoint(ToInterpolableNumber(list.Get(i))->Value(),
ToInterpolableNumber(list.Get(i + 1))->Value());
- result->Append(SVGPoint::Create(point));
+ result->Append(MakeGarbageCollected<SVGPoint>(point));
}
return result;
diff --git a/chromium/third_party/blink/renderer/core/animation/svg_rect_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/svg_rect_interpolation_type.cc
index d9974df1c8b..39ad3523616 100644
--- a/chromium/third_party/blink/renderer/core/animation/svg_rect_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/svg_rect_interpolation_type.cc
@@ -4,9 +4,12 @@
#include "third_party/blink/renderer/core/animation/svg_rect_interpolation_type.h"
#include <memory>
+#include <utility>
+
#include "third_party/blink/renderer/core/animation/interpolation_environment.h"
#include "third_party/blink/renderer/core/animation/string_keyframe.h"
#include "third_party/blink/renderer/core/svg/svg_rect.h"
+#include "third_party/blink/renderer/platform/heap/heap.h"
#include "third_party/blink/renderer/platform/wtf/std_lib_extras.h"
namespace blink {
@@ -22,10 +25,9 @@ enum RectComponentIndex : unsigned {
InterpolationValue SVGRectInterpolationType::MaybeConvertNeutral(
const InterpolationValue&,
ConversionCheckers&) const {
- std::unique_ptr<InterpolableList> result =
- InterpolableList::Create(kRectComponentIndexCount);
+ auto result = std::make_unique<InterpolableList>(kRectComponentIndexCount);
for (wtf_size_t i = 0; i < kRectComponentIndexCount; i++)
- result->Set(i, InterpolableNumber::Create(0));
+ result->Set(i, std::make_unique<InterpolableNumber>(0));
return InterpolationValue(std::move(result));
}
@@ -35,12 +37,11 @@ InterpolationValue SVGRectInterpolationType::MaybeConvertSVGValue(
return nullptr;
const SVGRect& rect = ToSVGRect(svg_value);
- std::unique_ptr<InterpolableList> result =
- InterpolableList::Create(kRectComponentIndexCount);
- result->Set(kRectX, InterpolableNumber::Create(rect.X()));
- result->Set(kRectY, InterpolableNumber::Create(rect.Y()));
- result->Set(kRectWidth, InterpolableNumber::Create(rect.Width()));
- result->Set(kRectHeight, InterpolableNumber::Create(rect.Height()));
+ auto result = std::make_unique<InterpolableList>(kRectComponentIndexCount);
+ result->Set(kRectX, std::make_unique<InterpolableNumber>(rect.X()));
+ result->Set(kRectY, std::make_unique<InterpolableNumber>(rect.Y()));
+ result->Set(kRectWidth, std::make_unique<InterpolableNumber>(rect.Width()));
+ result->Set(kRectHeight, std::make_unique<InterpolableNumber>(rect.Height()));
return InterpolationValue(std::move(result));
}
@@ -48,7 +49,7 @@ SVGPropertyBase* SVGRectInterpolationType::AppliedSVGValue(
const InterpolableValue& interpolable_value,
const NonInterpolableValue*) const {
const InterpolableList& list = ToInterpolableList(interpolable_value);
- SVGRect* result = SVGRect::Create();
+ auto* result = MakeGarbageCollected<SVGRect>();
result->SetX(ToInterpolableNumber(list.Get(kRectX))->Value());
result->SetY(ToInterpolableNumber(list.Get(kRectY))->Value());
result->SetWidth(ToInterpolableNumber(list.Get(kRectWidth))->Value());
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 24f6766723d..56bcdeb1e24 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
@@ -14,6 +14,7 @@
#include "third_party/blink/renderer/core/animation/svg_interpolation_environment.h"
#include "third_party/blink/renderer/core/svg/svg_transform.h"
#include "third_party/blink/renderer/core/svg/svg_transform_list.h"
+#include "third_party/blink/renderer/platform/heap/heap.h"
namespace blink {
@@ -49,16 +50,17 @@ namespace {
std::unique_ptr<InterpolableValue> TranslateToInterpolableValue(
SVGTransform* transform) {
FloatPoint translate = transform->Translate();
- std::unique_ptr<InterpolableList> result = InterpolableList::Create(2);
- result->Set(0, InterpolableNumber::Create(translate.X()));
- result->Set(1, InterpolableNumber::Create(translate.Y()));
+ auto result = std::make_unique<InterpolableList>(2);
+ result->Set(0, std::make_unique<InterpolableNumber>(translate.X()));
+ result->Set(1, std::make_unique<InterpolableNumber>(translate.Y()));
return std::move(result);
}
SVGTransform* TranslateFromInterpolableValue(const InterpolableValue& value) {
const InterpolableList& list = ToInterpolableList(value);
- SVGTransform* transform = SVGTransform::Create(SVGTransformType::kTranslate);
+ auto* transform =
+ MakeGarbageCollected<SVGTransform>(SVGTransformType::kTranslate);
transform->SetTranslate(ToInterpolableNumber(list.Get(0))->Value(),
ToInterpolableNumber(list.Get(1))->Value());
return transform;
@@ -67,16 +69,17 @@ SVGTransform* TranslateFromInterpolableValue(const InterpolableValue& value) {
std::unique_ptr<InterpolableValue> ScaleToInterpolableValue(
SVGTransform* transform) {
FloatSize scale = transform->Scale();
- std::unique_ptr<InterpolableList> result = InterpolableList::Create(2);
- result->Set(0, InterpolableNumber::Create(scale.Width()));
- result->Set(1, InterpolableNumber::Create(scale.Height()));
+ auto result = std::make_unique<InterpolableList>(2);
+ result->Set(0, std::make_unique<InterpolableNumber>(scale.Width()));
+ result->Set(1, std::make_unique<InterpolableNumber>(scale.Height()));
return std::move(result);
}
SVGTransform* ScaleFromInterpolableValue(const InterpolableValue& value) {
const InterpolableList& list = ToInterpolableList(value);
- SVGTransform* transform = SVGTransform::Create(SVGTransformType::kScale);
+ auto* transform =
+ MakeGarbageCollected<SVGTransform>(SVGTransformType::kScale);
transform->SetScale(ToInterpolableNumber(list.Get(0))->Value(),
ToInterpolableNumber(list.Get(1))->Value());
return transform;
@@ -85,17 +88,18 @@ SVGTransform* ScaleFromInterpolableValue(const InterpolableValue& value) {
std::unique_ptr<InterpolableValue> RotateToInterpolableValue(
SVGTransform* transform) {
FloatPoint rotation_center = transform->RotationCenter();
- std::unique_ptr<InterpolableList> result = InterpolableList::Create(3);
- result->Set(0, InterpolableNumber::Create(transform->Angle()));
- result->Set(1, InterpolableNumber::Create(rotation_center.X()));
- result->Set(2, InterpolableNumber::Create(rotation_center.Y()));
+ auto result = std::make_unique<InterpolableList>(3);
+ result->Set(0, std::make_unique<InterpolableNumber>(transform->Angle()));
+ result->Set(1, std::make_unique<InterpolableNumber>(rotation_center.X()));
+ result->Set(2, std::make_unique<InterpolableNumber>(rotation_center.Y()));
return std::move(result);
}
SVGTransform* RotateFromInterpolableValue(const InterpolableValue& value) {
const InterpolableList& list = ToInterpolableList(value);
- SVGTransform* transform = SVGTransform::Create(SVGTransformType::kRotate);
+ auto* transform =
+ MakeGarbageCollected<SVGTransform>(SVGTransformType::kRotate);
transform->SetRotate(ToInterpolableNumber(list.Get(0))->Value(),
ToInterpolableNumber(list.Get(1))->Value(),
ToInterpolableNumber(list.Get(2))->Value());
@@ -104,22 +108,24 @@ SVGTransform* RotateFromInterpolableValue(const InterpolableValue& value) {
std::unique_ptr<InterpolableValue> SkewXToInterpolableValue(
SVGTransform* transform) {
- return InterpolableNumber::Create(transform->Angle());
+ return std::make_unique<InterpolableNumber>(transform->Angle());
}
SVGTransform* SkewXFromInterpolableValue(const InterpolableValue& value) {
- SVGTransform* transform = SVGTransform::Create(SVGTransformType::kSkewx);
+ auto* transform =
+ MakeGarbageCollected<SVGTransform>(SVGTransformType::kSkewx);
transform->SetSkewX(ToInterpolableNumber(value).Value());
return transform;
}
std::unique_ptr<InterpolableValue> SkewYToInterpolableValue(
SVGTransform* transform) {
- return InterpolableNumber::Create(transform->Angle());
+ return std::make_unique<InterpolableNumber>(transform->Angle());
}
SVGTransform* SkewYFromInterpolableValue(const InterpolableValue& value) {
- SVGTransform* transform = SVGTransform::Create(SVGTransformType::kSkewy);
+ auto* transform =
+ MakeGarbageCollected<SVGTransform>(SVGTransformType::kSkewy);
transform->SetSkewY(ToInterpolableNumber(value).Value());
return transform;
}
@@ -175,10 +181,8 @@ const Vector<SVGTransformType>& GetTransformTypes(
class SVGTransformListChecker : public InterpolationType::ConversionChecker {
public:
- static std::unique_ptr<SVGTransformListChecker> Create(
- const InterpolationValue& underlying) {
- return base::WrapUnique(new SVGTransformListChecker(underlying));
- }
+ explicit SVGTransformListChecker(const InterpolationValue& underlying)
+ : underlying_(underlying.Clone()) {}
bool IsValid(const InterpolationEnvironment&,
const InterpolationValue& underlying) const final {
@@ -194,9 +198,6 @@ class SVGTransformListChecker : public InterpolationType::ConversionChecker {
}
private:
- SVGTransformListChecker(const InterpolationValue& underlying)
- : underlying_(underlying.Clone()) {}
-
const InterpolationValue underlying_;
};
@@ -217,8 +218,7 @@ InterpolationValue SVGTransformListInterpolationType::MaybeConvertSVGValue(
return nullptr;
const SVGTransformList& svg_list = ToSVGTransformList(svg_value);
- std::unique_ptr<InterpolableList> result =
- InterpolableList::Create(svg_list.length());
+ auto result = std::make_unique<InterpolableList>(svg_list.length());
Vector<SVGTransformType> transform_types;
for (wtf_size_t i = 0; i < svg_list.length(); i++) {
@@ -249,7 +249,8 @@ InterpolationValue SVGTransformListInterpolationType::MaybeConvertSingle(
types.AppendVector(GetTransformTypes(underlying));
interpolable_parts.push_back(underlying.interpolable_value->Clone());
}
- conversion_checkers.push_back(SVGTransformListChecker::Create(underlying));
+ conversion_checkers.push_back(
+ std::make_unique<SVGTransformListChecker>(underlying));
} else {
DCHECK(!keyframe.IsNeutral());
}
@@ -266,8 +267,7 @@ InterpolationValue SVGTransformListInterpolationType::MaybeConvertSingle(
interpolable_parts.push_back(std::move(value.interpolable_value));
}
- std::unique_ptr<InterpolableList> interpolable_list =
- InterpolableList::Create(types.size());
+ auto interpolable_list = std::make_unique<InterpolableList>(types.size());
wtf_size_t interpolable_list_index = 0;
for (auto& part : interpolable_parts) {
InterpolableList& list = ToInterpolableList(*part);
@@ -285,7 +285,7 @@ InterpolationValue SVGTransformListInterpolationType::MaybeConvertSingle(
SVGPropertyBase* SVGTransformListInterpolationType::AppliedSVGValue(
const InterpolableValue& interpolable_value,
const NonInterpolableValue* non_interpolable_value) const {
- SVGTransformList* result = SVGTransformList::Create();
+ auto* result = MakeGarbageCollected<SVGTransformList>();
const InterpolableList& list = ToInterpolableList(interpolable_value);
const Vector<SVGTransformType>& transform_types =
ToSVGTransformNonInterpolableValue(non_interpolable_value)
diff --git a/chromium/third_party/blink/renderer/core/animation/svg_value_interpolation_type.cc b/chromium/third_party/blink/renderer/core/animation/svg_value_interpolation_type.cc
index cb008dddc92..5792ea7e0e9 100644
--- a/chromium/third_party/blink/renderer/core/animation/svg_value_interpolation_type.cc
+++ b/chromium/third_party/blink/renderer/core/animation/svg_value_interpolation_type.cc
@@ -38,7 +38,7 @@ InterpolationValue SVGValueInterpolationType::MaybeConvertSVGValue(
SVGPropertyBase* referenced_value =
const_cast<SVGPropertyBase*>(&value); // Take ref.
return InterpolationValue(
- InterpolableList::Create(0),
+ std::make_unique<InterpolableList>(0),
SVGValueNonInterpolableValue::Create(referenced_value));
}
diff --git a/chromium/third_party/blink/renderer/core/animation/test_data/scale-animation.html b/chromium/third_party/blink/renderer/core/animation/test_data/scale-animation.html
new file mode 100644
index 00000000000..e92917a95ea
--- /dev/null
+++ b/chromium/third_party/blink/renderer/core/animation/test_data/scale-animation.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<style>
+@keyframes test {
+ 0% { transform: scale(2); }
+ 100% { transform: scale(5); }
+}
+
+.animate {
+ animation-name: test;
+ animation-duration: 1s;
+}
+</style>
+<div id="target" class="animate"></div>
diff --git a/chromium/third_party/blink/renderer/core/animation/timing_calculations.h b/chromium/third_party/blink/renderer/core/animation/timing_calculations.h
index db759dc2e59..01c922b6eda 100644
--- a/chromium/third_party/blink/renderer/core/animation/timing_calculations.h
+++ b/chromium/third_party/blink/renderer/core/animation/timing_calculations.h
@@ -50,6 +50,12 @@ static inline double MultiplyZeroAlwaysGivesZero(AnimationTimeDelta x,
return x.is_zero() || y == 0 ? 0 : (x * y).InSecondsF();
}
+static inline bool IsWithinEpsilon(double a, double b) {
+ // Permit 2-bits of quantization error. Threshold based on experimentation
+ // with accuracy of fmod.
+ return std::abs(a - b) <= 2.0 * std::numeric_limits<double>::epsilon();
+}
+
// https://drafts.csswg.org/web-animations-1/#animation-effect-phases-and-states
static inline AnimationEffect::Phase CalculatePhase(
double active_duration,
@@ -78,27 +84,9 @@ static inline AnimationEffect::Phase CalculatePhase(
return AnimationEffect::kPhaseActive;
}
-static inline bool IsActiveInParentPhase(AnimationEffect::Phase parent_phase,
- Timing::FillMode fill_mode) {
- switch (parent_phase) {
- case AnimationEffect::kPhaseBefore:
- return fill_mode == Timing::FillMode::BACKWARDS ||
- fill_mode == Timing::FillMode::BOTH;
- case AnimationEffect::kPhaseActive:
- return true;
- case AnimationEffect::kPhaseAfter:
- return fill_mode == Timing::FillMode::FORWARDS ||
- fill_mode == Timing::FillMode::BOTH;
- default:
- NOTREACHED();
- return false;
- }
-}
-
static inline double CalculateActiveTime(double active_duration,
Timing::FillMode fill_mode,
double local_time,
- AnimationEffect::Phase parent_phase,
AnimationEffect::Phase phase,
const Timing& specified) {
DCHECK_GE(active_duration, 0);
@@ -110,9 +98,7 @@ static inline double CalculateActiveTime(double active_duration,
return std::max(local_time - specified.start_delay, 0.0);
return NullValue();
case AnimationEffect::kPhaseActive:
- if (IsActiveInParentPhase(parent_phase, fill_mode))
- return local_time - specified.start_delay;
- return NullValue();
+ return local_time - specified.start_delay;
case AnimationEffect::kPhaseAfter:
if (fill_mode == Timing::FillMode::FORWARDS ||
fill_mode == Timing::FillMode::BOTH) {
@@ -190,77 +176,155 @@ static inline double CalculateIterationTime(double iteration_duration,
return iteration_time;
}
-static inline double CalculateCurrentIteration(double iteration_duration,
- double iteration_time,
- double offset_active_time,
- const Timing& specified) {
- DCHECK_GT(iteration_duration, 0);
- DCHECK(IsNull(iteration_time) || iteration_time >= 0);
-
- if (IsNull(offset_active_time))
+// Calculates the overall progress, which describes the number of iterations
+// that have completed (including partial iterations).
+// https://drafts.csswg.org/web-animations/#calculating-the-overall-progress
+static inline double CalculateOverallProgress(AnimationEffect::Phase phase,
+ double active_time,
+ double iteration_duration,
+ double iteration_count,
+ double iteration_start) {
+ // 1. If the active time is unresolved, return unresolved.
+ if (IsNull(active_time))
return NullValue();
- DCHECK_GE(iteration_time, 0);
- DCHECK_LE(iteration_time, iteration_duration);
- DCHECK_GE(offset_active_time, 0);
+ // 2. Calculate an initial value for overall progress.
+ double overall_progress = 0;
+ if (!iteration_duration) {
+ if (phase != AnimationEffect::kPhaseBefore)
+ overall_progress = iteration_count;
+ } else {
+ overall_progress = active_time / iteration_duration;
+ }
- if (!offset_active_time)
- return 0;
+ return overall_progress + iteration_start;
+}
- if (iteration_time == iteration_duration)
- return specified.iteration_start + specified.iteration_count - 1;
+// Calculates the simple iteration progress, which is a fraction of the progress
+// through the current iteration that ignores transformations to the time
+// introduced by the playback direction or timing functions applied to the
+// effect.
+// https://drafts.csswg.org/web-animations/#calculating-the-simple-iteration
+// -progress
+static inline double CalculateSimpleIterationProgress(
+ AnimationEffect::Phase phase,
+ double overall_progress,
+ double iteration_start,
+ double active_time,
+ double active_duration,
+ double iteration_count) {
+ // 1. If the overall progress is unresolved, return unresolved.
+ if (IsNull(overall_progress))
+ return NullValue();
- return floor(offset_active_time / iteration_duration);
-}
+ // 2. If overall progress is infinity, let the simple iteration progress be
+ // iteration start % 1.0, otherwise, let the simple iteration progress be
+ // overall progress % 1.0.
+ double simple_iteration_progress = std::isinf(overall_progress)
+ ? fmod(iteration_start, 1.0)
+ : fmod(overall_progress, 1.0);
+
+ // 3. If all of the following conditions are true,
+ // * the simple iteration progress calculated above is zero, and
+ // * the animation effect is in the active phase or the after phase, and
+ // * the active time is equal to the active duration, and
+ // * the iteration count is not equal to zero.
+ // let the simple iteration progress be 1.0.
+ if (IsWithinEpsilon(simple_iteration_progress, 0.0) &&
+ (phase == AnimationEffect::kPhaseActive ||
+ phase == AnimationEffect::kPhaseAfter) &&
+ IsWithinEpsilon(active_time, active_duration) &&
+ !IsWithinEpsilon(iteration_count, 0.0)) {
+ simple_iteration_progress = 1.0;
+ }
-static inline double CalculateDirectedTime(double current_iteration,
- double iteration_duration,
- double iteration_time,
- const Timing& specified) {
- DCHECK(IsNull(current_iteration) || current_iteration >= 0);
- DCHECK_GT(iteration_duration, 0);
+ // 4. Return simple iteration progress.
+ return simple_iteration_progress;
+}
- if (IsNull(iteration_time))
+// https://drafts.csswg.org/web-animations/#calculating-the-current-iteration
+static inline double CalculateCurrentIteration(
+ AnimationEffect::Phase phase,
+ double active_time,
+ double iteration_count,
+ double overall_progress,
+ double simple_iteration_progress) {
+ // 1. If the active time is unresolved, return unresolved.
+ if (IsNull(active_time))
return NullValue();
- DCHECK_GE(current_iteration, 0);
- DCHECK_GE(iteration_time, 0);
- DCHECK_LE(iteration_time, iteration_duration);
+ // 2. If the animation effect is in the after phase and the iteration count
+ // is infinity, return infinity.
+ if (phase == AnimationEffect::kPhaseAfter && std::isinf(iteration_count)) {
+ return std::numeric_limits<double>::infinity();
+ }
- const bool current_iteration_is_odd = fmod(current_iteration, 2) >= 1;
- const bool current_direction_is_forwards =
- specified.direction == Timing::PlaybackDirection::NORMAL ||
- (specified.direction == Timing::PlaybackDirection::ALTERNATE_NORMAL &&
- !current_iteration_is_odd) ||
- (specified.direction == Timing::PlaybackDirection::ALTERNATE_REVERSE &&
- current_iteration_is_odd);
+ // 3. If the simple iteration progress is 1.0, return floor(overall progress)
+ // - 1.
+ if (simple_iteration_progress == 1.0)
+ return floor(overall_progress) - 1;
- return current_direction_is_forwards ? iteration_time
- : iteration_duration - iteration_time;
+ // 4. Otherwise, return floor(overall progress).
+ return floor(overall_progress);
}
-static inline base::Optional<double> CalculateTransformedTime(
+// https://drafts.csswg.org/web-animations/#calculating-the-directed-progress
+static inline bool IsCurrentDirectionForwards(
double current_iteration,
+ Timing::PlaybackDirection direction) {
+ const bool current_iteration_is_even =
+ std::isinf(current_iteration)
+ ? true
+ : IsWithinEpsilon(fmod(current_iteration, 2), 0);
+
+ switch (direction) {
+ case Timing::PlaybackDirection::NORMAL:
+ return true;
+
+ case Timing::PlaybackDirection::REVERSE:
+ return false;
+
+ case Timing::PlaybackDirection::ALTERNATE_NORMAL:
+ return current_iteration_is_even;
+
+ case Timing::PlaybackDirection::ALTERNATE_REVERSE:
+ return !current_iteration_is_even;
+ }
+}
+
+// https://drafts.csswg.org/web-animations/#calculating-the-directed-progress
+static inline double CalculateDirectedProgress(
+ double simple_iteration_progress,
+ double current_iteration,
+ Timing::PlaybackDirection direction) {
+ // 1. If the simple progress is unresolved, return unresolved.
+ if (IsNull(simple_iteration_progress))
+ return NullValue();
+
+ // 2. Calculate the current direction.
+ bool current_direction_is_forwards =
+ IsCurrentDirectionForwards(current_iteration, direction);
+
+ // 3. If the current direction is forwards then return the simple iteration
+ // progress. Otherwise return 1 - simple iteration progress.
+ return current_direction_is_forwards ? simple_iteration_progress
+ : 1 - simple_iteration_progress;
+}
+
+// https://drafts.csswg.org/web-animations/#calculating-the-transformed-progress
+static inline double CalculateTransformedProgress(
+ double directed_progress,
double iteration_duration,
- double iteration_time,
- const Timing& specified) {
- DCHECK(IsNull(current_iteration) || current_iteration >= 0);
- DCHECK_GT(iteration_duration, 0);
- DCHECK(IsNull(iteration_time) ||
- (iteration_time >= 0 && iteration_time <= iteration_duration));
-
- double directed_time = CalculateDirectedTime(
- current_iteration, iteration_duration, iteration_time, specified);
- if (IsNull(directed_time))
- return base::nullopt;
- if (!std::isfinite(iteration_duration))
- return directed_time;
- double time_fraction = directed_time / iteration_duration;
- DCHECK(time_fraction >= 0 && time_fraction <= 1);
- return MultiplyZeroAlwaysGivesZero(
- iteration_duration,
- specified.timing_function->Evaluate(
- time_fraction, AccuracyForDuration(iteration_duration)));
+ scoped_refptr<TimingFunction> timing_function) {
+ if (IsNull(directed_progress))
+ return NullValue();
+
+ // Return the result of evaluating the animation effect’s timing function
+ // passing directed progress as the input progress value.
+ // Note that the spec calls for passing in a before flag as well, which should
+ // be used by the step easing functions (Possibly related to crbug/827560).
+ return timing_function->Evaluate(directed_progress,
+ AccuracyForDuration(iteration_duration));
}
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/animation/timing_calculations_test.cc b/chromium/third_party/blink/renderer/core/animation/timing_calculations_test.cc
index 116b427c632..b98ffaf4d08 100644
--- a/chromium/third_party/blink/renderer/core/animation/timing_calculations_test.cc
+++ b/chromium/third_party/blink/renderer/core/animation/timing_calculations_test.cc
@@ -43,63 +43,40 @@ TEST(AnimationTimingCalculationsTest, ActiveTime) {
// Before Phase
timing.start_delay = 10;
+ EXPECT_TRUE(
+ IsNull(CalculateActiveTime(20, Timing::FillMode::FORWARDS, 0,
+ AnimationEffect::kPhaseBefore, timing)));
EXPECT_TRUE(IsNull(CalculateActiveTime(
- 20, Timing::FillMode::FORWARDS, 0, AnimationEffect::kPhaseActive,
- AnimationEffect::kPhaseBefore, timing)));
- EXPECT_TRUE(IsNull(CalculateActiveTime(
- 20, Timing::FillMode::NONE, 0, AnimationEffect::kPhaseActive,
- AnimationEffect::kPhaseBefore, timing)));
+ 20, Timing::FillMode::NONE, 0, AnimationEffect::kPhaseBefore, timing)));
EXPECT_EQ(0, CalculateActiveTime(20, Timing::FillMode::BACKWARDS, 0,
- AnimationEffect::kPhaseActive,
AnimationEffect::kPhaseBefore, timing));
EXPECT_EQ(0, CalculateActiveTime(20, Timing::FillMode::BOTH, 0,
- AnimationEffect::kPhaseActive,
AnimationEffect::kPhaseBefore, timing));
timing.start_delay = -10;
EXPECT_EQ(5, CalculateActiveTime(20, Timing::FillMode::BACKWARDS, -5,
- AnimationEffect::kPhaseActive,
AnimationEffect::kPhaseBefore, timing));
// Active Phase
timing.start_delay = 10;
- // Active, and parent Before
- EXPECT_TRUE(IsNull(CalculateActiveTime(
- 20, Timing::FillMode::NONE, 15, AnimationEffect::kPhaseBefore,
- AnimationEffect::kPhaseActive, timing)));
- EXPECT_TRUE(IsNull(CalculateActiveTime(
- 20, Timing::FillMode::FORWARDS, 15, AnimationEffect::kPhaseBefore,
- AnimationEffect::kPhaseActive, timing)));
- // Active, and parent After
- EXPECT_TRUE(IsNull(CalculateActiveTime(
- 20, Timing::FillMode::NONE, 15, AnimationEffect::kPhaseAfter,
- AnimationEffect::kPhaseActive, timing)));
- EXPECT_TRUE(IsNull(CalculateActiveTime(
- 20, Timing::FillMode::BACKWARDS, 15, AnimationEffect::kPhaseAfter,
- AnimationEffect::kPhaseActive, timing)));
- // Active, and parent Active
EXPECT_EQ(5, CalculateActiveTime(20, Timing::FillMode::FORWARDS, 15,
- AnimationEffect::kPhaseActive,
AnimationEffect::kPhaseActive, timing));
// After Phase
timing.start_delay = 10;
EXPECT_EQ(21, CalculateActiveTime(21, Timing::FillMode::FORWARDS, 45,
- AnimationEffect::kPhaseActive,
AnimationEffect::kPhaseAfter, timing));
EXPECT_EQ(21, CalculateActiveTime(21, Timing::FillMode::BOTH, 45,
- AnimationEffect::kPhaseActive,
AnimationEffect::kPhaseAfter, timing));
+ EXPECT_TRUE(
+ IsNull(CalculateActiveTime(21, Timing::FillMode::BACKWARDS, 45,
+ AnimationEffect::kPhaseAfter, timing)));
EXPECT_TRUE(IsNull(CalculateActiveTime(
- 21, Timing::FillMode::BACKWARDS, 45, AnimationEffect::kPhaseActive,
- AnimationEffect::kPhaseAfter, timing)));
- EXPECT_TRUE(IsNull(CalculateActiveTime(
- 21, Timing::FillMode::NONE, 45, AnimationEffect::kPhaseActive,
- AnimationEffect::kPhaseAfter, timing)));
+ 21, Timing::FillMode::NONE, 45, AnimationEffect::kPhaseAfter, timing)));
// None
- EXPECT_TRUE(IsNull(CalculateActiveTime(
- 32, Timing::FillMode::NONE, NullValue(), AnimationEffect::kPhaseNone,
- AnimationEffect::kPhaseNone, timing)));
+ EXPECT_TRUE(
+ IsNull(CalculateActiveTime(32, Timing::FillMode::NONE, NullValue(),
+ AnimationEffect::kPhaseNone, timing)));
}
TEST(AnimationTimingCalculationsTest, OffsetActiveTime) {
@@ -142,105 +119,185 @@ TEST(AnimationTimingCalculationsTest, IterationTime) {
AnimationEffect::kPhaseActive, timing));
}
-TEST(AnimationTimingCalculationsTest, CurrentIteration) {
- Timing timing;
-
- // calculateCurrentIteration(
- // iterationDuration, iterationTime, scaledActiveTime, timing)
-
- // if the scaled active time is null
- EXPECT_TRUE(IsNull(CalculateCurrentIteration(1, 1, NullValue(), timing)));
-
- // if the scaled active time is zero
- EXPECT_EQ(0, CalculateCurrentIteration(1, 1, 0, timing));
+TEST(AnimationTimingCalculationsTest, OverallProgress) {
+ // If the active time is null.
+ EXPECT_TRUE(IsNull(CalculateOverallProgress(AnimationEffect::kPhaseAfter,
+ /*active_time=*/NullValue(),
+ /*iteration_duration=*/1.0,
+ /*iteration_count=*/1.0,
+ /*iteration_start=*/1.0)));
+
+ // If iteration duration is zero, calculate progress based on iteration count.
+ EXPECT_EQ(3, CalculateOverallProgress(AnimationEffect::kPhaseActive,
+ /*active_time=*/3.0,
+ /*iteration_duration=*/0.0,
+ /*iteration_count=*/3.0,
+ /*iteration_start=*/0.0));
+ // ...unless in before phase, in which case progress is zero.
+ EXPECT_EQ(0, CalculateOverallProgress(AnimationEffect::kPhaseBefore,
+ /*active_time=*/3.0,
+ /*iteration_duration=*/0.0,
+ /*iteration_count=*/3.0,
+ /*iteration_start=*/0.0));
+
+ // Otherwise.
+ EXPECT_EQ(3.0, CalculateOverallProgress(AnimationEffect::kPhaseAfter,
+ /*active_time=*/2.5,
+ /*iteration_duration=*/1.0,
+ /*iteration_count=*/0.0,
+ /*iteration_start=*/0.5));
+}
- // if the iteration time equals the iteration duration
- timing.iteration_start = 4;
- timing.iteration_count = 7;
- EXPECT_EQ(10, CalculateCurrentIteration(5, 5, 9, timing));
+TEST(AnimationTimingCalculationsTest, CalculateSimpleIterationProgress) {
+ // If the overall progress is null.
+ EXPECT_TRUE(
+ IsNull(CalculateSimpleIterationProgress(AnimationEffect::kPhaseAfter,
+ /*overall_progress=*/NullValue(),
+ /*iteration_start=*/1.0,
+ /*active_time=*/NullValue(),
+ /*active_duration=*/1.0,
+ /*iteration_count=*/1.0)));
+
+ // If the overall progress is infinite.
+ const double inf = std::numeric_limits<double>::infinity();
+ EXPECT_EQ(0.5, CalculateSimpleIterationProgress(AnimationEffect::kPhaseAfter,
+ /*overall_progress=*/inf,
+ /*iteration_start=*/1.5,
+ /*active_time=*/0.0,
+ /*active_duration=*/0.0,
+ /*iteration_count=*/inf));
+
+ // Precisely on an iteration boundary.
+ EXPECT_EQ(1.0, CalculateSimpleIterationProgress(AnimationEffect::kPhaseAfter,
+ /*overall_progress=*/3.0,
+ /*iteration_start=*/0.0,
+ /*active_time=*/3.0,
+ /*active_duration=*/3.0,
+ /*iteration_count=*/3.0));
+
+ // Otherwise.
+ EXPECT_EQ(0.5, CalculateSimpleIterationProgress(AnimationEffect::kPhaseAfter,
+ /*overall_progress=*/2.5,
+ /*iteration_start=*/0.0,
+ /*active_time=*/2.5,
+ /*active_duration=*/0.0,
+ /*iteration_count=*/0.0));
+}
- // otherwise
- EXPECT_EQ(3, CalculateCurrentIteration(3.2, 3.1, 10, timing));
+TEST(AnimationTimingCalculationsTest, CurrentIteration) {
+ // If the active time is null.
+ EXPECT_TRUE(
+ IsNull(CalculateCurrentIteration(AnimationEffect::kPhaseAfter,
+ /*active_time=*/NullValue(),
+ /*iteration_count=*/1.0,
+ /*overall_progress=*/NullValue(),
+ /*simple_iteration_progress=*/0)));
+
+ // If the iteration count is infinite.
+ const double inf = std::numeric_limits<double>::infinity();
+ EXPECT_EQ(inf, CalculateCurrentIteration(AnimationEffect::kPhaseAfter,
+ /*active_time=*/1.0,
+ /*iteration_count=*/inf,
+ /*overall_progress=*/inf,
+ /*simple_iteration_progress=*/0.0));
+
+ // Hold the endpoint of the final iteration of ending precisely on an
+ // iteration boundary.
+ EXPECT_EQ(2, CalculateCurrentIteration(AnimationEffect::kPhaseAfter,
+ /*active_time=*/3.0,
+ /*iteration_count=*/3.0,
+ /*overall_progress=*/3.0,
+ /*simple_iteration_progress=*/1.0));
+
+ // Otherwise.
+ EXPECT_EQ(2, CalculateCurrentIteration(AnimationEffect::kPhaseAfter,
+ /*active_time=*/2.5,
+ /*iteration_count=*/0.0,
+ /*overall_progress=*/2.5,
+ /*simple_iteration_progress=*/0.5));
}
-TEST(AnimationTimingCalculationsTest, DirectedTime) {
- Timing timing;
+TEST(AnimationTimingCalculationsTest, IsCurrentDirectionForwards) {
+ // IsCurrentDirectionForwards(current_iteration,
+ // direction);
+
+ EXPECT_TRUE(IsCurrentDirectionForwards(0, Timing::PlaybackDirection::NORMAL));
+ EXPECT_TRUE(IsCurrentDirectionForwards(1, Timing::PlaybackDirection::NORMAL));
+ EXPECT_TRUE(IsCurrentDirectionForwards(
+ 0, Timing::PlaybackDirection::ALTERNATE_NORMAL));
+ EXPECT_TRUE(IsCurrentDirectionForwards(
+ 1, Timing::PlaybackDirection::ALTERNATE_REVERSE));
+
+ EXPECT_FALSE(
+ IsCurrentDirectionForwards(0, Timing::PlaybackDirection::REVERSE));
+ EXPECT_FALSE(
+ IsCurrentDirectionForwards(1, Timing::PlaybackDirection::REVERSE));
+ EXPECT_FALSE(IsCurrentDirectionForwards(
+ 0, Timing::PlaybackDirection::ALTERNATE_REVERSE));
+ EXPECT_FALSE(IsCurrentDirectionForwards(
+ 1, Timing::PlaybackDirection::ALTERNATE_NORMAL));
+}
- // calculateDirectedTime(
- // currentIteration, iterationDuration, iterationTime, timing)
+TEST(AnimationTimingCalculationsTest, CalculateDirectedProgress) {
+ // CalculateDirectedProgress(simple_iteration_progress,
+ // current_iteration,
+ // direction);
- // if the iteration time is null
- EXPECT_TRUE(IsNull(CalculateDirectedTime(1, 2, NullValue(), timing)));
+ // if the simple iteration progress is null
+ EXPECT_TRUE(IsNull(CalculateDirectedProgress(
+ NullValue(), NullValue(), Timing::PlaybackDirection::NORMAL)));
// forwards
- EXPECT_EQ(17, CalculateDirectedTime(0, 20, 17, timing));
- EXPECT_EQ(17, CalculateDirectedTime(1, 20, 17, timing));
- timing.direction = Timing::PlaybackDirection::ALTERNATE_NORMAL;
- EXPECT_EQ(17, CalculateDirectedTime(0, 20, 17, timing));
- EXPECT_EQ(17, CalculateDirectedTime(2, 20, 17, timing));
- timing.direction = Timing::PlaybackDirection::ALTERNATE_REVERSE;
- EXPECT_EQ(17, CalculateDirectedTime(1, 20, 17, timing));
- EXPECT_EQ(17, CalculateDirectedTime(3, 20, 17, timing));
+ EXPECT_EQ(0,
+ CalculateDirectedProgress(0, 8, Timing::PlaybackDirection::NORMAL));
+ EXPECT_EQ(1,
+ CalculateDirectedProgress(1, 8, Timing::PlaybackDirection::NORMAL));
+ EXPECT_EQ(0,
+ CalculateDirectedProgress(0, 9, Timing::PlaybackDirection::NORMAL));
+ EXPECT_EQ(1,
+ CalculateDirectedProgress(1, 9, Timing::PlaybackDirection::NORMAL));
+ EXPECT_EQ(0, CalculateDirectedProgress(
+ 0, 8, Timing::PlaybackDirection::ALTERNATE_NORMAL));
+ EXPECT_EQ(1, CalculateDirectedProgress(
+ 1, 8, Timing::PlaybackDirection::ALTERNATE_NORMAL));
+ EXPECT_EQ(0, CalculateDirectedProgress(
+ 0, 9, Timing::PlaybackDirection::ALTERNATE_REVERSE));
+ EXPECT_EQ(1, CalculateDirectedProgress(
+ 1, 9, Timing::PlaybackDirection::ALTERNATE_REVERSE));
// reverse
- timing.direction = Timing::PlaybackDirection::REVERSE;
- EXPECT_EQ(3, CalculateDirectedTime(0, 20, 17, timing));
- EXPECT_EQ(3, CalculateDirectedTime(1, 20, 17, timing));
- timing.direction = Timing::PlaybackDirection::ALTERNATE_NORMAL;
- EXPECT_EQ(3, CalculateDirectedTime(1, 20, 17, timing));
- EXPECT_EQ(3, CalculateDirectedTime(3, 20, 17, timing));
- timing.direction = Timing::PlaybackDirection::ALTERNATE_REVERSE;
- EXPECT_EQ(3, CalculateDirectedTime(0, 20, 17, timing));
- EXPECT_EQ(3, CalculateDirectedTime(2, 20, 17, timing));
+ EXPECT_EQ(
+ 1, CalculateDirectedProgress(0, 8, Timing::PlaybackDirection::REVERSE));
+ EXPECT_EQ(
+ 0, CalculateDirectedProgress(1, 8, Timing::PlaybackDirection::REVERSE));
+ EXPECT_EQ(
+ 1, CalculateDirectedProgress(0, 9, Timing::PlaybackDirection::REVERSE));
+ EXPECT_EQ(
+ 0, CalculateDirectedProgress(1, 9, Timing::PlaybackDirection::REVERSE));
+ EXPECT_EQ(1, CalculateDirectedProgress(
+ 0, 9, Timing::PlaybackDirection::ALTERNATE_NORMAL));
+ EXPECT_EQ(0, CalculateDirectedProgress(
+ 1, 9, Timing::PlaybackDirection::ALTERNATE_NORMAL));
+ EXPECT_EQ(1, CalculateDirectedProgress(
+ 0, 8, Timing::PlaybackDirection::ALTERNATE_REVERSE));
+ EXPECT_EQ(0, CalculateDirectedProgress(
+ 1, 8, Timing::PlaybackDirection::ALTERNATE_REVERSE));
}
-TEST(AnimationTimingCalculationsTest, TransformedTime) {
- Timing timing;
-
- // calculateTransformedTime(
- // currentIteration, iterationDuration, iterationTime, timing)
+TEST(AnimationTimingCalculationsTest, TransformedProgress) {
+ // CalculateTransformedProgress(
+ // directed_progress, iteration_duraction, timing_function)
- // Iteration time is null
- EXPECT_FALSE(CalculateTransformedTime(1, 2, NullValue(), timing).has_value());
-
- // PlaybackDirectionForwards
- EXPECT_EQ(12, CalculateTransformedTime(0, 20, 12, timing));
- EXPECT_EQ(12, CalculateTransformedTime(1, 20, 12, timing));
-
- // PlaybackDirectionForwards with timing function
- timing.timing_function =
+ scoped_refptr<TimingFunction> timing_function =
StepsTimingFunction::Create(4, StepsTimingFunction::StepPosition::END);
- EXPECT_EQ(10, CalculateTransformedTime(0, 20, 12, timing));
- EXPECT_EQ(10, CalculateTransformedTime(1, 20, 12, timing));
- // PlaybackDirectionReverse
- timing.timing_function = Timing::Defaults().timing_function;
- timing.direction = Timing::PlaybackDirection::REVERSE;
- EXPECT_EQ(8, CalculateTransformedTime(0, 20, 12, timing));
- EXPECT_EQ(8, CalculateTransformedTime(1, 20, 12, timing));
+ // directed_progress is null.
+ EXPECT_TRUE(
+ IsNull(CalculateTransformedProgress(NullValue(), 1, timing_function)));
- // PlaybackDirectionReverse with timing function
- timing.timing_function =
- StepsTimingFunction::Create(4, StepsTimingFunction::StepPosition::END);
- EXPECT_EQ(5, CalculateTransformedTime(0, 20, 12, timing));
- EXPECT_EQ(5, CalculateTransformedTime(1, 20, 12, timing));
-
- // Timing function when directed time is null.
- EXPECT_FALSE(CalculateTransformedTime(1, 2, NullValue(), timing).has_value());
-
- // Timing function when iterationDuration is infinity
- timing.direction = Timing::PlaybackDirection::NORMAL;
- EXPECT_EQ(0, CalculateTransformedTime(
- 0, std::numeric_limits<double>::infinity(), 0, timing));
- EXPECT_EQ(1, CalculateTransformedTime(
- 0, std::numeric_limits<double>::infinity(), 1, timing));
- timing.direction = Timing::PlaybackDirection::REVERSE;
- EXPECT_EQ(std::numeric_limits<double>::infinity(),
- CalculateTransformedTime(0, std::numeric_limits<double>::infinity(),
- 0, timing));
- EXPECT_EQ(std::numeric_limits<double>::infinity(),
- CalculateTransformedTime(0, std::numeric_limits<double>::infinity(),
- 1, timing));
+ // Otherwise.
+ EXPECT_EQ(0, CalculateTransformedProgress(0, 1, timing_function));
+ EXPECT_EQ(1, CalculateTransformedProgress(1, 1, timing_function));
}
} // namespace blink
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 7953de5cfae..40695b5a103 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
@@ -30,7 +30,7 @@ class AnimationTimingInputTest : public testing::Test {
bool is_keyframeeffectoptions = true);
private:
- void SetUp() override { page_holder_ = DummyPageHolder::Create(); }
+ void SetUp() override { page_holder_ = std::make_unique<DummyPageHolder>(); }
Document* GetDocument() const { return &page_holder_->GetDocument(); }
diff --git a/chromium/third_party/blink/renderer/core/animation/transition_interpolation.cc b/chromium/third_party/blink/renderer/core/animation/transition_interpolation.cc
index b2818c722fe..09d7883513c 100644
--- a/chromium/third_party/blink/renderer/core/animation/transition_interpolation.cc
+++ b/chromium/third_party/blink/renderer/core/animation/transition_interpolation.cc
@@ -55,14 +55,8 @@ void TransitionInterpolation::Apply(StyleResolverState& state) const {
std::unique_ptr<TypedInterpolationValue>
TransitionInterpolation::GetInterpolatedValue() const {
- return TypedInterpolationValue::Create(
+ return std::make_unique<TypedInterpolationValue>(
type_, CurrentInterpolableValue().Clone(), CurrentNonInterpolableValue());
}
-AnimatableValue* TransitionInterpolation::GetInterpolatedCompositorValue()
- const {
- return AnimatableValue::Interpolate(compositor_start_, compositor_end_,
- cached_fraction_);
-}
-
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/animation/transition_interpolation.h b/chromium/third_party/blink/renderer/core/animation/transition_interpolation.h
index 2ebada4f8c1..a9d1d49eaff 100644
--- a/chromium/third_party/blink/renderer/core/animation/transition_interpolation.h
+++ b/chromium/third_party/blink/renderer/core/animation/transition_interpolation.h
@@ -84,8 +84,6 @@ class CORE_EXPORT TransitionInterpolation : public Interpolation {
std::unique_ptr<TypedInterpolationValue> GetInterpolatedValue() const;
- AnimatableValue* GetInterpolatedCompositorValue() const;
-
void Interpolate(int iteration, double fraction) final;
void Trace(Visitor* visitor) override {
diff --git a/chromium/third_party/blink/renderer/core/animation/transition_keyframe.cc b/chromium/third_party/blink/renderer/core/animation/transition_keyframe.cc
index b88829a520c..3652383f8ba 100644
--- a/chromium/third_party/blink/renderer/core/animation/transition_keyframe.cc
+++ b/chromium/third_party/blink/renderer/core/animation/transition_keyframe.cc
@@ -44,8 +44,9 @@ TransitionKeyframe::CreatePropertySpecificKeyframe(
DCHECK(offset == offset_);
EffectModel::CompositeOperation composite =
composite_.value_or(effect_composite);
- return PropertySpecificKeyframe::Create(CheckedOffset(), &Easing(), composite,
- value_->Clone(), compositor_value_);
+ return MakeGarbageCollected<PropertySpecificKeyframe>(
+ CheckedOffset(), &Easing(), composite, value_->Clone(),
+ compositor_value_);
}
Interpolation*
diff --git a/chromium/third_party/blink/renderer/core/animation/transition_keyframe.h b/chromium/third_party/blink/renderer/core/animation/transition_keyframe.h
index 768f9a73f9f..de9ad80c1d0 100644
--- a/chromium/third_party/blink/renderer/core/animation/transition_keyframe.h
+++ b/chromium/third_party/blink/renderer/core/animation/transition_keyframe.h
@@ -50,17 +50,6 @@ class CORE_EXPORT TransitionKeyframe : public Keyframe {
class PropertySpecificKeyframe : public Keyframe::PropertySpecificKeyframe {
public:
- static PropertySpecificKeyframe* Create(
- double offset,
- scoped_refptr<TimingFunction> easing,
- EffectModel::CompositeOperation composite,
- std::unique_ptr<TypedInterpolationValue> value,
- AnimatableValue* compositor_value) {
- return MakeGarbageCollected<PropertySpecificKeyframe>(
- offset, std::move(easing), composite, std::move(value),
- compositor_value);
- }
-
PropertySpecificKeyframe(double offset,
scoped_refptr<TimingFunction> easing,
EffectModel::CompositeOperation composite,
@@ -94,8 +83,8 @@ class CORE_EXPORT TransitionKeyframe : public Keyframe {
private:
Keyframe::PropertySpecificKeyframe* CloneWithOffset(
double offset) const final {
- return Create(offset, easing_, composite_, value_->Clone(),
- compositor_value_);
+ return MakeGarbageCollected<PropertySpecificKeyframe>(
+ offset, easing_, composite_, value_->Clone(), compositor_value_);
}
std::unique_ptr<TypedInterpolationValue> value_;
diff --git a/chromium/third_party/blink/renderer/core/animation/typed_interpolation_value.h b/chromium/third_party/blink/renderer/core/animation/typed_interpolation_value.h
index d9702ea3563..389df39c2c8 100644
--- a/chromium/third_party/blink/renderer/core/animation/typed_interpolation_value.h
+++ b/chromium/third_party/blink/renderer/core/animation/typed_interpolation_value.h
@@ -10,6 +10,7 @@
#include "base/memory/ptr_util.h"
#include "third_party/blink/renderer/core/animation/interpolation_value.h"
+#include "third_party/blink/renderer/platform/wtf/allocator.h"
namespace blink {
@@ -18,20 +19,24 @@ class InterpolationType;
// Represents an interpolated value between an adjacent pair of
// PropertySpecificKeyframes.
class TypedInterpolationValue {
+ USING_FAST_MALLOC(TypedInterpolationValue);
+
public:
- static std::unique_ptr<TypedInterpolationValue> Create(
+ TypedInterpolationValue(
const InterpolationType& type,
std::unique_ptr<InterpolableValue> interpolable_value,
- scoped_refptr<NonInterpolableValue> non_interpolable_value = nullptr) {
- return base::WrapUnique(
- new TypedInterpolationValue(type, std::move(interpolable_value),
- std::move(non_interpolable_value)));
+ scoped_refptr<NonInterpolableValue> non_interpolable_value = nullptr)
+ : type_(type),
+ value_(std::move(interpolable_value),
+ std::move(non_interpolable_value)) {
+ DCHECK(value_.interpolable_value);
}
std::unique_ptr<TypedInterpolationValue> Clone() const {
InterpolationValue copy = value_.Clone();
- return Create(type_, std::move(copy.interpolable_value),
- std::move(copy.non_interpolable_value));
+ return std::make_unique<TypedInterpolationValue>(
+ type_, std::move(copy.interpolable_value),
+ std::move(copy.non_interpolable_value));
}
const InterpolationType& GetType() const { return type_; }
@@ -46,16 +51,6 @@ class TypedInterpolationValue {
InterpolationValue& MutableValue() { return value_; }
private:
- TypedInterpolationValue(
- const InterpolationType& type,
- std::unique_ptr<InterpolableValue> interpolable_value,
- scoped_refptr<NonInterpolableValue> non_interpolable_value)
- : type_(type),
- value_(std::move(interpolable_value),
- std::move(non_interpolable_value)) {
- DCHECK(value_.interpolable_value);
- }
-
const InterpolationType& type_;
InterpolationValue value_;
};
diff --git a/chromium/third_party/blink/renderer/core/animation/underlying_length_checker.h b/chromium/third_party/blink/renderer/core/animation/underlying_length_checker.h
index bb2925cc8ba..ba7d0b61ca7 100644
--- a/chromium/third_party/blink/renderer/core/animation/underlying_length_checker.h
+++ b/chromium/third_party/blink/renderer/core/animation/underlying_length_checker.h
@@ -15,10 +15,8 @@ namespace blink {
class UnderlyingLengthChecker : public InterpolationType::ConversionChecker {
public:
- static std::unique_ptr<UnderlyingLengthChecker> Create(
- wtf_size_t underlying_length) {
- return base::WrapUnique(new UnderlyingLengthChecker(underlying_length));
- }
+ explicit UnderlyingLengthChecker(wtf_size_t underlying_length)
+ : underlying_length_(underlying_length) {}
static wtf_size_t GetUnderlyingLength(const InterpolationValue& underlying) {
if (!underlying)
@@ -32,9 +30,6 @@ class UnderlyingLengthChecker : public InterpolationType::ConversionChecker {
}
private:
- UnderlyingLengthChecker(wtf_size_t underlying_length)
- : underlying_length_(underlying_length) {}
-
wtf_size_t underlying_length_;
};