Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGAnimateElement.h

Issue 2746013007: Rework SMIL animation target invalidation (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/svg/SVGAnimateElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
4 * Copyright (C) 2008 Apple Inc. All rights reserved. 4 * Copyright (C) 2008 Apple Inc. All rights reserved.
5 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 5 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 const Attribute&) const override; 49 const Attribute&) const override;
50 50
51 AnimatedPropertyType animatedPropertyType(); 51 AnimatedPropertyType animatedPropertyType();
52 bool animatedPropertyTypeSupportsAddition(); 52 bool animatedPropertyTypeSupportsAddition();
53 53
54 protected: 54 protected:
55 SVGAnimateElement(const QualifiedName&, Document&); 55 SVGAnimateElement(const QualifiedName&, Document&);
56 56
57 bool hasValidTarget() override; 57 bool hasValidTarget() override;
58 58
59 void willChangeAnimationTarget() final;
60 void didChangeAnimationTarget() final;
61
59 void resetAnimatedType() final; 62 void resetAnimatedType() final;
60 void clearAnimatedType() final; 63 void clearAnimatedType() final;
61 64
62 bool calculateToAtEndOfDurationValue( 65 bool calculateToAtEndOfDurationValue(
63 const String& toAtEndOfDurationString) final; 66 const String& toAtEndOfDurationString) final;
64 bool calculateFromAndToValues(const String& fromString, 67 bool calculateFromAndToValues(const String& fromString,
65 const String& toString) final; 68 const String& toString) final;
66 bool calculateFromAndByValues(const String& fromString, 69 bool calculateFromAndByValues(const String& fromString,
67 const String& byString) final; 70 const String& byString) final;
68 void calculateAnimatedValue(float percentage, 71 void calculateAnimatedValue(float percentage,
69 unsigned repeatCount, 72 unsigned repeatCount,
70 SVGSMILElement* resultElement) final; 73 SVGSMILElement* resultElement) final;
71 void applyResultsToTarget() final; 74 void applyResultsToTarget() final;
72 float calculateDistance(const String& fromString, 75 float calculateDistance(const String& fromString,
73 const String& toString) final; 76 const String& toString) final;
74 bool isAdditive() final; 77 bool isAdditive() final;
75 78
76 void parseAttribute(const AttributeModificationParams&) override; 79 void parseAttribute(const AttributeModificationParams&) override;
77 80
78 void setTargetElement(SVGElement*) final;
79 void setAttributeName(const QualifiedName&); 81 void setAttributeName(const QualifiedName&);
80 82
81 enum AttributeType { AttributeTypeCSS, AttributeTypeXML, AttributeTypeAuto }; 83 enum AttributeType { AttributeTypeCSS, AttributeTypeXML, AttributeTypeAuto };
82 AttributeType getAttributeType() const { return m_attributeType; } 84 AttributeType getAttributeType() const { return m_attributeType; }
83 85
84 FRIEND_TEST_ALL_PREFIXES(UnsafeSVGAttributeSanitizationTest, 86 FRIEND_TEST_ALL_PREFIXES(UnsafeSVGAttributeSanitizationTest,
85 stringsShouldNotSupportAddition); 87 stringsShouldNotSupportAddition);
86 88
87 private: 89 private:
88 void resetAnimatedPropertyType(); 90 void resetAnimatedPropertyType();
89 91
90 bool shouldApplyAnimation(const SVGElement& targetElement, 92 bool shouldApplyAnimation(const SVGElement& targetElement,
91 const QualifiedName& attributeName); 93 const QualifiedName& attributeName);
92 94
93 void setAttributeType(const AtomicString&); 95 void setAttributeType(const AtomicString&);
94 96
95 InsertionNotificationRequest insertedInto(ContainerNode*) final; 97 InsertionNotificationRequest insertedInto(ContainerNode*) final;
96 void removedFrom(ContainerNode*) final; 98 void removedFrom(ContainerNode*) final;
97 99
98 void checkInvalidCSSAttributeType();
99 bool hasValidAttributeName() const;
100
101 virtual void resolveTargetProperty(); 100 virtual void resolveTargetProperty();
102 void clearTargetProperty(); 101 void clearTargetProperty();
103 102
104 virtual SVGPropertyBase* createPropertyForAnimation(const String&) const; 103 virtual SVGPropertyBase* createPropertyForAnimation(const String&) const;
105 SVGPropertyBase* createPropertyForAttributeAnimation(const String&) const; 104 SVGPropertyBase* createPropertyForAttributeAnimation(const String&) const;
106 SVGPropertyBase* createPropertyForCSSAnimation(const String&) const; 105 SVGPropertyBase* createPropertyForCSSAnimation(const String&) const;
107 106
108 SVGPropertyBase* adjustForInheritance(SVGPropertyBase*, 107 SVGPropertyBase* adjustForInheritance(SVGPropertyBase*,
109 AnimatedPropertyValueType) const; 108 AnimatedPropertyValueType) const;
110 109
111 Member<SVGPropertyBase> m_fromProperty; 110 Member<SVGPropertyBase> m_fromProperty;
112 Member<SVGPropertyBase> m_toProperty; 111 Member<SVGPropertyBase> m_toProperty;
113 Member<SVGPropertyBase> m_toAtEndOfDurationProperty; 112 Member<SVGPropertyBase> m_toAtEndOfDurationProperty;
114 Member<SVGPropertyBase> m_animatedValue; 113 Member<SVGPropertyBase> m_animatedValue;
115 114
116 protected: 115 protected:
117 Member<SVGAnimatedPropertyBase> m_targetProperty; 116 Member<SVGAnimatedPropertyBase> m_targetProperty;
118 AnimatedPropertyType m_type; 117 AnimatedPropertyType m_type;
119 CSSPropertyID m_cssPropertyId; 118 CSSPropertyID m_cssPropertyId;
120 119
121 bool isAnimatingSVGDom() const { return m_targetProperty; } 120 bool isAnimatingSVGDom() const { return m_targetProperty; }
122 bool isAnimatingCSSProperty() const { 121 bool isAnimatingCSSProperty() const {
123 return m_cssPropertyId != CSSPropertyInvalid; 122 return m_cssPropertyId != CSSPropertyInvalid;
124 } 123 }
125 124
126 private: 125 private:
127 AnimatedPropertyValueType m_fromPropertyValueType; 126 AnimatedPropertyValueType m_fromPropertyValueType;
128 AnimatedPropertyValueType m_toPropertyValueType; 127 AnimatedPropertyValueType m_toPropertyValueType;
129 AttributeType m_attributeType; 128 AttributeType m_attributeType;
130 bool m_hasInvalidCSSAttributeType;
131 }; 129 };
132 130
133 inline bool isSVGAnimateElement(const SVGElement& element) { 131 inline bool isSVGAnimateElement(const SVGElement& element) {
134 return element.hasTagName(SVGNames::animateTag) || 132 return element.hasTagName(SVGNames::animateTag) ||
135 element.hasTagName(SVGNames::animateTransformTag) || 133 element.hasTagName(SVGNames::animateTransformTag) ||
136 element.hasTagName(SVGNames::setTag); 134 element.hasTagName(SVGNames::setTag);
137 } 135 }
138 136
139 DEFINE_SVGELEMENT_TYPE_CASTS_WITH_FUNCTION(SVGAnimateElement); 137 DEFINE_SVGELEMENT_TYPE_CASTS_WITH_FUNCTION(SVGAnimateElement);
140 138
141 } // namespace blink 139 } // namespace blink
142 140
143 #endif // SVGAnimateElement_h 141 #endif // SVGAnimateElement_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/svg/SVGAnimateElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698