Bug 1372369 - Part 2: Set validity state to 'bad input' when the entered date value is invalid. r=smaug

If all fields in date/time input box are available but the input element's
value is empty, implies that it has been sanitized. In this case, we'll set the
'bad input' validity state. If any of the fields is cleared, we'll remove the
'bad input' validity state, as incomplete field does not imply 'bad input'.

MozReview-Commit-ID: 4EBpH5CWqXM
This commit is contained in:
Jessica Jong
2017-06-19 01:13:00 -04:00
parent 4c8f007035
commit 508c171997
12 changed files with 249 additions and 23 deletions

View File

@@ -125,6 +125,20 @@ nsDateTimeControlFrame::HandleBlurEvent()
}
}
bool
nsDateTimeControlFrame::HasBadInput()
{
nsCOMPtr<nsIDateTimeInputArea> inputAreaContent =
do_QueryInterface(mInputAreaContent);
bool result = false;
if (inputAreaContent) {
inputAreaContent->HasBadInput(&result);
}
return result;
}
nscoord
nsDateTimeControlFrame::GetMinISize(gfxContext* aRenderingContext)
{