Changeset 51567 in webkit


Ignore:
Timestamp:
Dec 1, 2009 4:41:29 PM (14 years ago)
Author:
Nikolas Zimmermann
Message:

2009-12-01 Nikolas Zimmermann <nzimmermann@rim.com>

Reviewed by Simon Fraser.

Add SVG animation test framework with 'snapshot' functionality
https://bugs.webkit.org/show_bug.cgi?id=31897

Add API used by the new 'sampleSVGAnimationForElementAtTime' DRT method,
forwarding the call to SVGDocumentExtensions, if SVG is enabled.

Implemented just like the existing pauseAnimation* methods for CSS animations.

  • Api/qwebframe.cpp: (qt_drt_pauseSVGAnimation):

2009-12-01 Nikolas Zimmermann <nzimmermann@rim.com>

Reviewed by Simon Fraser.

Add SVG animation test framework with 'snapshot' functionality
https://bugs.webkit.org/show_bug.cgi?id=31897

Add API used by the new 'sampleSVGAnimationForElementAtTime' DRT method,
forwarding the call to SVGDocumentExtensions, if SVG is enabled.

Implemented just like the existing pauseAnimation* methods for CSS animations.

  • webkit/webkitprivate.h:
  • webkit/webkitwebframe.cpp: (webkit_web_frame_pause_svg_animation):

2009-12-01 Nikolas Zimmermann <nzimmermann@rim.com>

Reviewed by Simon Fraser.

Add SVG animation test framework with 'snapshot' functionality
https://bugs.webkit.org/show_bug.cgi?id=31897

Add API used by the new 'sampleSVGAnimationForElementAtTime' DRT method,
forwarding the call to SVGDocumentExtensions, if SVG is enabled.

Implemented just like the existing pauseAnimation* methods for CSS animations.

  • Interfaces/IWebFramePrivate.idl:
  • WebFrame.cpp: (WebFrame::pauseSVGAnimation):
  • WebFrame.h:

2009-12-01 Nikolas Zimmermann <nzimmermann@rim.com>

Reviewed by Simon Fraser.

Add SVG animation test framework with 'snapshot' functionality
https://bugs.webkit.org/show_bug.cgi?id=31897

Add API used by the new 'sampleSVGAnimationForElementAtTime' DRT method,
forwarding the call to SVGDocumentExtensions, if SVG is enabled.

Implemented just like the existing pauseAnimation* methods for CSS animations.

  • WebView/WebFrame.mm: (-[WebFrame _pauseSVGAnimation:onSMILNode:atTime:]):
  • WebView/WebFramePrivate.h:

2009-12-01 Nikolas Zimmermann <nzimmermann@rim.com>

Reviewed by Simon Fraser.

Add SVG animation test framework with 'snapshot' functionality
https://bugs.webkit.org/show_bug.cgi?id=31897

Add 'sampleSVGAnimationForElementAtTime' method to the LayoutTestController,
for the use within the new SVG animation test framework (LayoutTests/svg/animations/)

layoutTestController.sampleAnimationAtTime(<svg animation id>, <absolute time>, <svg element id>);
to sample a svg animateMotion/animateColor/animate/set element at certain times.

After the desired SVG animation starts and calling the method above, it's immediately forwarded to
the desired sampling time. After JS returns from the 'sampleSVGAnimationForElementAtTime' method
a callback is fired used to sample the animation value at the target time. It's modelled similar
to the CSS animation/transition testing framework, inspired by
LayoutTests/animations/animation-test-helpers.js.

