Diff
Modified: trunk/Source/WebCore/ChangeLog (280088 => 280089)
--- trunk/Source/WebCore/ChangeLog 2021-07-20 17:53:14 UTC (rev 280088)
+++ trunk/Source/WebCore/ChangeLog 2021-07-20 18:21:58 UTC (rev 280089)
@@ -1,3 +1,28 @@
+2021-07-20 Said Abou-Hallawa <[email protected]>
+
+ Make SVGPropertyAnimator::computeCSSPropertyValue() take a reference to SVGElement
+ https://bugs.webkit.org/show_bug.cgi?id=228093
+ <rdar://80789262>
+
+ Reviewed by Simon Fraser.
+
+ The assumption is the pointer 'targetElement' can't be nullptr. So make
+ it a reference instead.
+
+ * svg/SVGAnimationElement.cpp:
+ (WebCore::SVGAnimationElement::computeCSSPropertyValue): Deleted.
+ (WebCore::inheritsFromProperty): Deleted.
+ (WebCore::SVGAnimationElement::determinePropertyValueTypes): Deleted.
+ * svg/SVGAnimationElement.h:
+ Delete unused methods from SVGAnimationElement.
+
+ * svg/properties/SVGPrimitivePropertyAnimator.h:
+ * svg/properties/SVGPropertyAnimator.h:
+ (WebCore::SVGPropertyAnimator::computeCSSPropertyValue const):
+ (WebCore::SVGPropertyAnimator::computeInheritedCSSPropertyValue const):
+ * svg/properties/SVGValuePropertyAnimatorImpl.h:
+ * svg/properties/SVGValuePropertyListAnimatorImpl.h:
+
2021-07-20 Chris Dumez <[email protected]>
REGRESSION (r278702): Cannot login to appaloosa-store.com/users/sign_in
Modified: trunk/Source/WebCore/svg/SVGAnimationElement.cpp (280088 => 280089)
--- trunk/Source/WebCore/svg/SVGAnimationElement.cpp 2021-07-20 17:53:14 UTC (rev 280088)
+++ trunk/Source/WebCore/svg/SVGAnimationElement.cpp 2021-07-20 18:21:58 UTC (rev 280089)
@@ -601,37 +601,6 @@
calculateAnimatedValue(effectivePercent, repeatCount);
}
-void SVGAnimationElement::computeCSSPropertyValue(SVGElement* element, CSSPropertyID id, String& valueString)
-{
- ASSERT(element);
-
- // Don't include any properties resulting from CSS Transitions/Animations or SMIL animations, as we want to retrieve the "base value".
- element->setUseOverrideComputedStyle(true);
- RefPtr<CSSValue> value = ComputedStyleExtractor(element).propertyValue(id);
- valueString = value ? value->cssText() : String();
- element->setUseOverrideComputedStyle(false);
-}
-
-static bool inheritsFromProperty(SVGElement* targetElement, const QualifiedName& attributeName, const String& value)
-{
- static MainThreadNeverDestroyed<const AtomString> inherit("inherit", AtomString::ConstructFromLiteral);
-
- if (value.isEmpty() || value != inherit)
- return false;
- return targetElement->isAnimatedStyleAttribute(attributeName);
-}
-
-void SVGAnimationElement::determinePropertyValueTypes(const String& from, const String& to)
-{
- auto targetElement = makeRefPtr(this->targetElement());
- ASSERT(targetElement);
-
- const QualifiedName& attributeName = this->attributeName();
- if (inheritsFromProperty(targetElement.get(), attributeName, from))
- m_fromPropertyValueType = InheritValue;
- if (inheritsFromProperty(targetElement.get(), attributeName, to))
- m_toPropertyValueType = InheritValue;
-}
void SVGAnimationElement::resetAnimation()
{
m_lastValuesAnimationFrom = String();
Modified: trunk/Source/WebCore/svg/SVGAnimationElement.h (280088 => 280089)
--- trunk/Source/WebCore/svg/SVGAnimationElement.h 2021-07-20 17:53:14 UTC (rev 280088)
+++ trunk/Source/WebCore/svg/SVGAnimationElement.h 2021-07-20 18:21:58 UTC (rev 280089)
@@ -79,9 +79,6 @@
enum class AttributeType : uint8_t { CSS, XML, Auto };
AttributeType attributeType() const { return m_attributeType; }
- void computeCSSPropertyValue(SVGElement*, CSSPropertyID, String& value);
- virtual void determinePropertyValueTypes(const String& from, const String& to);
-
protected:
SVGAnimationElement(const QualifiedName&, Document&);
Modified: trunk/Source/WebCore/svg/properties/SVGPrimitivePropertyAnimator.h (280088 => 280089)
--- trunk/Source/WebCore/svg/properties/SVGPrimitivePropertyAnimator.h 2021-07-20 17:53:14 UTC (rev 280088)
+++ trunk/Source/WebCore/svg/properties/SVGPrimitivePropertyAnimator.h 2021-07-20 18:21:58 UTC (rev 280089)
@@ -56,7 +56,7 @@
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));
}
Modified: trunk/Source/WebCore/svg/properties/SVGPropertyAnimator.h (280088 => 280089)
--- trunk/Source/WebCore/svg/properties/SVGPropertyAnimator.h 2021-07-20 17:53:14 UTC (rev 280088)
+++ trunk/Source/WebCore/svg/properties/SVGPropertyAnimator.h 2021-07-20 18:21:58 UTC (rev 280089)
@@ -76,14 +76,14 @@
return value == inherit ? computeInheritedCSSPropertyValue(targetElement) : value;
}
- String computeCSSPropertyValue(SVGElement* targetElement, CSSPropertyID id) const
+ String computeCSSPropertyValue(SVGElement& targetElement, CSSPropertyID id) const
{
- ASSERT(targetElement);
+ auto protector = makeRefPtr(targetElement);
// Don't include any properties resulting from CSS Transitions/Animations or SMIL animations, as we want to retrieve the "base value".
- targetElement->setUseOverrideComputedStyle(true);
- RefPtr<CSSValue> value = ComputedStyleExtractor(targetElement).propertyValue(id);
- targetElement->setUseOverrideComputedStyle(false);
+ targetElement.setUseOverrideComputedStyle(true);
+ RefPtr<CSSValue> value = ComputedStyleExtractor(&targetElement).propertyValue(id);
+ targetElement.setUseOverrideComputedStyle(false);
return value ? value->cssText() : String();
}
@@ -95,7 +95,7 @@
return emptyString();
SVGElement& svgParent = downcast<SVGElement>(*parent);
- return computeCSSPropertyValue(&svgParent, cssPropertyID(m_attributeName.localName()));
+ return computeCSSPropertyValue(svgParent, cssPropertyID(m_attributeName.localName()));
}
AnimationFunction m_function;
Modified: trunk/Source/WebCore/svg/properties/SVGValuePropertyAnimatorImpl.h (280088 => 280089)
--- trunk/Source/WebCore/svg/properties/SVGValuePropertyAnimatorImpl.h 2021-07-20 17:53:14 UTC (rev 280088)
+++ trunk/Source/WebCore/svg/properties/SVGValuePropertyAnimatorImpl.h 2021-07-20 18:21:58 UTC (rev 280089)
@@ -44,7 +44,7 @@
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);
Modified: trunk/Source/WebCore/svg/properties/SVGValuePropertyListAnimatorImpl.h (280088 => 280089)
--- trunk/Source/WebCore/svg/properties/SVGValuePropertyListAnimatorImpl.h 2021-07-20 17:53:14 UTC (rev 280088)
+++ trunk/Source/WebCore/svg/properties/SVGValuePropertyListAnimatorImpl.h 2021-07-20 18:21:58 UTC (rev 280089)
@@ -44,7 +44,7 @@
void start(SVGElement* targetElement) override
{
- String baseValue = computeCSSPropertyValue(targetElement, cssPropertyID(m_attributeName.localName()));
+ String baseValue = computeCSSPropertyValue(*targetElement, cssPropertyID(m_attributeName.localName()));
if (!m_list->parse(baseValue))
m_list->clearItems();
}