Bug 47405 - Refactor HTMLInputElement: Move typeMismatch(), valueMissing(), isRequiredFormControl(), and recalcWillValidate()
Summary: Refactor HTMLInputElement: Move typeMismatch(), valueMissing(), isRequiredFor...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P3 Minor
Assignee: Kent Tamura
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-08 03:38 PDT by Kent Tamura
Modified: 2010-10-09 06:30 PDT (History)
1 user (show)

See Also:


Attachments
Patch (38.67 KB, patch)
2010-10-08 03:46 PDT, Kent Tamura
no flags 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-10-08 03:38:55 PDT
Refactor HTMLInputElement: Move Move typeMismatch(), valueMissing(), isRequiredFormControl(), and recalcWillValidate()
Comment 1 Kent Tamura 2010-10-08 03:46:58 PDT
Created attachment 70221 [details]
Patch
Comment 2 Dimitri Glazkov (Google) 2010-10-08 09:52:18 PDT
Comment on attachment 70221 [details]
Patch

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

This looks better and better. I am very happy with this design.

> WebCore/html/HTMLInputElement.cpp:2020
> +    return m_inputType->supportsValidation() && HTMLFormControlElementWithState::recalcWillValidate();

OMG, This is so much easier to understand.

> WebCore/html/NumberInputType.h:48
> +    virtual bool typeMismatchForCandidate(const String&) const;
> +    virtual bool typeMismatchForCurrentValue() const;

I wonder if out of these two, there's just one virtual function, typeMismatchFor(const String&), and HTMLInputType::typeMismatch() just calls it?
Comment 3 Kent Tamura 2010-10-09 04:51:03 PDT
Thank you for reviewing a large patch.

> > WebCore/html/NumberInputType.h:48
> > +    virtual bool typeMismatchForCandidate(const String&) const;
> > +    virtual bool typeMismatchForCurrentValue() const;
> 
> I wonder if out of these two, there's just one virtual function, typeMismatchFor(const String&), and HTMLInputType::typeMismatch() just calls it?

Shorten the names sounds good. I change them to
 typeMismatchFor(const String&) and
 typeMismatch().

Unfortunately  typeMismatchFor(HTMLInputElement::value()) and typeMismatch() have different behaviors in some types.
Comment 4 Kent Tamura 2010-10-09 06:30:39 PDT
Landed as r69445.