Changeset 130777 in webkit
- Timestamp:
- Oct 9, 2012, 10:49:59 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r130776 r130777 1 2012-10-09 Philip Rogers <pdr@google.com> 2 3 Prevent animation when CSS attributeType is invalid. 4 https://bugs.webkit.org/show_bug.cgi?id=94569 5 6 Reviewed by Dirk Schulze. 7 8 Adding a test to prove this patch works (invalid-css-attribute-crash.svg) 9 and an additional test to show that switching between XML and CSS 10 attributeTypes works as expected (animate-css-xml-attributeType.html). 11 12 * platform/chromium/TestExpectations: 13 * platform/efl/TestExpectations: 14 * platform/gtk/TestExpectations: 15 * platform/mac/TestExpectations: 16 * platform/qt/TestExpectations: 17 * platform/win/TestExpectations: 18 * svg/animations/animate-css-xml-attributeType-expected.txt: Added. 19 * svg/animations/animate-css-xml-attributeType.html: Added. 20 * svg/animations/invalid-css-attribute-crash-expected.svg: Added. 21 * svg/animations/invalid-css-attribute-crash.svg: Added. 22 * svg/animations/script-tests/animate-css-xml-attributeType.js: Added. 23 (sample1): 24 (sample6): 25 (executeTest): 26 1 27 2012-10-08 Simon Fraser <simon.fraser@apple.com> 2 28 -
trunk/LayoutTests/platform/chromium/TestExpectations
r130771 r130777 1224 1224 crbug.com/19897 [ Android Linux Win ] svg/custom/getscreenctm-in-mixed-content2.xhtml [ Failure ] 1225 1225 1226 webkit.org/b/98718 svg/animations/animate-css-xml-attributeType.html [ Failure Pass ] 1227 1226 1228 # Failing since creation in http://trac.webkit.org/changeset/75308 1227 1229 # Failing worse maybe since https://bugs.webkit.org/show_bug.cgi?id=53471 -
trunk/LayoutTests/platform/efl/TestExpectations
r130769 r130777 820 820 webkit.org/b/98651 svg/text/non-bmp-positioning-lists.svg [ Skip ] 821 821 webkit.org/b/98653 svg/text/lengthAdjust-text-metrics.html [ Failure ] 822 823 webkit.org/b/98718 svg/animations/animate-css-xml-attributeType.html [ Failure Pass ] 822 824 823 825 # EFL's TestRunner does not implement setMediaType -
trunk/LayoutTests/platform/gtk/TestExpectations
r130773 r130777 535 535 webkit.org/b/89650 [ Debug ] svg/W3C-SVG-1.1/animate-elem-85-t.svg [ Failure Pass ] 536 536 webkit.org/b/89650 svg/W3C-SVG-1.1/struct-dom-06-b.svg [ Failure Pass ] 537 538 webkit.org/b/98718 svg/animations/animate-css-xml-attributeType.html [ Failure Pass ] 537 539 538 540 webkit.org/b/80158 plugins/netscape-plugin-page-cache-works.html [ Failure Pass ] -
trunk/LayoutTests/platform/mac/TestExpectations
r130655 r130777 1186 1186 webkit.org/b/89116 svg/filters/feLighting-crash.svg [ ImageOnlyFailure Pass ] 1187 1187 1188 webkit.org/b/98718 svg/animations/animate-css-xml-attributeType.html [ Failure Pass ] 1189 1188 1190 # Needs rebaseline after https://bugs.webkit.org/show_bug.cgi?id=79682 1189 1191 webkit.org/b/79682 svg/repaint/text-mask-update.svg [ Failure ImageOnlyFailure Missing Pass ] -
trunk/LayoutTests/platform/qt/TestExpectations
r130753 r130777 1426 1426 svg/text/text-intro-05-t.svg 1427 1427 svg/text/text-tselect-02-f.svg 1428 1429 webkit.org/b/98718 svg/animations/animate-css-xml-attributeType.html [ Failure Pass ] 1428 1430 1429 1431 # [Qt] svg/animations/animate-path-nested-transforms.html fails -
trunk/LayoutTests/platform/win/TestExpectations
r130720 r130777 142 142 fast/text/cg-vs-atsui.html 143 143 fast/text/atsui-spacing-features.html 144 145 webkit.org/b/98718 svg/animations/animate-css-xml-attributeType.html [ Failure Pass ] 144 146 145 147 # <rdar://problem/5718773> Support a minimum antialiased font size -
trunk/Source/WebCore/ChangeLog
r130774 r130777 1 2012-10-09 Philip Rogers <pdr@google.com> 2 3 Prevent animation when CSS attributeType is invalid. 4 https://bugs.webkit.org/show_bug.cgi?id=94569 5 6 Reviewed by Dirk Schulze. 7 8 This patch changes hasValidAttributeType() to return false when 9 we have attributeType=CSS with a non-CSS attribute name. 10 11 Previously we would animate non-CSS attributes when attributeType was 12 CSS which resulted in crashes. To track this case, this patch catches 13 changes to targetElement, attributeName, and attributeType and checks 14 if an invalid combination is present. If invalid, hasInvalidCSSAttributeType() 15 will return true causing hasValidAttributeType() to return false and prevent 16 the animation from running. 17 18 Tests: svg/animations/animate-css-xml-attributeType.html 19 svg/animations/invalid-css-attribute-crash-expected.svg 20 svg/animations/invalid-css-attribute-crash.svg 21 22 * svg/SVGAnimateElement.cpp: 23 (WebCore::SVGAnimateElement::hasValidAttributeType): 24 (WebCore::SVGAnimateElement::targetElementWillChange): 25 * svg/SVGAnimationElement.cpp: 26 (WebCore::SVGAnimationElement::SVGAnimationElement): 27 (WebCore::SVGAnimationElement::isSupportedAttribute): 28 29 This now supports the attributeType attribute which is stored in m_attributeType. 30 31 (WebCore::SVGAnimationElement::parseAttribute): 32 (WebCore::SVGAnimationElement::setAttributeType): 33 34 Changes to attributeType, attributeName, and targetElement need to be tracked 35 to determine when an invalid combination happens. 36 37 (WebCore::SVGAnimationElement::targetElementWillChange): 38 (WebCore): 39 (WebCore::SVGAnimationElement::setAttributeName): 40 (WebCore::SVGAnimationElement::checkInvalidCSSAttributeType): 41 * svg/SVGAnimationElement.h: 42 (WebCore::SVGAnimationElement::attributeType): 43 (SVGAnimationElement): 44 (WebCore::SVGAnimationElement::hasInvalidCSSAttributeType): 45 * svg/animation/SVGSMILElement.cpp: 46 (WebCore::SVGSMILElement::targetElement): 47 * svg/animation/SVGSMILElement.h: 48 (SVGSMILElement): 49 1 50 2012-10-09 Pravin D <pravind.2k4@gmail.com> 2 51 -
trunk/Source/WebCore/svg/SVGAnimateElement.cpp
r116451 r130777 57 57 if (!targetElement) 58 58 return false; 59 60 return m_animatedPropertyType != AnimatedUnknown ;59 60 return m_animatedPropertyType != AnimatedUnknown && !hasInvalidCSSAttributeType(); 61 61 } 62 62 … … 399 399 void SVGAnimateElement::targetElementWillChange(SVGElement* currentTarget, SVGElement* newTarget) 400 400 { 401 SVG SMILElement::targetElementWillChange(currentTarget, newTarget);401 SVGAnimationElement::targetElementWillChange(currentTarget, newTarget); 402 402 403 403 ASSERT(!m_animatedType); -
trunk/Source/WebCore/svg/SVGAnimationElement.cpp
r125608 r130777 56 56 , m_toPropertyValueType(RegularPropertyValue) 57 57 , m_animationValid(false) 58 , m_attributeType(AttributeTypeAuto) 59 , m_hasInvalidCSSAttributeType(false) 58 60 { 59 61 registerAnimatedPropertiesForSVGAnimationElement(); … … 146 148 supportedAttributes.add(SVGNames::keyPointsAttr); 147 149 supportedAttributes.add(SVGNames::keySplinesAttr); 150 supportedAttributes.add(SVGNames::attributeTypeAttr); 148 151 } 149 152 return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); … … 183 186 if (attribute.name() == SVGNames::keySplinesAttr) { 184 187 parseKeySplines(attribute.value(), m_keySplines); 188 return; 189 } 190 191 if (attribute.name() == SVGNames::attributeTypeAttr) { 192 setAttributeType(attribute.value()); 185 193 return; 186 194 } … … 282 290 } 283 291 284 SVGAnimationElement::AttributeType SVGAnimationElement::attributeType() const 285 { 292 void SVGAnimationElement::setAttributeType(const AtomicString& attributeType) 293 { 286 294 DEFINE_STATIC_LOCAL(const AtomicString, css, ("CSS")); 287 295 DEFINE_STATIC_LOCAL(const AtomicString, xml, ("XML")); 288 const AtomicString& value = fastGetAttribute(SVGNames::attributeTypeAttr); 289 if (value == css) 290 return AttributeTypeCSS; 291 if (value == xml) 292 return AttributeTypeXML; 293 return AttributeTypeAuto; 296 if (attributeType == css) 297 m_attributeType = AttributeTypeCSS; 298 else if (attributeType == xml) 299 m_attributeType = AttributeTypeXML; 300 else 301 m_attributeType = AttributeTypeAuto; 302 checkInvalidCSSAttributeType(targetElement(DoNotResolveNewTarget)); 294 303 } 295 304 … … 649 658 } 650 659 660 void SVGAnimationElement::targetElementWillChange(SVGElement* currentTarget, SVGElement* newTarget) 661 { 662 SVGSMILElement::targetElementWillChange(currentTarget, newTarget); 663 664 checkInvalidCSSAttributeType(newTarget); 665 } 666 667 void SVGAnimationElement::setAttributeName(const QualifiedName& attributeName) 668 { 669 SVGSMILElement::setAttributeName(attributeName); 670 671 checkInvalidCSSAttributeType(targetElement(DoNotResolveNewTarget)); 672 } 673 674 void SVGAnimationElement::checkInvalidCSSAttributeType(SVGElement* target) 675 { 676 m_hasInvalidCSSAttributeType = target && hasValidAttributeName() && attributeType() == AttributeTypeCSS && !isTargetAttributeCSSProperty(target, attributeName()); 677 } 678 651 679 } 652 680 -
trunk/Source/WebCore/svg/SVGAnimationElement.h
r117195 r130777 184 184 AttributeTypeAuto 185 185 }; 186 AttributeType attributeType() const ;186 AttributeType attributeType() const { return m_attributeType; } 187 187 188 188 String toValue() const; … … 199 199 AnimatedPropertyValueType m_toPropertyValueType; 200 200 201 virtual void targetElementWillChange(SVGElement* currentTarget, SVGElement* oldTarget) OVERRIDE; 202 bool hasInvalidCSSAttributeType() const { return m_hasInvalidCSSAttributeType; } 203 201 204 private: 202 205 virtual void animationAttributeChanged() OVERRIDE; 206 virtual void setAttributeName(const QualifiedName&) OVERRIDE; 207 void setAttributeType(const AtomicString&); 208 209 void checkInvalidCSSAttributeType(SVGElement*); 203 210 204 211 virtual bool calculateToAtEndOfDurationValue(const String& toAtEndOfDurationString) = 0; … … 231 238 bool m_animationValid; 232 239 240 AttributeType m_attributeType; 233 241 Vector<String> m_values; 234 242 Vector<float> m_keyTimes; … … 237 245 String m_lastValuesAnimationFrom; 238 246 String m_lastValuesAnimationTo; 247 bool m_hasInvalidCSSAttributeType; 239 248 }; 240 249 -
trunk/Source/WebCore/svg/animation/SVGSMILElement.cpp
r129670 r130777 568 568 } 569 569 570 SVGElement* SVGSMILElement::targetElement( )570 SVGElement* SVGSMILElement::targetElement(ResolveTarget resolveTarget) 571 571 { 572 572 if (m_targetElement) 573 573 return m_targetElement; 574 574 575 if (!inDocument() )575 if (!inDocument() || resolveTarget == DoNotResolveNewTarget) 576 576 return 0; 577 577 -
trunk/Source/WebCore/svg/animation/SVGSMILElement.h
r129670 r130777 59 59 SMILTimeContainer* timeContainer() const { return m_timeContainer.get(); } 60 60 61 SVGElement* targetElement( );61 SVGElement* targetElement(ResolveTarget = ResolveNewTarget); 62 62 void resetTargetElement(ResolveTarget = ResolveNewTarget); 63 63 const QualifiedName& attributeName() const { return m_attributeName; } … … 122 122 // Sub-classes may need to take action when the target is changed. 123 123 virtual void targetElementWillChange(SVGElement* currentTarget, SVGElement* newTarget); 124 virtual void setAttributeName(const QualifiedName&); 124 125 125 126 private: … … 143 144 void endListChanged(SMILTime eventTime); 144 145 145 void setAttributeName(const QualifiedName&);146 147 146 // This represents conditions on elements begin or end list that need to be resolved on runtime 148 147 // for example <animate begin="otherElement.begin + 8s; button.click" ... />
Note:
See TracChangeset
for help on using the changeset viewer.