Commit 46beddb8 authored by Fredrik Söderqvist's avatar Fredrik Söderqvist Committed by Commit Bot

Add const to SVGPropertyBase's animation value interface

Mechanical change (with luckily no repercussions).

Bug: 1017723
Change-Id: Iaae9529d3a4fb84f2dd4478875afdfc1ad211bd8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2395620
Commit-Queue: Stephen Chenney <schenney@chromium.org>
Auto-Submit: Fredrik Söderquist <fs@opera.com>
Reviewed-by: default avatarStephen Chenney <schenney@chromium.org>
Cr-Commit-Position: refs/heads/master@{#804826}
parent fa919e08
...@@ -117,8 +117,8 @@ class SVGListPropertyHelper : public SVGListPropertyBase { ...@@ -117,8 +117,8 @@ class SVGListPropertyHelper : public SVGListPropertyBase {
protected: protected:
void DeepCopy(const Derived*); void DeepCopy(const Derived*);
bool AdjustFromToListValues(Derived* from_list, bool AdjustFromToListValues(const Derived* from_list,
Derived* to_list, const Derived* to_list,
float percentage); float percentage);
virtual ItemPropertyType* CreatePaddingItem() const { virtual ItemPropertyType* CreatePaddingItem() const {
...@@ -136,8 +136,8 @@ void SVGListPropertyHelper<Derived, ItemProperty>::DeepCopy( ...@@ -136,8 +136,8 @@ void SVGListPropertyHelper<Derived, ItemProperty>::DeepCopy(
template <typename Derived, typename ItemProperty> template <typename Derived, typename ItemProperty>
bool SVGListPropertyHelper<Derived, ItemProperty>::AdjustFromToListValues( bool SVGListPropertyHelper<Derived, ItemProperty>::AdjustFromToListValues(
Derived* from_list, const Derived* from_list,
Derived* to_list, const Derived* to_list,
float percentage) { float percentage) {
// If no 'to' value is given, nothing to animate. // If no 'to' value is given, nothing to animate.
uint32_t to_list_size = to_list->length(); uint32_t to_list_size = to_list->length();
......
...@@ -63,16 +63,17 @@ class SVGPropertyBase : public GarbageCollected<SVGPropertyBase> { ...@@ -63,16 +63,17 @@ class SVGPropertyBase : public GarbageCollected<SVGPropertyBase> {
// FIXME: remove below and just have this inherit AnimatableValue in // FIXME: remove below and just have this inherit AnimatableValue in
// WebAnimations transition. // WebAnimations transition.
virtual void Add(SVGPropertyBase*, SVGElement*) = 0; virtual void Add(const SVGPropertyBase*, const SVGElement*) = 0;
virtual void CalculateAnimatedValue( virtual void CalculateAnimatedValue(
const SMILAnimationEffectParameters&, const SMILAnimationEffectParameters&,
float percentage, float percentage,
unsigned repeat_count, unsigned repeat_count,
SVGPropertyBase* from, const SVGPropertyBase* from,
SVGPropertyBase* to, const SVGPropertyBase* to,
SVGPropertyBase* to_at_end_of_duration_value, const SVGPropertyBase* to_at_end_of_duration_value,
SVGElement*) = 0; const SVGElement*) = 0;
virtual float CalculateDistance(SVGPropertyBase* to, SVGElement*) = 0; virtual float CalculateDistance(const SVGPropertyBase* to,
const SVGElement*) const = 0;
virtual AnimatedPropertyType GetType() const = 0; virtual AnimatedPropertyType GetType() const = 0;
......
...@@ -340,7 +340,7 @@ void SVGAngle::ConvertToSpecifiedUnits(SVGAngleType unit_type) { ...@@ -340,7 +340,7 @@ void SVGAngle::ConvertToSpecifiedUnits(SVGAngleType unit_type) {
orient_type_->SetEnumValue(kSVGMarkerOrientAngle); orient_type_->SetEnumValue(kSVGMarkerOrientAngle);
} }
void SVGAngle::Add(SVGPropertyBase* other, SVGElement*) { void SVGAngle::Add(const SVGPropertyBase* other, const SVGElement*) {
auto* other_angle = To<SVGAngle>(other); auto* other_angle = To<SVGAngle>(other);
// Only respect by animations, if from and by are both specified in angles // Only respect by animations, if from and by are both specified in angles
...@@ -364,10 +364,10 @@ void SVGAngle::CalculateAnimatedValue( ...@@ -364,10 +364,10 @@ void SVGAngle::CalculateAnimatedValue(
const SMILAnimationEffectParameters& parameters, const SMILAnimationEffectParameters& parameters,
float percentage, float percentage,
unsigned repeat_count, unsigned repeat_count,
SVGPropertyBase* from, const SVGPropertyBase* from,
SVGPropertyBase* to, const SVGPropertyBase* to,
SVGPropertyBase* to_at_end_of_duration, const SVGPropertyBase* to_at_end_of_duration,
SVGElement*) { const SVGElement*) {
auto* from_angle = To<SVGAngle>(from); auto* from_angle = To<SVGAngle>(from);
auto* to_angle = To<SVGAngle>(to); auto* to_angle = To<SVGAngle>(to);
...@@ -387,7 +387,8 @@ void SVGAngle::CalculateAnimatedValue( ...@@ -387,7 +387,8 @@ void SVGAngle::CalculateAnimatedValue(
SetValue(animated_value); SetValue(animated_value);
} }
float SVGAngle::CalculateDistance(SVGPropertyBase* other, SVGElement*) { float SVGAngle::CalculateDistance(const SVGPropertyBase* other,
const SVGElement*) const {
return fabsf(Value() - To<SVGAngle>(other)->Value()); return fabsf(Value() - To<SVGAngle>(other)->Value());
} }
......
...@@ -91,16 +91,17 @@ class SVGAngle final : public SVGPropertyHelper<SVGAngle> { ...@@ -91,16 +91,17 @@ class SVGAngle final : public SVGPropertyHelper<SVGAngle> {
String ValueAsString() const override; String ValueAsString() const override;
SVGParsingError SetValueAsString(const String&); SVGParsingError SetValueAsString(const String&);
void Add(SVGPropertyBase*, SVGElement*) override; void Add(const SVGPropertyBase*, const SVGElement*) override;
void CalculateAnimatedValue(const SMILAnimationEffectParameters&, void CalculateAnimatedValue(
float percentage, const SMILAnimationEffectParameters&,
unsigned repeat_count, float percentage,
SVGPropertyBase* from, unsigned repeat_count,
SVGPropertyBase* to, const SVGPropertyBase* from,
SVGPropertyBase* to_at_end_of_duration_value, const SVGPropertyBase* to,
SVGElement* context_element) override; const SVGPropertyBase* to_at_end_of_duration_value,
float CalculateDistance(SVGPropertyBase* to, const SVGElement* context_element) override;
SVGElement* context_element) override; float CalculateDistance(const SVGPropertyBase* to,
const SVGElement* context_element) const override;
static AnimatedPropertyType ClassType() { return kAnimatedAngle; } static AnimatedPropertyType ClassType() { return kAnimatedAngle; }
......
...@@ -48,7 +48,8 @@ SVGPropertyBase* SVGColorProperty::CloneForAnimation(const String&) const { ...@@ -48,7 +48,8 @@ SVGPropertyBase* SVGColorProperty::CloneForAnimation(const String&) const {
return nullptr; return nullptr;
} }
static inline Color FallbackColorForCurrentColor(SVGElement* target_element) { static inline Color FallbackColorForCurrentColor(
const SVGElement* target_element) {
DCHECK(target_element); DCHECK(target_element);
if (const ComputedStyle* target_style = target_element->GetComputedStyle()) if (const ComputedStyle* target_style = target_element->GetComputedStyle())
return target_style->VisitedDependentColor(GetCSSPropertyColor()); return target_style->VisitedDependentColor(GetCSSPropertyColor());
...@@ -56,15 +57,15 @@ static inline Color FallbackColorForCurrentColor(SVGElement* target_element) { ...@@ -56,15 +57,15 @@ static inline Color FallbackColorForCurrentColor(SVGElement* target_element) {
} }
static inline WebColorScheme ColorSchemeForSVGElement( static inline WebColorScheme ColorSchemeForSVGElement(
SVGElement* target_element) { const SVGElement* target_element) {
DCHECK(target_element); DCHECK(target_element);
if (const ComputedStyle* target_style = target_element->GetComputedStyle()) if (const ComputedStyle* target_style = target_element->GetComputedStyle())
return target_style->UsedColorScheme(); return target_style->UsedColorScheme();
return WebColorScheme::kLight; return WebColorScheme::kLight;
} }
void SVGColorProperty::Add(SVGPropertyBase* other, void SVGColorProperty::Add(const SVGPropertyBase* other,
SVGElement* context_element) { const SVGElement* context_element) {
DCHECK(context_element); DCHECK(context_element);
Color fallback_color = FallbackColorForCurrentColor(context_element); Color fallback_color = FallbackColorForCurrentColor(context_element);
...@@ -79,10 +80,10 @@ void SVGColorProperty::CalculateAnimatedValue( ...@@ -79,10 +80,10 @@ void SVGColorProperty::CalculateAnimatedValue(
const SMILAnimationEffectParameters& parameters, const SMILAnimationEffectParameters& parameters,
float percentage, float percentage,
unsigned repeat_count, unsigned repeat_count,
SVGPropertyBase* from_value, const SVGPropertyBase* from_value,
SVGPropertyBase* to_value, const SVGPropertyBase* to_value,
SVGPropertyBase* to_at_end_of_duration_value, const SVGPropertyBase* to_at_end_of_duration_value,
SVGElement* context_element) { const SVGElement* context_element) {
StyleColor from_style_color = To<SVGColorProperty>(from_value)->style_color_; StyleColor from_style_color = To<SVGColorProperty>(from_value)->style_color_;
StyleColor to_style_color = To<SVGColorProperty>(to_value)->style_color_; StyleColor to_style_color = To<SVGColorProperty>(to_value)->style_color_;
StyleColor to_at_end_of_duration_style_color = StyleColor to_at_end_of_duration_style_color =
...@@ -123,8 +124,9 @@ void SVGColorProperty::CalculateAnimatedValue( ...@@ -123,8 +124,9 @@ void SVGColorProperty::CalculateAnimatedValue(
roundf(animated_blue), roundf(animated_alpha))); roundf(animated_blue), roundf(animated_alpha)));
} }
float SVGColorProperty::CalculateDistance(SVGPropertyBase* to_value, float SVGColorProperty::CalculateDistance(
SVGElement* context_element) { const SVGPropertyBase* to_value,
const SVGElement* context_element) const {
DCHECK(context_element); DCHECK(context_element);
Color fallback_color = FallbackColorForCurrentColor(context_element); Color fallback_color = FallbackColorForCurrentColor(context_element);
WebColorScheme color_scheme = ColorSchemeForSVGElement(context_element); WebColorScheme color_scheme = ColorSchemeForSVGElement(context_element);
......
...@@ -47,15 +47,17 @@ class SVGColorProperty final : public SVGPropertyBase { ...@@ -47,15 +47,17 @@ class SVGColorProperty final : public SVGPropertyBase {
SVGPropertyBase* CloneForAnimation(const String&) const override; SVGPropertyBase* CloneForAnimation(const String&) const override;
String ValueAsString() const override; String ValueAsString() const override;
void Add(SVGPropertyBase*, SVGElement*) override; void Add(const SVGPropertyBase*, const SVGElement*) override;
void CalculateAnimatedValue(const SMILAnimationEffectParameters&, void CalculateAnimatedValue(
float percentage, const SMILAnimationEffectParameters&,
unsigned repeat_count, float percentage,
SVGPropertyBase* from, unsigned repeat_count,
SVGPropertyBase* to, const SVGPropertyBase* from,
SVGPropertyBase* to_at_end_of_duration_value, const SVGPropertyBase* to,
SVGElement*) override; const SVGPropertyBase* to_at_end_of_duration_value,
float CalculateDistance(SVGPropertyBase* to, SVGElement*) override; const SVGElement*) override;
float CalculateDistance(const SVGPropertyBase* to,
const SVGElement*) const override;
static AnimatedPropertyType ClassType() { return kAnimatedColor; } static AnimatedPropertyType ClassType() { return kAnimatedColor; }
AnimatedPropertyType GetType() const override { return ClassType(); } AnimatedPropertyType GetType() const override { return ClassType(); }
......
...@@ -48,21 +48,22 @@ SVGParsingError SVGBoolean::SetValueAsString(const String& value) { ...@@ -48,21 +48,22 @@ SVGParsingError SVGBoolean::SetValueAsString(const String& value) {
return SVGParseStatus::kExpectedBoolean; return SVGParseStatus::kExpectedBoolean;
} }
void SVGBoolean::Add(SVGPropertyBase*, SVGElement*) { void SVGBoolean::Add(const SVGPropertyBase*, const SVGElement*) {
NOTREACHED(); NOTREACHED();
} }
void SVGBoolean::CalculateAnimatedValue(const SMILAnimationEffectParameters&, void SVGBoolean::CalculateAnimatedValue(const SMILAnimationEffectParameters&,
float percentage, float percentage,
unsigned repeat_count, unsigned repeat_count,
SVGPropertyBase* from, const SVGPropertyBase* from,
SVGPropertyBase* to, const SVGPropertyBase* to,
SVGPropertyBase*, const SVGPropertyBase*,
SVGElement*) { const SVGElement*) {
NOTREACHED(); NOTREACHED();
} }
float SVGBoolean::CalculateDistance(SVGPropertyBase*, SVGElement*) { float SVGBoolean::CalculateDistance(const SVGPropertyBase*,
const SVGElement*) const {
// No paced animations for boolean. // No paced animations for boolean.
return -1; return -1;
} }
......
...@@ -50,15 +50,17 @@ class SVGBoolean final : public SVGPropertyHelper<SVGBoolean> { ...@@ -50,15 +50,17 @@ class SVGBoolean final : public SVGPropertyHelper<SVGBoolean> {
String ValueAsString() const override; String ValueAsString() const override;
SVGParsingError SetValueAsString(const String&); SVGParsingError SetValueAsString(const String&);
void Add(SVGPropertyBase*, SVGElement*) override; void Add(const SVGPropertyBase*, const SVGElement*) override;
void CalculateAnimatedValue(const SMILAnimationEffectParameters&, void CalculateAnimatedValue(
float percentage, const SMILAnimationEffectParameters&,
unsigned repeat_count, float percentage,
SVGPropertyBase* from, unsigned repeat_count,
SVGPropertyBase* to, const SVGPropertyBase* from,
SVGPropertyBase* to_at_end_of_duration_value, const SVGPropertyBase* to,
SVGElement*) override; const SVGPropertyBase* to_at_end_of_duration_value,
float CalculateDistance(SVGPropertyBase* to, SVGElement*) override; const SVGElement*) override;
float CalculateDistance(const SVGPropertyBase* to,
const SVGElement*) const override;
bool Value() const { return value_; } bool Value() const { return value_; }
void SetValue(bool value) { value_ = value; } void SetValue(bool value) { value_ = value; }
......
...@@ -71,7 +71,7 @@ uint16_t SVGEnumeration::MaxInternalEnumValue() const { ...@@ -71,7 +71,7 @@ uint16_t SVGEnumeration::MaxInternalEnumValue() const {
return map_.ValueOfLast(); return map_.ValueOfLast();
} }
void SVGEnumeration::Add(SVGPropertyBase*, SVGElement*) { void SVGEnumeration::Add(const SVGPropertyBase*, const SVGElement*) {
NOTREACHED(); NOTREACHED();
} }
...@@ -79,14 +79,15 @@ void SVGEnumeration::CalculateAnimatedValue( ...@@ -79,14 +79,15 @@ void SVGEnumeration::CalculateAnimatedValue(
const SMILAnimationEffectParameters&, const SMILAnimationEffectParameters&,
float percentage, float percentage,
unsigned repeat_count, unsigned repeat_count,
SVGPropertyBase* from, const SVGPropertyBase* from,
SVGPropertyBase* to, const SVGPropertyBase* to,
SVGPropertyBase*, const SVGPropertyBase*,
SVGElement*) { const SVGElement*) {
NOTREACHED(); NOTREACHED();
} }
float SVGEnumeration::CalculateDistance(SVGPropertyBase*, SVGElement*) { float SVGEnumeration::CalculateDistance(const SVGPropertyBase*,
const SVGElement*) const {
// No paced animations for enumerations. // No paced animations for enumerations.
return -1; return -1;
} }
......
...@@ -80,15 +80,17 @@ class SVGEnumeration : public SVGPropertyBase { ...@@ -80,15 +80,17 @@ class SVGEnumeration : public SVGPropertyBase {
String ValueAsString() const override; String ValueAsString() const override;
SVGParsingError SetValueAsString(const String&); SVGParsingError SetValueAsString(const String&);
void Add(SVGPropertyBase*, SVGElement*) override; void Add(const SVGPropertyBase*, const SVGElement*) override;
void CalculateAnimatedValue(const SMILAnimationEffectParameters&, void CalculateAnimatedValue(
float percentage, const SMILAnimationEffectParameters&,
unsigned repeat_count, float percentage,
SVGPropertyBase* from, unsigned repeat_count,
SVGPropertyBase* to, const SVGPropertyBase* from,
SVGPropertyBase* to_at_end_of_duration_value, const SVGPropertyBase* to,
SVGElement*) override; const SVGPropertyBase* to_at_end_of_duration_value,
float CalculateDistance(SVGPropertyBase* to, SVGElement*) override; const SVGElement*) override;
float CalculateDistance(const SVGPropertyBase* to,
const SVGElement*) const override;
static AnimatedPropertyType ClassType() { return kAnimatedEnumeration; } static AnimatedPropertyType ClassType() { return kAnimatedEnumeration; }
AnimatedPropertyType GetType() const override { return ClassType(); } AnimatedPropertyType GetType() const override { return ClassType(); }
......
...@@ -58,7 +58,7 @@ SVGParsingError SVGInteger::SetValueAsString(const String& string) { ...@@ -58,7 +58,7 @@ SVGParsingError SVGInteger::SetValueAsString(const String& string) {
return valid ? SVGParseStatus::kNoError : SVGParseStatus::kExpectedInteger; return valid ? SVGParseStatus::kNoError : SVGParseStatus::kExpectedInteger;
} }
void SVGInteger::Add(SVGPropertyBase* other, SVGElement*) { void SVGInteger::Add(const SVGPropertyBase* other, const SVGElement*) {
SetValue(value_ + To<SVGInteger>(other)->Value()); SetValue(value_ + To<SVGInteger>(other)->Value());
} }
...@@ -66,10 +66,10 @@ void SVGInteger::CalculateAnimatedValue( ...@@ -66,10 +66,10 @@ void SVGInteger::CalculateAnimatedValue(
const SMILAnimationEffectParameters& parameters, const SMILAnimationEffectParameters& parameters,
float percentage, float percentage,
unsigned repeat_count, unsigned repeat_count,
SVGPropertyBase* from, const SVGPropertyBase* from,
SVGPropertyBase* to, const SVGPropertyBase* to,
SVGPropertyBase* to_at_end_of_duration, const SVGPropertyBase* to_at_end_of_duration,
SVGElement*) { const SVGElement*) {
auto* from_integer = To<SVGInteger>(from); auto* from_integer = To<SVGInteger>(from);
auto* to_integer = To<SVGInteger>(to); auto* to_integer = To<SVGInteger>(to);
auto* to_at_end_of_duration_integer = To<SVGInteger>(to_at_end_of_duration); auto* to_at_end_of_duration_integer = To<SVGInteger>(to_at_end_of_duration);
...@@ -81,7 +81,8 @@ void SVGInteger::CalculateAnimatedValue( ...@@ -81,7 +81,8 @@ void SVGInteger::CalculateAnimatedValue(
value_ = clampTo<int>(roundf(animated_float)); value_ = clampTo<int>(roundf(animated_float));
} }
float SVGInteger::CalculateDistance(SVGPropertyBase* other, SVGElement*) { float SVGInteger::CalculateDistance(const SVGPropertyBase* other,
const SVGElement*) const {
return abs(value_ - To<SVGInteger>(other)->Value()); return abs(value_ - To<SVGInteger>(other)->Value());
} }
......
...@@ -52,16 +52,17 @@ class SVGInteger final : public SVGPropertyHelper<SVGInteger> { ...@@ -52,16 +52,17 @@ class SVGInteger final : public SVGPropertyHelper<SVGInteger> {
String ValueAsString() const override; String ValueAsString() const override;
SVGParsingError SetValueAsString(const String&); SVGParsingError SetValueAsString(const String&);
void Add(SVGPropertyBase*, SVGElement*) override; void Add(const SVGPropertyBase*, const SVGElement*) override;
void CalculateAnimatedValue(const SMILAnimationEffectParameters&, void CalculateAnimatedValue(
float percentage, const SMILAnimationEffectParameters&,
unsigned repeat_count, float percentage,
SVGPropertyBase* from, unsigned repeat_count,
SVGPropertyBase* to, const SVGPropertyBase* from,
SVGPropertyBase* to_at_end_of_duration_value, const SVGPropertyBase* to,
SVGElement* context_element) override; const SVGPropertyBase* to_at_end_of_duration_value,
float CalculateDistance(SVGPropertyBase* to, const SVGElement* context_element) override;
SVGElement* context_element) override; float CalculateDistance(const SVGPropertyBase* to,
const SVGElement* context_element) const override;
static AnimatedPropertyType ClassType() { return kAnimatedInteger; } static AnimatedPropertyType ClassType() { return kAnimatedInteger; }
......
...@@ -87,8 +87,8 @@ void SVGIntegerOptionalInteger::SetInitial(unsigned value) { ...@@ -87,8 +87,8 @@ void SVGIntegerOptionalInteger::SetInitial(unsigned value) {
second_integer_->SetInitial(value); second_integer_->SetInitial(value);
} }
void SVGIntegerOptionalInteger::Add(SVGPropertyBase* other, void SVGIntegerOptionalInteger::Add(const SVGPropertyBase* other,
SVGElement* context_element) { const SVGElement* context_element) {
auto* other_integer_optional_integer = To<SVGIntegerOptionalInteger>(other); auto* other_integer_optional_integer = To<SVGIntegerOptionalInteger>(other);
first_integer_->Add(other_integer_optional_integer->FirstInteger(), first_integer_->Add(other_integer_optional_integer->FirstInteger(),
context_element); context_element);
...@@ -100,10 +100,10 @@ void SVGIntegerOptionalInteger::CalculateAnimatedValue( ...@@ -100,10 +100,10 @@ void SVGIntegerOptionalInteger::CalculateAnimatedValue(
const SMILAnimationEffectParameters& parameters, const SMILAnimationEffectParameters& parameters,
float percentage, float percentage,
unsigned repeat_count, unsigned repeat_count,
SVGPropertyBase* from, const SVGPropertyBase* from,
SVGPropertyBase* to, const SVGPropertyBase* to,
SVGPropertyBase* to_at_end_of_duration, const SVGPropertyBase* to_at_end_of_duration,
SVGElement* context_element) { const SVGElement* context_element) {
auto* from_integer = To<SVGIntegerOptionalInteger>(from); auto* from_integer = To<SVGIntegerOptionalInteger>(from);
auto* to_integer = To<SVGIntegerOptionalInteger>(to); auto* to_integer = To<SVGIntegerOptionalInteger>(to);
auto* to_at_end_of_duration_integer = auto* to_at_end_of_duration_integer =
...@@ -119,8 +119,8 @@ void SVGIntegerOptionalInteger::CalculateAnimatedValue( ...@@ -119,8 +119,8 @@ void SVGIntegerOptionalInteger::CalculateAnimatedValue(
to_at_end_of_duration_integer->SecondInteger(), context_element); to_at_end_of_duration_integer->SecondInteger(), context_element);
} }
float SVGIntegerOptionalInteger::CalculateDistance(SVGPropertyBase* other, float SVGIntegerOptionalInteger::CalculateDistance(const SVGPropertyBase* other,
SVGElement*) { const SVGElement*) const {
// FIXME: Distance calculation is not possible for SVGIntegerOptionalInteger // FIXME: Distance calculation is not possible for SVGIntegerOptionalInteger
// right now. We need the distance for every single value. // right now. We need the distance for every single value.
return -1; return -1;
......
...@@ -55,16 +55,17 @@ class SVGIntegerOptionalInteger final : public SVGPropertyBase { ...@@ -55,16 +55,17 @@ class SVGIntegerOptionalInteger final : public SVGPropertyBase {
void SetInitial(unsigned); void SetInitial(unsigned);
static constexpr int kInitialValueBits = SVGInteger::kInitialValueBits; static constexpr int kInitialValueBits = SVGInteger::kInitialValueBits;
void Add(SVGPropertyBase*, SVGElement*) override; void Add(const SVGPropertyBase*, const SVGElement*) override;
void CalculateAnimatedValue(const SMILAnimationEffectParameters&, void CalculateAnimatedValue(
float percentage, const SMILAnimationEffectParameters&,
unsigned repeat_count, float percentage,
SVGPropertyBase* from, unsigned repeat_count,
SVGPropertyBase* to, const SVGPropertyBase* from,
SVGPropertyBase* to_at_end_of_duration_value, const SVGPropertyBase* to,
SVGElement* context_element) override; const SVGPropertyBase* to_at_end_of_duration_value,
float CalculateDistance(SVGPropertyBase* to, const SVGElement* context_element) override;
SVGElement* context_element) override; float CalculateDistance(const SVGPropertyBase* to,
const SVGElement* context_element) const override;
static AnimatedPropertyType ClassType() { static AnimatedPropertyType ClassType() {
return kAnimatedIntegerOptionalInteger; return kAnimatedIntegerOptionalInteger;
......
...@@ -312,7 +312,8 @@ bool SVGLength::NegativeValuesForbiddenForAnimatedLengthAttribute( ...@@ -312,7 +312,8 @@ bool SVGLength::NegativeValuesForbiddenForAnimatedLengthAttribute(
return no_negative_values_set.Contains(attr_name); return no_negative_values_set.Contains(attr_name);
} }
void SVGLength::Add(SVGPropertyBase* other, SVGElement* context_element) { void SVGLength::Add(const SVGPropertyBase* other,
const SVGElement* context_element) {
SVGLengthContext length_context(context_element); SVGLengthContext length_context(context_element);
SetValue(Value(length_context) + To<SVGLength>(other)->Value(length_context), SetValue(Value(length_context) + To<SVGLength>(other)->Value(length_context),
length_context); length_context);
...@@ -322,10 +323,10 @@ void SVGLength::CalculateAnimatedValue( ...@@ -322,10 +323,10 @@ void SVGLength::CalculateAnimatedValue(
const SMILAnimationEffectParameters& parameters, const SMILAnimationEffectParameters& parameters,
float percentage, float percentage,
unsigned repeat_count, unsigned repeat_count,
SVGPropertyBase* from_value, const SVGPropertyBase* from_value,
SVGPropertyBase* to_value, const SVGPropertyBase* to_value,
SVGPropertyBase* to_at_end_of_duration_value, const SVGPropertyBase* to_at_end_of_duration_value,
SVGElement* context_element) { const SVGElement* context_element) {
auto* from_length = To<SVGLength>(from_value); auto* from_length = To<SVGLength>(from_value);
auto* to_length = To<SVGLength>(to_value); auto* to_length = To<SVGLength>(to_value);
auto* to_at_end_of_duration_length = auto* to_at_end_of_duration_length =
...@@ -356,8 +357,8 @@ void SVGLength::CalculateAnimatedValue( ...@@ -356,8 +357,8 @@ void SVGLength::CalculateAnimatedValue(
value_ = CSSNumericLiteralValue::Create(animated_number, new_unit); value_ = CSSNumericLiteralValue::Create(animated_number, new_unit);
} }
float SVGLength::CalculateDistance(SVGPropertyBase* to_value, float SVGLength::CalculateDistance(const SVGPropertyBase* to_value,
SVGElement* context_element) { const SVGElement* context_element) const {
SVGLengthContext length_context(context_element); SVGLengthContext length_context(context_element);
auto* to_length = To<SVGLength>(to_value); auto* to_length = To<SVGLength>(to_value);
......
...@@ -126,16 +126,17 @@ class CORE_EXPORT SVGLength final : public SVGPropertyBase { ...@@ -126,16 +126,17 @@ class CORE_EXPORT SVGLength final : public SVGPropertyBase {
static bool NegativeValuesForbiddenForAnimatedLengthAttribute( static bool NegativeValuesForbiddenForAnimatedLengthAttribute(
const QualifiedName&); const QualifiedName&);
void Add(SVGPropertyBase*, SVGElement*) override; void Add(const SVGPropertyBase*, const SVGElement*) override;
void CalculateAnimatedValue(const SMILAnimationEffectParameters&, void CalculateAnimatedValue(
float percentage, const SMILAnimationEffectParameters&,
unsigned repeat_count, float percentage,
SVGPropertyBase* from, unsigned repeat_count,
SVGPropertyBase* to, const SVGPropertyBase* from,
SVGPropertyBase* to_at_end_of_duration_value, const SVGPropertyBase* to,
SVGElement* context_element) override; const SVGPropertyBase* to_at_end_of_duration_value,
float CalculateDistance(SVGPropertyBase* to, const SVGElement* context_element) override;
SVGElement* context_element) override; float CalculateDistance(const SVGPropertyBase* to,
const SVGElement* context_element) const override;
static AnimatedPropertyType ClassType() { return kAnimatedLength; } static AnimatedPropertyType ClassType() { return kAnimatedLength; }
AnimatedPropertyType GetType() const override { return ClassType(); } AnimatedPropertyType GetType() const override { return ClassType(); }
......
...@@ -79,7 +79,8 @@ SVGParsingError SVGLengthList::SetValueAsString(const String& value) { ...@@ -79,7 +79,8 @@ SVGParsingError SVGLengthList::SetValueAsString(const String& value) {
}); });
} }
void SVGLengthList::Add(SVGPropertyBase* other, SVGElement* context_element) { void SVGLengthList::Add(const SVGPropertyBase* other,
const SVGElement* context_element) {
auto* other_list = To<SVGLengthList>(other); auto* other_list = To<SVGLengthList>(other);
if (length() != other_list->length()) if (length() != other_list->length())
return; return;
...@@ -95,10 +96,10 @@ void SVGLengthList::CalculateAnimatedValue( ...@@ -95,10 +96,10 @@ void SVGLengthList::CalculateAnimatedValue(
const SMILAnimationEffectParameters& parameters, const SMILAnimationEffectParameters& parameters,
float percentage, float percentage,
unsigned repeat_count, unsigned repeat_count,
SVGPropertyBase* from_value, const SVGPropertyBase* from_value,
SVGPropertyBase* to_value, const SVGPropertyBase* to_value,
SVGPropertyBase* to_at_end_of_duration_value, const SVGPropertyBase* to_at_end_of_duration_value,
SVGElement* context_element) { const SVGElement* context_element) {
auto* from_list = To<SVGLengthList>(from_value); auto* from_list = To<SVGLengthList>(from_value);
auto* to_list = To<SVGLengthList>(to_value); auto* to_list = To<SVGLengthList>(to_value);
...@@ -115,18 +116,20 @@ void SVGLengthList::CalculateAnimatedValue( ...@@ -115,18 +116,20 @@ void SVGLengthList::CalculateAnimatedValue(
const bool needs_neutral_element = const bool needs_neutral_element =
!from_list_size || to_list_size != to_at_end_of_duration_list_size; !from_list_size || to_list_size != to_at_end_of_duration_list_size;
SVGLength* neutral = needs_neutral_element ? CreatePaddingItem() : nullptr; const SVGLength* neutral =
needs_neutral_element ? CreatePaddingItem() : nullptr;
for (uint32_t i = 0; i < to_list_size; ++i) { for (uint32_t i = 0; i < to_list_size; ++i) {
SVGLength* from = from_list_size ? from_list->at(i) : neutral; const SVGLength* from = from_list_size ? from_list->at(i) : neutral;
SVGLength* to_at_end = i < to_at_end_of_duration_list_size const SVGLength* to_at_end = i < to_at_end_of_duration_list_size
? to_at_end_of_duration_list->at(i) ? to_at_end_of_duration_list->at(i)
: neutral; : neutral;
at(i)->CalculateAnimatedValue(parameters, percentage, repeat_count, from, at(i)->CalculateAnimatedValue(parameters, percentage, repeat_count, from,
to_list->at(i), to_at_end, context_element); to_list->at(i), to_at_end, context_element);
} }
} }
float SVGLengthList::CalculateDistance(SVGPropertyBase* to, SVGElement*) { float SVGLengthList::CalculateDistance(const SVGPropertyBase* to,
const SVGElement*) const {
// FIXME: Distance calculation is not possible for SVGLengthList right now. We // FIXME: Distance calculation is not possible for SVGLengthList right now. We
// need the distance for every single value. // need the distance for every single value.
return -1; return -1;
......
...@@ -55,15 +55,17 @@ class SVGLengthList final ...@@ -55,15 +55,17 @@ class SVGLengthList final
SVGLengthList* Clone() override; SVGLengthList* Clone() override;
SVGLengthMode UnitMode() const { return mode_; } SVGLengthMode UnitMode() const { return mode_; }
void Add(SVGPropertyBase*, SVGElement*) override; void Add(const SVGPropertyBase*, const SVGElement*) override;
void CalculateAnimatedValue(const SMILAnimationEffectParameters&, void CalculateAnimatedValue(
float percentage, const SMILAnimationEffectParameters&,
unsigned repeat_count, float percentage,
SVGPropertyBase* from_value, unsigned repeat_count,
SVGPropertyBase* to_value, const SVGPropertyBase* from_value,
SVGPropertyBase* to_at_end_of_duration_value, const SVGPropertyBase* to_value,
SVGElement*) override; const SVGPropertyBase* to_at_end_of_duration_value,
float CalculateDistance(SVGPropertyBase* to, SVGElement*) override; const SVGElement*) override;
float CalculateDistance(const SVGPropertyBase* to,
const SVGElement*) const override;
static AnimatedPropertyType ClassType() { return kAnimatedLengthList; } static AnimatedPropertyType ClassType() { return kAnimatedLengthList; }
......
...@@ -70,7 +70,7 @@ SVGParsingError SVGNumber::SetValueAsString(const String& string) { ...@@ -70,7 +70,7 @@ SVGParsingError SVGNumber::SetValueAsString(const String& string) {
}); });
} }
void SVGNumber::Add(SVGPropertyBase* other, SVGElement*) { void SVGNumber::Add(const SVGPropertyBase* other, const SVGElement*) {
SetValue(value_ + To<SVGNumber>(other)->Value()); SetValue(value_ + To<SVGNumber>(other)->Value());
} }
...@@ -78,10 +78,10 @@ void SVGNumber::CalculateAnimatedValue( ...@@ -78,10 +78,10 @@ void SVGNumber::CalculateAnimatedValue(
const SMILAnimationEffectParameters& parameters, const SMILAnimationEffectParameters& parameters,
float percentage, float percentage,
unsigned repeat_count, unsigned repeat_count,
SVGPropertyBase* from, const SVGPropertyBase* from,
SVGPropertyBase* to, const SVGPropertyBase* to,
SVGPropertyBase* to_at_end_of_duration, const SVGPropertyBase* to_at_end_of_duration,
SVGElement*) { const SVGElement*) {
auto* from_number = To<SVGNumber>(from); auto* from_number = To<SVGNumber>(from);
auto* to_number = To<SVGNumber>(to); auto* to_number = To<SVGNumber>(to);
auto* to_at_end_of_duration_number = To<SVGNumber>(to_at_end_of_duration); auto* to_at_end_of_duration_number = To<SVGNumber>(to_at_end_of_duration);
...@@ -91,7 +91,8 @@ void SVGNumber::CalculateAnimatedValue( ...@@ -91,7 +91,8 @@ void SVGNumber::CalculateAnimatedValue(
to_at_end_of_duration_number->Value(), value_); to_at_end_of_duration_number->Value(), value_);
} }
float SVGNumber::CalculateDistance(SVGPropertyBase* other, SVGElement*) { float SVGNumber::CalculateDistance(const SVGPropertyBase* other,
const SVGElement*) const {
return fabsf(value_ - To<SVGNumber>(other)->Value()); return fabsf(value_ - To<SVGNumber>(other)->Value());
} }
......
...@@ -55,16 +55,17 @@ class SVGNumber : public SVGPropertyHelper<SVGNumber> { ...@@ -55,16 +55,17 @@ class SVGNumber : public SVGPropertyHelper<SVGNumber> {
String ValueAsString() const override; String ValueAsString() const override;
virtual SVGParsingError SetValueAsString(const String&); virtual SVGParsingError SetValueAsString(const String&);
void Add(SVGPropertyBase*, SVGElement*) override; void Add(const SVGPropertyBase*, const SVGElement*) override;
void CalculateAnimatedValue(const SMILAnimationEffectParameters&, void CalculateAnimatedValue(
float percentage, const SMILAnimationEffectParameters&,
unsigned repeat_count, float percentage,
SVGPropertyBase* from, unsigned repeat_count,
SVGPropertyBase* to, const SVGPropertyBase* from,
SVGPropertyBase* to_at_end_of_duration_value, const SVGPropertyBase* to,
SVGElement* context_element) override; const SVGPropertyBase* to_at_end_of_duration_value,
float CalculateDistance(SVGPropertyBase* to, const SVGElement* context_element) override;
SVGElement* context_element) override; float CalculateDistance(const SVGPropertyBase* to,
const SVGElement* context_element) const override;
static AnimatedPropertyType ClassType() { return kAnimatedNumber; } static AnimatedPropertyType ClassType() { return kAnimatedNumber; }
......
...@@ -58,7 +58,8 @@ SVGParsingError SVGNumberList::SetValueAsString(const String& value) { ...@@ -58,7 +58,8 @@ SVGParsingError SVGNumberList::SetValueAsString(const String& value) {
}); });
} }
void SVGNumberList::Add(SVGPropertyBase* other, SVGElement* context_element) { void SVGNumberList::Add(const SVGPropertyBase* other,
const SVGElement* context_element) {
auto* other_list = To<SVGNumberList>(other); auto* other_list = To<SVGNumberList>(other);
if (length() != other_list->length()) if (length() != other_list->length())
return; return;
...@@ -70,10 +71,10 @@ void SVGNumberList::CalculateAnimatedValue( ...@@ -70,10 +71,10 @@ void SVGNumberList::CalculateAnimatedValue(
const SMILAnimationEffectParameters& parameters, const SMILAnimationEffectParameters& parameters,
float percentage, float percentage,
unsigned repeat_count, unsigned repeat_count,
SVGPropertyBase* from_value, const SVGPropertyBase* from_value,
SVGPropertyBase* to_value, const SVGPropertyBase* to_value,
SVGPropertyBase* to_at_end_of_duration_value, const SVGPropertyBase* to_at_end_of_duration_value,
SVGElement* context_element) { const SVGElement* context_element) {
auto* from_list = To<SVGNumberList>(from_value); auto* from_list = To<SVGNumberList>(from_value);
auto* to_list = To<SVGNumberList>(to_value); auto* to_list = To<SVGNumberList>(to_value);
...@@ -90,18 +91,20 @@ void SVGNumberList::CalculateAnimatedValue( ...@@ -90,18 +91,20 @@ void SVGNumberList::CalculateAnimatedValue(
const bool needs_neutral_element = const bool needs_neutral_element =
!from_list_size || to_list_size != to_at_end_of_duration_list_size; !from_list_size || to_list_size != to_at_end_of_duration_list_size;
SVGNumber* neutral = needs_neutral_element ? CreatePaddingItem() : nullptr; const SVGNumber* neutral =
needs_neutral_element ? CreatePaddingItem() : nullptr;
for (uint32_t i = 0; i < to_list_size; ++i) { for (uint32_t i = 0; i < to_list_size; ++i) {
SVGNumber* from = from_list_size ? from_list->at(i) : neutral; const SVGNumber* from = from_list_size ? from_list->at(i) : neutral;
SVGNumber* to_at_end = i < to_at_end_of_duration_list_size const SVGNumber* to_at_end = i < to_at_end_of_duration_list_size
? to_at_end_of_duration_list->at(i) ? to_at_end_of_duration_list->at(i)
: neutral; : neutral;
at(i)->CalculateAnimatedValue(parameters, percentage, repeat_count, from, at(i)->CalculateAnimatedValue(parameters, percentage, repeat_count, from,
to_list->at(i), to_at_end, context_element); to_list->at(i), to_at_end, context_element);
} }
} }
float SVGNumberList::CalculateDistance(SVGPropertyBase* to, SVGElement*) { float SVGNumberList::CalculateDistance(const SVGPropertyBase* to,
const SVGElement*) const {
// FIXME: Distance calculation is not possible for SVGNumberList right now. We // FIXME: Distance calculation is not possible for SVGNumberList right now. We
// need the distance for every single value. // need the distance for every single value.
return -1; return -1;
......
...@@ -51,15 +51,17 @@ class SVGNumberList final ...@@ -51,15 +51,17 @@ class SVGNumberList final
SVGParsingError SetValueAsString(const String&); SVGParsingError SetValueAsString(const String&);
// SVGPropertyBase: // SVGPropertyBase:
void Add(SVGPropertyBase*, SVGElement*) override; void Add(const SVGPropertyBase*, const SVGElement*) override;
void CalculateAnimatedValue(const SMILAnimationEffectParameters&, void CalculateAnimatedValue(
float percentage, const SMILAnimationEffectParameters&,
unsigned repeat_count, float percentage,
SVGPropertyBase* from_value, unsigned repeat_count,
SVGPropertyBase* to_value, const SVGPropertyBase* from_value,
SVGPropertyBase* to_at_end_of_duration_value, const SVGPropertyBase* to_value,
SVGElement*) override; const SVGPropertyBase* to_at_end_of_duration_value,
float CalculateDistance(SVGPropertyBase* to, SVGElement*) override; const SVGElement*) override;
float CalculateDistance(const SVGPropertyBase* to,
const SVGElement*) const override;
static AnimatedPropertyType ClassType() { return kAnimatedNumberList; } static AnimatedPropertyType ClassType() { return kAnimatedNumberList; }
......
...@@ -89,8 +89,8 @@ void SVGNumberOptionalNumber::SetInitial(unsigned value) { ...@@ -89,8 +89,8 @@ void SVGNumberOptionalNumber::SetInitial(unsigned value) {
second_number_->SetInitial(value); second_number_->SetInitial(value);
} }
void SVGNumberOptionalNumber::Add(SVGPropertyBase* other, void SVGNumberOptionalNumber::Add(const SVGPropertyBase* other,
SVGElement* context_element) { const SVGElement* context_element) {
auto* other_number_optional_number = To<SVGNumberOptionalNumber>(other); auto* other_number_optional_number = To<SVGNumberOptionalNumber>(other);
first_number_->Add(other_number_optional_number->FirstNumber(), first_number_->Add(other_number_optional_number->FirstNumber(),
context_element); context_element);
...@@ -102,10 +102,10 @@ void SVGNumberOptionalNumber::CalculateAnimatedValue( ...@@ -102,10 +102,10 @@ void SVGNumberOptionalNumber::CalculateAnimatedValue(
const SMILAnimationEffectParameters& parameters, const SMILAnimationEffectParameters& parameters,
float percentage, float percentage,
unsigned repeat_count, unsigned repeat_count,
SVGPropertyBase* from, const SVGPropertyBase* from,
SVGPropertyBase* to, const SVGPropertyBase* to,
SVGPropertyBase* to_at_end_of_duration, const SVGPropertyBase* to_at_end_of_duration,
SVGElement* context_element) { const SVGElement* context_element) {
auto* from_number = To<SVGNumberOptionalNumber>(from); auto* from_number = To<SVGNumberOptionalNumber>(from);
auto* to_number = To<SVGNumberOptionalNumber>(to); auto* to_number = To<SVGNumberOptionalNumber>(to);
auto* to_at_end_of_duration_number = auto* to_at_end_of_duration_number =
...@@ -121,8 +121,8 @@ void SVGNumberOptionalNumber::CalculateAnimatedValue( ...@@ -121,8 +121,8 @@ void SVGNumberOptionalNumber::CalculateAnimatedValue(
context_element); context_element);
} }
float SVGNumberOptionalNumber::CalculateDistance(SVGPropertyBase* other, float SVGNumberOptionalNumber::CalculateDistance(const SVGPropertyBase* other,
SVGElement*) { const SVGElement*) const {
// FIXME: Distance calculation is not possible for SVGNumberOptionalNumber // FIXME: Distance calculation is not possible for SVGNumberOptionalNumber
// right now. We need the distance for every single value. // right now. We need the distance for every single value.
return -1; return -1;
......
...@@ -54,16 +54,17 @@ class SVGNumberOptionalNumber final : public SVGPropertyBase { ...@@ -54,16 +54,17 @@ class SVGNumberOptionalNumber final : public SVGPropertyBase {
void SetInitial(unsigned); void SetInitial(unsigned);
static constexpr int kInitialValueBits = SVGNumber::kInitialValueBits; static constexpr int kInitialValueBits = SVGNumber::kInitialValueBits;
void Add(SVGPropertyBase*, SVGElement*) override; void Add(const SVGPropertyBase*, const SVGElement*) override;
void CalculateAnimatedValue(const SMILAnimationEffectParameters&, void CalculateAnimatedValue(
float percentage, const SMILAnimationEffectParameters&,
unsigned repeat_count, float percentage,
SVGPropertyBase* from, unsigned repeat_count,
SVGPropertyBase* to, const SVGPropertyBase* from,
SVGPropertyBase* to_at_end_of_duration_value, const SVGPropertyBase* to,
SVGElement* context_element) override; const SVGPropertyBase* to_at_end_of_duration_value,
float CalculateDistance(SVGPropertyBase* to, const SVGElement* context_element) override;
SVGElement* context_element) override; float CalculateDistance(const SVGPropertyBase* to,
const SVGElement* context_element) const override;
static AnimatedPropertyType ClassType() { static AnimatedPropertyType ClassType() {
return kAnimatedNumberOptionalNumber; return kAnimatedNumberOptionalNumber;
......
...@@ -113,7 +113,7 @@ SVGPropertyBase* SVGPath::CloneForAnimation(const String& value) const { ...@@ -113,7 +113,7 @@ SVGPropertyBase* SVGPath::CloneForAnimation(const String& value) const {
MakeGarbageCollected<CSSPathValue>(std::move(byte_stream))); MakeGarbageCollected<CSSPathValue>(std::move(byte_stream)));
} }
void SVGPath::Add(SVGPropertyBase* other, SVGElement*) { void SVGPath::Add(const SVGPropertyBase* other, const SVGElement*) {
const auto& other_path_byte_stream = To<SVGPath>(other)->ByteStream(); const auto& other_path_byte_stream = To<SVGPath>(other)->ByteStream();
if (ByteStream().size() != other_path_byte_stream.size() || if (ByteStream().size() != other_path_byte_stream.size() ||
ByteStream().IsEmpty() || other_path_byte_stream.IsEmpty()) ByteStream().IsEmpty() || other_path_byte_stream.IsEmpty())
...@@ -127,10 +127,10 @@ void SVGPath::CalculateAnimatedValue( ...@@ -127,10 +127,10 @@ void SVGPath::CalculateAnimatedValue(
const SMILAnimationEffectParameters& parameters, const SMILAnimationEffectParameters& parameters,
float percentage, float percentage,
unsigned repeat_count, unsigned repeat_count,
SVGPropertyBase* from_value, const SVGPropertyBase* from_value,
SVGPropertyBase* to_value, const SVGPropertyBase* to_value,
SVGPropertyBase* to_at_end_of_duration_value, const SVGPropertyBase* to_at_end_of_duration_value,
SVGElement*) { const SVGElement*) {
const auto& to = To<SVGPath>(*to_value); const auto& to = To<SVGPath>(*to_value);
const SVGPathByteStream& to_stream = to.ByteStream(); const SVGPathByteStream& to_stream = to.ByteStream();
...@@ -175,7 +175,8 @@ void SVGPath::CalculateAnimatedValue( ...@@ -175,7 +175,8 @@ void SVGPath::CalculateAnimatedValue(
path_value_ = MakeGarbageCollected<CSSPathValue>(std::move(new_stream)); path_value_ = MakeGarbageCollected<CSSPathValue>(std::move(new_stream));
} }
float SVGPath::CalculateDistance(SVGPropertyBase* to, SVGElement*) { float SVGPath::CalculateDistance(const SVGPropertyBase* to,
const SVGElement*) const {
// FIXME: Support paced animations. // FIXME: Support paced animations.
return -1; return -1;
} }
......
...@@ -59,15 +59,17 @@ class SVGPath final : public SVGPropertyBase { ...@@ -59,15 +59,17 @@ class SVGPath final : public SVGPropertyBase {
String ValueAsString() const override; String ValueAsString() const override;
SVGParsingError SetValueAsString(const String&); SVGParsingError SetValueAsString(const String&);
void Add(SVGPropertyBase*, SVGElement*) override; void Add(const SVGPropertyBase*, const SVGElement*) override;
void CalculateAnimatedValue(const SMILAnimationEffectParameters&, void CalculateAnimatedValue(
float percentage, const SMILAnimationEffectParameters&,
unsigned repeat_count, float percentage,
SVGPropertyBase* from_value, unsigned repeat_count,
SVGPropertyBase* to_value, const SVGPropertyBase* from_value,
SVGPropertyBase* to_at_end_of_duration_value, const SVGPropertyBase* to_value,
SVGElement*) override; const SVGPropertyBase* to_at_end_of_duration_value,
float CalculateDistance(SVGPropertyBase* to, SVGElement*) override; const SVGElement*) override;
float CalculateDistance(const SVGPropertyBase* to,
const SVGElement*) const override;
static AnimatedPropertyType ClassType() { return kAnimatedPath; } static AnimatedPropertyType ClassType() { return kAnimatedPath; }
AnimatedPropertyType GetType() const override { return ClassType(); } AnimatedPropertyType GetType() const override { return ClassType(); }
......
...@@ -89,7 +89,7 @@ String SVGPoint::ValueAsString() const { ...@@ -89,7 +89,7 @@ String SVGPoint::ValueAsString() const {
return builder.ToString(); return builder.ToString();
} }
void SVGPoint::Add(SVGPropertyBase* other, SVGElement*) { void SVGPoint::Add(const SVGPropertyBase* other, const SVGElement*) {
// SVGPoint is not animated by itself // SVGPoint is not animated by itself
NOTREACHED(); NOTREACHED();
} }
...@@ -98,16 +98,16 @@ void SVGPoint::CalculateAnimatedValue( ...@@ -98,16 +98,16 @@ void SVGPoint::CalculateAnimatedValue(
const SMILAnimationEffectParameters&, const SMILAnimationEffectParameters&,
float percentage, float percentage,
unsigned repeat_count, unsigned repeat_count,
SVGPropertyBase* from_value, const SVGPropertyBase* from_value,
SVGPropertyBase* to_value, const SVGPropertyBase* to_value,
SVGPropertyBase* to_at_end_of_duration_value, const SVGPropertyBase* to_at_end_of_duration_value,
SVGElement*) { const SVGElement*) {
// SVGPoint is not animated by itself // SVGPoint is not animated by itself
NOTREACHED(); NOTREACHED();
} }
float SVGPoint::CalculateDistance(SVGPropertyBase* to, float SVGPoint::CalculateDistance(const SVGPropertyBase* to,
SVGElement* context_element) { const SVGElement* context_element) const {
// SVGPoint is not animated by itself // SVGPoint is not animated by itself
NOTREACHED(); NOTREACHED();
return 0.0f; return 0.0f;
......
...@@ -63,16 +63,17 @@ class SVGPoint final : public SVGPropertyHelper<SVGPoint> { ...@@ -63,16 +63,17 @@ class SVGPoint final : public SVGPropertyHelper<SVGPoint> {
String ValueAsString() const override; String ValueAsString() const override;
SVGParsingError SetValueAsString(const String&); SVGParsingError SetValueAsString(const String&);
void Add(SVGPropertyBase*, SVGElement*) override; void Add(const SVGPropertyBase*, const SVGElement*) override;
void CalculateAnimatedValue(const SMILAnimationEffectParameters&, void CalculateAnimatedValue(
float percentage, const SMILAnimationEffectParameters&,
unsigned repeat_count, float percentage,
SVGPropertyBase* from, unsigned repeat_count,
SVGPropertyBase* to, const SVGPropertyBase* from,
SVGPropertyBase* to_at_end_of_duration_value, const SVGPropertyBase* to,
SVGElement* context_element) override; const SVGPropertyBase* to_at_end_of_duration_value,
float CalculateDistance(SVGPropertyBase* to, const SVGElement* context_element) override;
SVGElement* context_element) override; float CalculateDistance(const SVGPropertyBase* to,
const SVGElement* context_element) const override;
static AnimatedPropertyType ClassType() { return kAnimatedPoint; } static AnimatedPropertyType ClassType() { return kAnimatedPoint; }
......
...@@ -73,7 +73,8 @@ SVGParsingError SVGPointList::SetValueAsString(const String& value) { ...@@ -73,7 +73,8 @@ SVGParsingError SVGPointList::SetValueAsString(const String& value) {
}); });
} }
void SVGPointList::Add(SVGPropertyBase* other, SVGElement* context_element) { void SVGPointList::Add(const SVGPropertyBase* other,
const SVGElement* context_element) {
auto* other_list = To<SVGPointList>(other); auto* other_list = To<SVGPointList>(other);
if (length() != other_list->length()) if (length() != other_list->length())
...@@ -87,10 +88,10 @@ void SVGPointList::CalculateAnimatedValue( ...@@ -87,10 +88,10 @@ void SVGPointList::CalculateAnimatedValue(
const SMILAnimationEffectParameters& parameters, const SMILAnimationEffectParameters& parameters,
float percentage, float percentage,
unsigned repeat_count, unsigned repeat_count,
SVGPropertyBase* from_value, const SVGPropertyBase* from_value,
SVGPropertyBase* to_value, const SVGPropertyBase* to_value,
SVGPropertyBase* to_at_end_of_duration_value, const SVGPropertyBase* to_at_end_of_duration_value,
SVGElement* context_element) { const SVGElement* context_element) {
auto* from_list = To<SVGPointList>(from_value); auto* from_list = To<SVGPointList>(from_value);
auto* to_list = To<SVGPointList>(to_value); auto* to_list = To<SVGPointList>(to_value);
auto* to_at_end_of_duration_list = auto* to_at_end_of_duration_list =
...@@ -126,7 +127,8 @@ void SVGPointList::CalculateAnimatedValue( ...@@ -126,7 +127,8 @@ void SVGPointList::CalculateAnimatedValue(
} }
} }
float SVGPointList::CalculateDistance(SVGPropertyBase* to, SVGElement*) { float SVGPointList::CalculateDistance(const SVGPropertyBase* to,
const SVGElement*) const {
// FIXME: Distance calculation is not possible for SVGPointList right now. We // FIXME: Distance calculation is not possible for SVGPointList right now. We
// need the distance for every single value. // need the distance for every single value.
return -1; return -1;
......
...@@ -51,15 +51,17 @@ class SVGPointList final ...@@ -51,15 +51,17 @@ class SVGPointList final
SVGParsingError SetValueAsString(const String&); SVGParsingError SetValueAsString(const String&);
// SVGPropertyBase: // SVGPropertyBase:
void Add(SVGPropertyBase*, SVGElement*) override; void Add(const SVGPropertyBase*, const SVGElement*) override;
void CalculateAnimatedValue(const SMILAnimationEffectParameters&, void CalculateAnimatedValue(
float percentage, const SMILAnimationEffectParameters&,
unsigned repeat_count, float percentage,
SVGPropertyBase* from_value, unsigned repeat_count,
SVGPropertyBase* to_value, const SVGPropertyBase* from_value,
SVGPropertyBase* to_at_end_of_duration_value, const SVGPropertyBase* to_value,
SVGElement*) override; const SVGPropertyBase* to_at_end_of_duration_value,
float CalculateDistance(SVGPropertyBase* to, SVGElement*) override; const SVGElement*) override;
float CalculateDistance(const SVGPropertyBase* to,
const SVGElement*) const override;
static AnimatedPropertyType ClassType() { return kAnimatedPoints; } static AnimatedPropertyType ClassType() { return kAnimatedPoints; }
......
...@@ -430,7 +430,8 @@ String SVGPreserveAspectRatio::ValueAsString() const { ...@@ -430,7 +430,8 @@ String SVGPreserveAspectRatio::ValueAsString() const {
return builder.ToString(); return builder.ToString();
} }
void SVGPreserveAspectRatio::Add(SVGPropertyBase* other, SVGElement*) { void SVGPreserveAspectRatio::Add(const SVGPropertyBase* other,
const SVGElement*) {
NOTREACHED(); NOTREACHED();
} }
...@@ -438,15 +439,16 @@ void SVGPreserveAspectRatio::CalculateAnimatedValue( ...@@ -438,15 +439,16 @@ void SVGPreserveAspectRatio::CalculateAnimatedValue(
const SMILAnimationEffectParameters&, const SMILAnimationEffectParameters&,
float percentage, float percentage,
unsigned repeat_count, unsigned repeat_count,
SVGPropertyBase* from_value, const SVGPropertyBase* from_value,
SVGPropertyBase* to_value, const SVGPropertyBase* to_value,
SVGPropertyBase*, const SVGPropertyBase*,
SVGElement*) { const SVGElement*) {
NOTREACHED(); NOTREACHED();
} }
float SVGPreserveAspectRatio::CalculateDistance(SVGPropertyBase* to_value, float SVGPreserveAspectRatio::CalculateDistance(
SVGElement* context_element) { const SVGPropertyBase* to_value,
const SVGElement* context_element) const {
// No paced animations for SVGPreserveAspectRatio. // No paced animations for SVGPreserveAspectRatio.
return -1; return -1;
} }
......
...@@ -86,16 +86,17 @@ class SVGPreserveAspectRatio final ...@@ -86,16 +86,17 @@ class SVGPreserveAspectRatio final
bool Parse(const UChar*& ptr, const UChar* end, bool validate); bool Parse(const UChar*& ptr, const UChar* end, bool validate);
bool Parse(const LChar*& ptr, const LChar* end, bool validate); bool Parse(const LChar*& ptr, const LChar* end, bool validate);
void Add(SVGPropertyBase*, SVGElement*) override; void Add(const SVGPropertyBase*, const SVGElement*) override;
void CalculateAnimatedValue(const SMILAnimationEffectParameters&, void CalculateAnimatedValue(
float percentage, const SMILAnimationEffectParameters&,
unsigned repeat_count, float percentage,
SVGPropertyBase* from, unsigned repeat_count,
SVGPropertyBase* to, const SVGPropertyBase* from,
SVGPropertyBase* to_at_end_of_duration_value, const SVGPropertyBase* to,
SVGElement* context_element) override; const SVGPropertyBase* to_at_end_of_duration_value,
float CalculateDistance(SVGPropertyBase* to, const SVGElement* context_element) override;
SVGElement* context_element) override; float CalculateDistance(const SVGPropertyBase* to,
const SVGElement* context_element) const override;
static AnimatedPropertyType ClassType() { static AnimatedPropertyType ClassType() {
return kAnimatedPreserveAspectRatio; return kAnimatedPreserveAspectRatio;
......
...@@ -86,7 +86,7 @@ String SVGRect::ValueAsString() const { ...@@ -86,7 +86,7 @@ String SVGRect::ValueAsString() const {
return builder.ToString(); return builder.ToString();
} }
void SVGRect::Add(SVGPropertyBase* other, SVGElement*) { void SVGRect::Add(const SVGPropertyBase* other, const SVGElement*) {
value_ += To<SVGRect>(other)->Value(); value_ += To<SVGRect>(other)->Value();
} }
...@@ -94,10 +94,10 @@ void SVGRect::CalculateAnimatedValue( ...@@ -94,10 +94,10 @@ void SVGRect::CalculateAnimatedValue(
const SMILAnimationEffectParameters& parameters, const SMILAnimationEffectParameters& parameters,
float percentage, float percentage,
unsigned repeat_count, unsigned repeat_count,
SVGPropertyBase* from_value, const SVGPropertyBase* from_value,
SVGPropertyBase* to_value, const SVGPropertyBase* to_value,
SVGPropertyBase* to_at_end_of_duration_value, const SVGPropertyBase* to_at_end_of_duration_value,
SVGElement*) { const SVGElement*) {
auto* from_rect = To<SVGRect>(from_value); auto* from_rect = To<SVGRect>(from_value);
auto* to_rect = To<SVGRect>(to_value); auto* to_rect = To<SVGRect>(to_value);
auto* to_at_end_of_duration_rect = To<SVGRect>(to_at_end_of_duration_value); auto* to_at_end_of_duration_rect = To<SVGRect>(to_at_end_of_duration_value);
...@@ -122,8 +122,8 @@ void SVGRect::CalculateAnimatedValue( ...@@ -122,8 +122,8 @@ void SVGRect::CalculateAnimatedValue(
value_ = FloatRect(animated_x, animated_y, animated_width, animated_height); value_ = FloatRect(animated_x, animated_y, animated_width, animated_height);
} }
float SVGRect::CalculateDistance(SVGPropertyBase* to, float SVGRect::CalculateDistance(const SVGPropertyBase* to,
SVGElement* context_element) { const SVGElement* context_element) const {
// FIXME: Distance calculation is not possible for SVGRect right now. We need // FIXME: Distance calculation is not possible for SVGRect right now. We need
// the distance for every single value. // the distance for every single value.
return -1; return -1;
......
...@@ -60,16 +60,17 @@ class SVGRect final : public SVGPropertyHelper<SVGRect> { ...@@ -60,16 +60,17 @@ class SVGRect final : public SVGPropertyHelper<SVGRect> {
String ValueAsString() const override; String ValueAsString() const override;
SVGParsingError SetValueAsString(const String&); SVGParsingError SetValueAsString(const String&);
void Add(SVGPropertyBase*, SVGElement*) override; void Add(const SVGPropertyBase*, const SVGElement*) override;
void CalculateAnimatedValue(const SMILAnimationEffectParameters&, void CalculateAnimatedValue(
float percentage, const SMILAnimationEffectParameters&,
unsigned repeat_count, float percentage,
SVGPropertyBase* from, unsigned repeat_count,
SVGPropertyBase* to, const SVGPropertyBase* from,
SVGPropertyBase* to_at_end_of_duration_value, const SVGPropertyBase* to,
SVGElement* context_element) override; const SVGPropertyBase* to_at_end_of_duration_value,
float CalculateDistance(SVGPropertyBase* to, const SVGElement* context_element) override;
SVGElement* context_element) override; float CalculateDistance(const SVGPropertyBase* to,
const SVGElement* context_element) const override;
bool IsValid() const { return is_valid_; } bool IsValid() const { return is_valid_; }
void SetInvalid(); void SetInvalid();
......
...@@ -21,21 +21,22 @@ ...@@ -21,21 +21,22 @@
namespace blink { namespace blink {
void SVGString::Add(SVGPropertyBase*, SVGElement*) { void SVGString::Add(const SVGPropertyBase*, const SVGElement*) {
NOTREACHED(); NOTREACHED();
} }
void SVGString::CalculateAnimatedValue(const SMILAnimationEffectParameters&, void SVGString::CalculateAnimatedValue(const SMILAnimationEffectParameters&,
float percentage, float percentage,
unsigned repeat_count, unsigned repeat_count,
SVGPropertyBase* from, const SVGPropertyBase* from,
SVGPropertyBase* to, const SVGPropertyBase* to,
SVGPropertyBase*, const SVGPropertyBase*,
SVGElement*) { const SVGElement*) {
NOTREACHED(); NOTREACHED();
} }
float SVGString::CalculateDistance(SVGPropertyBase*, SVGElement*) { float SVGString::CalculateDistance(const SVGPropertyBase*,
const SVGElement*) const {
// No paced animations for strings. // No paced animations for strings.
return -1; return -1;
} }
......
...@@ -57,15 +57,17 @@ class SVGString final : public SVGPropertyBase { ...@@ -57,15 +57,17 @@ class SVGString final : public SVGPropertyBase {
return SVGParseStatus::kNoError; return SVGParseStatus::kNoError;
} }
void Add(SVGPropertyBase*, SVGElement*) override; void Add(const SVGPropertyBase*, const SVGElement*) override;
void CalculateAnimatedValue(const SMILAnimationEffectParameters&, void CalculateAnimatedValue(
float percentage, const SMILAnimationEffectParameters&,
unsigned repeat_count, float percentage,
SVGPropertyBase* from, unsigned repeat_count,
SVGPropertyBase* to, const SVGPropertyBase* from,
SVGPropertyBase* to_at_end_of_duration_value, const SVGPropertyBase* to,
SVGElement*) override; const SVGPropertyBase* to_at_end_of_duration_value,
float CalculateDistance(SVGPropertyBase* to, SVGElement*) override; const SVGElement*) override;
float CalculateDistance(const SVGPropertyBase* to,
const SVGElement*) const override;
const String& Value() const { return value_; } const String& Value() const { return value_; }
void SetValue(const String& value) { value_ = value; } void SetValue(const String& value) { value_ = value; }
......
...@@ -100,8 +100,8 @@ String SVGStringListBase::ValueAsStringWithDelimiter( ...@@ -100,8 +100,8 @@ String SVGStringListBase::ValueAsStringWithDelimiter(
return builder.ToString(); return builder.ToString();
} }
void SVGStringListBase::Add(SVGPropertyBase* other, void SVGStringListBase::Add(const SVGPropertyBase* other,
SVGElement* context_element) { const SVGElement* context_element) {
// SVGStringList is never animated. // SVGStringList is never animated.
NOTREACHED(); NOTREACHED();
} }
...@@ -110,15 +110,16 @@ void SVGStringListBase::CalculateAnimatedValue( ...@@ -110,15 +110,16 @@ void SVGStringListBase::CalculateAnimatedValue(
const SMILAnimationEffectParameters&, const SMILAnimationEffectParameters&,
float, float,
unsigned, unsigned,
SVGPropertyBase*, const SVGPropertyBase*,
SVGPropertyBase*, const SVGPropertyBase*,
SVGPropertyBase*, const SVGPropertyBase*,
SVGElement*) { const SVGElement*) {
// SVGStringList is never animated. // SVGStringList is never animated.
NOTREACHED(); NOTREACHED();
} }
float SVGStringListBase::CalculateDistance(SVGPropertyBase*, SVGElement*) { float SVGStringListBase::CalculateDistance(const SVGPropertyBase*,
const SVGElement*) const {
// SVGStringList is never animated. // SVGStringList is never animated.
NOTREACHED(); NOTREACHED();
return -1.0f; return -1.0f;
......
...@@ -70,15 +70,17 @@ class SVGStringListBase : public SVGPropertyBase { ...@@ -70,15 +70,17 @@ class SVGStringListBase : public SVGPropertyBase {
virtual SVGParsingError SetValueAsString(const String&) = 0; virtual SVGParsingError SetValueAsString(const String&) = 0;
// SVGPropertyBase: // SVGPropertyBase:
void Add(SVGPropertyBase*, SVGElement*) override; void Add(const SVGPropertyBase*, const SVGElement*) override;
void CalculateAnimatedValue(const SMILAnimationEffectParameters&, void CalculateAnimatedValue(
float percentage, const SMILAnimationEffectParameters&,
unsigned repeat_count, float percentage,
SVGPropertyBase* from_value, unsigned repeat_count,
SVGPropertyBase* to_value, const SVGPropertyBase* from_value,
SVGPropertyBase* to_at_end_of_duration_value, const SVGPropertyBase* to_value,
SVGElement*) override; const SVGPropertyBase* to_at_end_of_duration_value,
float CalculateDistance(SVGPropertyBase* to, SVGElement*) override; const SVGElement*) override;
float CalculateDistance(const SVGPropertyBase* to,
const SVGElement*) const override;
static AnimatedPropertyType ClassType() { return kAnimatedStringList; } static AnimatedPropertyType ClassType() { return kAnimatedStringList; }
......
...@@ -217,7 +217,7 @@ String SVGTransform::ValueAsString() const { ...@@ -217,7 +217,7 @@ String SVGTransform::ValueAsString() const {
return builder.ToString(); return builder.ToString();
} }
void SVGTransform::Add(SVGPropertyBase*, SVGElement*) { void SVGTransform::Add(const SVGPropertyBase*, const SVGElement*) {
// SVGTransform is not animated by itself. // SVGTransform is not animated by itself.
NOTREACHED(); NOTREACHED();
} }
...@@ -225,15 +225,16 @@ void SVGTransform::Add(SVGPropertyBase*, SVGElement*) { ...@@ -225,15 +225,16 @@ void SVGTransform::Add(SVGPropertyBase*, SVGElement*) {
void SVGTransform::CalculateAnimatedValue(const SMILAnimationEffectParameters&, void SVGTransform::CalculateAnimatedValue(const SMILAnimationEffectParameters&,
float, float,
unsigned, unsigned,
SVGPropertyBase*, const SVGPropertyBase*,
SVGPropertyBase*, const SVGPropertyBase*,
SVGPropertyBase*, const SVGPropertyBase*,
SVGElement*) { const SVGElement*) {
// SVGTransform is not animated by itself. // SVGTransform is not animated by itself.
NOTREACHED(); NOTREACHED();
} }
float SVGTransform::CalculateDistance(SVGPropertyBase*, SVGElement*) { float SVGTransform::CalculateDistance(const SVGPropertyBase*,
const SVGElement*) const {
// SVGTransform is not animated by itself. // SVGTransform is not animated by itself.
NOTREACHED(); NOTREACHED();
......
...@@ -88,16 +88,17 @@ class SVGTransform final : public SVGPropertyBase { ...@@ -88,16 +88,17 @@ class SVGTransform final : public SVGPropertyBase {
String ValueAsString() const override; String ValueAsString() const override;
void Add(SVGPropertyBase*, SVGElement*) override; void Add(const SVGPropertyBase*, const SVGElement*) override;
void CalculateAnimatedValue(const SMILAnimationEffectParameters&, void CalculateAnimatedValue(
float percentage, const SMILAnimationEffectParameters&,
unsigned repeat_count, float percentage,
SVGPropertyBase* from, unsigned repeat_count,
SVGPropertyBase* to, const SVGPropertyBase* from,
SVGPropertyBase* to_at_end_of_duration_value, const SVGPropertyBase* to,
SVGElement* context_element) override; const SVGPropertyBase* to_at_end_of_duration_value,
float CalculateDistance(SVGPropertyBase* to, const SVGElement* context_element) override;
SVGElement* context_element) override; float CalculateDistance(const SVGPropertyBase* to,
const SVGElement* context_element) const override;
static AnimatedPropertyType ClassType() { return kAnimatedTransform; } static AnimatedPropertyType ClassType() { return kAnimatedTransform; }
AnimatedPropertyType GetType() const override { return ClassType(); } AnimatedPropertyType GetType() const override { return ClassType(); }
......
...@@ -41,8 +41,9 @@ SVGTransformDistance::SVGTransformDistance(SVGTransformType transform_type, ...@@ -41,8 +41,9 @@ SVGTransformDistance::SVGTransformDistance(SVGTransformType transform_type,
cy_(cy), cy_(cy),
transform_(transform) {} transform_(transform) {}
SVGTransformDistance::SVGTransformDistance(SVGTransform* from_svg_transform, SVGTransformDistance::SVGTransformDistance(
SVGTransform* to_svg_transform) const SVGTransform* from_svg_transform,
const SVGTransform* to_svg_transform)
: angle_(0), cx_(0), cy_(0) { : angle_(0), cx_(0), cy_(0) {
transform_type_ = from_svg_transform->TransformType(); transform_type_ = from_svg_transform->TransformType();
DCHECK_EQ(transform_type_, to_svg_transform->TransformType()); DCHECK_EQ(transform_type_, to_svg_transform->TransformType());
...@@ -116,8 +117,8 @@ SVGTransformDistance SVGTransformDistance::ScaledDistance( ...@@ -116,8 +117,8 @@ SVGTransformDistance SVGTransformDistance::ScaledDistance(
return SVGTransformDistance(); return SVGTransformDistance();
} }
SVGTransform* SVGTransformDistance::AddSVGTransforms(SVGTransform* first, SVGTransform* SVGTransformDistance::AddSVGTransforms(const SVGTransform* first,
SVGTransform* second, const SVGTransform* second,
unsigned repeat_count) { unsigned repeat_count) {
DCHECK_EQ(first->TransformType(), second->TransformType()); DCHECK_EQ(first->TransformType(), second->TransformType());
...@@ -164,7 +165,7 @@ SVGTransform* SVGTransformDistance::AddSVGTransforms(SVGTransform* first, ...@@ -164,7 +165,7 @@ SVGTransform* SVGTransformDistance::AddSVGTransforms(SVGTransform* first,
} }
SVGTransform* SVGTransformDistance::AddToSVGTransform( SVGTransform* SVGTransformDistance::AddToSVGTransform(
SVGTransform* transform) const { const SVGTransform* transform) const {
DCHECK(transform_type_ == transform->TransformType() || DCHECK(transform_type_ == transform->TransformType() ||
transform_type_ == SVGTransformType::kUnknown); transform_type_ == SVGTransformType::kUnknown);
......
...@@ -32,14 +32,14 @@ class SVGTransformDistance { ...@@ -32,14 +32,14 @@ class SVGTransformDistance {
public: public:
SVGTransformDistance(); SVGTransformDistance();
SVGTransformDistance(SVGTransform* from_transform, SVGTransformDistance(const SVGTransform* from_transform,
SVGTransform* to_transform); const SVGTransform* to_transform);
SVGTransformDistance ScaledDistance(float scale_factor) const; SVGTransformDistance ScaledDistance(float scale_factor) const;
SVGTransform* AddToSVGTransform(SVGTransform*) const; SVGTransform* AddToSVGTransform(const SVGTransform*) const;
static SVGTransform* AddSVGTransforms(SVGTransform*, static SVGTransform* AddSVGTransforms(const SVGTransform*,
SVGTransform*, const SVGTransform*,
unsigned repeat_count = 1); unsigned repeat_count = 1);
float Distance() const; float Distance() const;
......
...@@ -391,8 +391,8 @@ SVGPropertyBase* SVGTransformList::CloneForAnimation( ...@@ -391,8 +391,8 @@ SVGPropertyBase* SVGTransformList::CloneForAnimation(
return SVGListPropertyHelper::CloneForAnimation(value); return SVGListPropertyHelper::CloneForAnimation(value);
} }
void SVGTransformList::Add(SVGPropertyBase* other, void SVGTransformList::Add(const SVGPropertyBase* other,
SVGElement* context_element) { const SVGElement* context_element) {
if (IsEmpty()) if (IsEmpty())
return; return;
...@@ -401,8 +401,8 @@ void SVGTransformList::Add(SVGPropertyBase* other, ...@@ -401,8 +401,8 @@ void SVGTransformList::Add(SVGPropertyBase* other,
return; return;
DCHECK_EQ(length(), 1u); DCHECK_EQ(length(), 1u);
SVGTransform* from_transform = at(0); const SVGTransform* from_transform = at(0);
SVGTransform* to_transform = other_list->at(0); const SVGTransform* to_transform = other_list->at(0);
DCHECK_EQ(from_transform->TransformType(), to_transform->TransformType()); DCHECK_EQ(from_transform->TransformType(), to_transform->TransformType());
Clear(); Clear();
...@@ -413,10 +413,10 @@ void SVGTransformList::CalculateAnimatedValue( ...@@ -413,10 +413,10 @@ void SVGTransformList::CalculateAnimatedValue(
const SMILAnimationEffectParameters& parameters, const SMILAnimationEffectParameters& parameters,
float percentage, float percentage,
unsigned repeat_count, unsigned repeat_count,
SVGPropertyBase* from_value, const SVGPropertyBase* from_value,
SVGPropertyBase* to_value, const SVGPropertyBase* to_value,
SVGPropertyBase* to_at_end_of_duration_value, const SVGPropertyBase* to_at_end_of_duration_value,
SVGElement* context_element) { const SVGElement* context_element) {
// Spec: To animations provide specific functionality to get a smooth change // Spec: To animations provide specific functionality to get a smooth change
// from the underlying value to the 'to' attribute value, which conflicts // from the underlying value to the 'to' attribute value, which conflicts
// mathematically with the requirement for additive transform animations to be // mathematically with the requirement for additive transform animations to be
...@@ -434,8 +434,8 @@ void SVGTransformList::CalculateAnimatedValue( ...@@ -434,8 +434,8 @@ void SVGTransformList::CalculateAnimatedValue(
// Get a reference to the from value before potentially cleaning it out (in // Get a reference to the from value before potentially cleaning it out (in
// the case of a To animation.) // the case of a To animation.)
SVGTransform* to_transform = to_list->at(0); const SVGTransform* to_transform = to_list->at(0);
SVGTransform* effective_from = nullptr; const SVGTransform* effective_from = nullptr;
// If there's an existing 'from'/underlying value of the same type use that, // If there's an existing 'from'/underlying value of the same type use that,
// else use a "zero transform". // else use a "zero transform".
if (from_list->length() && if (from_list->length() &&
...@@ -452,7 +452,7 @@ void SVGTransformList::CalculateAnimatedValue( ...@@ -452,7 +452,7 @@ void SVGTransformList::CalculateAnimatedValue(
// Handle accumulation. // Handle accumulation.
if (repeat_count && parameters.is_cumulative) { if (repeat_count && parameters.is_cumulative) {
SVGTransform* effective_to_at_end = const SVGTransform* effective_to_at_end =
!to_at_end_of_duration_list->IsEmpty() !to_at_end_of_duration_list->IsEmpty()
? to_at_end_of_duration_list->at(0) ? to_at_end_of_duration_list->at(0)
: MakeGarbageCollected<SVGTransform>( : MakeGarbageCollected<SVGTransform>(
...@@ -473,8 +473,8 @@ void SVGTransformList::CalculateAnimatedValue( ...@@ -473,8 +473,8 @@ void SVGTransformList::CalculateAnimatedValue(
Append(current_transform); Append(current_transform);
} }
float SVGTransformList::CalculateDistance(SVGPropertyBase* to_value, float SVGTransformList::CalculateDistance(const SVGPropertyBase* to_value,
SVGElement*) { const SVGElement*) const {
// FIXME: This is not correct in all cases. The spec demands that each // FIXME: This is not correct in all cases. The spec demands that each
// component (translate x and y for example) is paced separately. To implement // component (translate x and y for example) is paced separately. To implement
// this we need to treat each component as individual animation everywhere. // this we need to treat each component as individual animation everywhere.
......
...@@ -58,15 +58,17 @@ class SVGTransformList final ...@@ -58,15 +58,17 @@ class SVGTransformList final
bool Parse(const UChar*& ptr, const UChar* end); bool Parse(const UChar*& ptr, const UChar* end);
bool Parse(const LChar*& ptr, const LChar* end); bool Parse(const LChar*& ptr, const LChar* end);
void Add(SVGPropertyBase*, SVGElement*) override; void Add(const SVGPropertyBase*, const SVGElement*) override;
void CalculateAnimatedValue(const SMILAnimationEffectParameters&, void CalculateAnimatedValue(
float percentage, const SMILAnimationEffectParameters&,
unsigned repeat_count, float percentage,
SVGPropertyBase* from_value, unsigned repeat_count,
SVGPropertyBase* to_value, const SVGPropertyBase* from_value,
SVGPropertyBase* to_at_end_of_duration_value, const SVGPropertyBase* to_value,
SVGElement*) override; const SVGPropertyBase* to_at_end_of_duration_value,
float CalculateDistance(SVGPropertyBase* to, SVGElement*) override; const SVGElement*) override;
float CalculateDistance(const SVGPropertyBase* to,
const SVGElement*) const override;
static AnimatedPropertyType ClassType() { return kAnimatedTransformList; } static AnimatedPropertyType ClassType() { return kAnimatedTransformList; }
......
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