Bug 51093 - Refactor HTMLInputElement: Move a part of HTMLInputElement::defaultEventHandler() to InputTypes
Summary: Refactor HTMLInputElement: Move a part of HTMLInputElement::defaultEventHandl...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Minor
Assignee: Kent Tamura
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-14 20:44 PST by Kent Tamura
Modified: 2010-12-23 04:59 PST (History)
2 users (show)

See Also:


Attachments
Patch (44.19 KB, patch)
2010-12-14 20:45 PST, Kent Tamura
dglazkov: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kent Tamura 2010-12-14 20:44:11 PST
Refactor HTMLInputElement: Move a part of HTMLInputElement::defaultEventHandler() to InputTypes
Comment 1 Kent Tamura 2010-12-14 20:45:00 PST
Created attachment 76626 [details]
Patch
Comment 2 Dimitri Glazkov (Google) 2010-12-15 10:32:13 PST
Comment on attachment 76626 [details]
Patch

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

ok, with comments.

> WebCore/ChangeLog:10
> +        renders, and the isindex form submission quirk code to InputTypes.

renders->renderers

> WebCore/html/HTMLInputElement.h:213
> +    void handleBeforeTextInsertedEvent(Event* event) { InputElement::handleBeforeTextInsertedEvent(m_data, this, this, event); }

Darin would tell me to move this into HTMLInputElement.cpp :)
Comment 3 Darin Adler 2010-12-15 10:44:13 PST
Comment on attachment 76626 [details]
Patch

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

Great to see more progress on this. I am really looking forward to the day we delete DeprecatedInputType, InputTypeMap, createTypeMap, deprecatedInputType, and m_deprecatedTypeNumber.

>> WebCore/html/HTMLInputElement.h:213
>> +    void handleBeforeTextInsertedEvent(Event* event) { InputElement::handleBeforeTextInsertedEvent(m_data, this, this, event); }
> 
> Darin would tell me to move this into HTMLInputElement.cpp :)

I definitely would it it was a virtual function and so unlikely to get inlined or if the function body was big enough and called in more than one place so that inlining it actually makes the overall code size bigger, with no significant gain in performance.

But if neither of those is true, then having it in the header is OK with me. I do prefer the wordier idiom where the function definition is outside the class definition, because it keeps the class definition itself easier to read. See Node::parentNode for an example of this.

> WebCore/html/NumberInputType.cpp:56
> +    return ch == '+' || ch == '-' || ch == '.' || ch == 'e' || ch == 'E' || (ch >= '0' && ch <= '9');

For the last part of this expression, the isASCIIDigit is a good choice, perhaps slightly better than writing it out.
Comment 4 Kent Tamura 2010-12-23 04:59:37 PST
Comment on attachment 76626 [details]
Patch

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

Thank you for reviewing.
I have committed it as http://trac.webkit.org/changeset/74549

>> WebCore/ChangeLog:10
>> +        renders, and the isindex form submission quirk code to InputTypes.
> 
> renders->renderers

Fixed.

>>> WebCore/html/HTMLInputElement.h:213
>>> +    void handleBeforeTextInsertedEvent(Event* event) { InputElement::handleBeforeTextInsertedEvent(m_data, this, this, event); }
>> 
>> Darin would tell me to move this into HTMLInputElement.cpp :)
> 
> I definitely would it it was a virtual function and so unlikely to get inlined or if the function body was big enough and called in more than one place so that inlining it actually makes the overall code size bigger, with no significant gain in performance.
> 
> But if neither of those is true, then having it in the header is OK with me. I do prefer the wordier idiom where the function definition is outside the class definition, because it keeps the class definition itself easier to read. See Node::parentNode for an example of this.

Yeah, this function is not virtual and has 1-line content.
I moved the function definition to the outside of the class declaration.

>> WebCore/html/NumberInputType.cpp:56
>> +    return ch == '+' || ch == '-' || ch == '.' || ch == 'e' || ch == 'E' || (ch >= '0' && ch <= '9');
> 
> For the last part of this expression, the isASCIIDigit is a good choice, perhaps slightly better than writing it out.

Fixed.