Bug 59975
Summary: | ValidityState::valid causes value sanitization 7 times | ||
---|---|---|---|
Product: | WebKit | Reporter: | Joseph Pecoraro <joepeck> |
Component: | Forms | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW | ||
Severity: | Normal | CC: | ahmad.saleem792, akeerthi, ashvayka, dmikurube, joepeck, rniwa, tkent, webkit-bug-importer |
Priority: | P2 | Keywords: | InRadar |
Version: | 528+ (Nightly build) | ||
Hardware: | PC | ||
OS: | OS X 10.5 |
Joseph Pecoraro
I noticed this while working on value sanitization for date inputs.
This could be a performance issue, because sanitization requires
parsing the input to see if it is valid.
bool ValidityState::valid() const
{
bool someError = typeMismatch() || stepMismatch() || rangeUnderflow() || rangeOverflow()
|| tooLong() || patternMismatch() || valueMissing() || customError();
return !someError;
}
It seems like this could really benefit from caching, or a better
design that allows for getting the sanitized value once, and running
the different validity tests on the pre-calculated value.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Ahmad Saleem
We still have similar function but different name:
https://searchfox.org/wubkat/source/Source/WebCore/html/FormListedElement.cpp#244
bool FormListedElement::computeValidity() const
{
bool someError = typeMismatch() || stepMismatch() || rangeUnderflow() || rangeOverflow()
|| tooShort() || tooLong() || patternMismatch() || valueMissing() || hasBadInput() || customError();
return !someError;
}
https://searchfox.org/wubkat/source/Source/WebCore/html/HTMLInputElement.cpp#344
bool HTMLInputElement::computeValidity() const
{
String value = this->value();
bool someError = m_inputType->isInvalid(value) || tooShort(value, CheckDirtyFlag) || tooLong(value, CheckDirtyFlag) || customError();
return !someError;
}
Radar WebKit Bug Importer
<rdar://problem/130825308>