Changeset 31334 in webkit


Ignore:
Timestamp:
Mar 26, 2008 5:21:17 PM (16 years ago)
Author:
Antti Koivisto
Message:

WebCore:

2008-03-26 Antti Koivisto <Antti Koivisto>

Reviewed by Anders.

http://bugs.webkit.org/show_bug.cgi?id=17077
Bug 17077: SVG SMIL animation is currently broken (and turned off) (affects Acid3 tests 75 and 76)

  • enable SVG animation support.
  • basic implementation of beginElement()/endElement().


Animation definitely will need more work than this, but it is a start!

  • Configurations/WebCore.xcconfig:
  • svg/SVGAnimationElement.cpp: (WebCore::SVGAnimationElement::SVGAnimationElement): (WebCore::SVGAnimationElement::updateAnimatedValueForElapsedSeconds): (WebCore::SVGAnimationElement::beginElement): (WebCore::SVGAnimationElement::beginElementAt): (WebCore::SVGAnimationElement::endElement): (WebCore::SVGAnimationElement::endElementAt):
  • svg/SVGAnimationElement.h:

WebKitTools:

2008-03-26 Antti Koivisto <Antti Koivisto>

Reviewed by Anders.


Enable SVG animation support by default.

  • Scripts/build-webkit:
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r31333 r31334  
     12008-03-26  Antti Koivisto  <antti@apple.com>
     2
     3        Reviewed by Anders.
     4
     5        http://bugs.webkit.org/show_bug.cgi?id=17077
     6        Bug 17077: SVG SMIL animation is currently broken (and turned off) (affects Acid3 tests 75 and 76)
     7
     8        - enable SVG animation support.
     9        - basic implementation of beginElement()/endElement().
     10       
     11        Animation definitely will need more work than this, but it is a start!
     12
     13        * Configurations/WebCore.xcconfig:
     14        * svg/SVGAnimationElement.cpp:
     15        (WebCore::SVGAnimationElement::SVGAnimationElement):
     16        (WebCore::SVGAnimationElement::updateAnimatedValueForElapsedSeconds):
     17        (WebCore::SVGAnimationElement::beginElement):
     18        (WebCore::SVGAnimationElement::beginElementAt):
     19        (WebCore::SVGAnimationElement::endElement):
     20        (WebCore::SVGAnimationElement::endElementAt):
     21        * svg/SVGAnimationElement.h:
     22
    1232008-03-26  Mark Rowe  <mrowe@apple.com>
    224
  • trunk/WebCore/Configurations/WebCore.xcconfig

    r31195 r31334  
    66EXPORTED_SYMBOLS_FILE_ppc64 = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/WebCore.LP64.exp;
    77EXPORTED_SYMBOLS_FILE_x86_64 = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/WebCore.LP64.exp;
    8 FEATURE_DEFINES = ENABLE_CROSS_DOCUMENT_MESSAGING ENABLE_DATABASE ENABLE_ICONDATABASE ENABLE_SVG ENABLE_SVG_AS_IMAGE ENABLE_SVG_FONTS ENABLE_SVG_FOREIGN_OBJECT ENABLE_SVG_USE ENABLE_VIDEO ENABLE_XPATH ENABLE_XSLT;
     8FEATURE_DEFINES = ENABLE_CROSS_DOCUMENT_MESSAGING ENABLE_DATABASE ENABLE_ICONDATABASE ENABLE_SVG ENABLE_SVG_AS_IMAGE ENABLE_SVG_FONTS ENABLE_SVG_FOREIGN_OBJECT ENABLE_SVG_USE ENABLE_VIDEO ENABLE_XPATH ENABLE_XSLT ENABLE_SVG_ANIMATION;
    99GCC_PREFIX_HEADER = WebCorePrefix.h;
    1010GCC_PREPROCESSOR_DEFINITIONS = $(DEBUG_DEFINES) $(FEATURE_DEFINES) $(GCC_PREPROCESSOR_DEFINITIONS);
  • trunk/WebCore/svg/SVGAnimationElement.cpp

    r31315 r31334  
    2929#include "Document.h"
    3030#include "FloatConversion.h"
     31#include "SVGNames.h"
    3132#include "SVGParserUtilities.h"
    3233#include "SVGSVGElement.h"
     
    4243
    4344namespace WebCore {
     45   
     46using namespace SVGNames;
    4447
    4548SVGAnimationElement::SVGAnimationElement(const QualifiedName& tagName, Document* doc)
     
    6366    , m_repetitions(0)
    6467    , m_repeatCount(0)
     68    , m_animationBegin(DBL_MAX)
     69    , m_animationEnd(DBL_MAX)
    6570{
    6671
     
    730735    // #1 (duration > 0) -> fine
    731736    // #2 (duration <= 0.0 && end > 0) -> fine
    732     if ((m_simpleDuration <= 0.0 && m_end <= 0.0) || (isIndefinite(m_simpleDuration) && m_end <= 0.0))
     737    // FIXME: This allows indefinite duration for the <set> element, not sure if it should be allowed for others too.
     738    // FIXME: Value won't naturally animate in this case so keeping the timer repeating is sort of pointless.
     739    if ((m_simpleDuration <= 0.0 && m_end <= 0.0) || (isIndefinite(m_simpleDuration) && m_end <= 0.0 && !hasTagName(setTag)))
    733740        return false; // Ignore dur="0" or dur="-neg"
    734741   
    735     double percentage = calculateTimePercentage(elapsedSeconds, m_begin, m_end, m_simpleDuration, m_repetitions);
     742    if (isIndefinite(m_animationBegin))
     743        m_animationBegin = m_begin;
     744   
     745    double percentage = calculateTimePercentage(elapsedSeconds, m_animationBegin, m_end, m_simpleDuration, m_repetitions);
    736746   
    737747    if (percentage <= 1.0 || connectedToTimer())
    738748        handleTimerEvent(elapsedSeconds, percentage);
    739749   
     750    if (elapsedSeconds > m_animationEnd) {
     751        if (connectedToTimer())
     752            disconnectTimer();
     753        m_animationEnd = DBL_MAX;
     754    }
     755   
    740756    return true; // value was updated, need to apply
    741757}
     
    743759bool SVGAnimationElement::beginElement(ExceptionCode& ec)
    744760{
     761    // FIXME: Should this be synchronous?
     762    return beginElementAt(0, ec);
     763}
     764
     765bool SVGAnimationElement::beginElementAt(float offset, ExceptionCode& ec)
     766{
     767    // FIXME: Handle negative offsets correctly.
     768    // In general we need to make SMIL concepts like "active duration" explicit in the code
     769    if (offset < 0)
     770        offset = 0;
     771   
     772    if (connectedToTimer())
     773        return false;
     774   
     775    m_animationBegin = offset;
     776    if (ownerSVGElement()) {
     777        ownerSVGElement()->timeScheduler()->addTimer(this, offset);
     778        ownerSVGElement()->timeScheduler()->startAnimations();
     779        connectTimer();
     780    } else
     781        return false;
     782
    745783    return false;
    746784}
    747785
    748 bool SVGAnimationElement::beginElementAt(float offset, ExceptionCode& ec)
    749 {
    750     return false;
    751 }
    752 
    753786bool SVGAnimationElement::endElement(ExceptionCode& ec)
    754787{
    755     return false;
     788    // FIXME: Should this be synchronous?
     789    return endElementAt(0, ec);
    756790}
    757791
    758792bool SVGAnimationElement::endElementAt(float offset, ExceptionCode& ec)
    759793{
    760     return false;
     794    if (offset < 0)
     795        return false;
     796    if (!connectedToTimer())
     797        return false;
     798    m_animationEnd = ownerSVGElement()->timeScheduler()->elapsed() + offset;
     799    return true;
    761800}
    762801
  • trunk/WebCore/svg/SVGAnimationElement.h

    r31315 r31334  
    192192            FloatPoint control2;
    193193        };
     194       
     195        double m_animationBegin;
     196        double m_animationEnd;
     197       
    194198        Vector<KeySpline> m_keySplines;
    195199    };
  • trunk/WebKitTools/ChangeLog

    r31308 r31334  
     12008-03-26  Antti Koivisto  <antti@apple.com>
     2
     3        Reviewed by Anders.
     4       
     5        Enable SVG animation support by default.
     6
     7        * Scripts/build-webkit:
     8
    192008-03-25  Adam Roben  <aroben@apple.com>
    210
  • trunk/WebKitTools/Scripts/build-webkit

    r31278 r31334  
    4545my $svgSupport = 1;
    4646my $svgExperimentalSupport = 0;
    47 my $svgAnimationSupport = $svgExperimentalSupport;
     47my $svgAnimationSupport = 1;
    4848my $svgFiltersSupport = $svgExperimentalSupport;
    4949my $svgForeignObjectSupport = 1;
Note: See TracChangeset for help on using the changeset viewer.