Changeset 253017 in webkit
- Timestamp:
- Dec 2, 2019 4:38:16 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r252998 r253017 1 2019-12-02 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 Crash when animating an enum attribute for multiple instances of an SVG element 4 https://bugs.webkit.org/show_bug.cgi?id=204766 5 6 Reviewed by Simon Fraser. 7 8 * svg/animations/animated-enum-lengthAdjust-instances-expected.txt: Added. 9 * svg/animations/animated-enum-lengthAdjust-instances.svg: Added. 10 1 11 2019-12-02 Alex Christensen <achristensen@webkit.org> 2 12 -
trunk/Source/WebCore/ChangeLog
r253016 r253017 1 2019-12-02 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 Crash when animating an enum attribute for multiple instances of an SVG element 4 https://bugs.webkit.org/show_bug.cgi?id=204766 5 6 Reviewed by Simon Fraser. 7 8 Test: svg/animations/animated-enum-lengthAdjust-instances.svg 9 10 All instances of SVG animated properties have to share a single animVal 11 such that once its value is progressed, all the instances will see the 12 change. This was not happening for SVGAnimatedDecoratedProperty. To do 13 that we need to: 14 15 -- Make SVGDecoratedProperty be RefCounted. 16 -- Change the type of SVGAnimatedDecoratedProperty::m_baseVal to 17 Ref<SVGDecoratedProperty<DecorationType>>. 18 -- Change the type of SVGAnimatedDecoratedProperty::m_animVal to 19 RefPtr<SVGDecoratedProperty<DecorationType>>. The master property 20 creates it and all the instances hold references to the same pointer. 21 -- Override the virtual methods instanceStartAnimation() and 22 instanceStopAnimation() of SVGAnimatedDecoratedProperty. 23 24 * svg/properties/SVGAnimatedDecoratedProperty.h: 25 (WebCore::SVGAnimatedDecoratedProperty::create): 26 (WebCore::SVGAnimatedDecoratedProperty::SVGAnimatedDecoratedProperty): 27 (WebCore::SVGAnimatedDecoratedProperty::animVal const): 28 (WebCore::SVGAnimatedDecoratedProperty::currentValue const): 29 * svg/properties/SVGDecoratedEnumeration.h: 30 (WebCore::SVGDecoratedEnumeration::create): 31 * svg/properties/SVGDecoratedProperty.h: 32 1 33 2019-12-02 Tim Horton <timothy_horton@apple.com> 2 34 -
trunk/Source/WebCore/svg/properties/SVGAnimatedDecoratedProperty.h
r248846 r253017 37 37 static Ref<AnimatedProperty> create(SVGElement* contextElement) 38 38 { 39 return adoptRef(*new AnimatedProperty(contextElement, makeUnique<DecoratedProperty<DecorationType, PropertyType>>()));39 return adoptRef(*new AnimatedProperty(contextElement, adoptRef(*new DecoratedProperty<DecorationType, PropertyType>()))); 40 40 } 41 41 … … 46 46 } 47 47 48 SVGAnimatedDecoratedProperty(SVGElement* contextElement, std::unique_ptr<SVGDecoratedProperty<DecorationType>>&& baseVal)48 SVGAnimatedDecoratedProperty(SVGElement* contextElement, Ref<SVGDecoratedProperty<DecorationType>>&& baseVal) 49 49 : SVGAnimatedProperty(contextElement) 50 50 , m_baseVal(WTFMove(baseVal)) … … 84 84 { 85 85 ASSERT_IMPLIES(isAnimating(), m_animVal); 86 return static_cast<PropertyType>((isAnimating() ? m_animVal : m_baseVal)->value());86 return static_cast<PropertyType>((isAnimating() ? *m_animVal : m_baseVal.get()).value()); 87 87 } 88 88 … … 112 112 PropertyType currentValue() const 113 113 { 114 return static_cast<PropertyType>((isAnimating() ? m_animVal : m_baseVal)->valueInternal()); 114 ASSERT_IMPLIES(isAnimating(), m_animVal); 115 return static_cast<PropertyType>((isAnimating() ? *m_animVal : m_baseVal.get()).valueInternal()); 115 116 } 116 117 … … 131 132 } 132 133 134 // Controlling the instance animation. 135 void instanceStartAnimation(SVGAnimatedProperty& animated) override 136 { 137 m_animVal = static_cast<decltype(*this)>(animated).m_animVal; 138 SVGAnimatedProperty::instanceStartAnimation(animated); 139 } 140 141 void instanceStopAnimation() override 142 { 143 m_animVal = nullptr; 144 SVGAnimatedProperty::instanceStopAnimation(); 145 } 146 133 147 protected: 134 std::unique_ptr<SVGDecoratedProperty<DecorationType>> m_baseVal;135 std::unique_ptr<SVGDecoratedProperty<DecorationType>> m_animVal;148 Ref<SVGDecoratedProperty<DecorationType>> m_baseVal; 149 RefPtr<SVGDecoratedProperty<DecorationType>> m_animVal; 136 150 SVGPropertyState m_state { SVGPropertyState::Clean }; 137 151 }; -
trunk/Source/WebCore/svg/properties/SVGDecoratedEnumeration.h
r248846 r253017 40 40 { 41 41 static_assert(std::is_integral<DecorationType>::value, "DecorationType form enum should be integral."); 42 return makeUnique<SVGDecoratedEnumeration>(value);42 return adoptRef(*new SVGDecoratedEnumeration(value)); 43 43 } 44 44 … … 59 59 } 60 60 61 std::unique_ptr<SVGDecoratedProperty<DecorationType>> clone() override61 Ref<SVGDecoratedProperty<DecorationType>> clone() override 62 62 { 63 63 return create(m_value); -
trunk/Source/WebCore/svg/properties/SVGDecoratedProperty.h
r248762 r253017 26 26 #pragma once 27 27 28 #include <wtf/RefCounted.h> 29 28 30 namespace WebCore { 29 31 30 32 template<typename DecorationType> 31 class SVGDecoratedProperty {33 class SVGDecoratedProperty : public RefCounted<SVGDecoratedProperty<DecorationType>> { 32 34 WTF_MAKE_FAST_ALLOCATED; 33 35 public: … … 49 51 50 52 virtual String valueAsString() const = 0; 51 virtual std::unique_ptr<SVGDecoratedProperty<DecorationType>> clone() = 0;53 virtual Ref<SVGDecoratedProperty<DecorationType>> clone() = 0; 52 54 }; 53 55
Note: See TracChangeset
for help on using the changeset viewer.