Commit e2004296 authored by antti@apple.com's avatar antti@apple.com
Browse files

WebCore:

2008-06-27  Antti Koivisto  <antti@apple.com>

        Reviewed by Oliver.
        
        <rdar://problem/6030720> 
        REGRESSION: Discrete animation between incompatible paths does not work

        Fall back to discrete path animation if paths are not suitable for morphing.
        
        Test: svg/custom/animate-path-discrete.svg
        
        * svg/SVGAnimateElement.cpp:
        (WebCore::SVGAnimateElement::calculateAnimatedValue):

LayoutTests:

2008-06-27  Antti Koivisto  <antti@apple.com>

        Reviewed by Oliver.
        
        <rdar://problem/6030720> 
        REGRESSION: Discrete animation between incompatible paths does not work

        * svg/custom/animate-path-discrete.svg: Added.
        * platform/mac/svg/custom/animate-path-discrete-expected.txt: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34829 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 61620cf9
2008-06-27 Antti Koivisto <antti@apple.com>
Reviewed by Oliver.
<rdar://problem/6030720>
REGRESSION: Discrete animation between incompatible paths does not work
* svg/custom/animate-path-discrete.svg: Added.
* platform/mac/svg/custom/animate-path-discrete-expected.txt: Added.
2008-06-26 David Smith <catfish.man@gmail.com>
 
Reviewed by Sam Weinig.
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
RenderSVGRoot {svg} at (248.73,151.99) size 30.77x12.77
RenderSVGContainer {g} at (248.73,151.99) size 30.77x12.77
RenderPath {path} at (248.73,151.99) size 30.77x12.77 [stroke={[type=SOLID] [color=#000000] [stroke width=5.00] [line cap=ROUND]}] [data="M37.00,107.00 L40.00,105.00 L45.00,105.00 L52.00,104.00"]
<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/SVG/DTD/svg10.dtd">
<svg viewBox="0 0 270 400" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<script type="text/ecmascript"> <![CDATA[
if (window.layoutTestController) {
layoutTestController.waitUntilDone();
setTimeout("layoutTestController.notifyDone()", 1000);
}
]]> </script>
<g id="mainlayer">
<path stroke="black" stroke-width="5" stroke-linecap="round" stroke-join="round" fill="none" d="M 37 107" >
<animate attributeName="d" dur="0.5s" fill="freeze" values="
M 37 107 ;
M 37 107 L 40 105 ;
M 37 107 L 40 105 L 45 105 ;
M 37 107 L 40 105 L 45 105 L 52 104
" />
</path>
</g>
</svg>
2008-06-27 Antti Koivisto <antti@apple.com>
Reviewed by Oliver.
<rdar://problem/6030720>
REGRESSION: Discrete animation between incompatible paths does not work
Fall back to discrete path animation if paths are not suitable for morphing.
Test: svg/custom/animate-path-discrete.svg
* svg/SVGAnimateElement.cpp:
(WebCore::SVGAnimateElement::calculateAnimatedValue):
2008-06-26 David Smith <catfish.man@gmail.com>
 
Reviewed by Sam Weinig.
......@@ -127,11 +127,24 @@ void SVGAnimateElement::calculateAnimatedValue(float percentage, unsigned repeat
results->m_animatedColor = color;
return;
}
AnimationMode animationMode = this->animationMode();
if (m_propertyType == PathProperty) {
results->m_animatedPath = SVGPathSegList::createAnimated(m_fromPath.get(), m_toPath.get(), percentage);
if (percentage == 0)
results->m_animatedPath = m_fromPath;
else if (percentage == 1.f)
results->m_animatedPath = m_toPath;
else {
if (m_fromPath && m_toPath)
results->m_animatedPath = SVGPathSegList::createAnimated(m_fromPath.get(), m_toPath.get(), percentage);
else
results->m_animatedPath.clear();
// Fall back to discrete animation if the paths are not compatible
if (!results->m_animatedPath)
results->m_animatedPath = ((animationMode == FromToAnimation && percentage > 0.5f) || animationMode == ToAnimation || percentage == 1.0f)
? m_toPath : m_fromPath;
}
return;
}
AnimationMode animationMode = this->animationMode();
ASSERT(animationMode == FromToAnimation || animationMode == ToAnimation || animationMode == ValuesAnimation);
if ((animationMode == FromToAnimation && percentage > 0.5f) || animationMode == ToAnimation || percentage == 1.0f)
results->m_animatedString = m_toString;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment