Closed Bug 769355 Opened 12 years ago Closed 12 years ago

Implement <input type=date> max attribute

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla20

People

(Reporter: raphc, Assigned: raphc)

References

Details

(Keywords: doc-bug-filed)

Attachments

(1 file, 4 obsolete files)

      No description provided.
Depends on: 769385
Attached patch patch (obsolete) — Splinter Review
This patch uses functions from the patch in bug 769370. As long as this one as not been r+ this one might change so a review might not be useful yet. Feedback would still be appreciated though.
Attachment #645693 - Flags: feedback?(mounir)
Blocks: 769357
Depends on: 769370
Comment on attachment 645693 [details] [diff] [review]
patch

Review of attachment 645693 [details] [diff] [review]:
-----------------------------------------------------------------

::: content/html/content/src/nsHTMLInputElement.cpp
@@ +1267,5 @@
>    nsAutoString maxStr;
>    GetAttr(kNameSpaceID_None, nsGkAtoms::max, maxStr);
>  
> +  double max;
> +  bool result = GetDoubleFromString(maxStr, max);

I know understand why you created that method in a previous patch. It will be indeed needed here. Though, I don't quite like the name.
What about: ConvertStringToNumber(), so it will match the specification's naming?
Attachment #645693 - Flags: feedback?(mounir) → feedback+
Comment on attachment 645693 [details] [diff] [review]
patch

Review of attachment 645693 [details] [diff] [review]:
-----------------------------------------------------------------

::: content/html/content/src/nsHTMLInputElement.cpp
@@ +4577,5 @@
> +        double max = GetMaxAsDouble();
> +        MOZ_ASSERT(!MOZ_DOUBLE_IS_NaN(max));
> +
> +        maxStr.AppendFloat(max);
> +      } else {

else if (mType == NS_FORM_INPUT_DATE)
and:
} else {
MOZ_NOTREACHED();
}
Attached patch patch (obsolete) — Splinter Review
Attachment #645693 - Attachment is obsolete: true
Attachment #650131 - Flags: review?(mounir)
Comment on attachment 650131 [details] [diff] [review]
patch

Review of attachment 650131 [details] [diff] [review]:
-----------------------------------------------------------------

::: content/html/content/src/nsHTMLInputElement.cpp
@@ +1275,5 @@
>    GetAttr(kNameSpaceID_None, nsGkAtoms::max, maxStr);
>  
> +  double max;
> +  bool result = ConvertStringToNumber(maxStr, max);
> +  return result ? max : MOZ_DOUBLE_NaN();

You can do:
return ConvertStringToNumber(maxStr, max) ? max : MOZ_DOUBLE_NaN();
Attachment #650131 - Flags: review?(mounir) → review+
Comment on attachment 650131 [details] [diff] [review]
patch

Review of attachment 650131 [details] [diff] [review]:
-----------------------------------------------------------------

::: content/html/content/src/nsHTMLInputElement.cpp
@@ +4603,5 @@
> +        maxStr.AppendFloat(max);
> +      } else if (mType == NS_FORM_INPUT_DATE) {
> +        GetAttr(kNameSpaceID_None, nsGkAtoms::max, maxStr);
> +      } else {
> +        NS_NOTREACHED("Invalid input type");

nit: please change that to "Unexpected input type".
Attached patch patch (obsolete) — Splinter Review
Attachment #650131 - Attachment is obsolete: true
Attachment #650247 - Flags: review+
Attached patch patch (obsolete) — Splinter Review
Attachment #650247 - Attachment is obsolete: true
Attachment #650248 - Flags: review+
Attached patch patchSplinter Review
Updated patch.
Attachment #650248 - Attachment is obsolete: true
https://hg.mozilla.org/mozilla-central/rev/739b8e307069
Status: NEW → RESOLVED
Closed: 12 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
See bug 866440 for documentation.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: