⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 179772 in webkit


Ignore:
Timestamp:
Feb 6, 2015, 5:24:48 PM (12 years ago)
Author:
Said Abou-Hallawa
Message:
 
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r179771 r179772  
     12015-02-06  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        Invalid cast in WebCore::SVGAnimateElement::calculateAnimatedValue.
     4        https://bugs.webkit.org/show_bug.cgi?id=135171.
     5
     6        Reviewed by Dean Jackson.
     7
     8        * svg/animations/animate-montion-invalid-attribute-expected.svg: Added.
     9        * svg/animations/animate-montion-invalid-attribute.svg: Added.
     10        Make sure that adding the same attribute to <animateMotion> and <animate>, which both
     11        animate the same target element, will be ignored and we won't crash.
     12
    1132015-02-06  Simon Fraser  <simon.fraser@apple.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r179771 r179772  
     12015-02-06  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        Invalid cast in WebCore::SVGAnimateElement::calculateAnimatedValue.
     4        https://bugs.webkit.org/show_bug.cgi?id=135171.
     5
     6        Reviewed by Dean Jackson.
     7
     8        The bug happens when an SVG element is animated by <animateMotion> followed by an
     9        <animateColor> or an <animate> and the values of the "attributeName" in both elements
     10        are the same. The problem is <animateMotion> should not have an attribute to animate.
     11        If it does by fuzz or by mistake, then we assume the <animateMotion> and the <animate>
     12        animate the same attribute for the same element target. Therefore we schedule them in
     13        the same AnimationVector in SMILTimeContainer::schedule(). When we call
     14        SVGAnimateElementBase::calculateAnimatedValue() for an SVGAnimateColorElement and the
     15        resultElement is SVGAnimateMotionElement, we fail to cast it to SVGAnimateElementBase
     16        because SVGAnimateMotionElement is derived from SVGAnimationElement which is the base
     17        class of all animate elements including SVGAnimateElementBase.
     18
     19        The fix is to nullify setting "attributeName" of an SVGAnimationElement. By doing so,
     20        "attributeName" and its value will be ignored from the <animateMotion> which is correct.
     21       
     22        Tests: svg/animations/animate-montion-invalid-attribute.svg.
     23
     24        * svg/SVGAnimateElementBase.cpp:
     25        (WebCore::SVGAnimateElementBase::setAttributeName):
     26        Do not call SVGAnimationElement::setAttributeName() since SVGAnimationElement should
     27        not have an attribute to animate. We prevent this by bypassing the parent in the class
     28        hierarchy: SVGAnimationElement and calling SVGSMILElement::setAttributeName() directly.
     29       
     30        * svg/SVGAnimationElement.cpp:
     31        (WebCore::SVGAnimationElement::setAttributeName): Deleted.
     32        * svg/SVGAnimationElement.h:
     33        SVGAnimationElement should not have an attribute to animate. So implement its
     34        setAttributeName() as a null function.
     35
    1362015-02-06  Simon Fraser  <simon.fraser@apple.com>
    237
  • trunk/Source/WebCore/svg/SVGAnimateElementBase.cpp

    r179695 r179772  
    425425void SVGAnimateElementBase::setAttributeName(const QualifiedName& attributeName)
    426426{
    427     SVGAnimationElement::setAttributeName(attributeName);
     427    SVGSMILElement::setAttributeName(attributeName);
     428    checkInvalidCSSAttributeType(targetElement());
    428429    resetAnimatedPropertyType();
    429430}
  • trunk/Source/WebCore/svg/SVGAnimationElement.cpp

    r179260 r179772  
    692692}
    693693
    694 void SVGAnimationElement::setAttributeName(const QualifiedName& attributeName)
    695 {
    696     SVGSMILElement::setAttributeName(attributeName);
    697     checkInvalidCSSAttributeType(targetElement());
    698 }
    699 
    700694void SVGAnimationElement::checkInvalidCSSAttributeType(SVGElement* target)
    701695{
  • trunk/Source/WebCore/svg/SVGAnimationElement.h

    r171341 r179772  
    195195
    196196    virtual void setTargetElement(SVGElement*) override;
    197     virtual void setAttributeName(const QualifiedName&) override;
     197    virtual void setAttributeName(const QualifiedName&) override { }
    198198    bool hasInvalidCSSAttributeType() const { return m_hasInvalidCSSAttributeType; }
     199    void checkInvalidCSSAttributeType(SVGElement*);
    199200
    200201    virtual void updateAnimationMode();
     
    205206    virtual void animationAttributeChanged() override;
    206207    void setAttributeType(const AtomicString&);
    207 
    208     void checkInvalidCSSAttributeType(SVGElement*);
    209208
    210209    virtual bool calculateToAtEndOfDurationValue(const String& toAtEndOfDurationString) = 0;
Note: See TracChangeset for help on using the changeset viewer.