Bug 28828 - Make SVGStyleElement title/media/type setters do something
Summary: Make SVGStyleElement title/media/type setters do something
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Minor
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-29 01:47 PDT by Cameron McCormack (:heycam)
Modified: 2009-09-03 02:12 PDT (History)
1 user (show)

See Also:


Attachments
Patch v1 (6.99 KB, patch)
2009-08-29 05:11 PDT, Cameron McCormack (:heycam)
eric: review-
Details | Formatted Diff | Diff
Patch v2 (7.39 KB, patch)
2009-08-31 06:19 PDT, Cameron McCormack (:heycam)
eric: review-
Details | Formatted Diff | Diff
Patch v3 (6.86 KB, patch)
2009-09-02 17:49 PDT, Cameron McCormack (:heycam)
no flags Details | Formatted Diff | Diff
Patch v4 (6.17 KB, patch)
2009-09-02 21:51 PDT, Cameron McCormack (:heycam)
no flags Details | Formatted Diff | Diff
Patch v4a (6.17 KB, patch)
2009-09-02 22:02 PDT, Cameron McCormack (:heycam)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Cameron McCormack (:heycam) 2009-08-29 01:47:09 PDT
setTitle(), setMedia() and setType() on SVGStyleElement should do something other than just throwing a NOT_MODIFIED_ERR.  Also remove the "setter raises" clauses from the IDL, since an exception should never be thrown.
Comment 1 Cameron McCormack (:heycam) 2009-08-29 05:11:26 PDT
Created attachment 38774 [details]
Patch v1
Comment 2 Eric Seidel (no email) 2009-08-31 03:17:14 PDT
Comment on attachment 38774 [details]
Patch v1

shouldBeEqualToString will make your life easier here:
 5 shouldBe("style.type", "'text/css'");

shouldBeEqualToString("style.type", "text/css");

Normally we would use longer argument names here:
 53 void SVGStyleElement::setXmlspace(const AtomicString& s, ExceptionCode&)
like "space"

and "type":
 65 void SVGStyleElement::setType(const AtomicString& s)

Why not just remove "setter raises()"?
 33                      /*setter raises(DOMException)*/;

Are these spec'd to raise, but they never should?  If so, please explain in your ChangeLog.

In general this looks great!  If you were a committer, I would r+ and you could land with changes.
Comment 3 Cameron McCormack (:heycam) 2009-08-31 06:19:17 PDT
Created attachment 38811 [details]
Patch v2

(In reply to comment #2)
> shouldBeEqualToString will make your life easier here:
>  5 shouldBe("style.type", "'text/css'");
> 
> shouldBeEqualToString("style.type", "text/css");

OK, changed to use that.  I just copied some other test that was using shouldBe() in this manner.

> Normally we would use longer argument names here:
>  53 void SVGStyleElement::setXmlspace(const AtomicString& s, ExceptionCode&)
> like "space"
> 
> and "type":
>  65 void SVGStyleElement::setType(const AtomicString& s)

Changed.

> Why not just remove "setter raises()"?
>  33                      /*setter raises(DOMException)*/;
> 
> Are these spec'd to raise, but they never should?  If so, please explain in
> your ChangeLog.

The spec says to raise these in case the DOM node is read only, but in reality this is never the case.  Strictly, it can happen if the <style> is a descendant of an Entity or EntityReference node.  Various methods would need to check isReadOnly() and throw a NO_MODIFICATION_ALLOWED_ERR in this case.  Does XMLTokenizerLibxml2 ever cause parsed XML documents to include EntityReference nodes instead of expanding them?  I couldn't tell from a quick look.

> In general this looks great!  If you were a committer, I would r+ and you could
> land with changes.

Thanks!  WebKit code is pretty nice to work with. :-)
Comment 4 Eric Seidel (no email) 2009-09-01 08:08:58 PDT
Comment on attachment 38811 [details]
Patch v2

Shouldn't we just pass the ec along to setAttribute?  Then we future-proof ourselves against the read-only node case, no?

    void setAttribute(const QualifiedName&, const AtomicString& value, ExceptionCode&);
Comment 5 Eric Seidel (no email) 2009-09-02 03:02:42 PDT
Comment on attachment 38811 [details]
Patch v2

r- for the unanswered setter issue.  Seems no reason to remove these exception codes if setAttribute can/should still throw.
Comment 6 Cameron McCormack (:heycam) 2009-09-02 17:49:08 PDT
Created attachment 38957 [details]
Patch v3

OK, that's reasonable about passing along the ExceptionCode.
Comment 7 Cameron McCormack (:heycam) 2009-09-02 17:50:56 PDT
Comment on attachment 38957 [details]
Patch v3

How about I test it first before requesting review...
Comment 8 Cameron McCormack (:heycam) 2009-09-02 21:51:41 PDT
Created attachment 38965 [details]
Patch v4

Turns out I couldn't use [Reflect] for title, since there needs to be a title() method on SVGStyleElement to override the one on StyleElement.  Oh well.  I had some changes to the ObjC bindings generators to make them work with [Reflect]ed attributes with setter exceptions, but I might file them separately.
Comment 9 Cameron McCormack (:heycam) 2009-09-02 22:02:28 PDT
Created attachment 38966 [details]
Patch v4a

Sigh, don't edit patches by hand without checking them. :/
Comment 10 Eric Seidel (no email) 2009-09-03 01:43:59 PDT
Comment on attachment 38966 [details]
Patch v4a

Wonderful!
Comment 11 Eric Seidel (no email) 2009-09-03 02:12:31 PDT
Comment on attachment 38966 [details]
Patch v4a

Clearing flags on attachment: 38966

Committed r48010: <http://trac.webkit.org/changeset/48010>
Comment 12 Eric Seidel (no email) 2009-09-03 02:12:35 PDT
All reviewed patches have been landed.  Closing bug.