Bug 125670

Summary: SVG animatable bindings are improperly being generated with "fastGetAttribute"
Product: WebKit Reporter: Brent Fulgham <bfulgham>
Component: WebCore Misc.Assignee: Brent Fulgham <bfulgham>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, cdumez, commit-queue, darin, haraken, rniwa, sam, simon.fraser, thorton
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 118845, 125527    
Bug Blocks:    
Attachments:
Description Flags
Patch
none
Updated to take advantage of fixes in Bug 125527. none

Description Brent Fulgham 2013-12-12 18:09:40 PST
The changes in Bug 118845 caused the 'fastGetAttribute' case to be called when animated attributes are involved.

> Source/WebCore/bindings/scripts/CodeGenerator.pm:575
> +        } elsif ($generator->IsSVGAnimatedType($attribute)) {

This is wrong. $attribute in this context is a hash, not a string that can be compared.  I think this test now always fails, causing us to use "fastGetAttribute" in some cases where it is not safe.

This should have been something like:

"my $type = $attribute->signature->type; 
if ($generator->IsSVGAniatedType($type)) {
... do stuff

I found this while correcting a second problem, where SVGScriptElementType was being used with "fastGetAttribute". This is also animatable, and should not go through that path.
Comment 1 Brent Fulgham 2013-12-12 18:24:11 PST
Created attachment 219139 [details]
Patch
Comment 2 Chris Dumez 2013-12-12 18:58:53 PST
Comment on attachment 219139 [details]
Patch

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

> Source/WebCore/bindings/scripts/CodeGenerator.pm:576
> +        } elsif ($generator->IsSVGAnimatedType($attributeType)) {

This change looks good.

> Source/WebCore/bindings/scripts/CodeGenerator.pm:578
> +        } elsif (($interfaceName =~ /SVGScriptElement/) && ($attribute->signature->name =~ /type/)) {

I don't understand this one. The "type" attribute on SVGScriptElement is not animatable in the specification (svg 1.1 or 2):
http://www.w3.org/TR/SVG2/script.html#ScriptElementTypeAttribute

Also, the attribute type in our IDL is a simple DOMString, not a SVGAnimatedString.
Comment 3 Darin Adler 2013-12-12 20:31:57 PST
Comment on attachment 219139 [details]
Patch

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

>> Source/WebCore/bindings/scripts/CodeGenerator.pm:578
>> +        } elsif (($interfaceName =~ /SVGScriptElement/) && ($attribute->signature->name =~ /type/)) {
> 
> I don't understand this one. The "type" attribute on SVGScriptElement is not animatable in the specification (svg 1.1 or 2):
> http://www.w3.org/TR/SVG2/script.html#ScriptElementTypeAttribute
> 
> Also, the attribute type in our IDL is a simple DOMString, not a SVGAnimatedString.

Patch in bug 125527 corrects things so that SVGScriptElement’s type attribute is correctly identified as not animatable, so we should land that first, and omit this change.
Comment 4 Brent Fulgham 2013-12-12 21:08:25 PST
(In reply to comment #3)
> (From update of attachment 219139 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=219139&action=review
> 
> >> Source/WebCore/bindings/scripts/CodeGenerator.pm:578
> >> +        } elsif (($interfaceName =~ /SVGScriptElement/) && ($attribute->signature->name =~ /type/)) {
> > 
> > I don't understand this one. The "type" attribute on SVGScriptElement is not animatable in the specification (svg 1.1 or 2):
> > http://www.w3.org/TR/SVG2/script.html#ScriptElementTypeAttribute
> > 
> > Also, the attribute type in our IDL is a simple DOMString, not a SVGAnimatedString.
> 
> Patch in bug 125527 corrects things so that SVGScriptElement’s type attribute is correctly identified as not animatable, so we should land that first, and omit this change.

Ah! That makes great sense, I'll revise the patch and  wait for 125527 to land. Thanks for looking it over.
Comment 5 Brent Fulgham 2013-12-12 21:31:45 PST
Created attachment 219151 [details]
Updated to take advantage of fixes in Bug 125527.
Comment 6 WebKit Commit Bot 2013-12-13 17:50:09 PST
Comment on attachment 219151 [details]
Updated to take advantage of fixes in Bug 125527.

Clearing flags on attachment: 219151

Committed r160578: <http://trac.webkit.org/changeset/160578>
Comment 7 WebKit Commit Bot 2013-12-13 17:50:13 PST
All reviewed patches have been landed.  Closing bug.