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

Changeset 175525 in webkit


Ignore:
Timestamp:
Nov 4, 2014, 1:20:52 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Fix animation of orient attribute on marker element
https://bugs.webkit.org/show_bug.cgi?id=137942

Source/WebCore:

Patch by Nikos Andronikos <nikos.andronikos-webkit@cisra.canon.com.au> on 2014-11-04
Reviewed by Dirk Schulze.

Fixed implementation of SVG animated angles and the SVG
marker element orient attribute.
SVG animated angle was missing the logic to support animation
from auto to a numeric angle value - this is now added.
The SVG marker element getter for orientType was not returning
the animated value for orientType so in some cases (i.e. when
the initial value and the animated values were of different types)
the animation was not being rendered - although it was running.

Tests: svg/animations/animate-marker-orienttype-1.html

svg/animations/animate-marker-orienttype-2.html
svg/animations/animate-marker-orienttype-3.html

  • svg/SVGAnimatedAngle.cpp:

(WebCore::SVGAnimatedAngleAnimator::calculateAnimatedValue):
Added logic to support auto to angle animation.

  • svg/SVGMarkerElement.cpp:

(WebCore::SVGMarkerElement::orientType):
This method now returns the animated value if an animation is
running.

  • svg/SVGMarkerElement.h:

LayoutTests:

Patch by Nikos Andrkos Andronikos <nikos.andronikos-webkit@cisra.canon.com.au> on 2014-11-04
Reviewed by Dirk Schulze.

Test the rendered result of the animation of the orient attribute.
Existing tests were only testing the animated value in the DOM.

  • svg/animations/animate-marker-orienttype-1-expected.txt: Added.
  • svg/animations/animate-marker-orienttype-1.html: Added.
  • svg/animations/animate-marker-orienttype-2-expected.txt: Added.
  • svg/animations/animate-marker-orienttype-2.html: Added.
  • svg/animations/animate-marker-orienttype-3-expected.txt: Added.
  • svg/animations/animate-marker-orienttype-3.html: Added.
