Bug 59975

Summary: ValidityState::valid causes value sanitization 7 times
Product: WebKit Reporter: Joseph Pecoraro <joepeck>
Component: FormsAssignee: 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
Reported 2011-05-02 16:26:48 PDT
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
Ahmad Saleem
Comment 1 2023-06-07 01:57:11 PDT
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
Comment 2 2024-06-29 16:04:42 PDT
Note You need to log in before you can comment on or make changes to this bug.