Diff
Modified: trunk/Source/WebCore/ChangeLog (280122 => 280123)
--- trunk/Source/WebCore/ChangeLog 2021-07-21 02:47:42 UTC (rev 280122)
+++ trunk/Source/WebCore/ChangeLog 2021-07-21 03:33:43 UTC (rev 280123)
@@ -1,3 +1,76 @@
+2021-07-20 Said Abou-Hallawa <[email protected]>
+
+ Make the 'targetElement' argument of the SVG animators to be a reference
+ https://bugs.webkit.org/show_bug.cgi?id=228132
+
+ Reviewed by Simon Fraser.
+
+ It is clear that many SVG animators functions assume the argument
+ 'targetElement' is not nullptr. Also the caller SVGAnimateElementBase
+ makes sure its targetElement() is not nullptr before calling any of its
+ animator's functions.
+
+ * svg/SVGAnimateElementBase.cpp:
+ (WebCore::SVGAnimateElementBase::setTargetElement):
+ (WebCore::SVGAnimateElementBase::calculateFromAndToValues):
+ (WebCore::SVGAnimateElementBase::calculateFromAndByValues):
+ (WebCore::SVGAnimateElementBase::startAnimation):
+ (WebCore::SVGAnimateElementBase::calculateAnimatedValue):
+ (WebCore::SVGAnimateElementBase::applyResultsToTarget):
+ (WebCore::SVGAnimateElementBase::stopAnimation):
+ (WebCore::SVGAnimateElementBase::calculateDistance):
+ * svg/SVGElement.cpp:
+ (WebCore::SVGElement::commitPropertyChange):
+ * svg/properties/SVGAnimatedPropertyAnimator.h:
+ * svg/properties/SVGAnimatedPropertyAnimatorImpl.h:
+ * svg/properties/SVGAnimatedPropertyPairAnimator.h:
+ * svg/properties/SVGAnimatedPropertyPairAnimatorImpl.h:
+ * svg/properties/SVGAnimationAdditiveFunction.h:
+ * svg/properties/SVGAnimationAdditiveListFunctionImpl.h:
+ (WebCore::SVGAnimationLengthListFunction::animate):
+ (WebCore::SVGAnimationNumberListFunction::animate):
+ (WebCore::SVGAnimationPointListFunction::animate):
+ (WebCore::SVGAnimationTransformListFunction::animate):
+ * svg/properties/SVGAnimationAdditiveValueFunctionImpl.cpp:
+ (WebCore::SVGAnimationColorFunction::colorFromString):
+ (WebCore::SVGAnimationIntegerFunction::calculateDistance const):
+ * svg/properties/SVGAnimationAdditiveValueFunctionImpl.h:
+ (WebCore::SVGAnimationAngleFunction::animate):
+ (WebCore::SVGAnimationColorFunction::animate):
+ (WebCore::SVGAnimationLengthFunction::animate):
+ (WebCore::SVGAnimationNumberFunction::animate):
+ (WebCore::SVGAnimationPathSegListFunction::animate):
+ (WebCore::SVGAnimationRectFunction::animate):
+ * svg/properties/SVGAnimationDiscreteFunction.h:
+ (WebCore::SVGAnimationDiscreteFunction::animate):
+ * svg/properties/SVGAnimationDiscreteFunctionImpl.h:
+ * svg/properties/SVGAnimationFunction.h:
+ (WebCore::SVGAnimationFunction::calculateDistance const):
+ (WebCore::SVGAnimationFunction::addFromAndToValues):
+ * svg/properties/SVGAttributeAnimator.cpp:
+ (WebCore::SVGAttributeAnimator::isAnimatedStylePropertyAniamtor const):
+ (WebCore::SVGAttributeAnimator::invalidateStyle):
+ (WebCore::SVGAttributeAnimator::applyAnimatedStylePropertyChange):
+ (WebCore::SVGAttributeAnimator::removeAnimatedStyleProperty):
+ (WebCore::SVGAttributeAnimator::applyAnimatedPropertyChange):
+ * svg/properties/SVGAttributeAnimator.h:
+ (WebCore::SVGAttributeAnimator::setFromAndToValues):
+ (WebCore::SVGAttributeAnimator::setFromAndByValues):
+ (WebCore::SVGAttributeAnimator::calculateDistance const):
+ * svg/properties/SVGPrimitivePropertyAnimator.h:
+ * svg/properties/SVGPropertyAnimator.h:
+ (WebCore::SVGPropertyAnimator::adjustForInheritance const):
+ (WebCore::SVGPropertyAnimator::computeInheritedCSSPropertyValue const):
+
+ * svg/properties/SVGPropertyOwnerRegistry.h:
+ * svg/properties/SVGPropertyRegistry.h:
+ Fix a typo in the name of setAnimatedPropertyDirty().
+
+ * svg/properties/SVGValuePropertyAnimator.h:
+ * svg/properties/SVGValuePropertyAnimatorImpl.h:
+ * svg/properties/SVGValuePropertyListAnimator.h:
+ * svg/properties/SVGValuePropertyListAnimatorImpl.h:
+
2021-07-20 Alan Bujtas <[email protected]>
Revert r272370: It delays first paint
Modified: trunk/Source/WebCore/svg/SVGAnimateElementBase.cpp (280122 => 280123)
--- trunk/Source/WebCore/svg/SVGAnimateElementBase.cpp 2021-07-21 02:47:42 UTC (rev 280122)
+++ trunk/Source/WebCore/svg/SVGAnimateElementBase.cpp 2021-07-21 03:33:43 UTC (rev 280123)
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2004, 2005 Nikolas Zimmermann <[email protected]>
* Copyright (C) 2004, 2005, 2006 Rob Buis <[email protected]>
- * Copyright (C) 2008-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2008-2021 Apple Inc. All rights reserved.
* Copyright (C) Research In Motion Limited 2011. All rights reserved.
* Copyright (C) 2014 Adobe Systems Incorporated. All rights reserved.
*
@@ -82,9 +82,9 @@
return animator && animator->isDiscrete();
}
-void SVGAnimateElementBase::setTargetElement(SVGElement* target)
+void SVGAnimateElementBase::setTargetElement(SVGElement* targetElement)
{
- SVGAnimationElement::setTargetElement(target);
+ SVGAnimationElement::setTargetElement(targetElement);
resetAnimation();
}
@@ -107,7 +107,7 @@
return false;
if (auto* animator = this->animator()) {
- animator->setFromAndToValues(targetElement(), animateRangeString(fromString), animateRangeString(toString));
+ animator->setFromAndToValues(*targetElement(), animateRangeString(fromString), animateRangeString(toString));
return true;
}
return false;
@@ -115,7 +115,7 @@
bool SVGAnimateElementBase::calculateFromAndByValues(const String& fromString, const String& byString)
{
- if (!this->targetElement())
+ if (!targetElement())
return false;
if (animationMode() == AnimationMode::By && (!isAdditive() || isDiscreteAnimator()))
@@ -125,7 +125,7 @@
return false;
if (auto* animator = this->animator()) {
- animator->setFromAndByValues(targetElement(), animateRangeString(fromString), animateRangeString(byString));
+ animator->setFromAndByValues(*targetElement(), animateRangeString(fromString), animateRangeString(byString));
return true;
}
return false;
@@ -152,7 +152,7 @@
return;
if (auto protectedAnimator = makeRefPtr(this->animator()))
- protectedAnimator->start(targetElement());
+ protectedAnimator->start(*targetElement());
}
void SVGAnimateElementBase::calculateAnimatedValue(float progress, unsigned repeatCount)
@@ -168,7 +168,7 @@
progress = progress < 0.5 ? 0 : 1;
if (auto protectedAnimator = makeRefPtr(this->animator()))
- protectedAnimator->animate(targetElement(), progress, repeatCount);
+ protectedAnimator->animate(*targetElement(), progress, repeatCount);
}
void SVGAnimateElementBase::applyResultsToTarget()
@@ -177,7 +177,7 @@
return;
if (auto* animator = this->animator())
- animator->apply(targetElement());
+ animator->apply(*targetElement());
}
void SVGAnimateElementBase::stopAnimation(SVGElement* targetElement)
@@ -186,7 +186,7 @@
return;
if (auto* animator = this->animatorIfExists())
- animator->stop(targetElement);
+ animator->stop(*targetElement);
}
std::optional<float> SVGAnimateElementBase::calculateDistance(const String& fromString, const String& toString)
@@ -196,7 +196,7 @@
return { };
if (auto* animator = this->animator())
- return animator->calculateDistance(targetElement(), fromString, toString);
+ return animator->calculateDistance(*targetElement(), fromString, toString);
return { };
}
Modified: trunk/Source/WebCore/svg/SVGElement.cpp (280122 => 280123)
--- trunk/Source/WebCore/svg/SVGElement.cpp 2021-07-21 02:47:42 UTC (rev 280122)
+++ trunk/Source/WebCore/svg/SVGElement.cpp 2021-07-21 03:33:43 UTC (rev 280123)
@@ -577,7 +577,7 @@
// A change in a style property, e.g SVGRectElement::x should be serialized to
// the attribute immediately. Otherwise it is okay to be lazy in this regard.
if (!propertyRegistry().isAnimatedStylePropertyAttribute(attributeName))
- propertyRegistry().setAnimatedPropertDirty(attributeName, animatedProperty);
+ propertyRegistry().setAnimatedPropertyDirty(attributeName, animatedProperty);
else
setSynchronizedLazyAttribute(attributeName, animatedProperty.baseValAsString());
Modified: trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyAnimator.h (280122 => 280123)
--- trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyAnimator.h 2021-07-21 02:47:42 UTC (rev 280122)
+++ trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyAnimator.h 2021-07-21 03:33:43 UTC (rev 280123)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -51,12 +51,12 @@
bool isDiscrete() const override { return m_function.isDiscrete(); }
- void setFromAndToValues(SVGElement* targetElement, const String& from, const String& to) override
+ void setFromAndToValues(SVGElement& targetElement, const String& from, const String& to) override
{
m_function.setFromAndToValues(targetElement, from, to);
}
- void setFromAndByValues(SVGElement* targetElement, const String& from, const String& by) override
+ void setFromAndByValues(SVGElement& targetElement, const String& from, const String& by) override
{
m_function.setFromAndByValues(targetElement, from, by);
}
@@ -66,7 +66,7 @@
m_function.setToAtEndOfDurationValue(toAtEndOfDuration);
}
- void start(SVGElement*) override
+ void start(SVGElement&) override
{
m_animated->startAnimation(*this);
for (auto& instance : m_animatedInstances)
@@ -73,7 +73,7 @@
instance->instanceStartAnimation(*this, m_animated);
}
- void apply(SVGElement* targetElement) override
+ void apply(SVGElement& targetElement) override
{
if (isAnimatedStylePropertyAniamtor(targetElement))
applyAnimatedStylePropertyChange(targetElement, m_animated->animValAsString());
@@ -80,7 +80,7 @@
applyAnimatedPropertyChange(targetElement);
}
- void stop(SVGElement* targetElement) override
+ void stop(SVGElement& targetElement) override
{
if (!m_animated->isAnimating())
return;
@@ -94,7 +94,7 @@
instance->instanceStopAnimation(*this);
}
- std::optional<float> calculateDistance(SVGElement* targetElement, const String& from, const String& to) const override
+ std::optional<float> calculateDistance(SVGElement& targetElement, const String& from, const String& to) const override
{
return m_function.calculateDistance(targetElement, from, to);
}
@@ -105,4 +105,4 @@
AnimationFunction m_function;
};
-}
+} // namespace WebCore
Modified: trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyAnimatorImpl.h (280122 => 280123)
--- trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyAnimatorImpl.h 2021-07-21 02:47:42 UTC (rev 280122)
+++ trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyAnimatorImpl.h 2021-07-21 03:33:43 UTC (rev 280123)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -54,7 +54,7 @@
}
private:
- void animate(SVGElement* targetElement, float progress, unsigned repeatCount) final
+ void animate(SVGElement& targetElement, float progress, unsigned repeatCount) final
{
m_function.animate(targetElement, progress, repeatCount, m_animated->animVal()->value());
}
@@ -72,7 +72,7 @@
}
private:
- void animate(SVGElement* targetElement, float progress, unsigned repeatCount) final
+ void animate(SVGElement& targetElement, float progress, unsigned repeatCount) final
{
bool& animated = m_animated->animVal();
m_function.animate(targetElement, progress, repeatCount, animated);
@@ -93,7 +93,7 @@
}
private:
- void animate(SVGElement* targetElement, float progress, unsigned repeatCount) final
+ void animate(SVGElement& targetElement, float progress, unsigned repeatCount) final
{
EnumType animated;
m_function.animate(targetElement, progress, repeatCount, animated);
@@ -115,7 +115,7 @@
}
private:
- void animate(SVGElement* targetElement, float progress, unsigned repeatCount) final
+ void animate(SVGElement& targetElement, float progress, unsigned repeatCount) final
{
m_function.animate(targetElement, progress, repeatCount, m_animated->animVal());
}
@@ -136,7 +136,7 @@
}
private:
- void animate(SVGElement* targetElement, float progress, unsigned repeatCount) final
+ void animate(SVGElement& targetElement, float progress, unsigned repeatCount) final
{
m_function.animate(targetElement, progress, repeatCount, m_animated->animVal()->value());
}
@@ -157,7 +157,7 @@
}
private:
- void animate(SVGElement* targetElement, float progress, unsigned repeatCount) final
+ void animate(SVGElement& targetElement, float progress, unsigned repeatCount) final
{
m_function.animate(targetElement, progress, repeatCount, m_animated->animVal());
}
@@ -176,7 +176,7 @@
}
private:
- void animate(SVGElement* targetElement, float progress, unsigned repeatCount) final
+ void animate(SVGElement& targetElement, float progress, unsigned repeatCount) final
{
m_function.animate(targetElement, progress, repeatCount, m_animated->animVal());
}
@@ -193,7 +193,7 @@
}
private:
- void animate(SVGElement* targetElement, float progress, unsigned repeatCount) final
+ void animate(SVGElement& targetElement, float progress, unsigned repeatCount) final
{
m_function.animate(targetElement, progress, repeatCount, m_animated->animVal());
}
@@ -210,7 +210,7 @@
}
private:
- void animate(SVGElement* targetElement, float progress, unsigned repeatCount) final
+ void animate(SVGElement& targetElement, float progress, unsigned repeatCount) final
{
m_animated->animVal()->pathByteStreamWillChange();
m_function.animate(targetElement, progress, repeatCount, m_animated->animVal()->pathByteStream());
@@ -228,7 +228,7 @@
}
private:
- void animate(SVGElement* targetElement, float progress, unsigned repeatCount) final
+ void animate(SVGElement& targetElement, float progress, unsigned repeatCount) final
{
m_function.animate(targetElement, progress, repeatCount, m_animated->animVal());
}
@@ -247,7 +247,7 @@
}
private:
- void animate(SVGElement* targetElement, float progress, unsigned repeatCount) final
+ void animate(SVGElement& targetElement, float progress, unsigned repeatCount) final
{
SVGMarkerOrientType animated;
m_function.animate(targetElement, progress, repeatCount, animated);
@@ -266,7 +266,7 @@
}
private:
- void animate(SVGElement* targetElement, float progress, unsigned repeatCount) final
+ void animate(SVGElement& targetElement, float progress, unsigned repeatCount) final
{
SVGPreserveAspectRatioValue& animated = m_animated->animVal()->value();
m_function.animate(targetElement, progress, repeatCount, animated);
@@ -285,7 +285,7 @@
}
private:
- void animate(SVGElement* targetElement, float progress, unsigned repeatCount) final
+ void animate(SVGElement& targetElement, float progress, unsigned repeatCount) final
{
m_function.animate(targetElement, progress, repeatCount, m_animated->animVal()->value());
}
@@ -307,13 +307,13 @@
return m_attributeName.matches(HTMLNames::classAttr);
}
- void animate(SVGElement* targetElement, float progress, unsigned repeatCount) final
+ void animate(SVGElement& targetElement, float progress, unsigned repeatCount) final
{
String& animated = m_animated->animVal();
m_function.animate(targetElement, progress, repeatCount, animated);
}
- void apply(SVGElement* targetElement) final
+ void apply(SVGElement& targetElement) final
{
Base::apply(targetElement);
if (isAnimatedStyleClassAniamtor())
@@ -320,7 +320,7 @@
invalidateStyle(targetElement);
}
- void stop(SVGElement* targetElement) final
+ void stop(SVGElement& targetElement) final
{
if (!m_animated->isAnimating())
return;
@@ -342,10 +342,10 @@
}
private:
- void animate(SVGElement* targetElement, float progress, unsigned repeatCount) final
+ void animate(SVGElement& targetElement, float progress, unsigned repeatCount) final
{
m_function.animate(targetElement, progress, repeatCount, m_animated->animVal());
}
};
-}
+} // namespace WebCore
Modified: trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyPairAnimator.h (280122 => 280123)
--- trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyPairAnimator.h 2021-07-21 02:47:42 UTC (rev 280122)
+++ trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyPairAnimator.h 2021-07-21 03:33:43 UTC (rev 280123)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -51,24 +51,24 @@
}
protected:
- void start(SVGElement* targetElement) override
+ void start(SVGElement& targetElement) override
{
m_animatedPropertyAnimator1->start(targetElement);
m_animatedPropertyAnimator2->start(targetElement);
}
- void animate(SVGElement* targetElement, float progress, unsigned repeatCount) override
+ void animate(SVGElement& targetElement, float progress, unsigned repeatCount) override
{
m_animatedPropertyAnimator1->animate(targetElement, progress, repeatCount);
m_animatedPropertyAnimator2->animate(targetElement, progress, repeatCount);
}
- void apply(SVGElement* targetElement) override
+ void apply(SVGElement& targetElement) override
{
applyAnimatedPropertyChange(targetElement);
}
- void stop(SVGElement* targetElement) override
+ void stop(SVGElement& targetElement) override
{
m_animatedPropertyAnimator1->stop(targetElement);
m_animatedPropertyAnimator2->stop(targetElement);
@@ -78,4 +78,4 @@
Ref<AnimatedPropertyAnimator2> m_animatedPropertyAnimator2;
};
-}
+} // namespace WebCore
Modified: trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyPairAnimatorImpl.h (280122 => 280123)
--- trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyPairAnimatorImpl.h 2021-07-21 02:47:42 UTC (rev 280122)
+++ trunk/Source/WebCore/svg/properties/SVGAnimatedPropertyPairAnimatorImpl.h 2021-07-21 03:33:43 UTC (rev 280123)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -44,7 +44,7 @@
}
private:
- void setFromAndToValues(SVGElement*, const String& from, const String& to) final
+ void setFromAndToValues(SVGElement&, const String& from, const String& to) final
{
auto pairFrom = SVGPropertyTraits<std::pair<SVGAngleValue, SVGMarkerOrientType>>::fromString(from);
auto pairTo = SVGPropertyTraits<std::pair<SVGAngleValue, SVGMarkerOrientType>>::fromString(to);
@@ -56,7 +56,7 @@
m_animatedPropertyAnimator2->m_function.m_to = pairTo.second;
}
- void setFromAndByValues(SVGElement* targetElement, const String& from, const String& by) final
+ void setFromAndByValues(SVGElement& targetElement, const String& from, const String& by) final
{
setFromAndToValues(targetElement, from, by);
if (m_animatedPropertyAnimator2->m_function.m_from != SVGMarkerOrientAngle || m_animatedPropertyAnimator2->m_function.m_to != SVGMarkerOrientAngle)
@@ -64,7 +64,7 @@
m_animatedPropertyAnimator1->m_function.addFromAndToValues(targetElement);
}
- void animate(SVGElement* targetElement, float progress, unsigned repeatCount) final
+ void animate(SVGElement& targetElement, float progress, unsigned repeatCount) final
{
if (m_animatedPropertyAnimator2->m_function.m_from != m_animatedPropertyAnimator2->m_function.m_to) {
// Discrete animation - no linear interpolation possible between values (e.g. auto to angle).
@@ -97,7 +97,7 @@
m_animatedPropertyAnimator2->m_animated->setAnimVal(SVGMarkerOrientUnknown);
}
- void stop(SVGElement* targetElement) final
+ void stop(SVGElement& targetElement) final
{
if (!m_animatedPropertyAnimator1->m_animated->isAnimating())
return;
@@ -117,7 +117,7 @@
}
private:
- void setFromAndToValues(SVGElement*, const String& from, const String& to) final
+ void setFromAndToValues(SVGElement&, const String& from, const String& to) final
{
auto pairFrom = SVGPropertyTraits<std::pair<int, int>>::fromString(from);
auto pairTo = SVGPropertyTraits<std::pair<int, int>>::fromString(to);
@@ -129,7 +129,7 @@
m_animatedPropertyAnimator2->m_function.m_to = pairTo.second;
}
- void setFromAndByValues(SVGElement*, const String& from, const String& by) final
+ void setFromAndByValues(SVGElement&, const String& from, const String& by) final
{
auto pairFrom = SVGPropertyTraits<std::pair<int, int>>::fromString(from);
auto pairBy = SVGPropertyTraits<std::pair<int, int>>::fromString(by);
@@ -160,7 +160,7 @@
}
private:
- void setFromAndToValues(SVGElement*, const String& from, const String& to) final
+ void setFromAndToValues(SVGElement&, const String& from, const String& to) final
{
auto pairFrom = SVGPropertyTraits<std::pair<float, float>>::fromString(from);
auto pairTo = SVGPropertyTraits<std::pair<float, float>>::fromString(to);
@@ -172,7 +172,7 @@
m_animatedPropertyAnimator2->m_function.m_to = pairTo.second;
}
- void setFromAndByValues(SVGElement*, const String& from, const String& by) final
+ void setFromAndByValues(SVGElement&, const String& from, const String& by) final
{
auto pairFrom = SVGPropertyTraits<std::pair<float, float>>::fromString(from);
auto pairBy = SVGPropertyTraits<std::pair<float, float>>::fromString(by);
@@ -192,4 +192,4 @@
}
};
-}
+} // namespace WebCore
Modified: trunk/Source/WebCore/svg/properties/SVGAnimationAdditiveFunction.h (280122 => 280123)
--- trunk/Source/WebCore/svg/properties/SVGAnimationAdditiveFunction.h 2021-07-21 02:47:42 UTC (rev 280122)
+++ trunk/Source/WebCore/svg/properties/SVGAnimationAdditiveFunction.h 2021-07-21 03:33:43 UTC (rev 280123)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -39,7 +39,7 @@
{
}
- void setFromAndByValues(SVGElement* targetElement, const String& from, const String& by) override
+ void setFromAndByValues(SVGElement& targetElement, const String& from, const String& by) override
{
setFromAndToValues(targetElement, from, by);
addFromAndToValues(targetElement);
@@ -73,4 +73,4 @@
bool m_isAdditive;
};
-}
+} // namespace WebCore
Modified: trunk/Source/WebCore/svg/properties/SVGAnimationAdditiveListFunctionImpl.h (280122 => 280123)
--- trunk/Source/WebCore/svg/properties/SVGAnimationAdditiveListFunctionImpl.h 2021-07-21 02:47:42 UTC (rev 280122)
+++ trunk/Source/WebCore/svg/properties/SVGAnimationAdditiveListFunctionImpl.h 2021-07-21 03:33:43 UTC (rev 280123)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2019-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -45,7 +45,7 @@
{
}
- void setFromAndToValues(SVGElement*, const String& from, const String& to) override
+ void setFromAndToValues(SVGElement&, const String& from, const String& to) override
{
m_from->parse(from);
m_to->parse(to);
@@ -56,7 +56,7 @@
m_toAtEndOfDuration->parse(toAtEndOfDuration);
}
- void animate(SVGElement* targetElement, float progress, unsigned repeatCount, RefPtr<SVGLengthList>& animated)
+ void animate(SVGElement& targetElement, float progress, unsigned repeatCount, RefPtr<SVGLengthList>& animated)
{
if (!adjustAnimatedList(m_animationMode, progress, animated))
return;
@@ -67,7 +67,7 @@
Vector<Ref<SVGLength>>& animatedItems = animated->items();
SVGLengthMode lengthMode = animated->lengthMode();
- SVGLengthContext lengthContext(targetElement);
+ SVGLengthContext lengthContext(&targetElement);
for (unsigned i = 0; i < toItems.size(); ++i) {
SVGLengthType lengthType = (i < fromItems.size() && progress < 0.5 ? fromItems : toItems)[i]->value().lengthType();
@@ -82,7 +82,7 @@
}
private:
- void addFromAndToValues(SVGElement* targetElement) override
+ void addFromAndToValues(SVGElement& targetElement) override
{
const Vector<Ref<SVGLength>>& fromItems = m_from->items();
const Vector<Ref<SVGLength>>& toItems = m_to->items();
@@ -90,7 +90,7 @@
if (!fromItems.size() || fromItems.size() != toItems.size())
return;
- SVGLengthContext lengthContext(targetElement);
+ SVGLengthContext lengthContext(&targetElement);
for (unsigned i = 0; i < fromItems.size(); ++i) {
const SVGLengthValue& fromValue = fromItems[i]->value();
SVGLengthValue& toValue = toItems[i]->value();
@@ -104,7 +104,7 @@
using Base = SVGAnimationAdditiveListFunction<SVGNumberList>;
using Base::Base;
- void setFromAndToValues(SVGElement*, const String& from, const String& to) override
+ void setFromAndToValues(SVGElement&, const String& from, const String& to) override
{
m_from->parse(from);
m_to->parse(to);
@@ -115,7 +115,7 @@
m_toAtEndOfDuration->parse(toAtEndOfDuration);
}
- void animate(SVGElement*, float progress, unsigned repeatCount, RefPtr<SVGNumberList>& animated)
+ void animate(SVGElement&, float progress, unsigned repeatCount, RefPtr<SVGNumberList>& animated)
{
if (!adjustAnimatedList(m_animationMode, progress, animated))
return;
@@ -136,7 +136,7 @@
}
private:
- void addFromAndToValues(SVGElement*) override
+ void addFromAndToValues(SVGElement&) override
{
const Vector<Ref<SVGNumber>>& fromItems = m_from->items();
Vector<Ref<SVGNumber>>& toItems = m_to->items();
@@ -154,7 +154,7 @@
using Base = SVGAnimationAdditiveListFunction<SVGPointList>;
using Base::Base;
- void setFromAndToValues(SVGElement*, const String& from, const String& to) override
+ void setFromAndToValues(SVGElement&, const String& from, const String& to) override
{
m_from->parse(from);
m_to->parse(to);
@@ -165,7 +165,7 @@
m_toAtEndOfDuration->parse(toAtEndOfDuration);
}
- void animate(SVGElement*, float progress, unsigned repeatCount, RefPtr<SVGPointList>& animated)
+ void animate(SVGElement&, float progress, unsigned repeatCount, RefPtr<SVGPointList>& animated)
{
if (!adjustAnimatedList(m_animationMode, progress, animated))
return;
@@ -189,7 +189,7 @@
}
private:
- void addFromAndToValues(SVGElement*) override
+ void addFromAndToValues(SVGElement&) override
{
const Vector<Ref<SVGPoint>>& fromItems = m_from->items();
Vector<Ref<SVGPoint>>& toItems = m_to->items();
@@ -207,7 +207,7 @@
using Base = SVGAnimationAdditiveListFunction<SVGTransformList>;
using Base::Base;
- void setFromAndToValues(SVGElement*, const String& from, const String& to) override
+ void setFromAndToValues(SVGElement&, const String& from, const String& to) override
{
m_from->parse(from);
m_to->parse(to);
@@ -218,7 +218,7 @@
m_toAtEndOfDuration->parse(toAtEndOfDuration);
}
- void animate(SVGElement*, float progress, unsigned repeatCount, RefPtr<SVGTransformList>& animated)
+ void animate(SVGElement&, float progress, unsigned repeatCount, RefPtr<SVGTransformList>& animated)
{
// Pass false to 'resizeAnimatedIfNeeded', as the special post-multiplication behavior of <animateTransform> needs to be respected below.
if (!adjustAnimatedList(m_animationMode, progress, animated, false))
@@ -255,7 +255,7 @@
}
private:
- void addFromAndToValues(SVGElement*) override
+ void addFromAndToValues(SVGElement&) override
{
const Vector<Ref<SVGTransform>>& fromItems = m_from->items();
Vector<Ref<SVGTransform>>& toItems = m_to->items();
@@ -271,4 +271,4 @@
}
};
-}
+} // namespace WebCore
Modified: trunk/Source/WebCore/svg/properties/SVGAnimationAdditiveValueFunctionImpl.cpp (280122 => 280123)
--- trunk/Source/WebCore/svg/properties/SVGAnimationAdditiveValueFunctionImpl.cpp 2021-07-21 02:47:42 UTC (rev 280122)
+++ trunk/Source/WebCore/svg/properties/SVGAnimationAdditiveValueFunctionImpl.cpp 2021-07-21 03:33:43 UTC (rev 280123)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2019-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,7 +32,7 @@
namespace WebCore {
-Color SVGAnimationColorFunction::colorFromString(SVGElement* targetElement, const String& string)
+Color SVGAnimationColorFunction::colorFromString(SVGElement& targetElement, const String& string)
{
static MainThreadNeverDestroyed<const AtomString> currentColor("currentColor", AtomString::ConstructFromLiteral);
@@ -39,15 +39,15 @@
if (string != currentColor.get())
return SVGPropertyTraits<Color>::fromString(string);
- if (auto* renderer = targetElement->renderer())
+ if (auto* renderer = targetElement.renderer())
return renderer->style().visitedDependentColor(CSSPropertyColor);
return { };
}
-std::optional<float> SVGAnimationIntegerFunction::calculateDistance(SVGElement*, const String& from, const String& to) const
+std::optional<float> SVGAnimationIntegerFunction::calculateDistance(SVGElement&, const String& from, const String& to) const
{
return std::abs(parseInteger<int>(to).value_or(0) - parseInteger<int>(from).value_or(0));
}
-}
+} // namespace WebCore
Modified: trunk/Source/WebCore/svg/properties/SVGAnimationAdditiveValueFunctionImpl.h (280122 => 280123)
--- trunk/Source/WebCore/svg/properties/SVGAnimationAdditiveValueFunctionImpl.h 2021-07-21 02:47:42 UTC (rev 280122)
+++ trunk/Source/WebCore/svg/properties/SVGAnimationAdditiveValueFunctionImpl.h 2021-07-21 03:33:43 UTC (rev 280123)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -41,13 +41,13 @@
using Base = SVGAnimationAdditiveValueFunction<SVGAngleValue>;
using Base::Base;
- void setFromAndToValues(SVGElement*, const String&, const String&) override
+ void setFromAndToValues(SVGElement&, const String&, const String&) override
{
// Values will be set by SVGAnimatedAngleOrientAnimator.
ASSERT_NOT_REACHED();
}
- void animate(SVGElement*, float progress, unsigned repeatCount, SVGAngleValue& animated)
+ void animate(SVGElement&, float progress, unsigned repeatCount, SVGAngleValue& animated)
{
float number = animated.value();
number = Base::animate(progress, repeatCount, m_from.value(), m_to.value(), toAtEndOfDuration().value(), number);
@@ -57,7 +57,7 @@
private:
friend class SVGAnimatedAngleOrientAnimator;
- void addFromAndToValues(SVGElement*) override
+ void addFromAndToValues(SVGElement&) override
{
m_to.setValue(m_to.value() + m_from.value());
}
@@ -68,7 +68,7 @@
using Base = SVGAnimationAdditiveValueFunction<Color>;
using Base::Base;
- void setFromAndToValues(SVGElement* targetElement, const String& from, const String& to) override
+ void setFromAndToValues(SVGElement& targetElement, const String& from, const String& to) override
{
m_from = colorFromString(targetElement, from);
m_to = colorFromString(targetElement, to);
@@ -79,7 +79,7 @@
m_toAtEndOfDuration = SVGPropertyTraits<Color>::fromString(toAtEndOfDuration);
}
- void animate(SVGElement*, float progress, unsigned repeatCount, Color& animated)
+ void animate(SVGElement&, float progress, unsigned repeatCount, Color& animated)
{
auto simpleAnimated = animated.toSRGBALossy<uint8_t>();
auto simpleFrom = m_animationMode == AnimationMode::To ? simpleAnimated : m_from.toSRGBALossy<uint8_t>();
@@ -94,7 +94,7 @@
animated = makeFromComponentsClamping<SRGBA<uint8_t>>(std::lround(red), std::lround(green), std::lround(blue), std::lround(alpha));
}
- std::optional<float> calculateDistance(SVGElement*, const String& from, const String& to) const override
+ std::optional<float> calculateDistance(SVGElement&, const String& from, const String& to) const override
{
Color fromColor = CSSParser::parseColor(from.stripWhiteSpace());
if (!fromColor.isValid())
@@ -114,7 +114,7 @@
}
private:
- void addFromAndToValues(SVGElement*) override
+ void addFromAndToValues(SVGElement&) override
{
auto simpleFrom = m_from.toSRGBALossy<uint8_t>();
auto simpleTo = m_to.toSRGBALossy<uint8_t>();
@@ -123,7 +123,7 @@
m_to = makeFromComponentsClamping<SRGBA<uint8_t>>(simpleTo.red + simpleFrom.red, simpleTo.green + simpleFrom.green, simpleTo.blue + simpleFrom.blue);
}
- static Color colorFromString(SVGElement*, const String&);
+ static Color colorFromString(SVGElement&, const String&);
};
class SVGAnimationIntegerFunction final : public SVGAnimationAdditiveValueFunction<int> {
@@ -133,7 +133,7 @@
using Base = SVGAnimationAdditiveValueFunction<int>;
using Base::Base;
- void setFromAndToValues(SVGElement*, const String& from, const String& to) override
+ void setFromAndToValues(SVGElement&, const String& from, const String& to) override
{
m_from = SVGPropertyTraits<int>::fromString(from);
m_to = SVGPropertyTraits<int>::fromString(to);
@@ -144,15 +144,15 @@
m_toAtEndOfDuration = SVGPropertyTraits<int>::fromString(toAtEndOfDuration);
}
- void animate(SVGElement*, float progress, unsigned repeatCount, int& animated)
+ void animate(SVGElement&, float progress, unsigned repeatCount, int& animated)
{
animated = static_cast<int>(roundf(Base::animate(progress, repeatCount, m_from, m_to, toAtEndOfDuration(), animated)));
}
- std::optional<float> calculateDistance(SVGElement*, const String&, const String&) const final;
+ std::optional<float> calculateDistance(SVGElement&, const String&, const String&) const final;
private:
- void addFromAndToValues(SVGElement*) final
+ void addFromAndToValues(SVGElement&) final
{
m_to += m_from;
}
@@ -168,7 +168,7 @@
{
}
- void setFromAndToValues(SVGElement*, const String& from, const String& to) override
+ void setFromAndToValues(SVGElement&, const String& from, const String& to) override
{
m_from = SVGLengthValue(m_lengthMode, from);
m_to = SVGLengthValue(m_lengthMode, to);
@@ -179,9 +179,9 @@
m_toAtEndOfDuration = SVGLengthValue(m_lengthMode, toAtEndOfDuration);
}
- void animate(SVGElement* targetElement, float progress, unsigned repeatCount, SVGLengthValue& animated)
+ void animate(SVGElement& targetElement, float progress, unsigned repeatCount, SVGLengthValue& animated)
{
- SVGLengthContext lengthContext(targetElement);
+ SVGLengthContext lengthContext(&targetElement);
SVGLengthType lengthType = progress < 0.5 ? m_from.lengthType() : m_to.lengthType();
float from = (m_animationMode == AnimationMode::To ? animated : m_from).value(lengthContext);
@@ -193,9 +193,9 @@
animated = { lengthContext, value, lengthType, m_lengthMode };
}
- std::optional<float> calculateDistance(SVGElement* targetElement, const String& from, const String& to) const override
+ std::optional<float> calculateDistance(SVGElement& targetElement, const String& from, const String& to) const override
{
- SVGLengthContext lengthContext(targetElement);
+ SVGLengthContext lengthContext(&targetElement);
auto fromLength = SVGLengthValue(m_lengthMode, from);
auto toLength = SVGLengthValue(m_lengthMode, to);
return fabsf(toLength.value(lengthContext) - fromLength.value(lengthContext));
@@ -202,9 +202,9 @@
}
private:
- void addFromAndToValues(SVGElement* targetElement) override
+ void addFromAndToValues(SVGElement& targetElement) override
{
- SVGLengthContext lengthContext(targetElement);
+ SVGLengthContext lengthContext(&targetElement);
m_to.setValue(lengthContext, m_to.value(lengthContext) + m_from.value(lengthContext));
}
@@ -218,7 +218,7 @@
using Base = SVGAnimationAdditiveValueFunction<float>;
using Base::Base;
- void setFromAndToValues(SVGElement*, const String& from, const String& to) override
+ void setFromAndToValues(SVGElement&, const String& from, const String& to) override
{
m_from = SVGPropertyTraits<float>::fromString(from);
m_to = SVGPropertyTraits<float>::fromString(to);
@@ -229,19 +229,19 @@
m_toAtEndOfDuration = SVGPropertyTraits<float>::fromString(toAtEndOfDuration);
}
- void animate(SVGElement*, float progress, unsigned repeatCount, float& animated)
+ void animate(SVGElement&, float progress, unsigned repeatCount, float& animated)
{
float from = m_animationMode == AnimationMode::To ? animated : m_from;
animated = Base::animate(progress, repeatCount, from, m_to, toAtEndOfDuration(), animated);
}
- std::optional<float> calculateDistance(SVGElement*, const String& from, const String& to) const override
+ std::optional<float> calculateDistance(SVGElement&, const String& from, const String& to) const override
{
return std::abs(parseNumber(to).value_or(0) - parseNumber(from).value_or(0));
}
private:
- void addFromAndToValues(SVGElement*) override
+ void addFromAndToValues(SVGElement&) override
{
m_to += m_from;
}
@@ -252,7 +252,7 @@
using Base = SVGAnimationAdditiveValueFunction<SVGPathByteStream>;
using Base::Base;
- void setFromAndToValues(SVGElement*, const String& from, const String& to) override
+ void setFromAndToValues(SVGElement&, const String& from, const String& to) override
{
m_from = SVGPathByteStream(from);
m_to = SVGPathByteStream(to);
@@ -263,7 +263,7 @@
m_toAtEndOfDuration = SVGPathByteStream(toAtEndOfDuration);
}
- void animate(SVGElement*, float progress, unsigned repeatCount, SVGPathByteStream& animated)
+ void animate(SVGElement&, float progress, unsigned repeatCount, SVGPathByteStream& animated)
{
SVGPathByteStream underlyingPath;
if (m_animationMode == AnimationMode::To)
@@ -288,7 +288,7 @@
}
private:
- void addFromAndToValues(SVGElement*) override
+ void addFromAndToValues(SVGElement&) override
{
if (!m_from.size() || m_from.size() != m_to.size())
return;
@@ -301,7 +301,7 @@
using Base = SVGAnimationAdditiveValueFunction<FloatRect>;
using Base::Base;
- void setFromAndToValues(SVGElement*, const String& from, const String& to) override
+ void setFromAndToValues(SVGElement&, const String& from, const String& to) override
{
m_from = SVGPropertyTraits<FloatRect>::fromString(from);
m_to = SVGPropertyTraits<FloatRect>::fromString(to);
@@ -312,7 +312,7 @@
m_toAtEndOfDuration = SVGPropertyTraits<FloatRect>::fromString(toAtEndOfDuration);
}
- void animate(SVGElement*, float progress, unsigned repeatCount, FloatRect& animated)
+ void animate(SVGElement&, float progress, unsigned repeatCount, FloatRect& animated)
{
FloatRect from = m_animationMode == AnimationMode::To ? animated : m_from;
@@ -325,10 +325,10 @@
}
private:
- void addFromAndToValues(SVGElement*) override
+ void addFromAndToValues(SVGElement&) override
{
m_to += m_from;
}
};
-}
+} // namespace WebCore
Modified: trunk/Source/WebCore/svg/properties/SVGAnimationDiscreteFunction.h (280122 => 280123)
--- trunk/Source/WebCore/svg/properties/SVGAnimationDiscreteFunction.h 2021-07-21 02:47:42 UTC (rev 280122)
+++ trunk/Source/WebCore/svg/properties/SVGAnimationDiscreteFunction.h 2021-07-21 03:33:43 UTC (rev 280123)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -42,12 +42,12 @@
ASSERT_NOT_REACHED();
}
- void setFromAndByValues(SVGElement*, const String&, const String&) override
+ void setFromAndByValues(SVGElement&, const String&, const String&) override
{
ASSERT_NOT_REACHED();
}
- void animate(SVGElement*, float progress, unsigned, ValueType& animated)
+ void animate(SVGElement&, float progress, unsigned, ValueType& animated)
{
if ((m_animationMode == AnimationMode::FromTo && progress > 0.5) || m_animationMode == AnimationMode::To || progress == 1)
animated = m_to;
@@ -60,4 +60,4 @@
ValueType m_to;
};
-}
+} // namespace WebCore
Modified: trunk/Source/WebCore/svg/properties/SVGAnimationDiscreteFunctionImpl.h (280122 => 280123)
--- trunk/Source/WebCore/svg/properties/SVGAnimationDiscreteFunctionImpl.h 2021-07-21 02:47:42 UTC (rev 280122)
+++ trunk/Source/WebCore/svg/properties/SVGAnimationDiscreteFunctionImpl.h 2021-07-21 03:33:43 UTC (rev 280123)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2019-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -35,7 +35,7 @@
using Base = SVGAnimationDiscreteFunction<bool>;
using Base::Base;
- void setFromAndToValues(SVGElement*, const String& from, const String& to) override
+ void setFromAndToValues(SVGElement&, const String& from, const String& to) override
{
m_from = SVGPropertyTraits<bool>::fromString(from);
m_to = SVGPropertyTraits<bool>::fromString(to);
@@ -51,7 +51,7 @@
public:
using Base::Base;
- void setFromAndToValues(SVGElement*, const String& from, const String& to) override
+ void setFromAndToValues(SVGElement&, const String& from, const String& to) override
{
m_from = SVGPropertyTraits<EnumType>::fromString(from);
m_to = SVGPropertyTraits<EnumType>::fromString(to);
@@ -63,7 +63,7 @@
using Base = SVGAnimationDiscreteFunction<SVGMarkerOrientType>;
using Base::Base;
- void setFromAndToValues(SVGElement*, const String&, const String&) override
+ void setFromAndToValues(SVGElement&, const String&, const String&) override
{
// Values will be set by SVGAnimatedAngleOrientAnimator.
ASSERT_NOT_REACHED();
@@ -78,7 +78,7 @@
using Base = SVGAnimationDiscreteFunction<SVGPreserveAspectRatioValue>;
using Base::Base;
- void setFromAndToValues(SVGElement*, const String& from, const String& to) override
+ void setFromAndToValues(SVGElement&, const String& from, const String& to) override
{
m_from = SVGPreserveAspectRatioValue(from);
m_to = SVGPreserveAspectRatioValue(to);
@@ -90,7 +90,7 @@
using Base = SVGAnimationDiscreteFunction<String>;
using Base::Base;
- void setFromAndToValues(SVGElement*, const String& from, const String& to) override
+ void setFromAndToValues(SVGElement&, const String& from, const String& to) override
{
m_from = from;
m_to = to;
@@ -97,4 +97,4 @@
}
};
-}
+} // namespace WebCore
Modified: trunk/Source/WebCore/svg/properties/SVGAnimationFunction.h (280122 => 280123)
--- trunk/Source/WebCore/svg/properties/SVGAnimationFunction.h 2021-07-21 02:47:42 UTC (rev 280122)
+++ trunk/Source/WebCore/svg/properties/SVGAnimationFunction.h 2021-07-21 03:33:43 UTC (rev 280123)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -37,11 +37,11 @@
virtual bool isDiscrete() const { return false; }
- virtual void setFromAndToValues(SVGElement* targetElement, const String&, const String&) = 0;
- virtual void setFromAndByValues(SVGElement* targetElement, const String&, const String&) = 0;
+ virtual void setFromAndToValues(SVGElement& targetElement, const String&, const String&) = 0;
+ virtual void setFromAndByValues(SVGElement& targetElement, const String&, const String&) = 0;
virtual void setToAtEndOfDurationValue(const String&) = 0;
- virtual std::optional<float> calculateDistance(SVGElement*, const String&, const String&) const { return { }; }
+ virtual std::optional<float> calculateDistance(SVGElement&, const String&, const String&) const { return { }; }
protected:
SVGAnimationFunction(AnimationMode animationMode)
: m_animationMode(animationMode)
@@ -48,9 +48,9 @@
{
}
- virtual void addFromAndToValues(SVGElement*) { }
+ virtual void addFromAndToValues(SVGElement&) { }
AnimationMode m_animationMode;
};
-}
+} // namespace WebCore
Modified: trunk/Source/WebCore/svg/properties/SVGAttributeAnimator.cpp (280122 => 280123)
--- trunk/Source/WebCore/svg/properties/SVGAttributeAnimator.cpp 2021-07-21 02:47:42 UTC (rev 280122)
+++ trunk/Source/WebCore/svg/properties/SVGAttributeAnimator.cpp 2021-07-21 03:33:43 UTC (rev 280123)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,97 +32,92 @@
namespace WebCore {
-bool SVGAttributeAnimator::isAnimatedStylePropertyAniamtor(const SVGElement* targetElement) const
+bool SVGAttributeAnimator::isAnimatedStylePropertyAniamtor(const SVGElement& targetElement) const
{
- return targetElement->isAnimatedStyleAttribute(m_attributeName);
+ return targetElement.isAnimatedStyleAttribute(m_attributeName);
}
-void SVGAttributeAnimator::invalidateStyle(SVGElement* targetElement)
+void SVGAttributeAnimator::invalidateStyle(SVGElement& targetElement)
{
- SVGElement::InstanceInvalidationGuard guard(*targetElement);
- targetElement->invalidateSVGPresentationalHintStyle();
+ SVGElement::InstanceInvalidationGuard guard(targetElement);
+ targetElement.invalidateSVGPresentationalHintStyle();
}
-void SVGAttributeAnimator::applyAnimatedStylePropertyChange(SVGElement* element, CSSPropertyID id, const String& value)
+void SVGAttributeAnimator::applyAnimatedStylePropertyChange(SVGElement& element, CSSPropertyID id, const String& value)
{
- ASSERT(element);
- ASSERT(!element->m_deletionHasBegun);
+ ASSERT(!element.m_deletionHasBegun);
ASSERT(id != CSSPropertyInvalid);
- if (!element->ensureAnimatedSMILStyleProperties().setProperty(id, value, false))
+ if (!element.ensureAnimatedSMILStyleProperties().setProperty(id, value, false))
return;
- element->invalidateStyle();
+ element.invalidateStyle();
}
-void SVGAttributeAnimator::applyAnimatedStylePropertyChange(SVGElement* targetElement, const String& value)
+void SVGAttributeAnimator::applyAnimatedStylePropertyChange(SVGElement& targetElement, const String& value)
{
- ASSERT(targetElement);
ASSERT(m_attributeName != anyQName());
// FIXME: Do we really need to check both isConnected and !parentNode?
- if (!targetElement->isConnected() || !targetElement->parentNode())
+ if (!targetElement.isConnected() || !targetElement.parentNode())
return;
CSSPropertyID id = cssPropertyID(m_attributeName.localName());
- SVGElement::InstanceUpdateBlocker blocker(*targetElement);
+ SVGElement::InstanceUpdateBlocker blocker(targetElement);
applyAnimatedStylePropertyChange(targetElement, id, value);
// If the target element has instances, update them as well, w/o requiring the <use> tree to be rebuilt.
- for (auto& instance : copyToVectorOf<Ref<SVGElement>>(targetElement->instances()))
- applyAnimatedStylePropertyChange(instance.ptr(), id, value);
+ for (auto& instance : copyToVectorOf<Ref<SVGElement>>(targetElement.instances()))
+ applyAnimatedStylePropertyChange(instance, id, value);
}
-void SVGAttributeAnimator::removeAnimatedStyleProperty(SVGElement* element, CSSPropertyID id)
+void SVGAttributeAnimator::removeAnimatedStyleProperty(SVGElement& element, CSSPropertyID id)
{
- ASSERT(element);
- ASSERT(!element->m_deletionHasBegun);
+ ASSERT(!element.m_deletionHasBegun);
ASSERT(id != CSSPropertyInvalid);
- element->ensureAnimatedSMILStyleProperties().removeProperty(id);
- element->invalidateStyle();
+ element.ensureAnimatedSMILStyleProperties().removeProperty(id);
+ element.invalidateStyle();
}
-void SVGAttributeAnimator::removeAnimatedStyleProperty(SVGElement* targetElement)
+void SVGAttributeAnimator::removeAnimatedStyleProperty(SVGElement& targetElement)
{
- ASSERT(targetElement);
ASSERT(m_attributeName != anyQName());
// FIXME: Do we really need to check both isConnected and !parentNode?
- if (!targetElement->isConnected() || !targetElement->parentNode())
+ if (!targetElement.isConnected() || !targetElement.parentNode())
return;
CSSPropertyID id = cssPropertyID(m_attributeName.localName());
- SVGElement::InstanceUpdateBlocker blocker(*targetElement);
+ SVGElement::InstanceUpdateBlocker blocker(targetElement);
removeAnimatedStyleProperty(targetElement, id);
// If the target element has instances, update them as well, w/o requiring the <use> tree to be rebuilt.
- for (auto& instance : copyToVectorOf<Ref<SVGElement>>(targetElement->instances()))
- removeAnimatedStyleProperty(instance.ptr(), id);
+ for (auto& instance : copyToVectorOf<Ref<SVGElement>>(targetElement.instances()))
+ removeAnimatedStyleProperty(instance, id);
}
-void SVGAttributeAnimator::applyAnimatedPropertyChange(SVGElement* element, const QualifiedName& attributeName)
+void SVGAttributeAnimator::applyAnimatedPropertyChange(SVGElement& element, const QualifiedName& attributeName)
{
- ASSERT(!element->m_deletionHasBegun);
- element->svgAttributeChanged(attributeName);
+ ASSERT(!element.m_deletionHasBegun);
+ element.svgAttributeChanged(attributeName);
}
-void SVGAttributeAnimator::applyAnimatedPropertyChange(SVGElement* targetElement)
+void SVGAttributeAnimator::applyAnimatedPropertyChange(SVGElement& targetElement)
{
- ASSERT(targetElement);
ASSERT(m_attributeName != anyQName());
// FIXME: Do we really need to check both isConnected and !parentNode?
- if (!targetElement->isConnected() || !targetElement->parentNode())
+ if (!targetElement.isConnected() || !targetElement.parentNode())
return;
- SVGElement::InstanceUpdateBlocker blocker(*targetElement);
+ SVGElement::InstanceUpdateBlocker blocker(targetElement);
applyAnimatedPropertyChange(targetElement, m_attributeName);
// If the target element has instances, update them as well, w/o requiring the <use> tree to be rebuilt.
- for (auto& instance : copyToVectorOf<Ref<SVGElement>>(targetElement->instances()))
- applyAnimatedPropertyChange(instance.ptr(), m_attributeName);
+ for (auto& instance : copyToVectorOf<Ref<SVGElement>>(targetElement.instances()))
+ applyAnimatedPropertyChange(instance, m_attributeName);
}
-}
+} // namespace WebCore
Modified: trunk/Source/WebCore/svg/properties/SVGAttributeAnimator.h (280122 => 280123)
--- trunk/Source/WebCore/svg/properties/SVGAttributeAnimator.h 2021-07-21 02:47:42 UTC (rev 280122)
+++ trunk/Source/WebCore/svg/properties/SVGAttributeAnimator.h 2021-07-21 03:33:43 UTC (rev 280123)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -64,30 +64,30 @@
virtual bool isDiscrete() const { return false; }
- virtual void setFromAndToValues(SVGElement*, const String&, const String&) { }
- virtual void setFromAndByValues(SVGElement*, const String&, const String&) { }
+ virtual void setFromAndToValues(SVGElement&, const String&, const String&) { }
+ virtual void setFromAndByValues(SVGElement&, const String&, const String&) { }
virtual void setToAtEndOfDurationValue(const String&) { }
- virtual void start(SVGElement*) = 0;
- virtual void animate(SVGElement*, float progress, unsigned repeatCount) = 0;
- virtual void apply(SVGElement*) = 0;
- virtual void stop(SVGElement* targetElement) = 0;
+ virtual void start(SVGElement&) = 0;
+ virtual void animate(SVGElement&, float progress, unsigned repeatCount) = 0;
+ virtual void apply(SVGElement&) = 0;
+ virtual void stop(SVGElement& targetElement) = 0;
- virtual std::optional<float> calculateDistance(SVGElement*, const String&, const String&) const { return { }; }
+ virtual std::optional<float> calculateDistance(SVGElement&, const String&, const String&) const { return { }; }
protected:
- bool isAnimatedStylePropertyAniamtor(const SVGElement*) const;
+ bool isAnimatedStylePropertyAniamtor(const SVGElement&) const;
- static void invalidateStyle(SVGElement*);
- static void applyAnimatedStylePropertyChange(SVGElement*, CSSPropertyID, const String& value);
- static void removeAnimatedStyleProperty(SVGElement*, CSSPropertyID);
- static void applyAnimatedPropertyChange(SVGElement*, const QualifiedName&);
+ static void invalidateStyle(SVGElement&);
+ static void applyAnimatedStylePropertyChange(SVGElement&, CSSPropertyID, const String& value);
+ static void removeAnimatedStyleProperty(SVGElement&, CSSPropertyID);
+ static void applyAnimatedPropertyChange(SVGElement&, const QualifiedName&);
- void applyAnimatedStylePropertyChange(SVGElement*, const String& value);
- void removeAnimatedStyleProperty(SVGElement*);
- void applyAnimatedPropertyChange(SVGElement*);
+ void applyAnimatedStylePropertyChange(SVGElement&, const String& value);
+ void removeAnimatedStyleProperty(SVGElement&);
+ void applyAnimatedPropertyChange(SVGElement&);
const QualifiedName& m_attributeName;
};
-}
+} // namespace WebCore
Modified: trunk/Source/WebCore/svg/properties/SVGPrimitivePropertyAnimator.h (280122 => 280123)
--- trunk/Source/WebCore/svg/properties/SVGPrimitivePropertyAnimator.h 2021-07-21 02:47:42 UTC (rev 280122)
+++ trunk/Source/WebCore/svg/properties/SVGPrimitivePropertyAnimator.h 2021-07-21 03:33:43 UTC (rev 280123)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2019-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -54,19 +54,19 @@
{
}
- void start(SVGElement* targetElement) override
+ void start(SVGElement& targetElement) override
{
- String baseValue = computeCSSPropertyValue(*targetElement, cssPropertyID(m_attributeName.localName()));
+ String baseValue = computeCSSPropertyValue(targetElement, cssPropertyID(m_attributeName.localName()));
m_property->setValue(SVGPropertyTraits<PropertyType>::fromString(baseValue));
}
- void animate(SVGElement* targetElement, float progress, unsigned repeatCount) override
+ void animate(SVGElement& targetElement, float progress, unsigned repeatCount) override
{
PropertyType& animated = m_property->value();
m_function.animate(targetElement, progress, repeatCount, animated);
}
- void apply(SVGElement* targetElement) override
+ void apply(SVGElement& targetElement) override
{
applyAnimatedStylePropertyChange(targetElement, SVGPropertyTraits<PropertyType>::toString(m_property->value()));
}
@@ -75,4 +75,4 @@
Ref<ValuePropertyType> m_property;
};
-}
+} // namespace WebCore
Modified: trunk/Source/WebCore/svg/properties/SVGPropertyAnimator.h (280122 => 280123)
--- trunk/Source/WebCore/svg/properties/SVGPropertyAnimator.h 2021-07-21 02:47:42 UTC (rev 280122)
+++ trunk/Source/WebCore/svg/properties/SVGPropertyAnimator.h 2021-07-21 03:33:43 UTC (rev 280123)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2019-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -37,12 +37,12 @@
public:
bool isDiscrete() const override { return m_function.isDiscrete(); }
- void setFromAndToValues(SVGElement* targetElement, const String& from, const String& to) override
+ void setFromAndToValues(SVGElement& targetElement, const String& from, const String& to) override
{
m_function.setFromAndToValues(targetElement, adjustForInheritance(targetElement, from), adjustForInheritance(targetElement, to));
}
- void setFromAndByValues(SVGElement* targetElement, const String& from, const String& by) override
+ void setFromAndByValues(SVGElement& targetElement, const String& from, const String& by) override
{
m_function.setFromAndByValues(targetElement, from, by);
}
@@ -60,17 +60,17 @@
{
}
- void stop(SVGElement* targetElement) override
+ void stop(SVGElement& targetElement) override
{
removeAnimatedStyleProperty(targetElement);
}
- std::optional<float> calculateDistance(SVGElement* targetElement, const String& from, const String& to) const override
+ std::optional<float> calculateDistance(SVGElement& targetElement, const String& from, const String& to) const override
{
return m_function.calculateDistance(targetElement, from, to);
}
- String adjustForInheritance(SVGElement* targetElement, const String& value) const
+ String adjustForInheritance(SVGElement& targetElement, const String& value) const
{
static MainThreadNeverDestroyed<const AtomString> inherit("inherit", AtomString::ConstructFromLiteral);
return value == inherit ? computeInheritedCSSPropertyValue(targetElement) : value;
@@ -87,10 +87,9 @@
return value ? value->cssText() : String();
}
- String computeInheritedCSSPropertyValue(SVGElement* targetElement) const
+ String computeInheritedCSSPropertyValue(SVGElement& targetElement) const
{
- ASSERT(targetElement);
- auto parent = makeRefPtr(targetElement->parentElement());
+ auto parent = makeRefPtr(targetElement.parentElement());
if (!parent || !parent->isSVGElement())
return emptyString();
@@ -101,4 +100,4 @@
AnimationFunction m_function;
};
-}
+} // namespace WebCore
Modified: trunk/Source/WebCore/svg/properties/SVGPropertyOwnerRegistry.h (280122 => 280123)
--- trunk/Source/WebCore/svg/properties/SVGPropertyOwnerRegistry.h 2021-07-21 02:47:42 UTC (rev 280122)
+++ trunk/Source/WebCore/svg/properties/SVGPropertyOwnerRegistry.h 2021-07-21 03:33:43 UTC (rev 280123)
@@ -202,7 +202,7 @@
return attributeName;
}
- void setAnimatedPropertDirty(const QualifiedName& attributeName, SVGAnimatedProperty& animatedProperty) const override
+ void setAnimatedPropertyDirty(const QualifiedName& attributeName, SVGAnimatedProperty& animatedProperty) const override
{
enumerateRecursively([&](const auto& entry) -> bool {
if (!entry.key.matches(attributeName))
Modified: trunk/Source/WebCore/svg/properties/SVGPropertyRegistry.h (280122 => 280123)
--- trunk/Source/WebCore/svg/properties/SVGPropertyRegistry.h 2021-07-21 02:47:42 UTC (rev 280122)
+++ trunk/Source/WebCore/svg/properties/SVGPropertyRegistry.h 2021-07-21 03:33:43 UTC (rev 280123)
@@ -39,7 +39,7 @@
virtual void detachAllProperties() const = 0;
virtual QualifiedName propertyAttributeName(const SVGProperty&) const = 0;
virtual QualifiedName animatedPropertyAttributeName(const SVGAnimatedProperty&) const = 0;
- virtual void setAnimatedPropertDirty(const QualifiedName&, SVGAnimatedProperty&) const = 0;
+ virtual void setAnimatedPropertyDirty(const QualifiedName&, SVGAnimatedProperty&) const = 0;
virtual std::optional<String> synchronize(const QualifiedName&) const = 0;
virtual HashMap<QualifiedName, String> synchronizeAllAttributes() const = 0;
Modified: trunk/Source/WebCore/svg/properties/SVGValuePropertyAnimator.h (280122 => 280123)
--- trunk/Source/WebCore/svg/properties/SVGValuePropertyAnimator.h 2021-07-21 02:47:42 UTC (rev 280122)
+++ trunk/Source/WebCore/svg/properties/SVGValuePropertyAnimator.h 2021-07-21 03:33:43 UTC (rev 280123)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -44,12 +44,12 @@
{
}
- void animate(SVGElement* targetElement, float progress, unsigned repeatCount) override
+ void animate(SVGElement& targetElement, float progress, unsigned repeatCount) override
{
m_function.animate(targetElement, progress, repeatCount, m_property->value());
}
- void apply(SVGElement* targetElement) override
+ void apply(SVGElement& targetElement) override
{
applyAnimatedStylePropertyChange(targetElement, m_property->valueAsString());
}
@@ -61,4 +61,4 @@
Ref<PropertyType> m_property;
};
-}
+} // namespace WebCore
Modified: trunk/Source/WebCore/svg/properties/SVGValuePropertyAnimatorImpl.h (280122 => 280123)
--- trunk/Source/WebCore/svg/properties/SVGValuePropertyAnimatorImpl.h 2021-07-21 02:47:42 UTC (rev 280122)
+++ trunk/Source/WebCore/svg/properties/SVGValuePropertyAnimatorImpl.h 2021-07-21 03:33:43 UTC (rev 280123)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -42,9 +42,9 @@
return adoptRef(*new SVGLengthAnimator(attributeName, WTFMove(property), animationMode, calcMode, isAccumulated, isAdditive, SVGLengthMode::Other));
}
- void start(SVGElement* targetElement) override
+ void start(SVGElement& targetElement) override
{
- String baseValue = computeCSSPropertyValue(*targetElement, cssPropertyID(m_attributeName.localName()));
+ String baseValue = computeCSSPropertyValue(targetElement, cssPropertyID(m_attributeName.localName()));
SVGLengthValue value(SVGLengthMode::Other);
if (!value.setValueAsString(baseValue).hasException())
m_property->setValue(value);
@@ -51,5 +51,4 @@
}
};
-}
-
+} // namespace WebCore
Modified: trunk/Source/WebCore/svg/properties/SVGValuePropertyListAnimator.h (280122 => 280123)
--- trunk/Source/WebCore/svg/properties/SVGValuePropertyListAnimator.h 2021-07-21 02:47:42 UTC (rev 280122)
+++ trunk/Source/WebCore/svg/properties/SVGValuePropertyListAnimator.h 2021-07-21 03:33:43 UTC (rev 280123)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -44,12 +44,12 @@
{
}
- void animate(SVGElement* targetElement, float progress, unsigned repeatCount) override
+ void animate(SVGElement& targetElement, float progress, unsigned repeatCount) override
{
m_function.animate(targetElement, progress, repeatCount, m_list);
}
- void apply(SVGElement* targetElement) override
+ void apply(SVGElement& targetElement) override
{
applyAnimatedStylePropertyChange(targetElement, m_list->valueAsString());
}
@@ -61,4 +61,4 @@
RefPtr<ListType> m_list;
};
-}
+} // namespace WebCore
Modified: trunk/Source/WebCore/svg/properties/SVGValuePropertyListAnimatorImpl.h (280122 => 280123)
--- trunk/Source/WebCore/svg/properties/SVGValuePropertyListAnimatorImpl.h 2021-07-21 02:47:42 UTC (rev 280122)
+++ trunk/Source/WebCore/svg/properties/SVGValuePropertyListAnimatorImpl.h 2021-07-21 03:33:43 UTC (rev 280123)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2018-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -42,12 +42,12 @@
return adoptRef(*new SVGLengthListAnimator(attributeName, WTFMove(property), animationMode, calcMode, isAccumulated, isAdditive, SVGLengthMode::Other));
}
- void start(SVGElement* targetElement) override
+ void start(SVGElement& targetElement) final
{
- String baseValue = computeCSSPropertyValue(*targetElement, cssPropertyID(m_attributeName.localName()));
+ String baseValue = computeCSSPropertyValue(targetElement, cssPropertyID(m_attributeName.localName()));
if (!m_list->parse(baseValue))
m_list->clearItems();
}
};
-}
+} // namespace WebCore