Inline static Create() from renderer/core/animation/css

Identifies and removes usage of static Create() for those classes
defined in //third_party/blink/renderer/core/animation/css.

One note about the Create() method of CSSAnimation and CSSTransition,
it contained the following check:

  DCHECK(timeline && timeline->IsDocumentTimeline());

This is deemed unnecessary and has not been copied inline. The only
uses of these Create() methods were obtaining the Timeline object from
element->GetDocument().Timeline(). This implies that timeline exists
as long as the Document exists (which would trigger a different error)
and it is of type DocumentTimeline, because it was instantiated like
that in the Document constructor:

  https://chromium.googlesource.com/chromium/src/+/5bfed55ceed4a194fd934ab81e47e213dd815fe7/third_party/blink/renderer/core/dom/document.cc#1136

Finally, CompositorKeyframeValueFactory is STATIC_ONLY so its
Create method will not be modified.

Bug: 939691
Change-Id: I9ffcd0688edf7cbab5cc10892254b3384ec2cbd5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1943237
Reviewed-by: Henrique Ferreiro <hferreiro@igalia.com>
Reviewed-by: Stephen McGruer <smcgruer@chromium.org>
Commit-Queue: Jacobo Aragunde Pérez <jaragunde@igalia.com>
Cr-Commit-Position: refs/heads/master@{#720319}
diff --git a/third_party/blink/renderer/core/animation/animation_test.cc b/third_party/blink/renderer/core/animation/animation_test.cc
index 6c0ccea..afe926b 100644
--- a/third_party/blink/renderer/core/animation/animation_test.cc
+++ b/third_party/blink/renderer/core/animation/animation_test.cc
@@ -107,7 +107,8 @@
     // Egregious hack: Sideload the compositor value.
     // This is usually set in a part of the rendering process SimulateFrame
     // doesn't call.
-    start_keyframe->SetCompositorValue(CompositorKeyframeDouble::Create(1.0));
+    start_keyframe->SetCompositorValue(
+        MakeGarbageCollected<CompositorKeyframeDouble>(1.0));
     TransitionKeyframe* end_keyframe =
         TransitionKeyframe::Create(PropertyHandleOpacity);
     end_keyframe->SetValue(std::make_unique<TypedInterpolationValue>(
@@ -115,7 +116,8 @@
         std::make_unique<InterpolableNumber>(0.0)));
     end_keyframe->SetOffset(1.0);
     // Egregious hack: Sideload the compositor value.
-    end_keyframe->SetCompositorValue(CompositorKeyframeDouble::Create(0.0));
+    end_keyframe->SetCompositorValue(
+        MakeGarbageCollected<CompositorKeyframeDouble>(0.0));
 
     TransitionKeyframeVector keyframes;
     keyframes.push_back(start_keyframe);
diff --git a/third_party/blink/renderer/core/animation/compositor_animations_test.cc b/third_party/blink/renderer/core/animation/compositor_animations_test.cc
index 55c500eb..3dae990 100644
--- a/third_party/blink/renderer/core/animation/compositor_animations_test.cc
+++ b/third_party/blink/renderer/core/animation/compositor_animations_test.cc
@@ -345,7 +345,7 @@
                                      LinearTimingFunction::Shared(),
                                      EffectModel::kCompositeReplace),
             compositor_keyframe_value_(
-                CompositorKeyframeDouble::Create(offset)) {}
+                MakeGarbageCollected<CompositorKeyframeDouble>(offset)) {}
       bool IsNeutral() const final { return true; }
       PropertySpecificKeyframe* CloneWithOffset(double) const final {
         NOTREACHED();
diff --git a/third_party/blink/renderer/core/animation/css/compositor_keyframe_color.h b/third_party/blink/renderer/core/animation/css/compositor_keyframe_color.h
index 8a83f4a..c84381b 100644
--- a/third_party/blink/renderer/core/animation/css/compositor_keyframe_color.h
+++ b/third_party/blink/renderer/core/animation/css/compositor_keyframe_color.h
@@ -17,10 +17,6 @@
   CompositorKeyframeColor(SkColor color) : color_(color) {}
   ~CompositorKeyframeColor() override = default;
 
-  static CompositorKeyframeColor* Create(SkColor color) {
-    return MakeGarbageCollected<CompositorKeyframeColor>(color);
-  }
-
   SkColor ToColor() const { return color_; }
 
  private:
diff --git a/third_party/blink/renderer/core/animation/css/compositor_keyframe_double.h b/third_party/blink/renderer/core/animation/css/compositor_keyframe_double.h
index 0133e1a..94e9fbf 100644
--- a/third_party/blink/renderer/core/animation/css/compositor_keyframe_double.h
+++ b/third_party/blink/renderer/core/animation/css/compositor_keyframe_double.h
@@ -16,10 +16,6 @@
   CompositorKeyframeDouble(double number) : number_(number) {}
   ~CompositorKeyframeDouble() override = default;
 
-  static CompositorKeyframeDouble* Create(double number) {
-    return MakeGarbageCollected<CompositorKeyframeDouble>(number);
-  }
-
   double ToDouble() const { return number_; }
 
  private:
diff --git a/third_party/blink/renderer/core/animation/css/compositor_keyframe_filter_operations.h b/third_party/blink/renderer/core/animation/css/compositor_keyframe_filter_operations.h
index e85d6ca6..f4b5925 100644
--- a/third_party/blink/renderer/core/animation/css/compositor_keyframe_filter_operations.h
+++ b/third_party/blink/renderer/core/animation/css/compositor_keyframe_filter_operations.h
@@ -14,11 +14,6 @@
 class CompositorKeyframeFilterOperations final
     : public CompositorKeyframeValue {
  public:
-  static CompositorKeyframeFilterOperations* Create(
-      const FilterOperations& operations) {
-    return MakeGarbageCollected<CompositorKeyframeFilterOperations>(operations);
-  }
-
   CompositorKeyframeFilterOperations(const FilterOperations& operations)
       : operation_wrapper_(
             MakeGarbageCollected<FilterOperationsWrapper>(operations)) {}
diff --git a/third_party/blink/renderer/core/animation/css/compositor_keyframe_transform.h b/third_party/blink/renderer/core/animation/css/compositor_keyframe_transform.h
index 6c191b3..58c86ee 100644
--- a/third_party/blink/renderer/core/animation/css/compositor_keyframe_transform.h
+++ b/third_party/blink/renderer/core/animation/css/compositor_keyframe_transform.h
@@ -19,11 +19,6 @@
       : transform_(transform), zoom_(zoom) {}
   ~CompositorKeyframeTransform() override = default;
 
-  static CompositorKeyframeTransform* Create(
-      const TransformOperations& transform,
-      double zoom) {
-    return MakeGarbageCollected<CompositorKeyframeTransform>(transform, zoom);
-  }
   const TransformOperations& GetTransformOperations() const {
     return transform_;
   }
diff --git a/third_party/blink/renderer/core/animation/css/compositor_keyframe_value_factory.cc b/third_party/blink/renderer/core/animation/css/compositor_keyframe_value_factory.cc
index 44b5feb..d8462776 100644
--- a/third_party/blink/renderer/core/animation/css/compositor_keyframe_value_factory.cc
+++ b/third_party/blink/renderer/core/animation/css/compositor_keyframe_value_factory.cc
@@ -13,6 +13,7 @@
 #include "third_party/blink/renderer/core/css/css_color_value.h"
 #include "third_party/blink/renderer/core/css/properties/css_property.h"
 #include "third_party/blink/renderer/core/style/computed_style.h"
+#include "third_party/blink/renderer/platform/heap/heap.h"
 #include "third_party/blink/renderer/platform/runtime_enabled_features.h"
 
 namespace blink {
@@ -27,8 +28,8 @@
     operation.Operations().push_back(
         std::move(has_transform ? transform : initial_transform));
   }
-  return CompositorKeyframeTransform::Create(operation,
-                                             has_transform ? zoom : 1);
+  return MakeGarbageCollected<CompositorKeyframeTransform>(
+      operation, has_transform ? zoom : 1);
 }
 
 CompositorKeyframeValue* CompositorKeyframeValueFactory::Create(
@@ -44,14 +45,16 @@
 #endif
   switch (css_property.PropertyID()) {
     case CSSPropertyID::kOpacity:
-      return CompositorKeyframeDouble::Create(style.Opacity());
+      return MakeGarbageCollected<CompositorKeyframeDouble>(style.Opacity());
     case CSSPropertyID::kFilter:
-      return CompositorKeyframeFilterOperations::Create(style.Filter());
+      return MakeGarbageCollected<CompositorKeyframeFilterOperations>(
+          style.Filter());
     case CSSPropertyID::kBackdropFilter:
-      return CompositorKeyframeFilterOperations::Create(style.BackdropFilter());
+      return MakeGarbageCollected<CompositorKeyframeFilterOperations>(
+          style.BackdropFilter());
     case CSSPropertyID::kTransform:
-      return CompositorKeyframeTransform::Create(style.Transform(),
-                                                 style.EffectiveZoom());
+      return MakeGarbageCollected<CompositorKeyframeTransform>(
+          style.Transform(), style.EffectiveZoom());
     case CSSPropertyID::kTranslate: {
       return CreateFromTransformProperties(style.Translate(),
                                            style.EffectiveZoom(), nullptr);
@@ -73,7 +76,7 @@
 
       const auto* primitive_value = DynamicTo<CSSPrimitiveValue>(value);
       if (primitive_value && primitive_value->IsNumber()) {
-        return CompositorKeyframeDouble::Create(
+        return MakeGarbageCollected<CompositorKeyframeDouble>(
             primitive_value->GetFloatValue());
       }
 
@@ -81,7 +84,7 @@
       // CSSIdentifierValue when given a value of currentcolor
       if (const auto* color_value = DynamicTo<cssvalue::CSSColorValue>(value)) {
         Color color = color_value->Value();
-        return CompositorKeyframeColor::Create(SkColorSetARGB(
+        return MakeGarbageCollected<CompositorKeyframeColor>(SkColorSetARGB(
             color.Alpha(), color.Red(), color.Green(), color.Blue()));
       }
 
diff --git a/third_party/blink/renderer/core/animation/css/css_animation.cc b/third_party/blink/renderer/core/animation/css/css_animation.cc
index dee7da2..62de5d5 100644
--- a/third_party/blink/renderer/core/animation/css/css_animation.cc
+++ b/third_party/blink/renderer/core/animation/css/css_animation.cc
@@ -6,16 +6,6 @@
 
 namespace blink {
 
-CSSAnimation* CSSAnimation::Create(AnimationEffect* effect,
-                                   AnimationTimeline* timeline,
-                                   const String& animation_name) {
-  DCHECK(timeline && timeline->IsDocumentTimeline());
-
-  return MakeGarbageCollected<CSSAnimation>(
-      timeline->GetDocument()->ContextDocument(), timeline, effect,
-      animation_name);
-}
-
 CSSAnimation::CSSAnimation(ExecutionContext* execution_context,
                            AnimationTimeline* timeline,
                            AnimationEffect* content,
diff --git a/third_party/blink/renderer/core/animation/css/css_animation.h b/third_party/blink/renderer/core/animation/css/css_animation.h
index 1df6961..3f7d0ec 100644
--- a/third_party/blink/renderer/core/animation/css/css_animation.h
+++ b/third_party/blink/renderer/core/animation/css/css_animation.h
@@ -15,10 +15,6 @@
   DEFINE_WRAPPERTYPEINFO();
 
  public:
-  static CSSAnimation* Create(AnimationEffect*,
-                              AnimationTimeline*,
-                              const String& animation_name);
-
   CSSAnimation(ExecutionContext*,
                AnimationTimeline*,
                AnimationEffect*,
diff --git a/third_party/blink/renderer/core/animation/css/css_animations.cc b/third_party/blink/renderer/core/animation/css/css_animations.cc
index e05e598e..35c9b71 100644
--- a/third_party/blink/renderer/core/animation/css/css_animations.cc
+++ b/third_party/blink/renderer/core/animation/css/css_animations.cc
@@ -523,8 +523,9 @@
         element, inert_animation->Model(), inert_animation->SpecifiedTiming(),
         KeyframeEffect::kDefaultPriority, event_delegate);
 
-    CSSAnimation* animation = CSSAnimation::Create(
-        effect, &(element->GetDocument().Timeline()), entry.name);
+    auto* animation = MakeGarbageCollected<CSSAnimation>(
+        element->GetDocument().ContextDocument(),
+        &(element->GetDocument().Timeline()), effect, entry.name);
     animation->play();
     if (inert_animation->Paused())
       animation->pause();
@@ -592,8 +593,10 @@
     auto* transition_effect = MakeGarbageCollected<KeyframeEffect>(
         element, model, inert_animation->SpecifiedTiming(),
         KeyframeEffect::kTransitionPriority, event_delegate);
-    Animation* animation = CSSTransition::Create(
-        transition_effect, &(element->GetDocument().Timeline()), property);
+    auto* animation = MakeGarbageCollected<CSSTransition>(
+        element->GetDocument().ContextDocument(),
+        &(element->GetDocument().Timeline()), transition_effect, property);
+
     animation->play();
 
     // Set the current time as the start time for retargeted transitions
diff --git a/third_party/blink/renderer/core/animation/css/css_transition.cc b/third_party/blink/renderer/core/animation/css/css_transition.cc
index f4fcedf..d516953 100644
--- a/third_party/blink/renderer/core/animation/css/css_transition.cc
+++ b/third_party/blink/renderer/core/animation/css/css_transition.cc
@@ -6,14 +6,6 @@
 
 namespace blink {
 
-CSSTransition* CSSTransition::Create(AnimationEffect* effect,
-                                     AnimationTimeline* timeline,
-                                     const PropertyHandle& property) {
-  DCHECK(timeline && timeline->IsDocumentTimeline());
-  return MakeGarbageCollected<CSSTransition>(
-      timeline->GetDocument()->ContextDocument(), timeline, effect, property);
-}
-
 CSSTransition::CSSTransition(ExecutionContext* execution_context,
                              AnimationTimeline* timeline,
                              AnimationEffect* content,
diff --git a/third_party/blink/renderer/core/animation/css/css_transition.h b/third_party/blink/renderer/core/animation/css/css_transition.h
index 9752b9ee..483b2f0e 100644
--- a/third_party/blink/renderer/core/animation/css/css_transition.h
+++ b/third_party/blink/renderer/core/animation/css/css_transition.h
@@ -14,10 +14,6 @@
   DEFINE_WRAPPERTYPEINFO();
 
  public:
-  static CSSTransition* Create(AnimationEffect*,
-                               AnimationTimeline*,
-                               const PropertyHandle&);
-
   CSSTransition(ExecutionContext*,
                 AnimationTimeline*,
                 AnimationEffect*,