Commit aae911cd authored by Fredrik Söderquist's avatar Fredrik Söderquist Committed by Commit Bot

Remove dead Blend() code

(last use probably removed by https://codereview.chromium.org/2750293003
and similar earlier CLs.)

ShadowList: :Blend and BasicShape::Blend/CanBlend are no longer used
Change-Id: I3d9690768f64fa8c602b55cb1a0bf8654100e04c
Reviewed-on: https://chromium-review.googlesource.com/809012Reviewed-by: default avatarStephen McGruer <smcgruer@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#522104}
parent 96309230
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "core/layout/OrderIterator.h" #include "core/layout/OrderIterator.h"
#include "core/style/ComputedStyle.h" #include "core/style/ComputedStyle.h"
#include "platform/LayoutUnit.h" #include "platform/LayoutUnit.h"
#include "platform/geometry/LayoutPoint.h"
#include "platform/wtf/Noncopyable.h" #include "platform/wtf/Noncopyable.h"
#include "platform/wtf/Vector.h" #include "platform/wtf/Vector.h"
......
...@@ -30,43 +30,12 @@ ...@@ -30,43 +30,12 @@
#include "core/style/BasicShapes.h" #include "core/style/BasicShapes.h"
#include "core/css/BasicShapeFunctions.h" #include "core/css/BasicShapeFunctions.h"
#include "platform/CalculationValue.h"
#include "platform/LengthFunctions.h" #include "platform/LengthFunctions.h"
#include "platform/geometry/FloatRect.h" #include "platform/geometry/FloatRect.h"
#include "platform/graphics/Path.h" #include "platform/graphics/Path.h"
namespace blink { namespace blink {
bool BasicShape::CanBlend(const BasicShape* other) const {
// FIXME: Support animations between different shapes in the future.
if (!other || !IsSameType(*other))
return false;
// Just polygons with same number of vertices can be animated.
if (GetType() == BasicShape::kBasicShapePolygonType &&
(ToBasicShapePolygon(this)->Values().size() !=
ToBasicShapePolygon(other)->Values().size() ||
ToBasicShapePolygon(this)->GetWindRule() !=
ToBasicShapePolygon(other)->GetWindRule()))
return false;
// Circles with keywords for radii or center coordinates cannot be animated.
if (GetType() == BasicShape::kBasicShapeCircleType) {
if (!ToBasicShapeCircle(this)->Radius().CanBlend(
ToBasicShapeCircle(other)->Radius()))
return false;
}
// Ellipses with keywords for radii or center coordinates cannot be animated.
if (GetType() != BasicShape::kBasicShapeEllipseType)
return true;
return (ToBasicShapeEllipse(this)->RadiusX().CanBlend(
ToBasicShapeEllipse(other)->RadiusX()) &&
ToBasicShapeEllipse(this)->RadiusY().CanBlend(
ToBasicShapeEllipse(other)->RadiusY()));
}
bool BasicShapeCircle::operator==(const BasicShape& o) const { bool BasicShapeCircle::operator==(const BasicShape& o) const {
if (!IsSameType(o)) if (!IsSameType(o))
return false; return false;
...@@ -105,18 +74,6 @@ void BasicShapeCircle::GetPath(Path& path, const FloatRect& bounding_box) { ...@@ -105,18 +74,6 @@ void BasicShapeCircle::GetPath(Path& path, const FloatRect& bounding_box) {
radius * 2)); radius * 2));
} }
scoped_refptr<BasicShape> BasicShapeCircle::Blend(const BasicShape* other,
double progress) const {
DCHECK_EQ(GetType(), other->GetType());
const BasicShapeCircle* o = ToBasicShapeCircle(other);
scoped_refptr<BasicShapeCircle> result = BasicShapeCircle::Create();
result->SetCenterX(center_x_.Blend(o->CenterX(), progress));
result->SetCenterY(center_y_.Blend(o->CenterY(), progress));
result->SetRadius(radius_.Blend(o->Radius(), progress));
return result;
}
bool BasicShapeEllipse::operator==(const BasicShape& o) const { bool BasicShapeEllipse::operator==(const BasicShape& o) const {
if (!IsSameType(o)) if (!IsSameType(o))
return false; return false;
...@@ -153,30 +110,6 @@ void BasicShapeEllipse::GetPath(Path& path, const FloatRect& bounding_box) { ...@@ -153,30 +110,6 @@ void BasicShapeEllipse::GetPath(Path& path, const FloatRect& bounding_box) {
radius_x * 2, radius_y * 2)); radius_x * 2, radius_y * 2));
} }
scoped_refptr<BasicShape> BasicShapeEllipse::Blend(const BasicShape* other,
double progress) const {
DCHECK_EQ(GetType(), other->GetType());
const BasicShapeEllipse* o = ToBasicShapeEllipse(other);
scoped_refptr<BasicShapeEllipse> result = BasicShapeEllipse::Create();
if (radius_x_.GetType() != BasicShapeRadius::kValue ||
o->RadiusX().GetType() != BasicShapeRadius::kValue ||
radius_y_.GetType() != BasicShapeRadius::kValue ||
o->RadiusY().GetType() != BasicShapeRadius::kValue) {
result->SetCenterX(o->CenterX());
result->SetCenterY(o->CenterY());
result->SetRadiusX(o->RadiusX());
result->SetRadiusY(o->RadiusY());
return result;
}
result->SetCenterX(center_x_.Blend(o->CenterX(), progress));
result->SetCenterY(center_y_.Blend(o->CenterY(), progress));
result->SetRadiusX(radius_x_.Blend(o->RadiusX(), progress));
result->SetRadiusY(radius_y_.Blend(o->RadiusY(), progress));
return result;
}
void BasicShapePolygon::GetPath(Path& path, const FloatRect& bounding_box) { void BasicShapePolygon::GetPath(Path& path, const FloatRect& bounding_box) {
DCHECK(path.IsEmpty()); DCHECK(path.IsEmpty());
DCHECK(!(values_.size() % 2)); DCHECK(!(values_.size() % 2));
...@@ -200,32 +133,6 @@ void BasicShapePolygon::GetPath(Path& path, const FloatRect& bounding_box) { ...@@ -200,32 +133,6 @@ void BasicShapePolygon::GetPath(Path& path, const FloatRect& bounding_box) {
path.CloseSubpath(); path.CloseSubpath();
} }
scoped_refptr<BasicShape> BasicShapePolygon::Blend(const BasicShape* other,
double progress) const {
DCHECK(other);
DCHECK(IsSameType(*other));
const BasicShapePolygon* o = ToBasicShapePolygon(other);
DCHECK_EQ(values_.size(), o->Values().size());
DCHECK(!(values_.size() % 2));
size_t length = values_.size();
scoped_refptr<BasicShapePolygon> result = BasicShapePolygon::Create();
if (!length)
return result;
result->SetWindRule(o->GetWindRule());
for (size_t i = 0; i < length; i = i + 2) {
result->AppendPoint(
values_.at(i).Blend(o->Values().at(i), progress, kValueRangeAll),
values_.at(i + 1).Blend(o->Values().at(i + 1), progress,
kValueRangeAll));
}
return result;
}
bool BasicShapePolygon::operator==(const BasicShape& o) const { bool BasicShapePolygon::operator==(const BasicShape& o) const {
if (!IsSameType(o)) if (!IsSameType(o))
return false; return false;
...@@ -263,39 +170,6 @@ void BasicShapeInset::GetPath(Path& path, const FloatRect& bounding_box) { ...@@ -263,39 +170,6 @@ void BasicShapeInset::GetPath(Path& path, const FloatRect& bounding_box) {
path.AddRoundedRect(final_rect); path.AddRoundedRect(final_rect);
} }
static inline LengthSize BlendLengthSize(const LengthSize& to,
const LengthSize& from,
double progress) {
return LengthSize(
to.Width().Blend(from.Width(), progress, kValueRangeNonNegative),
to.Height().Blend(from.Height(), progress, kValueRangeNonNegative));
}
scoped_refptr<BasicShape> BasicShapeInset::Blend(const BasicShape* other,
double progress) const {
DCHECK(other);
DCHECK(IsSameType(*other));
const BasicShapeInset& other_inset = ToBasicShapeInset(*other);
scoped_refptr<BasicShapeInset> result = BasicShapeInset::Create();
result->SetTop(top_.Blend(other_inset.Top(), progress, kValueRangeAll));
result->SetRight(right_.Blend(other_inset.Right(), progress, kValueRangeAll));
result->SetBottom(
bottom_.Blend(other_inset.Bottom(), progress, kValueRangeAll));
result->SetLeft(left_.Blend(other_inset.Left(), progress, kValueRangeAll));
result->SetTopLeftRadius(
BlendLengthSize(top_left_radius_, other_inset.TopLeftRadius(), progress));
result->SetTopRightRadius(BlendLengthSize(
top_right_radius_, other_inset.TopRightRadius(), progress));
result->SetBottomRightRadius(BlendLengthSize(
bottom_right_radius_, other_inset.BottomRightRadius(), progress));
result->SetBottomLeftRadius(BlendLengthSize(
bottom_left_radius_, other_inset.BottomLeftRadius(), progress));
return result;
}
bool BasicShapeInset::operator==(const BasicShape& o) const { bool BasicShapeInset::operator==(const BasicShape& o) const {
if (!IsSameType(o)) if (!IsSameType(o))
return false; return false;
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include "base/memory/scoped_refptr.h" #include "base/memory/scoped_refptr.h"
#include "core/CoreExport.h" #include "core/CoreExport.h"
#include "core/style/ComputedStyleConstants.h"
#include "platform/Length.h" #include "platform/Length.h"
#include "platform/LengthSize.h" #include "platform/LengthSize.h"
#include "platform/graphics/GraphicsTypes.h" #include "platform/graphics/GraphicsTypes.h"
...@@ -59,14 +58,12 @@ class CORE_EXPORT BasicShape : public RefCounted<BasicShape> { ...@@ -59,14 +58,12 @@ class CORE_EXPORT BasicShape : public RefCounted<BasicShape> {
kStylePathType kStylePathType
}; };
bool CanBlend(const BasicShape*) const;
bool IsSameType(const BasicShape& other) const { bool IsSameType(const BasicShape& other) const {
return GetType() == other.GetType(); return GetType() == other.GetType();
} }
virtual void GetPath(Path&, const FloatRect&) = 0; virtual void GetPath(Path&, const FloatRect&) = 0;
virtual WindRule GetWindRule() const { return RULE_NONZERO; } virtual WindRule GetWindRule() const { return RULE_NONZERO; }
virtual scoped_refptr<BasicShape> Blend(const BasicShape*, double) const = 0;
virtual bool operator==(const BasicShape&) const = 0; virtual bool operator==(const BasicShape&) const = 0;
virtual ShapeType GetType() const = 0; virtual ShapeType GetType() const = 0;
...@@ -108,13 +105,6 @@ class BasicShapeCenterCoordinate { ...@@ -108,13 +105,6 @@ class BasicShapeCenterCoordinate {
const Length& length() const { return length_; } const Length& length() const { return length_; }
const Length& ComputedLength() const { return computed_length_; } const Length& ComputedLength() const { return computed_length_; }
BasicShapeCenterCoordinate Blend(const BasicShapeCenterCoordinate& other,
double progress) const {
return BasicShapeCenterCoordinate(
kTopLeft, computed_length_.Blend(other.computed_length_, progress,
kValueRangeAll));
}
private: private:
Direction direction_; Direction direction_;
Length length_; Length length_;
...@@ -138,19 +128,6 @@ class BasicShapeRadius { ...@@ -138,19 +128,6 @@ class BasicShapeRadius {
const Length& Value() const { return value_; } const Length& Value() const { return value_; }
RadiusType GetType() const { return type_; } RadiusType GetType() const { return type_; }
bool CanBlend(const BasicShapeRadius& other) const {
// FIXME determine how to interpolate between keywords. See issue 330248.
return type_ == kValue && other.GetType() == kValue;
}
BasicShapeRadius Blend(const BasicShapeRadius& other, double progress) const {
if (type_ != kValue || other.GetType() != kValue)
return BasicShapeRadius(other);
return BasicShapeRadius(
value_.Blend(other.Value(), progress, kValueRangeNonNegative));
}
private: private:
Length value_; Length value_;
RadiusType type_; RadiusType type_;
...@@ -172,7 +149,6 @@ class CORE_EXPORT BasicShapeCircle final : public BasicShape { ...@@ -172,7 +149,6 @@ class CORE_EXPORT BasicShapeCircle final : public BasicShape {
void SetRadius(BasicShapeRadius radius) { radius_ = radius; } void SetRadius(BasicShapeRadius radius) { radius_ = radius; }
void GetPath(Path&, const FloatRect&) override; void GetPath(Path&, const FloatRect&) override;
scoped_refptr<BasicShape> Blend(const BasicShape*, double) const override;
bool operator==(const BasicShape&) const override; bool operator==(const BasicShape&) const override;
ShapeType GetType() const override { return kBasicShapeCircleType; } ShapeType GetType() const override { return kBasicShapeCircleType; }
...@@ -207,7 +183,6 @@ class BasicShapeEllipse final : public BasicShape { ...@@ -207,7 +183,6 @@ class BasicShapeEllipse final : public BasicShape {
void SetRadiusY(BasicShapeRadius radius_y) { radius_y_ = radius_y; } void SetRadiusY(BasicShapeRadius radius_y) { radius_y_ = radius_y; }
void GetPath(Path&, const FloatRect&) override; void GetPath(Path&, const FloatRect&) override;
scoped_refptr<BasicShape> Blend(const BasicShape*, double) const override;
bool operator==(const BasicShape&) const override; bool operator==(const BasicShape&) const override;
ShapeType GetType() const override { return kBasicShapeEllipseType; } ShapeType GetType() const override { return kBasicShapeEllipseType; }
...@@ -230,8 +205,6 @@ class BasicShapePolygon final : public BasicShape { ...@@ -230,8 +205,6 @@ class BasicShapePolygon final : public BasicShape {
} }
const Vector<Length>& Values() const { return values_; } const Vector<Length>& Values() const { return values_; }
Length GetXAt(unsigned i) const { return values_.at(2 * i); }
Length GetYAt(unsigned i) const { return values_.at(2 * i + 1); }
void SetWindRule(WindRule wind_rule) { wind_rule_ = wind_rule; } void SetWindRule(WindRule wind_rule) { wind_rule_ = wind_rule; }
void AppendPoint(const Length& x, const Length& y) { void AppendPoint(const Length& x, const Length& y) {
...@@ -240,7 +213,6 @@ class BasicShapePolygon final : public BasicShape { ...@@ -240,7 +213,6 @@ class BasicShapePolygon final : public BasicShape {
} }
void GetPath(Path&, const FloatRect&) override; void GetPath(Path&, const FloatRect&) override;
scoped_refptr<BasicShape> Blend(const BasicShape*, double) const override;
bool operator==(const BasicShape&) const override; bool operator==(const BasicShape&) const override;
WindRule GetWindRule() const override { return wind_rule_; } WindRule GetWindRule() const override { return wind_rule_; }
...@@ -289,7 +261,6 @@ class BasicShapeInset : public BasicShape { ...@@ -289,7 +261,6 @@ class BasicShapeInset : public BasicShape {
} }
void GetPath(Path&, const FloatRect&) override; void GetPath(Path&, const FloatRect&) override;
scoped_refptr<BasicShape> Blend(const BasicShape*, double) const override;
bool operator==(const BasicShape&) const override; bool operator==(const BasicShape&) const override;
ShapeType GetType() const override { return kBasicShapeInsetType; } ShapeType GetType() const override { return kBasicShapeInsetType; }
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include "platform/LengthBox.h" #include "platform/LengthBox.h"
#include "platform/LengthPoint.h" #include "platform/LengthPoint.h"
#include "platform/LengthSize.h" #include "platform/LengthSize.h"
#include "platform/geometry/LayoutRectOutsets.h"
#include "platform/graphics/Color.h" #include "platform/graphics/Color.h"
#include "platform/graphics/TouchAction.h" #include "platform/graphics/TouchAction.h"
#include "platform/runtime_enabled_features.h" #include "platform/runtime_enabled_features.h"
...@@ -84,8 +85,6 @@ class StyleResolver; ...@@ -84,8 +85,6 @@ class StyleResolver;
class StyleSelfAlignmentData; class StyleSelfAlignmentData;
class TransformationMatrix; class TransformationMatrix;
class ContentData;
typedef Vector<scoped_refptr<ComputedStyle>, 4> PseudoStyleCache; typedef Vector<scoped_refptr<ComputedStyle>, 4> PseudoStyleCache;
namespace CSSLonghand { namespace CSSLonghand {
......
...@@ -49,40 +49,6 @@ void ShadowList::AdjustRectForShadow(FloatRect& rect) const { ...@@ -49,40 +49,6 @@ void ShadowList::AdjustRectForShadow(FloatRect& rect) const {
rect.Expand(RectOutsetsIncludingOriginal()); rect.Expand(RectOutsetsIncludingOriginal());
} }
scoped_refptr<ShadowList> ShadowList::Blend(const ShadowList* from,
const ShadowList* to,
double progress,
const Color& current_color) {
size_t from_length = from ? from->Shadows().size() : 0;
size_t to_length = to ? to->Shadows().size() : 0;
if (!from_length && !to_length)
return nullptr;
ShadowDataVector shadows;
DEFINE_STATIC_LOCAL(ShadowData, default_shadow_data,
(ShadowData::NeutralValue()));
DEFINE_STATIC_LOCAL(
ShadowData, default_inset_shadow_data,
(FloatPoint(), 0, 0, kInset, StyleColor(Color::kTransparent)));
size_t max_length = std::max(from_length, to_length);
for (size_t i = 0; i < max_length; ++i) {
const ShadowData* from_shadow =
i < from_length ? &from->Shadows()[i] : nullptr;
const ShadowData* to_shadow = i < to_length ? &to->Shadows()[i] : nullptr;
if (!from_shadow)
from_shadow = to_shadow->Style() == kInset ? &default_inset_shadow_data
: &default_shadow_data;
else if (!to_shadow)
to_shadow = from_shadow->Style() == kInset ? &default_inset_shadow_data
: &default_shadow_data;
shadows.push_back(to_shadow->Blend(*from_shadow, progress, current_color));
}
return ShadowList::Adopt(shadows);
}
sk_sp<SkDrawLooper> ShadowList::CreateDrawLooper( sk_sp<SkDrawLooper> ShadowList::CreateDrawLooper(
DrawLooperBuilder::ShadowAlphaMode alpha_mode, DrawLooperBuilder::ShadowAlphaMode alpha_mode,
const Color& current_color, const Color& current_color,
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include <memory> #include <memory>
#include "core/style/ShadowData.h" #include "core/style/ShadowData.h"
#include "platform/geometry/FloatRectOutsets.h" #include "platform/geometry/FloatRectOutsets.h"
#include "platform/geometry/LayoutRect.h"
#include "platform/graphics/DrawLooperBuilder.h" #include "platform/graphics/DrawLooperBuilder.h"
#include "platform/wtf/RefCounted.h" #include "platform/wtf/RefCounted.h"
#include "platform/wtf/Vector.h" #include "platform/wtf/Vector.h"
...@@ -42,7 +41,6 @@ ...@@ -42,7 +41,6 @@
namespace blink { namespace blink {
class FloatRect; class FloatRect;
class LayoutRect;
typedef Vector<ShadowData, 1> ShadowDataVector; typedef Vector<ShadowData, 1> ShadowDataVector;
...@@ -58,11 +56,6 @@ class ShadowList : public RefCounted<ShadowList> { ...@@ -58,11 +56,6 @@ class ShadowList : public RefCounted<ShadowList> {
bool operator==(const ShadowList& o) const { return shadows_ == o.shadows_; } bool operator==(const ShadowList& o) const { return shadows_ == o.shadows_; }
bool operator!=(const ShadowList& o) const { return !(*this == o); } bool operator!=(const ShadowList& o) const { return !(*this == o); }
static scoped_refptr<ShadowList> Blend(const ShadowList* from,
const ShadowList* to,
double progress,
const Color& current_color);
// Outsets needed to include all shadows in this list, as well as the // Outsets needed to include all shadows in this list, as well as the
// source (i.e. no outsets will be negative). // source (i.e. no outsets will be negative).
FloatRectOutsets RectOutsetsIncludingOriginal() const; FloatRectOutsets RectOutsetsIncludingOriginal() const;
......
...@@ -66,10 +66,4 @@ void StylePath::GetPath(Path&, const FloatRect&) { ...@@ -66,10 +66,4 @@ void StylePath::GetPath(Path&, const FloatRect&) {
NOTREACHED(); NOTREACHED();
} }
scoped_refptr<BasicShape> StylePath::Blend(const BasicShape*, double) const {
// TODO(ericwilligers): Implement animation for offset-path.
NOTREACHED();
return nullptr;
}
} // namespace blink } // namespace blink
...@@ -8,8 +8,6 @@ ...@@ -8,8 +8,6 @@
#include <memory> #include <memory>
#include "base/memory/scoped_refptr.h" #include "base/memory/scoped_refptr.h"
#include "core/style/BasicShapes.h" #include "core/style/BasicShapes.h"
#include "platform/heap/Handle.h"
#include "platform/wtf/RefCounted.h"
namespace blink { namespace blink {
...@@ -33,7 +31,6 @@ class StylePath final : public BasicShape { ...@@ -33,7 +31,6 @@ class StylePath final : public BasicShape {
CSSValue* ComputedCSSValue() const; CSSValue* ComputedCSSValue() const;
void GetPath(Path&, const FloatRect&) override; void GetPath(Path&, const FloatRect&) override;
scoped_refptr<BasicShape> Blend(const BasicShape*, double) const override;
bool operator==(const BasicShape&) const override; bool operator==(const BasicShape&) const override;
ShapeType GetType() const override { return kStylePathType; } ShapeType GetType() const override { return kStylePathType; }
......
...@@ -29,10 +29,4 @@ void StyleRay::GetPath(Path&, const FloatRect&) { ...@@ -29,10 +29,4 @@ void StyleRay::GetPath(Path&, const FloatRect&) {
NOTREACHED(); NOTREACHED();
} }
scoped_refptr<BasicShape> StyleRay::Blend(const BasicShape*, double) const {
// TODO(ericwilligers): Implement animation for offset-path.
NOTREACHED();
return nullptr;
}
} // namespace blink } // namespace blink
...@@ -27,7 +27,6 @@ class StyleRay : public BasicShape { ...@@ -27,7 +27,6 @@ class StyleRay : public BasicShape {
bool Contain() const { return contain_; } bool Contain() const { return contain_; }
void GetPath(Path&, const FloatRect&) override; void GetPath(Path&, const FloatRect&) override;
scoped_refptr<BasicShape> Blend(const BasicShape*, double) const override;
bool operator==(const BasicShape&) const override; bool operator==(const BasicShape&) const override;
ShapeType GetType() const override { return kStyleRayType; } ShapeType GetType() const override { return kStyleRayType; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment