Skip to content

Commit

Permalink
Drop SVGAnimatedPropertyBase::AnimationEnded()
Browse files Browse the repository at this point in the history
For all practical reasons this does exactly the same thing as its close
relative SetAnimatedValue() - the only difference being that
AnimationEnded() always explicitly sets the current value to the base
value.

By assigning the behavior of AnimationEnded() to passing nullptr to
SetAnimatedValue(), the former can be removed.

Bug: 1017723
Change-Id: I4a4be2af4f95cb15a9445003c7fccd1086820a91
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4110868
Reviewed-by: Philip Rogers <pdr@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/main@{#1084923}
  • Loading branch information
Fredrik Söderquist authored and Chromium LUCI CQ committed Dec 19, 2022
1 parent 5606f51 commit e5673cf
Show file tree
Hide file tree
Showing 10 changed files with 3 additions and 38 deletions.
Expand Up @@ -55,7 +55,6 @@ class SVGAnimatedPropertyBase : public GarbageCollectedMixin {
virtual bool IsAnimating() const = 0;

virtual void SetAnimatedValue(SVGPropertyBase*) = 0;
virtual void AnimationEnded() = 0;

virtual SVGParsingError AttributeChanged(const String&) = 0;
virtual bool NeedsSynchronizeAttribute() const;
Expand Down Expand Up @@ -142,12 +141,8 @@ class SVGAnimatedPropertyCommon : public SVGAnimatedPropertyBase {
}

void SetAnimatedValue(SVGPropertyBase* value) override {
DCHECK_EQ(value->GetType(), Property::ClassType());
current_value_ = static_cast<Property*>(value);
}

void AnimationEnded() override {
current_value_ = base_value_;
DCHECK(!value || value->GetType() == Property::ClassType());
current_value_ = value ? static_cast<Property*>(value) : BaseValue();
}

void Trace(Visitor* visitor) const override {
Expand Down Expand Up @@ -237,11 +232,6 @@ class SVGAnimatedProperty<Property, TearOffType, void>
UpdateAnimValTearOffIfNeeded();
}

void AnimationEnded() override {
SVGAnimatedPropertyCommon<Property>::AnimationEnded();
UpdateAnimValTearOffIfNeeded();
}

// SVGAnimated* DOM Spec implementations:

// baseVal()/animVal() are only to be used from SVG DOM implementation.
Expand Down
5 changes: 0 additions & 5 deletions third_party/blink/renderer/core/svg/svg_animated_angle.cc
Expand Up @@ -73,9 +73,4 @@ void SVGAnimatedAngle::SetAnimatedValue(SVGPropertyBase* value) {
orient_type_->SetAnimatedValue(CurrentValue()->OrientType());
}

void SVGAnimatedAngle::AnimationEnded() {
SVGAnimatedProperty<SVGAngle>::AnimationEnded();
orient_type_->AnimationEnded();
}

} // namespace blink
1 change: 0 additions & 1 deletion third_party/blink/renderer/core/svg/svg_animated_angle.h
Expand Up @@ -55,7 +55,6 @@ class SVGAnimatedAngle final : public ScriptWrappable,
void SynchronizeAttribute() override;

void SetAnimatedValue(SVGPropertyBase*) override;
void AnimationEnded() override;

void Trace(Visitor*) const override;

Expand Down
Expand Up @@ -71,12 +71,6 @@ void SVGAnimatedIntegerOptionalInteger::SetAnimatedValue(
second_integer_->SetAnimatedValue(CurrentValue()->SecondInteger());
}

void SVGAnimatedIntegerOptionalInteger::AnimationEnded() {
SVGAnimatedPropertyCommon<SVGIntegerOptionalInteger>::AnimationEnded();
first_integer_->AnimationEnded();
second_integer_->AnimationEnded();
}

bool SVGAnimatedIntegerOptionalInteger::NeedsSynchronizeAttribute() const {
return first_integer_->NeedsSynchronizeAttribute() ||
second_integer_->NeedsSynchronizeAttribute();
Expand Down
Expand Up @@ -53,7 +53,6 @@ class SVGAnimatedIntegerOptionalInteger

void SetAnimatedValue(SVGPropertyBase*) override;
bool NeedsSynchronizeAttribute() const override;
void AnimationEnded() override;

SVGAnimatedInteger* FirstInteger() { return first_integer_.Get(); }
SVGAnimatedInteger* SecondInteger() { return second_integer_.Get(); }
Expand Down
Expand Up @@ -58,12 +58,6 @@ void SVGAnimatedNumberOptionalNumber::SetAnimatedValue(SVGPropertyBase* value) {
second_number_->SetAnimatedValue(CurrentValue()->SecondNumber());
}

void SVGAnimatedNumberOptionalNumber::AnimationEnded() {
SVGAnimatedPropertyCommon<SVGNumberOptionalNumber>::AnimationEnded();
first_number_->AnimationEnded();
second_number_->AnimationEnded();
}

bool SVGAnimatedNumberOptionalNumber::NeedsSynchronizeAttribute() const {
return first_number_->NeedsSynchronizeAttribute() ||
second_number_->NeedsSynchronizeAttribute();
Expand Down
Expand Up @@ -53,7 +53,6 @@ class SVGAnimatedNumberOptionalNumber

void SetAnimatedValue(SVGPropertyBase*) override;
bool NeedsSynchronizeAttribute() const override;
void AnimationEnded() override;

SVGAnimatedNumber* FirstNumber() { return first_number_.Get(); }
SVGAnimatedNumber* SecondNumber() { return second_number_.Get(); }
Expand Down
2 changes: 1 addition & 1 deletion third_party/blink/renderer/core/svg/svg_element.cc
Expand Up @@ -265,7 +265,7 @@ void SVGElement::ClearAnimatedAttribute(const QualifiedName& attribute) {
ForSelfAndInstances(this, [&params](SVGElement* element) {
if (SVGAnimatedPropertyBase* animated_property =
element->PropertyFromAttribute(params.name)) {
animated_property->AnimationEnded();
animated_property->SetAnimatedValue(nullptr);
element->SvgAttributeChanged(params);
}
});
Expand Down
4 changes: 0 additions & 4 deletions third_party/blink/renderer/core/svg/svg_static_string_list.cc
Expand Up @@ -65,10 +65,6 @@ void SVGStaticStringList::SetAnimatedValue(SVGPropertyBase*) {
NOTREACHED();
}

void SVGStaticStringList::AnimationEnded() {
NOTREACHED();
}

SVGStringListTearOff* SVGStaticStringList::TearOff() {
if (!tear_off_)
tear_off_ = MakeGarbageCollected<SVGStringListTearOff>(value_, this);
Expand Down
Expand Up @@ -62,7 +62,6 @@ class SVGStaticStringList final : public GarbageCollected<SVGStaticStringList>,
const SVGPropertyBase& BaseValueBase() const override;
bool IsAnimating() const override;
void SetAnimatedValue(SVGPropertyBase*) override;
void AnimationEnded() override;

SVGParsingError AttributeChanged(const String&) override;

Expand Down

0 comments on commit e5673cf

Please sign in to comment.