Bug 102358 - Remove isHTMLInputElement since it's unused and toInputElement exists
Summary: Remove isHTMLInputElement since it's unused and toInputElement exists
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Elliott Sprehn
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-15 02:19 PST by Elliott Sprehn
Modified: 2012-11-15 10:14 PST (History)
6 users (show)

See Also:


Attachments
Patch (1.38 KB, patch)
2012-11-15 02:22 PST, Elliott Sprehn
no flags Details | Formatted Diff | Diff
Patch (1.57 KB, patch)
2012-11-15 09:28 PST, Elliott Sprehn
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Elliott Sprehn 2012-11-15 02:19:16 PST
Remove isHTMLInputElement since it's dangerous and unused
Comment 1 Elliott Sprehn 2012-11-15 02:22:32 PST
Created attachment 174378 [details]
Patch
Comment 2 Ryosuke Niwa 2012-11-15 03:33:32 PST
Comment on attachment 174378 [details]
Patch

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

> Source/WebCore/ChangeLog:11
> +        isHTMLInputElement only checked if the tag name was input which is bad
> +        since other things inherit from HTMLInputElement. Instead callers should
> +        use Node::toInputElement() which is virtual and will handle subclasses
> +        properly.

Why is that dangerous? If an element has the name HTMLNames::inputTag, then it can't certainly be some other element, right?
I agree that you can't assume that an element's name is HTMLNames::inputTag just because it's an instance of a HTMLInputElement but that's a separate issue.
Comment 3 Elliott Sprehn 2012-11-15 09:13:53 PST
(In reply to comment #2)
> (From update of attachment 174378 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=174378&action=review
> 
> > Source/WebCore/ChangeLog:11
> > +        isHTMLInputElement only checked if the tag name was input which is bad
> > +        since other things inherit from HTMLInputElement. Instead callers should
> > +        use Node::toInputElement() which is virtual and will handle subclasses
> > +        properly.
> 
> Why is that dangerous? If an element has the name HTMLNames::inputTag, then it can't certainly be some other element, right?
> I agree that you can't assume that an element's name is HTMLNames::inputTag just because it's an instance of a HTMLInputElement but that's a separate issue.

Dangerous is probably the wrong word. Why would I ever want to call this method instead of just using toInputElement() though?
Comment 4 Elliott Sprehn 2012-11-15 09:28:17 PST
Created attachment 174466 [details]
Patch
Comment 5 WebKit Review Bot 2012-11-15 10:14:31 PST
Comment on attachment 174466 [details]
Patch

Clearing flags on attachment: 174466

Committed r134790: <http://trac.webkit.org/changeset/134790>
Comment 6 WebKit Review Bot 2012-11-15 10:14:35 PST
All reviewed patches have been landed.  Closing bug.