[go: nahoru, domu]

[cc/animation] Remove some dead code

Code was found via Chromium coverage report and then some sleuthing to
spot a method that was only called from a test.

Bug: 252472
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I7223c9210d336fbec89b923e903bd95a64865d40
Reviewed-on: https://chromium-review.googlesource.com/1060106
Commit-Queue: Stephen McGruer <smcgruer@chromium.org>
Reviewed-by: Majid Valipour <majidvp@chromium.org>
Cr-Commit-Position: refs/heads/master@{#559193}
diff --git a/cc/animation/animation_curve.h b/cc/animation/animation_curve.h
index 9865878a..34979f7 100644
--- a/cc/animation/animation_curve.h
+++ b/cc/animation/animation_curve.h
@@ -13,10 +13,6 @@
 #include "ui/gfx/geometry/size_f.h"
 #include "ui/gfx/transform.h"
 
-namespace gfx {
-class BoxF;
-}
-
 namespace cc {
 
 class ColorAnimationCurve;
@@ -81,12 +77,6 @@
 
   virtual TransformOperations GetValue(base::TimeDelta t) const = 0;
 
-  // Sets |bounds| to be the bounding box for the region within which |box|
-  // will move during this animation. If this region cannot be computed,
-  // returns false.
-  virtual bool AnimatedBoundsForBox(const gfx::BoxF& box,
-                                    gfx::BoxF* bounds) const = 0;
-
   // Returns true if this animation is a translation.
   virtual bool IsTranslation() const = 0;
 
diff --git a/cc/animation/keyframed_animation_curve.cc b/cc/animation/keyframed_animation_curve.cc
index 89f088a..ed44328 100644
--- a/cc/animation/keyframed_animation_curve.cc
+++ b/cc/animation/keyframed_animation_curve.cc
@@ -381,28 +381,6 @@
   return keyframes_[i + 1]->Value().Blend(keyframes_[i]->Value(), progress);
 }
 
-bool KeyframedTransformAnimationCurve::AnimatedBoundsForBox(
-    const gfx::BoxF& box,
-    gfx::BoxF* bounds) const {
-  DCHECK_GE(keyframes_.size(), 2ul);
-  *bounds = gfx::BoxF();
-  for (size_t i = 0; i < keyframes_.size() - 1; ++i) {
-    gfx::BoxF bounds_for_step;
-    float min_progress = 0.0;
-    float max_progress = 1.0;
-    if (keyframes_[i]->timing_function())
-      keyframes_[i]->timing_function()->Range(&min_progress, &max_progress);
-    if (!keyframes_[i+1]->Value().BlendedBoundsForBox(box,
-                                                      keyframes_[i]->Value(),
-                                                      min_progress,
-                                                      max_progress,
-                                                      &bounds_for_step))
-      return false;
-    bounds->Union(bounds_for_step);
-  }
-  return true;
-}
-
 bool KeyframedTransformAnimationCurve::PreservesAxisAlignment() const {
   for (const auto& keyframe : keyframes_) {
     if (!keyframe->Value().PreservesAxisAlignment())
diff --git a/cc/animation/keyframed_animation_curve.h b/cc/animation/keyframed_animation_curve.h
index 0378056..582a26c2 100644
--- a/cc/animation/keyframed_animation_curve.h
+++ b/cc/animation/keyframed_animation_curve.h
@@ -238,8 +238,6 @@
 
   // TransformAnimationCurve implementation
   TransformOperations GetValue(base::TimeDelta t) const override;
-  bool AnimatedBoundsForBox(const gfx::BoxF& box,
-                            gfx::BoxF* bounds) const override;
   bool PreservesAxisAlignment() const override;
   bool IsTranslation() const override;
   bool AnimationStartScale(bool forward_direction,
diff --git a/cc/animation/keyframed_animation_curve_unittest.cc b/cc/animation/keyframed_animation_curve_unittest.cc
index 7a13c743..b71f127 100644
--- a/cc/animation/keyframed_animation_curve_unittest.cc
+++ b/cc/animation/keyframed_animation_curve_unittest.cc
@@ -658,32 +658,6 @@
   }
 }
 
-// Tests that animated bounds are computed as expected.
-TEST(KeyframedAnimationCurveTest, AnimatedBounds) {
-  std::unique_ptr<KeyframedTransformAnimationCurve> curve(
-      KeyframedTransformAnimationCurve::Create());
-
-  TransformOperations operations1;
-  curve->AddKeyframe(
-      TransformKeyframe::Create(base::TimeDelta(), operations1, nullptr));
-  operations1.AppendTranslate(2.0, 3.0, -1.0);
-  curve->AddKeyframe(TransformKeyframe::Create(
-      base::TimeDelta::FromSecondsD(0.5f), operations1, nullptr));
-  TransformOperations operations2;
-  operations2.AppendTranslate(4.0, 1.0, 2.0);
-  curve->AddKeyframe(TransformKeyframe::Create(
-      base::TimeDelta::FromSecondsD(1.f), operations2,
-      CubicBezierTimingFunction::CreatePreset(
-          CubicBezierTimingFunction::EaseType::EASE)));
-
-  gfx::BoxF box(2.f, 3.f, 4.f, 1.f, 3.f, 2.f);
-  gfx::BoxF bounds;
-
-  EXPECT_TRUE(curve->AnimatedBoundsForBox(box, &bounds));
-  EXPECT_EQ(gfx::BoxF(2.f, 3.f, 3.f, 5.f, 6.f, 5.f).ToString(),
-            bounds.ToString());
-}
-
 // Tests that animations that are translations are correctly identified.
 TEST(KeyframedAnimationCurveTest, IsTranslation) {
   std::unique_ptr<KeyframedTransformAnimationCurve> curve(
diff --git a/cc/animation/timing_function.cc b/cc/animation/timing_function.cc
index e3df8de..ad73588c6 100644
--- a/cc/animation/timing_function.cc
+++ b/cc/animation/timing_function.cc
@@ -65,11 +65,6 @@
   return static_cast<float>(bezier_.Slope(x));
 }
 
-void CubicBezierTimingFunction::Range(float* min, float* max) const {
-  *min = static_cast<float>(bezier_.range_min());
-  *max = static_cast<float>(bezier_.range_max());
-}
-
 std::unique_ptr<TimingFunction> CubicBezierTimingFunction::Clone() const {
   return base::WrapUnique(new CubicBezierTimingFunction(*this));
 }
@@ -97,11 +92,6 @@
   return base::WrapUnique(new StepsTimingFunction(*this));
 }
 
-void StepsTimingFunction::Range(float* min, float* max) const {
-  *min = 0.0f;
-  *max = 1.0f;
-}
-
 float StepsTimingFunction::Velocity(double x) const {
   return 0.0f;
 }
@@ -150,11 +140,6 @@
   return base::WrapUnique(new FramesTimingFunction(*this));
 }
 
-void FramesTimingFunction::Range(float* min, float* max) const {
-  *min = 0.0f;
-  *max = 1.0f;
-}
-
 float FramesTimingFunction::Velocity(double x) const {
   return 0.0f;
 }
diff --git a/cc/animation/timing_function.h b/cc/animation/timing_function.h
index 5ff8d35..32bbf95f 100644
--- a/cc/animation/timing_function.h
+++ b/cc/animation/timing_function.h
@@ -24,8 +24,6 @@
   virtual Type GetType() const = 0;
   virtual float GetValue(double t) const = 0;
   virtual float Velocity(double time) const = 0;
-  // The smallest and largest values returned by GetValue for inputs in [0, 1].
-  virtual void Range(float* min, float* max) const = 0;
   virtual std::unique_ptr<TimingFunction> Clone() const = 0;
 
  protected:
@@ -50,7 +48,6 @@
   Type GetType() const override;
   float GetValue(double time) const override;
   float Velocity(double time) const override;
-  void Range(float* min, float* max) const override;
   std::unique_ptr<TimingFunction> Clone() const override;
 
   EaseType ease_type() const { return ease_type_; }
@@ -83,7 +80,6 @@
   Type GetType() const override;
   float GetValue(double t) const override;
   std::unique_ptr<TimingFunction> Clone() const override;
-  void Range(float* min, float* max) const override;
   float Velocity(double time) const override;
 
   int steps() const { return steps_; }
@@ -110,7 +106,6 @@
   Type GetType() const override;
   float GetValue(double t) const override;
   std::unique_ptr<TimingFunction> Clone() const override;
-  void Range(float* min, float* max) const override;
   float Velocity(double time) const override;
 
   int frames() const { return frames_; }
diff --git a/cc/test/animation_test_common.cc b/cc/test/animation_test_common.cc
index bfd4504..c3b26878 100644
--- a/cc/test/animation_test_common.cc
+++ b/cc/test/animation_test_common.cc
@@ -168,11 +168,6 @@
   return TransformOperations();
 }
 
