Bug 118334

Summary: Append overloading function for isFooElement
Product: WebKit Reporter: Kangil Han <kangil.han>
Component: WebCore Misc.Assignee: Kangil Han <kangil.han>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, kling, koivisto, tkent
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch none

Kangil Han
Reported 2013-07-02 19:04:45 PDT
is/toHTMLFormElement should use Element* for its argument
Attachments
Patch (13.48 KB, patch)
2013-07-02 19:09 PDT, Kangil Han
no flags
Patch (1.83 KB, patch)
2013-07-03 01:14 PDT, Kangil Han
no flags
Patch (14.96 KB, patch)
2013-07-03 05:08 PDT, Kangil Han
no flags
Patch (11.66 KB, patch)
2013-07-03 06:34 PDT, Kangil Han
no flags
Kangil Han
Comment 1 2013-07-02 19:09:50 PDT
Kent Tamura
Comment 2 2013-07-02 22:46:49 PDT
Comment on attachment 205961 [details] Patch The code looks worse. Why don't you provide both of isHTMLFormElement(Node*) and isHTMLFormElement(Element*).
Andreas Kling
Comment 3 2013-07-02 22:48:53 PDT
(In reply to comment #2) > (From update of attachment 205961 [details]) > The code looks worse. > Why don't you provide both of isHTMLFormElement(Node*) and isHTMLFormElement(Element*). Or possibly: template<class T> bool isHTMLFormElementNode(T*)
Kangil Han
Comment 4 2013-07-02 23:34:00 PDT
Thx tkent and kling for the comments! I will investigate to make code better. :)
Kangil Han
Comment 5 2013-07-03 01:14:19 PDT
Kangil Han
Comment 6 2013-07-03 03:57:58 PDT
kling, tkent: review please? :)
Antti Koivisto
Comment 7 2013-07-03 04:08:03 PDT
Comment on attachment 205977 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=205977&action=review I > Source/WebCore/html/HTMLFormElement.h:165 > -inline bool isHTMLFormElement(Node* node) > +template<class T> > +inline bool isHTMLFormElement(T* t) I think you should provide overloads instead of using templates since you only really need two cases. Error messages are clearer that way.
Kangil Han
Comment 8 2013-07-03 04:14:18 PDT
(In reply to comment #7) > I think you should provide overloads instead of using templates since you only really need two cases. Error messages are clearer that way. Thx! I will do that. :)
Kangil Han
Comment 9 2013-07-03 05:08:15 PDT
Antti Koivisto
Comment 10 2013-07-03 05:29:10 PDT
Comment on attachment 205994 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=205994&action=review > Source/WebCore/html/HTMLOptionElement.h:119 > +inline HTMLOptionElement* toHTMLOptionElement(Element* element) > +{ > + ASSERT_WITH_SECURITY_IMPLICATION(!element || isHTMLOptionElement(element)); > + return static_cast<HTMLOptionElement*>(element); > +} > + You don't really need the to* overloads.
Kangil Han
Comment 11 2013-07-03 06:34:43 PDT
Kangil Han
Comment 12 2013-07-03 06:36:37 PDT
(In reply to comment #10) > (From update of attachment 205994 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=205994&action=review > > > Source/WebCore/html/HTMLOptionElement.h:119 > > +inline HTMLOptionElement* toHTMLOptionElement(Element* element) > > +{ > > + ASSERT_WITH_SECURITY_IMPLICATION(!element || isHTMLOptionElement(element)); > > + return static_cast<HTMLOptionElement*>(element); > > +} > > + > > You don't really need the to* overloads. Yes, right! Thx! :) Took anttik's comment into consideration.
Antti Koivisto
Comment 13 2013-07-03 06:38:37 PDT
Comment on attachment 206000 [details] Patch Actually maybe you need it. I guess ASSERT_WITH_SECURITY_IMPLICATION might get compiled in in release mode too?
Antti Koivisto
Comment 14 2013-07-03 06:42:55 PDT
Comment on attachment 206000 [details] Patch Never mind, apparently it is just a fuzzer hint.
WebKit Commit Bot
Comment 15 2013-07-03 07:19:19 PDT
Comment on attachment 206000 [details] Patch Clearing flags on attachment: 206000 Committed r152353: <http://trac.webkit.org/changeset/152353>
WebKit Commit Bot
Comment 16 2013-07-03 07:19:22 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.