The default bug view has changed. See this FAQ.

Implement <input type=date> max attribute

RESOLVED FIXED in mozilla20

Status

()

Core
DOM: Core & HTML
RESOLVED FIXED
5 years ago
4 years ago

People

(Reporter: raphc, Assigned: raphc)

Tracking

({doc-bug-filed})

Trunk
mozilla20
doc-bug-filed
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 4 obsolete attachments)

Comment hidden (empty)
(Assignee)

Updated

5 years ago
Depends on: 769385
(Assignee)

Comment 1

5 years ago
Created attachment 645693 [details] [diff] [review]
patch

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)
(Assignee)

Updated

5 years ago
Blocks: 769357
(Assignee)

Updated

5 years ago
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();
}
(Assignee)

Comment 4

5 years ago
Created attachment 650131 [details] [diff] [review]
patch
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".
(Assignee)

Comment 7

5 years ago
Created attachment 650247 [details] [diff] [review]
patch
Attachment #650131 - Attachment is obsolete: true
Attachment #650247 - Flags: review+
(Assignee)

Comment 8

5 years ago
Created attachment 650248 [details] [diff] [review]
patch
Attachment #650247 - Attachment is obsolete: true
Attachment #650248 - Flags: review+
(Assignee)

Comment 9

5 years ago
Created attachment 652508 [details] [diff] [review]
patch

Updated patch.
Attachment #650248 - Attachment is obsolete: true
https://hg.mozilla.org/mozilla-central/rev/739b8e307069
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
Keywords: dev-doc-needed
See bug 866440 for documentation.
Keywords: dev-doc-needed → doc-bug-filed
You need to log in before you can comment on or make changes to this bug.