Bug 1278185 - Implement valueAsNumber and valueAsDate for <input type=month>. r=smaug

This commit is contained in:
Jessica Jong
2016-07-11 01:00:00 +02:00
parent 3a43ab0c26
commit 2d26b0e0a7
5 changed files with 309 additions and 24 deletions

View File

@@ -1036,11 +1036,7 @@ protected:
/**
* Returns if valueAsNumber attribute applies for the current type.
*/
bool DoesValueAsNumberApply() const
{
// TODO: this is temporary until bug 888324 is fixed.
return DoesMinMaxApply() && mType != NS_FORM_INPUT_MONTH;
}
bool DoesValueAsNumberApply() const { return DoesMinMaxApply(); }
/**
* Returns if autocomplete attribute applies for the current type.
@@ -1205,6 +1201,12 @@ protected:
*/
uint32_t NumberOfDaysInMonth(uint32_t aMonth, uint32_t aYear) const;
/**
* This methods returns the number of months between January 1970 and the
* given year and month.
*/
int32_t MonthsSinceJan1970(uint32_t aYear, uint32_t aMonth) const;
/**
* Returns whether aValue is a valid time as described by HTML specifications:
* http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#valid-time-string
@@ -1438,6 +1440,11 @@ protected:
// Float value returned by GetStep() when the step attribute is set to 'any'.
static const Decimal kStepAny;
// Maximum year limited by ECMAScript date object range, year <= 275760.
static const double kMaximumYear;
// Minimum year limited by HTML standard, year >= 1.
static const double kMinimumYear;
/**
* The type of this input (<input type=...>) as an integer.
* @see nsIFormControl.h (specifically NS_FORM_INPUT_*)