Bug 31342 - Type constraint check for date&time types
Summary: Type constraint check for date&time types
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 29004 31340
Blocks:
  Show dependency treegraph
 
Reported: 2009-11-11 02:35 PST by Kent Tamura
Modified: 2009-11-18 18:18 PST (History)
2 users (show)

See Also:


Attachments
ValidityState.typeMismatch and layout tests (rev.6) (39.28 KB, patch)
2009-11-11 02:50 PST, Kent Tamura
tkent: commit-queue-
Details | Formatted Diff | Diff
ValidityState.typeMismatch and layout tests (rev.7) (36.18 KB, patch)
2009-11-16 23:03 PST, 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 2009-11-11 02:35:31 PST
Add support for ValidaityState.typeMismatch, and layout tests covering Bug#31340 too.
Comment 1 Kent Tamura 2009-11-11 02:50:09 PST
Created attachment 42945 [details]
ValidityState.typeMismatch and layout tests (rev.6)

Moved from Bug#29004 without changes.
Comment 2 Kent Tamura 2009-11-12 03:25:57 PST
Comment on attachment 42945 [details]
ValidityState.typeMismatch and layout tests (rev.6)

I need to update the patch due to changes of depending patch.
Comment 3 Kent Tamura 2009-11-16 23:03:33 PST
Created attachment 43345 [details]
ValidityState.typeMismatch and layout tests (rev.7)

- Update for ISODateTime interface change.
Comment 4 Darin Adler 2009-11-18 15:26:51 PST
Comment on attachment 43345 [details]
ValidityState.typeMismatch and layout tests (rev.7)

> +bool HTMLInputElement::formStringToISODateTime(InputType type, const String& src, ISODateTime* out)

I'd name it "formString" or "string" rather than "src", since the name of the function says "formString".

> +    ISODateTime result;
> +    if (!out)
> +        out = &result;

I don't think "result" is a great name for this local buffer used when the result is not wanted. Maybe "ignoredResult" would be better. Or even "localBuffer" or something like that.

> +    const UChar* uchars = src.characters();

Personally, I'd just name this "characters".

> +    default:
> +        ASSERT_NOT_REACHED();
> +    }
> +    return false;

I'd put the return in with the default, or put the ASSERT out with the return. Normally I also put in all the other cases, because I like the way gcc will warn you if you add a new enum and don't have a case for it, but that would be a long list of cases.

r=me as is
Comment 5 Kent Tamura 2009-11-18 17:37:07 PST
I'll commit manually with the following changes.

(In reply to comment #4)
> (From update of attachment 43345 [details])
> > +bool HTMLInputElement::formStringToISODateTime(InputType type, const String& src, ISODateTime* out)
> 
> I'd name it "formString" or "string" rather than "src", since the name of the
> function says "formString".

Renamed to "formString."

> > +    ISODateTime result;
> > +    if (!out)
> > +        out = &result;
> 
> I don't think "result" is a great name for this local buffer used when the
> result is not wanted. Maybe "ignoredResult" would be better. Or even
> "localBuffer" or something like that.

Renamed to "ignoredResult."

> > +    const UChar* uchars = src.characters();
> 
> Personally, I'd just name this "characters".

Done.

> > +    default:
> > +        ASSERT_NOT_REACHED();
> > +    }
> > +    return false;
> 
> I'd put the return in with the default, or put the ASSERT out with the return.
> Normally I also put in all the other cases, because I like the way gcc will
> warn you if you add a new enum and don't have a case for it, but that would be
> a long list of cases.

Moved "return" to the default section.


Thanks!
Comment 6 Kent Tamura 2009-11-18 18:17:47 PST
Comment on attachment 43345 [details]
ValidityState.typeMismatch and layout tests (rev.7)

Landed as r51163
http://trac.webkit.org/changeset/51163