NEW 59975
ValidityState::valid causes value sanitization 7 times
https://bugs.webkit.org/show_bug.cgi?id=59975
Summary ValidityState::valid causes value sanitization 7 times
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.