Changeset 56775 in webkit


Ignore:
Timestamp:
Mar 30, 2010 4:28:55 AM (14 years ago)
Author:
krit@webkit.org
Message:

2010-03-30 Dirk Schulze <krit@webkit.org>

Reviewed by Nikolas Zimmermann.

SVG Animation doesn't respect 'currentColor'
https://bugs.webkit.org/show_bug.cgi?id=36695

Test: svg/custom/animation-currentColor.svg

SVG Animation can't handle currentColor at the moment. This patch catches the
color value of the target element and replaces 'currentColor' with it's color string.

  • svg/SVGAnimationElement.cpp: (WebCore::adjustForCurrentColor): (WebCore::SVGAnimationElement::startedActiveInterval):

2010-03-30 Dirk Schulze <krit@webkit.org>

Reviewed by Nikolas Zimmermann.

SVG Animation doesn't respect 'currentColor'
https://bugs.webkit.org/show_bug.cgi?id=36695

Check if SVG animation takes the color value of the target element as 'currentColor'.

  • platform/mac/svg/custom/animation-currentColor-expected.checksum: Added.
  • platform/mac/svg/custom/animation-currentColor-expected.png: Added.
  • platform/mac/svg/custom/animation-currentColor-expected.txt: Added.
  • svg/custom/animation-currentColor.svg: Added.
Location:
trunk
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r56773 r56775  
     12010-03-30  Dirk Schulze  <krit@webkit.org>
     2
     3        Reviewed by Nikolas Zimmermann.
     4
     5        SVG Animation doesn't respect 'currentColor'
     6        https://bugs.webkit.org/show_bug.cgi?id=36695
     7
     8        Check if SVG animation takes the color value of the target element as 'currentColor'.
     9
     10        * platform/mac/svg/custom/animation-currentColor-expected.checksum: Added.
     11        * platform/mac/svg/custom/animation-currentColor-expected.png: Added.
     12        * platform/mac/svg/custom/animation-currentColor-expected.txt: Added.
     13        * svg/custom/animation-currentColor.svg: Added.
     14
    1152010-03-30  Yury Semikhatsky  <yurys@chromium.org>
    216
  • trunk/WebCore/ChangeLog

    r56772 r56775  
     12010-03-30  Dirk Schulze  <krit@webkit.org>
     2
     3        Reviewed by Nikolas Zimmermann.
     4
     5        SVG Animation doesn't respect 'currentColor'
     6        https://bugs.webkit.org/show_bug.cgi?id=36695
     7
     8        Test: svg/custom/animation-currentColor.svg
     9
     10        SVG Animation can't handle currentColor at the moment. This patch catches the
     11        color value of the target element and replaces 'currentColor' with it's color string.
     12
     13        * svg/SVGAnimationElement.cpp:
     14        (WebCore::adjustForCurrentColor):
     15        (WebCore::SVGAnimationElement::startedActiveInterval):
     16
    1172010-03-30  Ilya Tikhonovsky  <loislo@chromium.org>
    218
  • trunk/WebCore/svg/SVGAnimationElement.cpp

    r56214 r56775  
    2727#include "SVGAnimationElement.h"
    2828
     29#include "Color.h"
    2930#include "CSSComputedStyleDeclaration.h"
    3031#include "CSSParser.h"
     
    3637#include "HTMLNames.h"
    3738#include "MappedAttribute.h"
     39#include "RenderObject.h"
    3840#include "SVGElementInstance.h"
    3941#include "SVGNames.h"
     
    469471    }
    470472}
     473static inline void adjustForCurrentColor(String& value, SVGElement* target)
     474{
     475    if (!target || !target->isStyled() || value != "currentColor")
     476        return;
     477
     478    if (RenderObject* targetRenderer = target->renderer())
     479        value = targetRenderer->style()->color().name();
     480}
    471481   
    472482void SVGAnimationElement::startedActiveInterval()
     
    488498    }
    489499
     500    String from = fromValue();
     501    String to = toValue();
     502    String by = byValue();
     503    SVGElement* target = targetElement();
    490504    AnimationMode animationMode = this->animationMode();
    491505    if (animationMode == NoAnimation)
    492506        return;
    493     if (animationMode == FromToAnimation)
    494         m_animationValid = calculateFromAndToValues(fromValue(), toValue());
    495     else if (animationMode == ToAnimation) {
     507    if (animationMode == FromToAnimation) {
     508        adjustForCurrentColor(from, target);
     509        adjustForCurrentColor(to, target);
     510        m_animationValid = calculateFromAndToValues(from, to);
     511    } else if (animationMode == ToAnimation) {
    496512        // For to-animations the from value is the current accumulated value from lower priority animations.
    497513        // The value is not static and is determined during the animation.
    498         m_animationValid = calculateFromAndToValues(String(), toValue());
    499     } else if (animationMode == FromByAnimation)
    500         m_animationValid = calculateFromAndByValues(fromValue(), byValue());
    501     else if (animationMode == ByAnimation)
    502         m_animationValid = calculateFromAndByValues(String(), byValue());
    503     else if (animationMode == ValuesAnimation) {
     514        adjustForCurrentColor(to, target);
     515        m_animationValid = calculateFromAndToValues(String(), to);
     516    } else if (animationMode == FromByAnimation) {
     517        adjustForCurrentColor(from, target);
     518        adjustForCurrentColor(by, target);
     519        m_animationValid = calculateFromAndByValues(from, by);
     520    } else if (animationMode == ByAnimation) {
     521        adjustForCurrentColor(by, target);
     522        m_animationValid = calculateFromAndByValues(String(), by);
     523    } else if (animationMode == ValuesAnimation) {
    504524        m_animationValid = m_values.size() > 1
    505525            && (calcMode == CalcModePaced || !hasAttribute(SVGNames::keyTimesAttr) || hasAttribute(SVGNames::keyPointsAttr) || (m_values.size() == m_keyTimes.size()))
Note: See TracChangeset for help on using the changeset viewer.