Location:
trunk
Files:
6 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r175511 r175525  
     12014-11-04  Nikos Andrkos Andronikos  <nikos.andronikos-webkit@cisra.canon.com.au>
     2
     3        Fix animation of orient attribute on marker element
     4        https://bugs.webkit.org/show_bug.cgi?id=137942
     5
     6        Reviewed by Dirk Schulze.
     7
     8        Test the rendered result of the animation of the orient attribute.
     9        Existing tests were only testing the animated value in the DOM.
     10
     11        * svg/animations/animate-marker-orienttype-1-expected.txt: Added.
     12        * svg/animations/animate-marker-orienttype-1.html: Added.
     13        * svg/animations/animate-marker-orienttype-2-expected.txt: Added.
     14        * svg/animations/animate-marker-orienttype-2.html: Added.
     15        * svg/animations/animate-marker-orienttype-3-expected.txt: Added.
     16        * svg/animations/animate-marker-orienttype-3.html: Added.
     17
    1182014-11-03  Shivakumar JM  <shiva.jm@samsung.com>
    219
  • trunk/Source/WebCore/ChangeLog

    r175513 r175525  
     12014-11-04  Nikos Andronikos  <nikos.andronikos-webkit@cisra.canon.com.au>
     2
     3        Fix animation of orient attribute on marker element
     4        https://bugs.webkit.org/show_bug.cgi?id=137942
     5
     6        Reviewed by Dirk Schulze.
     7
     8        Fixed implementation of SVG animated angles and the SVG
     9        marker element orient attribute.
     10        SVG animated angle was missing the logic to support animation
     11        from auto to a numeric angle value - this is now added.
     12        The SVG marker element getter for orientType was not returning
     13        the animated value for orientType so in some cases (i.e. when
     14        the initial value and the animated values were of different types)
     15        the animation was not being rendered - although it was running.
     16
     17        Tests: svg/animations/animate-marker-orienttype-1.html
     18               svg/animations/animate-marker-orienttype-2.html
     19               svg/animations/animate-marker-orienttype-3.html
     20
     21        * svg/SVGAnimatedAngle.cpp:
     22        (WebCore::SVGAnimatedAngleAnimator::calculateAnimatedValue):
     23        Added logic to support auto to angle animation.
     24        * svg/SVGMarkerElement.cpp:
     25        (WebCore::SVGMarkerElement::orientType):
     26        This method now returns the animated value if an animation is
     27        running.
     28        * svg/SVGMarkerElement.h:
     29
    1302014-11-03  Chris Dumez  <cdumez@apple.com>
    231
  • trunk/Source/WebCore/svg/SVGAnimatedAngle.cpp

    r174050 r175525  
    9797
    9898    if (fromAngleAndEnumeration.second != toAngleAndEnumeration.second) {
    99         // Animating from eg. auto to 90deg, or auto to 90deg.
    100         if (fromAngleAndEnumeration.second == SVGMarkerOrientAngle) {
    101             // Animating from an angle value to eg. 'auto' - this disabled additive as 'auto' is a keyword..
    102             if (toAngleAndEnumeration.second == SVGMarkerOrientAuto) {
    103                 if (percentage < 0.5f) {
    104                     animatedAngleAndEnumeration.first = fromAngleAndEnumeration.first;
    105                     animatedAngleAndEnumeration.second = SVGMarkerOrientAngle;
    106                     return;
    107                 }
     99        // Discrete animation - no linear interpolation possible between values (e.g. auto to angle).
     100        if (percentage < 0.5f) {
     101            animatedAngleAndEnumeration.second = fromAngleAndEnumeration.second;
     102            if (fromAngleAndEnumeration.second == SVGMarkerOrientAngle)
     103                animatedAngleAndEnumeration.first = fromAngleAndEnumeration.first;
     104            else
    108105                animatedAngleAndEnumeration.first.setValue(0);
    109                 animatedAngleAndEnumeration.second = SVGMarkerOrientAuto;
    110                 return;
    111             }
    112             animatedAngleAndEnumeration.first.setValue(0);
    113             animatedAngleAndEnumeration.second = SVGMarkerOrientUnknown;
    114106            return;
    115107        }
     108        animatedAngleAndEnumeration.second = toAngleAndEnumeration.second;
     109        if (toAngleAndEnumeration.second == SVGMarkerOrientAngle)
     110            animatedAngleAndEnumeration.first = toAngleAndEnumeration.first;
     111        else
     112            animatedAngleAndEnumeration.first.setValue(0);
     113        return;
    116114    }
    117115
  • trunk/Source/WebCore/svg/SVGMarkerElement.cpp

    r173859 r175525  
    249249        (&ownerType, orientTypePropertyInfo(), ownerType.m_orientType.value);
    250250}
    251  
     251
     252SVGMarkerOrientType& SVGMarkerElement::orientType() const
     253{
     254    if (SVGAnimatedEnumeration* wrapper = SVGAnimatedProperty::lookupWrapper<UseOwnerType, SVGAnimatedEnumeration>(this, orientTypePropertyInfo())) {
     255        if (wrapper->isAnimating()) {
     256            ASSERT(wrapper->currentAnimatedValue() >= 0 && wrapper->currentAnimatedValue() < SVGMarkerOrientMax);
     257            return reinterpret_cast<SVGMarkerOrientType&>(wrapper->currentAnimatedValue());
     258        }
     259    }
     260    return m_orientType.value;
     261}
     262
    252263PassRefPtr<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType>> SVGMarkerElement::orientTypeAnimated()
    253264{
  • trunk/Source/WebCore/svg/SVGMarkerElement.h

    r173804 r175525  
    4343    SVGMarkerOrientUnknown = 0,
    4444    SVGMarkerOrientAuto,
    45     SVGMarkerOrientAngle
     45    SVGMarkerOrientAngle,
     46
     47    // Add new elements before here.
     48    SVGMarkerOrientMax
    4649};
    4750
     
    156159    static void synchronizeOrientType(SVGElement* contextElement);
    157160    static PassRefPtr<SVGAnimatedProperty> lookupOrCreateOrientTypeWrapper(SVGElement* contextElement);
    158     SVGMarkerOrientType& orientType() const { return m_orientType.value; }
     161    SVGMarkerOrientType& orientType() const;
    159162    SVGMarkerOrientType& orientTypeBaseValue() const { return m_orientType.value; }
    160163    void setOrientTypeBaseValue(const SVGMarkerOrientType& type) { m_orientType.value = type; }
Note: See TracChangeset for help on using the changeset viewer.