Bug 127337 - Fix SVG animations which set rx or ry attributes
Summary: Fix SVG animations which set rx or ry attributes
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: BlinkMergeCandidate
Depends on:
Blocks:
 
Reported: 2014-01-21 02:37 PST by Peter Molnar
Modified: 2014-01-22 06:11 PST (History)
10 users (show)

See Also:


Attachments
patch (4.67 KB, patch)
2014-01-21 02:39 PST, Peter Molnar
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Molnar 2014-01-21 02:37:58 PST
Fix SVG animations which set rx or ry attributes

Merged from Blink: https://src.chromium.org/viewvc/blink?revision=152376&view=revision
Comment 1 Peter Molnar 2014-01-21 02:39:25 PST
Created attachment 221730 [details]
patch
Comment 2 WebKit Commit Bot 2014-01-21 05:24:46 PST
Comment on attachment 221730 [details]
patch

Clearing flags on attachment: 221730

Committed r162438: <http://trac.webkit.org/changeset/162438>
Comment 3 WebKit Commit Bot 2014-01-21 05:24:48 PST
All reviewed patches have been landed.  Closing bug.
Comment 4 Darin Adler 2014-01-21 18:41:59 PST
Comment on attachment 221730 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=221730&action=review

> Source/WebCore/rendering/svg/SVGPathData.cpp:119
> +    bool hasRx = rect->rx().value(lengthContext) > 0;
> +    bool hasRy = rect->ry().value(lengthContext) > 0;

Wasteful to repeat these expressions once to evaluate the has booleans and a second time if either is true. Should refactor so we don’t do it twice.

Also, is > 0 really the correct test? Is that from the spec, or just copying what the Blink folks did? Did the Blink folks give a rationale for that particular test?
Comment 5 Philip Rogers 2014-01-21 19:06:04 PST
(In reply to comment #4)
> (From update of attachment 221730 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=221730&action=review
> 
> > Source/WebCore/rendering/svg/SVGPathData.cpp:119
> > +    bool hasRx = rect->rx().value(lengthContext) > 0;
> > +    bool hasRy = rect->ry().value(lengthContext) > 0;
> 
> Wasteful to repeat these expressions once to evaluate the has booleans and a second time if either is true. Should refactor so we don’t do it twice.

Excellent catch Darin. We should definitely refactor that into a helper function.

> 
> Also, is > 0 really the correct test? Is that from the spec, or just copying what the Blink folks did? Did the Blink folks give a rationale for that particular test?

The Blink folks did a terrible job of describing this change and I apologize for that :(
The spec is clear about negative rx/ry values in https://svgwg.org/svg2-draft/single-page.html#shapes-RectElement, and the new behavior matches Firefox (IE does not support SMIL). This change is really about making the negative rx/ry logic work for animations as well. The hasAttribute check is not appropriate for attributes that can be set by an animation element.
Comment 6 Peter Molnar 2014-01-22 06:11:21 PST
(In reply to comment #5)
> (In reply to comment #4)
> > (From update of attachment 221730 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=221730&action=review
> > 
> > > Source/WebCore/rendering/svg/SVGPathData.cpp:119
> > > +    bool hasRx = rect->rx().value(lengthContext) > 0;
> > > +    bool hasRy = rect->ry().value(lengthContext) > 0;
> > 
> > Wasteful to repeat these expressions once to evaluate the has booleans and a second time if either is true. Should refactor so we don’t do it twice.
> 
> Excellent catch Darin. We should definitely refactor that into a helper function.
> 
> > 
> > Also, is > 0 really the correct test? Is that from the spec, or just copying what the Blink folks did? Did the Blink folks give a rationale for that particular test?
> 
> The Blink folks did a terrible job of describing this change and I apologize for that :(
> The spec is clear about negative rx/ry values in https://svgwg.org/svg2-draft/single-page.html#shapes-RectElement, and the new behavior matches Firefox (IE does not support SMIL). This change is really about making the negative rx/ry logic work for animations as well. The hasAttribute check is not appropriate for attributes that can be set by an animation element.

I created a new bug for the follow-up: https://bugs.webkit.org/show_bug.cgi?id=127423

The double calculation issue is resolved there.