Though it has been extended to integrate within the fast/js/js-test-* framework, that's used for
the SVG dynamic-updates tests, to simplify test creation, by utilizing script-tests/* only.

Adding a simple testcase testing the DRT methods, it will soon be extended to test animVal/baseVal
interaction, while animating.

Test: svg/animations/animVal-basics.html

  • WebCore.base.exp:
  • WebCore.xcodeproj/project.pbxproj:
  • svg/SVGDocumentExtensions.cpp: (WebCore::SVGDocumentExtensions::sampleAnimationAtTime):
  • svg/SVGDocumentExtensions.h:
  • svg/animation/SMILTimeContainer.cpp: (WebCore::SMILTimeContainer::SMILTimeContainer): (WebCore::SMILTimeContainer::sampleAnimationAtTime): (WebCore::SMILTimeContainer::updateAnimations):
  • svg/animation/SMILTimeContainer.h:

2009-12-01 Nikolas Zimmermann <nzimmermann@rim.com>

Reviewed by Simon Fraser.

Add SVG animation test framework with 'snapshot' functionality
https://bugs.webkit.org/show_bug.cgi?id=31897

Add LayoutTests/svg/animations directory, containing a new
framework for SVG animation test with sampling at certain times.

Added one example test, which will be extended soon to cover animVal
support, once basic support has been implemented.

  • svg/animations: Added.
  • svg/animations/animVal-basics-expected.txt: Added.
  • svg/animations/animVal-basics.html: Added.
  • svg/animations/resources: Added.
  • svg/animations/resources/SVGAnimationTestCase.js: Added. (isCloseEnough): (moveAnimationTimelineAndSample): (startTest): (sampleAnimation): (runAnimationTest):
  • svg/animations/script-tests: Added.
  • svg/animations/script-tests/TEMPLATE.html: Added.
  • svg/animations/script-tests/animVal-basics.js: Added. (sample1): (sample2): (sample3): (executeTest):

2009-12-01 Nikolas Zimmermann <nzimmermann@rim.com>

Reviewed by Simon Fraser.

Add SVG animation test framework with 'snapshot' functionality
https://bugs.webkit.org/show_bug.cgi?id=31897

Add new 'sampleSVGAnimationForElementAtTime' DRT method,
used by the new SVG animation testing framework, implemented
for qt/gtk/win/mac.

  • DumpRenderTree/LayoutTestController.cpp: (sampleSVGAnimationForElementAtTimeCallback): (LayoutTestController::staticFunctions):
  • DumpRenderTree/LayoutTestController.h:
  • DumpRenderTree/gtk/LayoutTestControllerGtk.cpp: (LayoutTestController::sampleSVGAnimationForElementAtTime):
  • DumpRenderTree/mac/LayoutTestControllerMac.mm: (LayoutTestController::sampleSVGAnimationForElementAtTime):
  • DumpRenderTree/qt/LayoutTestControllerQt.cpp: (LayoutTestController::sampleSVGAnimationForElementAtTime):
  • DumpRenderTree/qt/LayoutTestControllerQt.h:
  • DumpRenderTree/win/LayoutTestControllerWin.cpp: (LayoutTestController::sampleSVGAnimationForElementAtTime):
  • DumpRenderTree/wx/LayoutTestControllerWx.cpp: (LayoutTestController::sampleSVGAnimationForElementAtTime):
Location:
trunk
Files:
8 added
29 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r51563 r51567  
     12009-12-01  Nikolas Zimmermann  <nzimmermann@rim.com>
     2
     3        Reviewed by Simon Fraser.
     4
     5        Add SVG animation test framework with 'snapshot' functionality
     6        https://bugs.webkit.org/show_bug.cgi?id=31897
     7
     8        Add LayoutTests/svg/animations directory, containing a new
     9        framework for SVG animation test with sampling at certain times.
     10
     11        Added one example test, which will be extended soon to cover animVal
     12        support, once basic support has been implemented.
     13
     14        * svg/animations: Added.
     15        * svg/animations/animVal-basics-expected.txt: Added.
     16        * svg/animations/animVal-basics.html: Added.
     17        * svg/animations/resources: Added.
     18        * svg/animations/resources/SVGAnimationTestCase.js: Added.
     19        (isCloseEnough):
     20        (moveAnimationTimelineAndSample):
     21        (startTest):
     22        (sampleAnimation):
     23        (runAnimationTest):
     24        * svg/animations/script-tests: Added.
     25        * svg/animations/script-tests/TEMPLATE.html: Added.
     26        * svg/animations/script-tests/animVal-basics.js: Added.
     27        (sample1):
     28        (sample2):
     29        (sample3):
     30        (executeTest):
     31
    1322009-12-01  Adam Roben  <aroben@apple.com>
    233
  • trunk/WebCore/ChangeLog

    r51566 r51567  
     12009-12-01  Nikolas Zimmermann  <nzimmermann@rim.com>
     2
     3        Reviewed by Simon Fraser.
     4
     5        Add SVG animation test framework with 'snapshot' functionality
     6        https://bugs.webkit.org/show_bug.cgi?id=31897
     7
     8        Add 'sampleSVGAnimationForElementAtTime' method to the LayoutTestController,
     9        for the use within the new SVG animation test framework (LayoutTests/svg/animations/)
     10
     11        layoutTestController.sampleAnimationAtTime(<svg animation id>, <absolute time>, <svg element id>);
     12        to sample a svg animateMotion/animateColor/animate/set element at certain times.
     13
     14        After the desired SVG animation starts and calling the method above, it's immediately forwarded to
     15        the desired sampling time. After JS returns from the 'sampleSVGAnimationForElementAtTime' method
     16        a callback is fired used to sample the animation value at the target time. It's modelled similar
     17        to the CSS animation/transition testing framework, inspired by
     18        LayoutTests/animations/animation-test-helpers.js.
     19
     20        Though it has been extended to integrate within the fast/js/js-test-* framework, that's used for
     21        the SVG dynamic-updates tests, to simplify test creation, by utilizing script-tests/* only.
     22
     23        Adding a simple testcase testing the DRT methods, it will soon be extended to test animVal/baseVal
     24        interaction, while animating.
     25
     26        Test: svg/animations/animVal-basics.html
     27
     28        * WebCore.base.exp:
     29        * WebCore.xcodeproj/project.pbxproj:
     30        * svg/SVGDocumentExtensions.cpp:
     31        (WebCore::SVGDocumentExtensions::sampleAnimationAtTime):
     32        * svg/SVGDocumentExtensions.h:
     33        * svg/animation/SMILTimeContainer.cpp:
     34        (WebCore::SMILTimeContainer::SMILTimeContainer):
     35        (WebCore::SMILTimeContainer::sampleAnimationAtTime):
     36        (WebCore::SMILTimeContainer::updateAnimations):
     37        * svg/animation/SMILTimeContainer.h:
     38
    1392009-12-01  Jens Alfke  <snej@chromium.org>
    240
  • trunk/WebCore/WebCore.base.exp

    r51522 r51567  
    985985__ZTVN7WebCore17FrameLoaderClientE
    986986__ZTVN7WebCore25HistoryPropertyListWriterE
     987__ZN7WebCore14SVGSMILElement13isSMILElementEPNS_4NodeE
     988__ZN7WebCore21SVGDocumentExtensions21sampleAnimationAtTimeERKNS_6StringEPNS_14SVGSMILElementEd
     989__ZN7WebCore8Document19accessSVGExtensionsEv
     990__ZN7WebCore8Document13svgExtensionsEv
    987991_filenameByFixingIllegalCharacters
    988992_hasCaseInsensitiveSubstring
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r51531 r51567  
    9191                08744BAA0EDB7D86004C9E63 /* WMLOnEventElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08744BA90EDB7D86004C9E63 /* WMLOnEventElement.cpp */; };
    9292                08744BAE0EDB7D92004C9E63 /* WMLOnEventElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 08744BAD0EDB7D92004C9E63 /* WMLOnEventElement.h */; };
    93                 0878B1FD10874E3F00A55097 /* SVGAnimatedProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 0878B1F910874E3F00A55097 /* SVGAnimatedProperty.h */; };
     93                0878B1FD10874E3F00A55097 /* SVGAnimatedProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 0878B1F910874E3F00A55097 /* SVGAnimatedProperty.h */; settings = {ATTRIBUTES = (Private, ); }; };
    9494                0878B1FE10874E3F00A55097 /* SynchronizablePropertyController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0878B1FA10874E3F00A55097 /* SynchronizablePropertyController.cpp */; };
    95                 0878B1FF10874E3F00A55097 /* SynchronizablePropertyController.h in Headers */ = {isa = PBXBuildFile; fileRef = 0878B1FB10874E3F00A55097 /* SynchronizablePropertyController.h */; };
    96                 0878B20010874E3F00A55097 /* SynchronizableTypeWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 0878B1FC10874E3F00A55097 /* SynchronizableTypeWrapper.h */; };
     95                0878B1FF10874E3F00A55097 /* SynchronizablePropertyController.h in Headers */ = {isa = PBXBuildFile; fileRef = 0878B1FB10874E3F00A55097 /* SynchronizablePropertyController.h */; settings = {ATTRIBUTES = (Private, ); }; };
     96                0878B20010874E3F00A55097 /* SynchronizableTypeWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 0878B1FC10874E3F00A55097 /* SynchronizableTypeWrapper.h */; settings = {ATTRIBUTES = (Private, ); }; };
    9797                087FFA0F0EFF3ED3009DBD88 /* WMLInsertedLegendElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 087FFA0D0EFF3ED3009DBD88 /* WMLInsertedLegendElement.cpp */; };
    9898                087FFA100EFF3ED3009DBD88 /* WMLInsertedLegendElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 087FFA0E0EFF3ED3009DBD88 /* WMLInsertedLegendElement.h */; };
     
    33263326                B22279870D00BF220071B782 /* SVGAnimatedPoints.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B22277F10D00BF1F0071B782 /* SVGAnimatedPoints.cpp */; };
    33273327                B22279880D00BF220071B782 /* SVGAnimatedPoints.h in Headers */ = {isa = PBXBuildFile; fileRef = B22277F20D00BF1F0071B782 /* SVGAnimatedPoints.h */; };
    3328                 B222798D0D00BF220071B782 /* SVGAnimatedTemplate.h in Headers */ = {isa = PBXBuildFile; fileRef = B22277F70D00BF1F0071B782 /* SVGAnimatedTemplate.h */; };
     3328                B222798D0D00BF220071B782 /* SVGAnimatedTemplate.h in Headers */ = {isa = PBXBuildFile; fileRef = B22277F70D00BF1F0071B782 /* SVGAnimatedTemplate.h */; settings = {ATTRIBUTES = (Private, ); }; };
    33293329                B222798F0D00BF220071B782 /* SVGAnimateElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B22277F90D00BF1F0071B782 /* SVGAnimateElement.cpp */; };
    33303330                B22279900D00BF220071B782 /* SVGAnimateElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B22277FA0D00BF1F0071B782 /* SVGAnimateElement.h */; };
     
    33523352                B22279B40D00BF220071B782 /* SVGDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = B222781E0D00BF1F0071B782 /* SVGDocument.h */; };
    33533353                B22279B60D00BF220071B782 /* SVGElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B22278200D00BF1F0071B782 /* SVGElement.cpp */; };
    3354                 B22279B70D00BF220071B782 /* SVGElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278210D00BF1F0071B782 /* SVGElement.h */; };
     3354                B22279B70D00BF220071B782 /* SVGElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278210D00BF1F0071B782 /* SVGElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
    33553355                B22279B90D00BF220071B782 /* SVGElementInstance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B22278230D00BF1F0071B782 /* SVGElementInstance.cpp */; };
    33563356                B22279BA0D00BF220071B782 /* SVGElementInstance.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278240D00BF1F0071B782 /* SVGElementInstance.h */; };
     
    34353435                B2227A300D00BF220071B782 /* SVGLangSpace.h in Headers */ = {isa = PBXBuildFile; fileRef = B222789A0D00BF200071B782 /* SVGLangSpace.h */; };
    34363436                B2227A320D00BF220071B782 /* SVGLength.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B222789C0D00BF200071B782 /* SVGLength.cpp */; };
    3437                 B2227A330D00BF220071B782 /* SVGLength.h in Headers */ = {isa = PBXBuildFile; fileRef = B222789D0D00BF200071B782 /* SVGLength.h */; };
     3437                B2227A330D00BF220071B782 /* SVGLength.h in Headers */ = {isa = PBXBuildFile; fileRef = B222789D0D00BF200071B782 /* SVGLength.h */; settings = {ATTRIBUTES = (Private, ); }; };
    34383438                B2227A350D00BF220071B782 /* SVGLengthList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B222789F0D00BF200071B782 /* SVGLengthList.cpp */; };
    34393439                B2227A360D00BF220071B782 /* SVGLengthList.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278A00D00BF200071B782 /* SVGLengthList.h */; };
     
    36973697                B27B285E0CEF0D7200D39D54 /* DOMSVGMissingGlyphElement.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = B27B28330CEF0C3500D39D54 /* DOMSVGMissingGlyphElement.h */; };
    36983698                B28C6A270D00C44800334AA4 /* SVGDocumentExtensions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B28C6A1E0D00C44800334AA4 /* SVGDocumentExtensions.cpp */; };
    3699                 B28C6A280D00C44800334AA4 /* SVGDocumentExtensions.h in Headers */ = {isa = PBXBuildFile; fileRef = B28C6A1F0D00C44800334AA4 /* SVGDocumentExtensions.h */; };
     3699                B28C6A280D00C44800334AA4 /* SVGDocumentExtensions.h in Headers */ = {isa = PBXBuildFile; fileRef = B28C6A1F0D00C44800334AA4 /* SVGDocumentExtensions.h */; settings = {ATTRIBUTES = (Private, ); }; };
    37003700                B28C6A290D00C44800334AA4 /* SVGImageLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B28C6A200D00C44800334AA4 /* SVGImageLoader.cpp */; };
    37013701                B28C6A2A0D00C44800334AA4 /* SVGImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = B28C6A210D00C44800334AA4 /* SVGImageLoader.h */; };
     
    47324732                E4AFCFA50DAF29A300F5F55C /* UnitBezier.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AFCFA40DAF29A300F5F55C /* UnitBezier.h */; };
    47334733                E4AFD00B0DAF335400F5F55C /* SMILTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4AFD0050DAF335400F5F55C /* SMILTime.cpp */; };
    4734                 E4AFD00C0DAF335400F5F55C /* SMILTime.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AFD0060DAF335400F5F55C /* SMILTime.h */; };
     4734                E4AFD00C0DAF335400F5F55C /* SMILTime.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AFD0060DAF335400F5F55C /* SMILTime.h */; settings = {ATTRIBUTES = (Private, ); }; };
    47354735                E4AFD00D0DAF335500F5F55C /* SMILTimeContainer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4AFD0070DAF335400F5F55C /* SMILTimeContainer.cpp */; };
    47364736                E4AFD00E0DAF335500F5F55C /* SMILTimeContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AFD0080DAF335400F5F55C /* SMILTimeContainer.h */; };
    47374737                E4AFD00F0DAF335500F5F55C /* SVGSMILElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4AFD0090DAF335400F5F55C /* SVGSMILElement.cpp */; };
    4738                 E4AFD0100DAF335500F5F55C /* SVGSMILElement.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AFD00A0DAF335400F5F55C /* SVGSMILElement.h */; };
     4738                E4AFD0100DAF335500F5F55C /* SVGSMILElement.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AFD00A0DAF335400F5F55C /* SVGSMILElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
    47394739                E4C1789A0EE6903800824D69 /* CSSSelectorList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4C178950EE6903800824D69 /* CSSSelectorList.cpp */; };
    47404740                E4C1789B0EE6903800824D69 /* CSSSelectorList.h in Headers */ = {isa = PBXBuildFile; fileRef = E4C178960EE6903800824D69 /* CSSSelectorList.h */; };
  • trunk/WebCore/svg/SVGDocumentExtensions.cpp

    r45786 r51567  
    3535#include "FrameLoader.h"
    3636#include "Page.h"
     37#include "SVGSMILElement.h"
    3738#include "SVGSVGElement.h"
    3839#include "SMILTimeContainer.h"
     
    8788}
    8889
     90bool SVGDocumentExtensions::sampleAnimationAtTime(const String& elementId, SVGSMILElement* element, double time)
     91{
     92    ASSERT(element);
     93    SMILTimeContainer* container = element->timeContainer();
     94    if (!container || container->isPaused())
     95        return false;
     96
     97    container->sampleAnimationAtTime(elementId, time);
     98    return true;
     99}
     100
    89101void SVGDocumentExtensions::reportWarning(const String& message)
    90102{
  • trunk/WebCore/svg/SVGDocumentExtensions.h

    r36823 r51567  
    4242class SVGElementInstance;
    4343class SVGStyledElement;
     44class SVGSMILElement;
    4445class SVGSVGElement;
    4546
     
    5556    void pauseAnimations();
    5657    void unpauseAnimations();
     58    bool sampleAnimationAtTime(const String& elementId, SVGSMILElement*, double time);
    5759
    5860    void reportWarning(const String&);
  • trunk/WebCore/svg/animation/SMILTimeContainer.cpp

    r42377 r51567  
    4747    , m_pauseTime(0)
    4848    , m_accumulatedPauseTime(0)
     49    , m_nextManualSampleTime(0)
    4950    , m_documentOrderIndexesDirty(false)
    5051    , m_timer(this, &SMILTimeContainer::timerFired)
     
    208209    return baseValue;
    209210}
    210      
     211
     212void SMILTimeContainer::sampleAnimationAtTime(const String& elementId, double newTime)
     213{
     214    ASSERT(m_beginTime);
     215    ASSERT(!isPaused());
     216
     217    // Fast-forward to the time DRT wants to sample
     218    m_timer.stop();
     219    m_nextSamplingTarget = elementId;
     220    m_nextManualSampleTime = newTime;
     221
     222    updateAnimations(elapsed());
     223}
     224
    211225void SMILTimeContainer::updateAnimations(SMILTime elapsed)
    212226{
     
    215229    Vector<SVGSMILElement*> toAnimate;
    216230    copyToVector(m_scheduledAnimations, toAnimate);
    217    
     231
     232    if (m_nextManualSampleTime) {
     233        SMILTime samplingDiff;
     234        for (unsigned n = 0; n < toAnimate.size(); ++n) {
     235            SVGSMILElement* animation = toAnimate[n];
     236            ASSERT(animation->timeContainer() == this);
     237
     238            SVGElement* targetElement = animation->targetElement();
     239            if (!targetElement || targetElement->getIDAttribute() != m_nextSamplingTarget)
     240                continue;
     241
     242            samplingDiff = animation->intervalBegin();
     243            break;
     244        }
     245
     246        elapsed = SMILTime(m_nextManualSampleTime) + samplingDiff;
     247        m_nextManualSampleTime = 0;
     248    }
     249
    218250    // Sort according to priority. Elements with later begin time have higher priority.
    219251    // In case of a tie, document order decides.
  • trunk/WebCore/svg/animation/SMILTimeContainer.h

    r32044 r51567  
    6161        void setDocumentOrderIndexesDirty() { m_documentOrderIndexesDirty = true; }
    6262
     63        // Move to a specific time. Only used for DRT testing purposes.
     64        void sampleAnimationAtTime(const String& elementId, double seconds);
     65
    6366    private:
    6467        SMILTimeContainer(SVGSVGElement* owner);
     
    7780        double m_pauseTime;
    7881        double m_accumulatedPauseTime;
    79        
     82        double m_nextManualSampleTime;
     83        String m_nextSamplingTarget;
     84
    8085        bool m_documentOrderIndexesDirty;
    8186       
  • trunk/WebKit/gtk/ChangeLog

    r51486 r51567  
     12009-12-01  Nikolas Zimmermann  <nzimmermann@rim.com>
     2
     3        Reviewed by Simon Fraser.
     4
     5        Add SVG animation test framework with 'snapshot' functionality
     6        https://bugs.webkit.org/show_bug.cgi?id=31897
     7
     8        Add API used by the new 'sampleSVGAnimationForElementAtTime' DRT method,
     9        forwarding the call to SVGDocumentExtensions, if SVG is enabled.
     10
     11        Implemented just like the existing pauseAnimation* methods for CSS animations.
     12
     13        * webkit/webkitprivate.h:
     14        * webkit/webkitwebframe.cpp:
     15        (webkit_web_frame_pause_svg_animation):
     16
    1172009-11-30  Xan Lopez  <xlopez@igalia.com>
    218
  • trunk/WebKit/gtk/webkit/webkitprivate.h

    r50507 r51567  
    302302    webkit_web_frame_pause_transition(WebKitWebFrame* frame, const gchar* name, double time, const gchar* element);
    303303
     304    WEBKIT_API bool
     305    webkit_web_frame_pause_svg_animation(WebKitWebFrame* frame, const gchar* animationId, double time, const gchar* elementId);
     306
    304307    WEBKIT_API unsigned int
    305308    webkit_web_frame_number_of_active_animations(WebKitWebFrame* frame);
  • trunk/WebKit/gtk/webkit/webkitwebframe.cpp

    r50923 r51567  
    5555#include "ScriptController.h"
    5656#include "SubstituteData.h"
     57#include "SVGSMILElement.h"
    5758
    5859#include <atk/atk.h>
     
    960961}
    961962
     963bool webkit_web_frame_pause_svg_animation(WebKitWebFrame* frame, const gchar* animationId, double time, const gchar* elementId)
     964{
     965    ASSERT(core(frame));
     966    Document* document = core(frame)->document();
     967    if (!document || !document->svgExtensions())
     968        return false;
     969    Element* coreElement = document->getElementById(AtomicString(animationId));
     970    if (!coreElement || !SVGSMILElement::isSMILElement(coreElement))
     971        return false;
     972#if ENABLE(SVG)
     973    return document->accessSVGExtensions()->sampleAnimationAtTime(elementId, static_cast<SVGSMILElement*>(coreElement), time);
     974#else
     975    return false;
     976#endif
     977}
     978
    962979unsigned int webkit_web_frame_number_of_active_animations(WebKitWebFrame* frame)
    963980{
  • trunk/WebKit/mac/ChangeLog

    r51562 r51567  
     12009-12-01  Nikolas Zimmermann  <nzimmermann@rim.com>
     2
     3        Reviewed by Simon Fraser.
     4
     5        Add SVG animation test framework with 'snapshot' functionality
     6        https://bugs.webkit.org/show_bug.cgi?id=31897
     7
     8        Add API used by the new 'sampleSVGAnimationForElementAtTime' DRT method,
     9        forwarding the call to SVGDocumentExtensions, if SVG is enabled.
     10
     11        Implemented just like the existing pauseAnimation* methods for CSS animations.
     12
     13        * WebView/WebFrame.mm:
     14        (-[WebFrame _pauseSVGAnimation:onSMILNode:atTime:]):
     15        * WebView/WebFramePrivate.h:
     16
    1172009-12-01  Sam Weinig  <sam@webkit.org>
    218
  • trunk/WebKit/mac/WebView/WebFrame.mm

    r50943 r51567  
    8080#import <WebCore/ScriptValue.h>
    8181#import <WebCore/SmartReplace.h>
     82#import <WebCore/SVGSMILElement.h>
    8283#import <WebCore/TextIterator.h>
    8384#import <WebCore/ThreadCheck.h>
     
    11171118}
    11181119
     1120// Pause a given SVG animation on the target node at a specific time.
     1121// This method is only intended to be used for testing the SVG animation system.
     1122- (BOOL)_pauseSVGAnimation:(NSString*)elementId onSMILNode:(DOMNode *)node atTime:(NSTimeInterval)time
     1123{
     1124    Frame* frame = core(self);
     1125    if (!frame)
     1126        return false;
     1127 
     1128    Document* document = frame->document();
     1129    if (!document || !document->svgExtensions())
     1130        return false;
     1131
     1132    Node* coreNode = core(node);
     1133    if (!coreNode || !SVGSMILElement::isSMILElement(coreNode))
     1134        return false;
     1135
     1136#if ENABLE(SVG)
     1137    return document->accessSVGExtensions()->sampleAnimationAtTime(elementId, static_cast<SVGSMILElement*>(coreNode), time);
     1138#else
     1139    return false;
     1140#endif
     1141}
     1142
    11191143- (unsigned) _numberOfActiveAnimations
    11201144{
  • trunk/WebKit/mac/WebView/WebFramePrivate.h

    r50943 r51567  
    107107- (BOOL)_pauseTransitionOfProperty:(NSString*)name onNode:(DOMNode*)node atTime:(NSTimeInterval)time;
    108108
     109// Pause a given SVG animation on the target node at a specific time.
     110// This method is only intended to be used for testing the SVG animation system.
     111- (BOOL)_pauseSVGAnimation:(NSString*)elementId onSMILNode:(DOMNode *)node atTime:(NSTimeInterval)time;
     112
    109113// Returns the total number of currently running animations (includes both CSS transitions and CSS animations).
    110114- (unsigned) _numberOfActiveAnimations;
  • trunk/WebKit/qt/Api/qwebframe.cpp

    r51174 r51567  
    5757#include "SelectionController.h"
    5858#include "SubstituteData.h"
     59#include "SVGSMILElement.h"
    5960#include "htmlediting.h"
    6061#include "markup.h"
     
    147148
    148149    return controller->pauseTransitionAtTime(coreNode->renderer(), propertyName, time);
     150}
     151
     152// Pause a given SVG animation on the target node at a specific time.
     153// This method is only intended to be used for testing the SVG animation system.
     154bool QWEBKIT_EXPORT qt_drt_pauseSVGAnimation(QWebFrame *qframe, const QString &animationId, double time, const QString &elementId)
     155{
     156    Frame* frame = QWebFramePrivate::core(qframe);
     157    if (!frame)
     158        return false;
     159
     160    Document* doc = frame->document();
     161    Q_ASSERT(doc);
     162
     163    if (!doc->svgExtensions())
     164        return false;
     165
     166    Node* coreNode = doc->getElementById(animationId);
     167    if (!coreNode || !SVGSMILElement::isSMILElement(coreNode))
     168        return false;
     169
     170#if ENABLE(SVG)
     171    return document->accessSVGExtensions()->sampleAnimationAtTime(elementId, static_cast<SVGSMILElement*>(coreNode), time);
     172#else
     173    return false;
     174#endif
    149175}
    150176
  • trunk/WebKit/qt/ChangeLog

    r51558 r51567  
     12009-12-01  Nikolas Zimmermann  <nzimmermann@rim.com>
     2
     3        Reviewed by Simon Fraser.
     4
     5        Add SVG animation test framework with 'snapshot' functionality
     6        https://bugs.webkit.org/show_bug.cgi?id=31897
     7
     8        Add API used by the new 'sampleSVGAnimationForElementAtTime' DRT method,
     9        forwarding the call to SVGDocumentExtensions, if SVG is enabled.
     10
     11        Implemented just like the existing pauseAnimation* methods for CSS animations.
     12
     13        * Api/qwebframe.cpp:
     14        (qt_drt_pauseSVGAnimation):
     15
    1162009-12-01  Daniel Bates  <dbates@webkit.org>
    217
  • trunk/WebKit/win/ChangeLog

    r51510 r51567  
     12009-12-01  Nikolas Zimmermann  <nzimmermann@rim.com>
     2
     3        Reviewed by Simon Fraser.
     4
     5        Add SVG animation test framework with 'snapshot' functionality
     6        https://bugs.webkit.org/show_bug.cgi?id=31897
     7
     8        Add API used by the new 'sampleSVGAnimationForElementAtTime' DRT method,
     9        forwarding the call to SVGDocumentExtensions, if SVG is enabled.
     10
     11        Implemented just like the existing pauseAnimation* methods for CSS animations.
     12
     13        * Interfaces/IWebFramePrivate.idl:
     14        * WebFrame.cpp:
     15        (WebFrame::pauseSVGAnimation):
     16        * WebFrame.h:
     17
    1182009-11-30  Adam Roben  <aroben@apple.com>
    219
  • trunk/WebKit/win/Interfaces/IWebFramePrivate.idl

    r50943 r51567  
    9090    HRESULT pauseAnimation([in] BSTR animationName, [in] IDOMNode* node, [in] double secondsFromNow, [out, retval] BOOL* animationWasRunning);
    9191    HRESULT pauseTransition([in] BSTR propertyName, [in] IDOMNode* node, [in] double secondsFromNow, [out, retval] BOOL* transitionWasRunning);
     92    HRESULT pauseSVGAnimation([in] BSTR elementId, [in] IDOMNode* node, [in] double secondsFromNow, [out, retval] BOOL* animationWasRunning);
    9293    HRESULT numberOfActiveAnimations([out, retval] UINT* number);
    9394
  • trunk/WebKit/win/WebFrame.cpp

    r51500 r51567  
    9393#include <WebCore/RenderTreeAsText.h>
    9494#include <WebCore/Settings.h>
     95#include <WebCore/SVGSMILElement.h>
    9596#include <WebCore/TextIterator.h>
    9697#include <WebCore/JSDOMBinding.h>
     
    11571158}
    11581159
     1160HRESULT WebFrame::pauseSVGAnimation(BSTR elementId, IDOMNode* node, double secondsFromNow, BOOL* animationWasRunning)
     1161{
     1162    if (!node || !animationWasRunning)
     1163        return E_POINTER;
     1164
     1165    *animationWasRunning = FALSE;
     1166
     1167    Frame* frame = core(this);
     1168    if (!frame)
     1169        return E_FAIL;
     1170
     1171    Document* document = frame->document();
     1172    if (!document || !document->svgExtensions())
     1173        return E_FAIL;
     1174
     1175    COMPtr<DOMNode> domNode(Query, node);
     1176    if (!domNode || !SVGSMILElement::isSMILElement(domNode))
     1177        return E_FAIL;
     1178
     1179#if ENABLE(SVG)
     1180    *animationWasRunning = document->accessSVGExtensions()->sampleAnimationAtTime(String(elementId, SysStringLen(elementId)), static_cast<SVGSMILElement*>(domNode), secondsFromNow);
     1181#else
     1182    *animationWasRunning = FALSE;
     1183#endif
     1184
     1185    return S_OK;
     1186}
     1187
    11591188HRESULT WebFrame::numberOfActiveAnimations(UINT* number)
    11601189{
  • trunk/WebKit/win/WebFrame.h

    r50973 r51567  
    241241    virtual HRESULT STDMETHODCALLTYPE pauseAnimation(BSTR animationName, IDOMNode*, double secondsFromNow, BOOL* animationWasRunning);
    242242    virtual HRESULT STDMETHODCALLTYPE pauseTransition(BSTR propertyName, IDOMNode*, double secondsFromNow, BOOL* transitionWasRunning);
     243    virtual HRESULT STDMETHODCALLTYPE pauseSVGAnimation(BSTR elementId, IDOMNode*, double secondsFromNow, BOOL* animationWasRunning);
    243244    virtual HRESULT STDMETHODCALLTYPE numberOfActiveAnimations(UINT*);
    244245
  • trunk/WebKitTools/ChangeLog

    r51554 r51567  
     12009-12-01  Nikolas Zimmermann  <nzimmermann@rim.com>
     2
     3        Reviewed by Simon Fraser.
     4
     5        Add SVG animation test framework with 'snapshot' functionality
     6        https://bugs.webkit.org/show_bug.cgi?id=31897
     7
     8        Add new 'sampleSVGAnimationForElementAtTime' DRT method,
     9        used by the new SVG animation testing framework, implemented
     10        for qt/gtk/win/mac.
     11
     12        * DumpRenderTree/LayoutTestController.cpp:
     13        (sampleSVGAnimationForElementAtTimeCallback):
     14        (LayoutTestController::staticFunctions):
     15        * DumpRenderTree/LayoutTestController.h:
     16        * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
     17        (LayoutTestController::sampleSVGAnimationForElementAtTime):
     18        * DumpRenderTree/mac/LayoutTestControllerMac.mm:
     19        (LayoutTestController::sampleSVGAnimationForElementAtTime):
     20        * DumpRenderTree/qt/LayoutTestControllerQt.cpp:
     21        (LayoutTestController::sampleSVGAnimationForElementAtTime):
     22        * DumpRenderTree/qt/LayoutTestControllerQt.h:
     23        * DumpRenderTree/win/LayoutTestControllerWin.cpp:
     24        (LayoutTestController::sampleSVGAnimationForElementAtTime):
     25        * DumpRenderTree/wx/LayoutTestControllerWx.cpp:
     26        (LayoutTestController::sampleSVGAnimationForElementAtTime):
     27
    1282009-12-01  Adam Roben  <aroben@apple.com>
    229
  • trunk/WebKitTools/DumpRenderTree/LayoutTestController.cpp

    r51523 r51567  
    10721072    LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
    10731073    return JSValueMakeBoolean(context, controller->pauseTransitionAtTimeOnElementWithId(propertyName.get(), time, elementId.get()));
     1074}
     1075
     1076static JSValueRef sampleSVGAnimationForElementAtTimeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     1077{
     1078    if (argumentCount != 3)
     1079        return JSValueMakeUndefined(context);
     1080
     1081    JSRetainPtr<JSStringRef> animationId(Adopt, JSValueToStringCopy(context, arguments[0], exception));
     1082    ASSERT(!*exception);
     1083    double time = JSValueToNumber(context, arguments[1], exception);
     1084    ASSERT(!*exception);
     1085    JSRetainPtr<JSStringRef> elementId(Adopt, JSValueToStringCopy(context, arguments[2], exception));
     1086    ASSERT(!*exception);
     1087
     1088    LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
     1089    return JSValueMakeBoolean(context, controller->sampleSVGAnimationForElementAtTime(animationId.get(), time, elementId.get()));
    10741090}
    10751091
     
    12451261        { "pauseAnimationAtTimeOnElementWithId", pauseAnimationAtTimeOnElementWithIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    12461262        { "pauseTransitionAtTimeOnElementWithId", pauseTransitionAtTimeOnElementWithIdCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     1263        { "sampleSVGAnimationForElementAtTime", sampleSVGAnimationForElementAtTimeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    12471264        { "printToPDF", dumpAsPDFCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    12481265        { "queueBackNavigation", queueBackNavigationCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
  • trunk/WebKitTools/DumpRenderTree/LayoutTestController.h

    r51294 r51567  
    203203    bool pauseAnimationAtTimeOnElementWithId(JSStringRef animationName, double time, JSStringRef elementId);
    204204    bool pauseTransitionAtTimeOnElementWithId(JSStringRef propertyName, double time, JSStringRef elementId);
     205    bool sampleSVGAnimationForElementAtTime(JSStringRef animationId, double time, JSStringRef elementId);
    205206    unsigned numberOfActiveAnimations() const;
    206207
  • trunk/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp

    r51320 r51567  
    449449}
    450450
     451bool LayoutTestController::sampleSVGAnimationForElementAtTime(JSStringRef animationId, double time, JSStringRef elementId)
     452{   
     453    gchar* animationElement = JSStringCopyUTF8CString(animationId);
     454    bool returnValue = webkit_web_frame_pause_svg_animation(mainFrame, elementId, time, animationElement);
     455    g_free(element);
     456    return returnValue;
     457}
     458
    451459unsigned LayoutTestController::numberOfActiveAnimations() const
    452460{
  • trunk/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm

    r51294 r51567  
    487487}
    488488
     489bool LayoutTestController::sampleSVGAnimationForElementAtTime(JSStringRef animationId, double time, JSStringRef elementId)
     490{
     491    RetainPtr<CFStringRef> animationIDCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, animationId));
     492    NSString *animationIDNS = (NSString *)animationIDCF.get();
     493    RetainPtr<CFStringRef> elementIDCF(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, elementId));
     494    NSString *elementIDNS = (NSString *)elementIDCF.get();
     495
     496    return [mainFrame _pauseSVGAnimation:elementIDNS onSMILNode:[[mainFrame DOMDocument] getElementById:animationIDNS] atTime:time];
     497}
     498
    489499unsigned LayoutTestController::numberOfActiveAnimations() const
    490500{
  • trunk/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp

    r51087 r51567  
    4040extern bool qt_drt_pauseAnimation(QWebFrame*, const QString& name, double time, const QString& elementId);
    4141extern bool qt_drt_pauseTransitionOfProperty(QWebFrame*, const QString& name, double time, const QString& elementId);
     42extern bool qt_drt_pauseSVGAnimation(QWebFrame*, const QString& animationId, double time, const QString& elementId);
    4243extern int qt_drt_numberOfActiveAnimations(QWebFrame*);
     44
    4345extern void qt_drt_whiteListAccessFromOrigin(const QString& sourceOrigin, const QString& destinationProtocol, const QString& destinationHost, bool allowDestinationSubdomains);
    4446extern QString qt_drt_counterValueForElementById(QWebFrame* qFrame, const QString& id);
     
    281283}
    282284
     285bool LayoutTestController::sampleSVGAnimationForElementAtTime(const QString& animationId,
     286                                                              double time,
     287                                                              const QString& elementId)
     288{
     289    QWebFrame* frame = m_drt->webPage()->mainFrame();
     290    Q_ASSERT(frame);
     291    return qt_drt_pauseSVGAnimation(frame, animationId, time, elementId);
     292}
     293
    283294unsigned LayoutTestController::numberOfActiveAnimations() const
    284295{
  • trunk/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h

    r51037 r51567  
    116116    bool pauseAnimationAtTimeOnElementWithId(const QString& animationName, double time, const QString& elementId);
    117117    bool pauseTransitionAtTimeOnElementWithId(const QString& propertyName, double time, const QString& elementId);
     118    bool pauseSVGAnimationAtTimeOnElementWithId(double time, const QString& elementId);
    118119    unsigned numberOfActiveAnimations() const;
    119120
  • trunk/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp

    r51545 r51567  
    862862}
    863863
     864bool LayoutTestController::sampleSVGAnimationForElementAtTime(JSStringRef animationId, double time, JSStringRef elementId)
     865{
     866    COMPtr<IDOMDocument> document;
     867    if (FAILED(frame->DOMDocument(&document)))
     868        return false;
     869
     870    BSTR idBSTR = JSStringCopyBSTR(animationId);
     871    COMPtr<IDOMElement> element;
     872    HRESULT hr = document->getElementById(idBSTR, &element);
     873    SysFreeString(idBSTR);
     874    if (FAILED(hr))
     875        return false;
     876
     877    COMPtr<IWebFramePrivate> framePrivate(Query, frame);
     878    if (!framePrivate)
     879        return false;
     880
     881    BSTR elementIdBSTR = JSStringCopyBSTR(elementId);
     882    BOOL wasRunning = FALSE;
     883    hr = framePrivate->pauseSVGAnimation(elementIdBSTR, element.get(), time, &wasRunning);
     884    SysFreeString(elementIdBSTR);
     885
     886    return SUCCEEDED(hr) && wasRunning;
     887}
     888
    864889unsigned LayoutTestController::numberOfActiveAnimations() const
    865890{
  • trunk/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp

    r51294 r51567  
    268268}
    269269
     270bool LayoutTestController::sampleSVGAnimationForElementAtTime(JSStringRef animationId, double time, JSStringRef elementId)
     271{
     272    // FIXME: implement
     273    return false;
     274}
     275
    270276void LayoutTestController::setCacheModel(int)
    271277{
Note: See TracChangeset for help on using the changeset viewer.