RESOLVED FIXED 20057
Animate viewBox attribute in SVG
https://bugs.webkit.org/show_bug.cgi?id=20057
Summary Animate viewBox attribute in SVG
Bruce Rindahl
Reported 2008-07-16 11:24:29 PDT
Request to support animation of the viewBox attribute of an svg element. View the above URL in Opera 9.5 (there is a bug but you can see the desired effect) or IE with the Adobe SVG plugin. Minimal test case to be attached
Attachments
SVG file showing requested behavior (1.23 KB, image/svg+xml)
2008-07-16 11:27 PDT, Bruce Rindahl
no flags
correction to previous attachment (1.21 KB, image/svg+xml)
2008-07-16 12:42 PDT, Bruce Rindahl
no flags
Patch (37.95 KB, patch)
2011-06-22 03:19 PDT, Dirk Schulze
zimmermann: review+
Bruce Rindahl
Comment 1 2008-07-16 11:27:41 PDT
Created attachment 22310 [details] SVG file showing requested behavior Open attachment and click on the red circle. A zooming effect should be created because the viewBox is animated via script. Repeated click result in continual zooming. Works in IE/ASV and Opera(has a hiccup).
Bruce Rindahl
Comment 2 2008-07-16 12:42:38 PDT
Created attachment 22312 [details] correction to previous attachment
Dirk Schulze
Comment 3 2011-06-22 02:33:13 PDT
Upload a patch to support viewBox animation soon.
Dirk Schulze
Comment 4 2011-06-22 03:19:34 PDT
Nikolas Zimmermann
Comment 5 2011-06-22 03:42:51 PDT
Comment on attachment 98148 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=98148&action=review Great patch, r=me. > Source/WebCore/svg/SVGAnimatedRect.cpp:36 > + OwnPtr<SVGAnimatedType> animatedType = SVGAnimatedType::createRect(new FloatRect()); you can omit the braces after the new FloatRect. > Source/WebCore/svg/SVGAnimatedRect.cpp:75 > + newRect = percentage < 0.5f ? fromRect : toRect; Again the .f, we don't need that anymore - the style guide says we should omit this. > Source/WebCore/svg/SVGAnimatedRect.cpp:99 > + return -1; Does this affect a specific animation mode which won't work with rects? > Source/WebCore/svg/SVGAnimatedType.cpp:129 > + return String::number(m_data.rect->x()) + ' ' + String::number(m_data.rect->y()) + ' ' > + + String::number(m_data.rect->width()) + ' ' + String::number(m_data.rect->height()); Great, that's exactly how we can construct strings like this efficiently with the new StringAppend operator+ trickery :-)
Dirk Schulze
Comment 6 2011-06-22 05:29:35 PDT
(In reply to comment #5) > (From update of attachment 98148 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=98148&action=review > > Great patch, r=me. > > > Source/WebCore/svg/SVGAnimatedRect.cpp:36 > > + OwnPtr<SVGAnimatedType> animatedType = SVGAnimatedType::createRect(new FloatRect()); > > you can omit the braces after the new FloatRect. > > > Source/WebCore/svg/SVGAnimatedRect.cpp:75 > > + newRect = percentage < 0.5f ? fromRect : toRect; > > Again the .f, we don't need that anymore - the style guide says we should omit this. Really? I asked for it on your other reviews, but you never answered to the question. I was not aware of this change. Just thought this is the case for round numbers like 0 or 1. Isn't it a double if you omit the .f? > > > Source/WebCore/svg/SVGAnimatedRect.cpp:99 > > + return -1; > > Does this affect a specific animation mode which won't work with rects? Yes, paced animations. Just supported by Opera so far. The specification is vague about that. > > > Source/WebCore/svg/SVGAnimatedType.cpp:129 > > + return String::number(m_data.rect->x()) + ' ' + String::number(m_data.rect->y()) + ' ' > > + + String::number(m_data.rect->width()) + ' ' + String::number(m_data.rect->height()); > > Great, that's exactly how we can construct strings like this efficiently with the new StringAppend operator+ trickery :-) Hehe. I know. You told me to use it that way before ;) Thanks for the review.
Dirk Schulze
Comment 7 2011-06-22 08:25:17 PDT
Note You need to log in before you can comment on or make changes to this bug.