Commit 840d1766 authored by zimmermann@webkit.org's avatar zimmermann@webkit.org
Browse files

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):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51567 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent bc3c1476
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 Adam Roben <aroben@apple.com>
 
Skip more tests that fail with specific versions of CFNetwork on
SVG 1.1 dynamic animation tests
Trivial animVal testcase, to see wheter we support it at all. Should result in a 200x200 rect and only PASS messages
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS rect.width.animVal.value is 200
PASS rect.width.baseVal.value is 200
PASS rect.width.animVal.value is 150
PASS rect.width.baseVal.value is 150
PASS rect.width.animVal.value is almost 100, just before-end
PASS rect.width.baseVal.value is almost 100, just before-end
PASS rect.width.animVal.value is 200
PASS rect.width.baseVal.value is 200
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
<script src="../../fast/js/resources/js-test-pre.js"></script>
<script src="../dynamic-updates/resources/SVGTestCase.js"></script>
<script src="resources/SVGAnimationTestCase.js"></script>
</head>
<body>
<h1>SVG 1.1 dynamic animation tests</h1>
<p id="description"></p>
<div id="console"></div>
<script src="script-tests/animVal-basics.js"></script>
</body>
</html>
// Inspired by Layoutests/animations/animation-test-helpers.js
// Modified to work with SVG and together with LayoutTests/svg/dynamic-updates/resources/SVGTestCase.js
function isCloseEnough(actual, desired, tolerance)
{
var diff = Math.abs(actual - desired);
return diff <= tolerance;
}
function moveAnimationTimelineAndSample(index)
{
var animationId = expectedResults[index][0];
var time = expectedResults[index][1];
var elementId = expectedResults[index][2];
var sampleCallback = expectedResults[index][3];
if (!layoutTestController.sampleSVGAnimationForElementAtTime(animationId, time, elementId)) {
testFailed("animation \"" + animationId + "\" is not running");
return;
}
sampleCallback();
}
var currentTest = 0;
var expectedResults;
function startTest(callback) {
if (currentTest > 0)
throw("Not allowed to call startTest() twice");
testCount = expectedResults.length;
currentTest = 0;
if (callback)
callback();
// Immediately sample, if the first time is 0
if (expectedResults[0][1] == '0') {
expectedResults[0][3]();
++currentTest;
}
// We may have just sampled on animation-begin, give the
// document some time to invoke the SVG animation.
// If we fix the animation to start with the SVGLoad event
// not on implicitClose(), we can even avoid this hack.
window.setTimeout(sampleAnimation, 0);
}
function sampleAnimation() {
if (currentTest == expectedResults.length) {
completeTest();
return;
}
moveAnimationTimelineAndSample(currentTest);
++currentTest;
sampleAnimation();
}
var hasPauseAnimationAPI;
var globalCallback;
function runAnimationTest(expected, callback)
{
if (!expected)
throw("Expected results are missing!");
expectedResults = expected;
hasPauseAnimationAPI = ('layoutTestController' in window) && ('sampleSVGAnimationForElementAtTime' in layoutTestController);
if (!hasPauseAnimationAPI)
throw("SVG animation pause API missing!");
startTest(callback);
}
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
<script src="../../fast/js/resources/js-test-pre.js"></script>
<script src="../dynamic-updates/resources/SVGTestCase.js"></script>
<script src="resources/SVGAnimationTestCase.js"></script>
</head>
<body>
<h1>SVG 1.1 dynamic animation tests</h1>
<p id="description"></p>
<div id="console"></div>
<script src="YOUR_JS_FILE_HERE"></script>
</body>
</html>
// FIXME: This test will become useful once we have basic animVal support. For now it's just testing the SVG animation test infrastructure
description("Trivial animVal testcase, to see wheter we support it at all. Should result in a 200x200 rect and only PASS messages");
createSVGTestCase();
// Setup test document
var rect = createSVGElement("rect");
rect.setAttribute("id", "rect");
rect.setAttribute("width", "200");
rect.setAttribute("height", "200");
rect.setAttribute("fill", "green");
rect.setAttribute("onclick", "executeTest()");
var animate = createSVGElement("animate");
animate.setAttribute("id", "animation");
animate.setAttribute("attributeName", "width");
animate.setAttribute("from", "200");
animate.setAttribute("to", "100");
animate.setAttribute("begin", "click");
animate.setAttribute("dur", "4s");
rect.appendChild(animate);
rootSVGElement.appendChild(rect);
// Setup animation test
function sample1() {
// Check initial/end conditions
shouldBe("rect.width.animVal.value", "200");
shouldBe("rect.width.baseVal.value", "200");
}
function sample2() {
// FIXME: Add animVal support. Animates baseVal at the moment.
// shouldBe("rect.width.animVal.value", "150");
// shouldBe("rect.width.baseVal.value", "200");
// Check half-time conditions
shouldBe("rect.width.animVal.value", "150");
shouldBe("rect.width.baseVal.value", "150");
}
function sample3() {
// FIXME: Add animVal support. Animates baseVal at the moment.
// shouldBe("rect.width.animVal.value", "100");
// shouldBe("rect.width.baseVal.value", "200");
// Check just before-end conditions
var ok = isCloseEnough(rect.width.animVal.value, 100, 0.01);
if (ok)
testPassed("rect.width.animVal.value is almost 100, just before-end");
else
testFailed("rect.width.animVal.value is NOT almost 100, as expected");
ok = isCloseEnough(rect.width.baseVal.value, 100, 0.01);
if (ok)
testPassed("rect.width.baseVal.value is almost 100, just before-end");
else
testFailed("rect.width.baseVal.value is NOT almost 100, as expected");
}
function executeTest() {
const expectedValues = [
// [animationId, time, elementId, sampleCallback]
["animation", 0.0, "rect", sample1],
["animation", 2.0, "rect", sample2],
["animation", 3.9999, "rect", sample3],
["animation", 4.0 , "rect", sample1]
];
runAnimationTest(expectedValues);
}
// Begin test async
window.setTimeout("triggerUpdate(15, 30)", 0);
var successfullyParsed = true;
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 Jens Alfke <snej@chromium.org>
 
Reviewed by Darin Adler.
......@@ -984,6 +984,10 @@ __ZTVN7WebCore12ChromeClientE
__ZTVN7WebCore17FileChooserClientE
__ZTVN7WebCore17FrameLoaderClientE
__ZTVN7WebCore25HistoryPropertyListWriterE
__ZN7WebCore14SVGSMILElement13isSMILElementEPNS_4NodeE
__ZN7WebCore21SVGDocumentExtensions21sampleAnimationAtTimeERKNS_6StringEPNS_14SVGSMILElementEd
__ZN7WebCore8Document19accessSVGExtensionsEv
__ZN7WebCore8Document13svgExtensionsEv
_filenameByFixingIllegalCharacters
_hasCaseInsensitiveSubstring
_hasCaseInsensitiveSuffix
......
......@@ -90,10 +90,10 @@
087281580F26B9B600AFC596 /* OptionGroupElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 087281540F26B9B600AFC596 /* OptionGroupElement.h */; };
08744BAA0EDB7D86004C9E63 /* WMLOnEventElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08744BA90EDB7D86004C9E63 /* WMLOnEventElement.cpp */; };
08744BAE0EDB7D92004C9E63 /* WMLOnEventElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 08744BAD0EDB7D92004C9E63 /* WMLOnEventElement.h */; };
0878B1FD10874E3F00A55097 /* SVGAnimatedProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 0878B1F910874E3F00A55097 /* SVGAnimatedProperty.h */; };
0878B1FD10874E3F00A55097 /* SVGAnimatedProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 0878B1F910874E3F00A55097 /* SVGAnimatedProperty.h */; settings = {ATTRIBUTES = (Private, ); }; };
0878B1FE10874E3F00A55097 /* SynchronizablePropertyController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0878B1FA10874E3F00A55097 /* SynchronizablePropertyController.cpp */; };
0878B1FF10874E3F00A55097 /* SynchronizablePropertyController.h in Headers */ = {isa = PBXBuildFile; fileRef = 0878B1FB10874E3F00A55097 /* SynchronizablePropertyController.h */; };
0878B20010874E3F00A55097 /* SynchronizableTypeWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 0878B1FC10874E3F00A55097 /* SynchronizableTypeWrapper.h */; };
0878B1FF10874E3F00A55097 /* SynchronizablePropertyController.h in Headers */ = {isa = PBXBuildFile; fileRef = 0878B1FB10874E3F00A55097 /* SynchronizablePropertyController.h */; settings = {ATTRIBUTES = (Private, ); }; };
0878B20010874E3F00A55097 /* SynchronizableTypeWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 0878B1FC10874E3F00A55097 /* SynchronizableTypeWrapper.h */; settings = {ATTRIBUTES = (Private, ); }; };
087FFA0F0EFF3ED3009DBD88 /* WMLInsertedLegendElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 087FFA0D0EFF3ED3009DBD88 /* WMLInsertedLegendElement.cpp */; };
087FFA100EFF3ED3009DBD88 /* WMLInsertedLegendElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 087FFA0E0EFF3ED3009DBD88 /* WMLInsertedLegendElement.h */; };
08807B760ED709AB003F6975 /* WMLGoElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08807B6A0ED709AB003F6975 /* WMLGoElement.cpp */; };
......@@ -3325,7 +3325,7 @@
B22279850D00BF220071B782 /* SVGAnimatedPathData.h in Headers */ = {isa = PBXBuildFile; fileRef = B22277EF0D00BF1F0071B782 /* SVGAnimatedPathData.h */; };
B22279870D00BF220071B782 /* SVGAnimatedPoints.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B22277F10D00BF1F0071B782 /* SVGAnimatedPoints.cpp */; };
B22279880D00BF220071B782 /* SVGAnimatedPoints.h in Headers */ = {isa = PBXBuildFile; fileRef = B22277F20D00BF1F0071B782 /* SVGAnimatedPoints.h */; };
B222798D0D00BF220071B782 /* SVGAnimatedTemplate.h in Headers */ = {isa = PBXBuildFile; fileRef = B22277F70D00BF1F0071B782 /* SVGAnimatedTemplate.h */; };
B222798D0D00BF220071B782 /* SVGAnimatedTemplate.h in Headers */ = {isa = PBXBuildFile; fileRef = B22277F70D00BF1F0071B782 /* SVGAnimatedTemplate.h */; settings = {ATTRIBUTES = (Private, ); }; };
B222798F0D00BF220071B782 /* SVGAnimateElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B22277F90D00BF1F0071B782 /* SVGAnimateElement.cpp */; };
B22279900D00BF220071B782 /* SVGAnimateElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B22277FA0D00BF1F0071B782 /* SVGAnimateElement.h */; };
B22279920D00BF220071B782 /* SVGAnimateMotionElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B22277FC0D00BF1F0071B782 /* SVGAnimateMotionElement.cpp */; };
......@@ -3351,7 +3351,7 @@
B22279B30D00BF220071B782 /* SVGDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B222781D0D00BF1F0071B782 /* SVGDocument.cpp */; };
B22279B40D00BF220071B782 /* SVGDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = B222781E0D00BF1F0071B782 /* SVGDocument.h */; };
B22279B60D00BF220071B782 /* SVGElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B22278200D00BF1F0071B782 /* SVGElement.cpp */; };
B22279B70D00BF220071B782 /* SVGElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278210D00BF1F0071B782 /* SVGElement.h */; };
B22279B70D00BF220071B782 /* SVGElement.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278210D00BF1F0071B782 /* SVGElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
B22279B90D00BF220071B782 /* SVGElementInstance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B22278230D00BF1F0071B782 /* SVGElementInstance.cpp */; };
B22279BA0D00BF220071B782 /* SVGElementInstance.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278240D00BF1F0071B782 /* SVGElementInstance.h */; };
B22279BC0D00BF220071B782 /* SVGElementInstanceList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B22278260D00BF1F0071B782 /* SVGElementInstanceList.cpp */; };
......@@ -3434,7 +3434,7 @@
B2227A2F0D00BF220071B782 /* SVGLangSpace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B22278990D00BF200071B782 /* SVGLangSpace.cpp */; };
B2227A300D00BF220071B782 /* SVGLangSpace.h in Headers */ = {isa = PBXBuildFile; fileRef = B222789A0D00BF200071B782 /* SVGLangSpace.h */; };
B2227A320D00BF220071B782 /* SVGLength.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B222789C0D00BF200071B782 /* SVGLength.cpp */; };
B2227A330D00BF220071B782 /* SVGLength.h in Headers */ = {isa = PBXBuildFile; fileRef = B222789D0D00BF200071B782 /* SVGLength.h */; };
B2227A330D00BF220071B782 /* SVGLength.h in Headers */ = {isa = PBXBuildFile; fileRef = B222789D0D00BF200071B782 /* SVGLength.h */; settings = {ATTRIBUTES = (Private, ); }; };
B2227A350D00BF220071B782 /* SVGLengthList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B222789F0D00BF200071B782 /* SVGLengthList.cpp */; };
B2227A360D00BF220071B782 /* SVGLengthList.h in Headers */ = {isa = PBXBuildFile; fileRef = B22278A00D00BF200071B782 /* SVGLengthList.h */; };
B2227A380D00BF220071B782 /* SVGLinearGradientElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B22278A20D00BF200071B782 /* SVGLinearGradientElement.cpp */; };
......@@ -3696,7 +3696,7 @@
B27B285D0CEF0D7200D39D54 /* DOMSVGGlyphElement.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = B27B28300CEF0C3500D39D54 /* DOMSVGGlyphElement.h */; };
B27B285E0CEF0D7200D39D54 /* DOMSVGMissingGlyphElement.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = B27B28330CEF0C3500D39D54 /* DOMSVGMissingGlyphElement.h */; };
B28C6A270D00C44800334AA4 /* SVGDocumentExtensions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B28C6A1E0D00C44800334AA4 /* SVGDocumentExtensions.cpp */; };
B28C6A280D00C44800334AA4 /* SVGDocumentExtensions.h in Headers */ = {isa = PBXBuildFile; fileRef = B28C6A1F0D00C44800334AA4 /* SVGDocumentExtensions.h */; };
B28C6A280D00C44800334AA4 /* SVGDocumentExtensions.h in Headers */ = {isa = PBXBuildFile; fileRef = B28C6A1F0D00C44800334AA4 /* SVGDocumentExtensions.h */; settings = {ATTRIBUTES = (Private, ); }; };
B28C6A290D00C44800334AA4 /* SVGImageLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B28C6A200D00C44800334AA4 /* SVGImageLoader.cpp */; };
B28C6A2A0D00C44800334AA4 /* SVGImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = B28C6A210D00C44800334AA4 /* SVGImageLoader.h */; };
B297BC700B3C14CF0045A590 /* JSSVGPathSegListCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B297BC6F0B3C14CF0045A590 /* JSSVGPathSegListCustom.cpp */; };
......@@ -4731,11 +4731,11 @@
E49626C30D80D94900E3405C /* PreloadScanner.h in Headers */ = {isa = PBXBuildFile; fileRef = E4D4ABE10D7542F100F96869 /* PreloadScanner.h */; };
E4AFCFA50DAF29A300F5F55C /* UnitBezier.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AFCFA40DAF29A300F5F55C /* UnitBezier.h */; };
E4AFD00B0DAF335400F5F55C /* SMILTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4AFD0050DAF335400F5F55C /* SMILTime.cpp */; };
E4AFD00C0DAF335400F5F55C /* SMILTime.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AFD0060DAF335400F5F55C /* SMILTime.h */; };
E4AFD00C0DAF335400F5F55C /* SMILTime.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AFD0060DAF335400F5F55C /* SMILTime.h */; settings = {ATTRIBUTES = (Private, ); }; };
E4AFD00D0DAF335500F5F55C /* SMILTimeContainer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4AFD0070DAF335400F5F55C /* SMILTimeContainer.cpp */; };
E4AFD00E0DAF335500F5F55C /* SMILTimeContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AFD0080DAF335400F5F55C /* SMILTimeContainer.h */; };
E4AFD00F0DAF335500F5F55C /* SVGSMILElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4AFD0090DAF335400F5F55C /* SVGSMILElement.cpp */; };
E4AFD0100DAF335500F5F55C /* SVGSMILElement.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AFD00A0DAF335400F5F55C /* SVGSMILElement.h */; };
E4AFD0100DAF335500F5F55C /* SVGSMILElement.h in Headers */ = {isa = PBXBuildFile; fileRef = E4AFD00A0DAF335400F5F55C /* SVGSMILElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
E4C1789A0EE6903800824D69 /* CSSSelectorList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4C178950EE6903800824D69 /* CSSSelectorList.cpp */; };
E4C1789B0EE6903800824D69 /* CSSSelectorList.h in Headers */ = {isa = PBXBuildFile; fileRef = E4C178960EE6903800824D69 /* CSSSelectorList.h */; };
E4C279580CF9741900E97B98 /* RenderMedia.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4C279560CF9741900E97B98 /* RenderMedia.cpp */; };
......@@ -34,6 +34,7 @@
#include "Frame.h"
#include "FrameLoader.h"
#include "Page.h"
#include "SVGSMILElement.h"
#include "SVGSVGElement.h"
#include "SMILTimeContainer.h"
#include "XMLTokenizer.h"
......@@ -86,6 +87,17 @@ void SVGDocumentExtensions::unpauseAnimations()
(*itr)->unpauseAnimations();
}
bool SVGDocumentExtensions::sampleAnimationAtTime(const String& elementId, SVGSMILElement* element, double time)
{
ASSERT(element);
SMILTimeContainer* container = element->timeContainer();
if (!container || container->isPaused())
return false;
container->sampleAnimationAtTime(elementId, time);
return true;
}
void SVGDocumentExtensions::reportWarning(const String& message)
{
if (Frame* frame = m_doc->frame())
......
......@@ -41,6 +41,7 @@ class Node;
class String;
class SVGElementInstance;
class SVGStyledElement;
class SVGSMILElement;
class SVGSVGElement;
class SVGDocumentExtensions {
......@@ -54,6 +55,7 @@ public:
void startAnimations();
void pauseAnimations();
void unpauseAnimations();
bool sampleAnimationAtTime(const String& elementId, SVGSMILElement*, double time);
void reportWarning(const String&);
void reportError(const String&);
......
......@@ -46,6 +46,7 @@ SMILTimeContainer::SMILTimeContainer(SVGSVGElement* owner)
: m_beginTime(0)
, m_pauseTime(0)
, m_accumulatedPauseTime(0)
, m_nextManualSampleTime(0)
, m_documentOrderIndexesDirty(false)
, m_timer(this, &SMILTimeContainer::timerFired)
, m_ownerSVGElement(owner)
......@@ -207,14 +208,45 @@ String SMILTimeContainer::baseValueFor(ElementAttributePair key)
m_savedBaseValues.add(key, baseValue);
return baseValue;
}
void SMILTimeContainer::sampleAnimationAtTime(const String& elementId, double newTime)
{
ASSERT(m_beginTime);
ASSERT(!isPaused());
// Fast-forward to the time DRT wants to sample
m_timer.stop();
m_nextSamplingTarget = elementId;
m_nextManualSampleTime = newTime;
updateAnimations(elapsed());
}
void SMILTimeContainer::updateAnimations(SMILTime elapsed)
{
SMILTime earliersFireTime = SMILTime::unresolved();
Vector<SVGSMILElement*> toAnimate;
copyToVector(m_scheduledAnimations, toAnimate);
if (m_nextManualSampleTime) {
SMILTime samplingDiff;
for (unsigned n = 0; n < toAnimate.size(); ++n) {
SVGSMILElement* animation = toAnimate[n];
ASSERT(animation->timeContainer() == this);
SVGElement* targetElement = animation->targetElement();
if (!targetElement || targetElement->getIDAttribute() != m_nextSamplingTarget)
continue;
samplingDiff = animation->intervalBegin();
break;
}
elapsed = SMILTime(m_nextManualSampleTime) + samplingDiff;
m_nextManualSampleTime = 0;
}
// Sort according to priority. Elements with later begin time have higher priority.
// In case of a tie, document order decides.
// FIXME: This should also consider timing relationships between the elements. Dependents
......
......@@ -60,6 +60,9 @@ namespace WebCore {
void setDocumentOrderIndexesDirty() { m_documentOrderIndexesDirty = true; }
// Move to a specific time. Only used for DRT testing purposes.
void sampleAnimationAtTime(const String& elementId, double seconds);
private:
SMILTimeContainer(SVGSVGElement* owner);
......@@ -76,7 +79,9 @@ namespace WebCore {
double m_beginTime;
double m_pauseTime;
double m_accumulatedPauseTime;
double m_nextManualSampleTime;
String m_nextSamplingTarget;
bool m_documentOrderIndexesDirty;
Timer<SMILTimeContainer> m_timer;
......
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-11-30 Xan Lopez <xlopez@igalia.com>
Reviewed by Gustavo Noronha.
......
......@@ -301,6 +301,9 @@ extern "C" {
WEBKIT_API bool
webkit_web_frame_pause_transition(WebKitWebFrame* frame, const gchar* name, double time, const gchar* element);
WEBKIT_API bool
webkit_web_frame_pause_svg_animation(WebKitWebFrame* frame, const gchar* animationId, double time, const gchar* elementId);
WEBKIT_API unsigned int
webkit_web_frame_number_of_active_animations(WebKitWebFrame* frame);
......
......@@ -54,6 +54,7 @@
#include "JSDOMBinding.h"
#include "ScriptController.h"
#include "SubstituteData.h"
#include "SVGSMILElement.h"
#include <atk/atk.h>
#include <JavaScriptCore/APICast.h>
......@@ -959,6 +960,22 @@ bool webkit_web_frame_pause_transition(WebKitWebFrame* frame, const gchar* name,
return core(frame)->animation()->pauseTransitionAtTime(coreElement->renderer(), AtomicString(name), time);
}
bool webkit_web_frame_pause_svg_animation(WebKitWebFrame* frame, const gchar* animationId, double time, const gchar* elementId)
{
ASSERT(core(frame));
Document* document = core(frame)->document();
if (!document || !document->svgExtensions())
return false;
Element* coreElement = document->getElementById(AtomicString(animationId));
if (!coreElement || !SVGSMILElement::isSMILElement(coreElement))
return false;
#if ENABLE(SVG)
return document->accessSVGExtensions()->sampleAnimationAtTime(elementId, static_cast<SVGSMILElement*>(coreElement), time);
#else
return false;
#endif
}
unsigned int webkit_web_frame_number_of_active_animations(WebKitWebFrame* frame)
{
Frame* coreFrame = core(frame);
......
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 Sam Weinig <sam@webkit.org>
 
Reviewed by Mark Rowe.
......
......@@ -79,6 +79,7 @@
#import <WebCore/RuntimeApplicationChecks.h>
#import <WebCore/ScriptValue.h>
#import <WebCore/SmartReplace.h>
#import <WebCore/SVGSMILElement.h>
#import <WebCore/TextIterator.h>
#import <WebCore/ThreadCheck.h>
#import <WebCore/TypingCommand.h>
......@@ -1116,6 +1117,29 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
return controller->pauseTransitionAtTime(coreNode->renderer(), name, time);
}
// Pause a given SVG animation on the target node at a specific time.
// This method is only intended to be used for testing the SVG animation system.
- (BOOL)_pauseSVGAnimation:(NSString*)elementId onSMILNode:(DOMNode *)node atTime:(NSTimeInterval)time
{
Frame* frame = core(self);
if (!frame)
return false;
Document* document = frame->document();
if (!document || !document->svgExtensions())
return false;
Node* coreNode = core(node);
if (!coreNode || !SVGSMILElement::isSMILElement(coreNode))
return false;
#if ENABLE(SVG)
return document->accessSVGExtensions()->sampleAnimationAtTime(elementId, static_cast<SVGSMILElement*>(coreNode), time);
#else
return false;
#endif
}
- (unsigned) _numberOfActiveAnimations
{
Frame* frame = core(self);
......
......@@ -106,6 +106,10 @@ typedef enum {
- (BOOL)_pauseAnimation:(NSString*)name onNode:(DOMNode *)node atTime:(NSTimeInterval)time;