-bool FakeTransformTransition::AnimatedBoundsForBox(const gfx::BoxF& box,
-                                                   gfx::BoxF* bounds) const {
-  return false;
-}
-
 bool FakeTransformTransition::IsTranslation() const { return true; }
 
 bool FakeTransformTransition::PreservesAxisAlignment() const {
diff --git a/cc/test/animation_test_common.h b/cc/test/animation_test_common.h
index b1525e2..96e492b8 100644
--- a/cc/test/animation_test_common.h
+++ b/cc/test/animation_test_common.h
@@ -42,8 +42,6 @@
 
   base::TimeDelta Duration() const override;
   TransformOperations GetValue(base::TimeDelta time) const override;
-  bool AnimatedBoundsForBox(const gfx::BoxF& box,
-                            gfx::BoxF* bounds) const override;
   bool IsTranslation() const override;
   bool PreservesAxisAlignment() const override;
   bool AnimationStartScale(bool forward_direction,
diff --git a/ui/compositor/transform_animation_curve_adapter.cc b/ui/compositor/transform_animation_curve_adapter.cc
index 0973c67a..4935096 100644
--- a/ui/compositor/transform_animation_curve_adapter.cc
+++ b/ui/compositor/transform_animation_curve_adapter.cc
@@ -65,15 +65,6 @@
   return WrapTransform(gfx::ComposeTransform(to_return));
 }
 
-bool TransformAnimationCurveAdapter::AnimatedBoundsForBox(
-    const gfx::BoxF& box,
-    gfx::BoxF* bounds) const {
-  // TODO(ajuma): Once cc::TransformOperation::BlendedBoundsForBox supports
-  // computing bounds for TransformOperationMatrix, use that to compute
-  // the bounds we need here.
-  return false;
-}
-
 bool TransformAnimationCurveAdapter::IsTranslation() const {
   return initial_value_.IsIdentityOrTranslation() &&
          target_value_.IsIdentityOrTranslation();
@@ -138,15 +129,6 @@
   return WrapTransform(to_return);
 }
 
-bool InverseTransformCurveAdapter::AnimatedBoundsForBox(
-    const gfx::BoxF& box,
-    gfx::BoxF* bounds) const {
-  // TODO(ajuma): Once cc::TransformOperation::BlendedBoundsForBox supports
-  // computing bounds for TransformOperationMatrix, use that to compute
-  // the bounds we need here.
-  return false;
-}
-
 bool InverseTransformCurveAdapter::IsTranslation() const {
   return initial_value_.IsIdentityOrTranslation() &&
          base_curve_.IsTranslation();
diff --git a/ui/compositor/transform_animation_curve_adapter.h b/ui/compositor/transform_animation_curve_adapter.h
index 53d1d96..bc03f41 100644
--- a/ui/compositor/transform_animation_curve_adapter.h
+++ b/ui/compositor/transform_animation_curve_adapter.h
@@ -34,8 +34,6 @@
   base::TimeDelta Duration() const override;
   std::unique_ptr<AnimationCurve> Clone() const override;
   cc::TransformOperations GetValue(base::TimeDelta t) const override;
-  bool AnimatedBoundsForBox(const gfx::BoxF& box,
-                            gfx::BoxF* bounds) const override;
   bool IsTranslation() const override;
   bool PreservesAxisAlignment() const override;
   bool AnimationStartScale(bool forward_direction,
@@ -68,8 +66,6 @@
   base::TimeDelta Duration() const override;
   std::unique_ptr<AnimationCurve> Clone() const override;
   cc::TransformOperations GetValue(base::TimeDelta t) const override;
-  bool AnimatedBoundsForBox(const gfx::BoxF& box,
-                            gfx::BoxF* bounds) const override;
   bool IsTranslation() const override;
   bool PreservesAxisAlignment() const override;
   bool AnimationStartScale(bool forward_direction,