Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: f396d230a2064186c8385e3ab0615614052a909f
https://github.com/WebKit/WebKit/commit/f396d230a2064186c8385e3ab0615614052a909f
Author: Chris Dumez <[email protected]>
Date: 2026-03-29 (Sun, 29 Mar 2026)
Changed paths:
M Source/WebCore/html/InputType.cpp
M Source/WebCore/html/InputType.h
M Source/WebCore/html/StepRange.cpp
Log Message:
-----------
Avoid redundant StepRange creation and value parsing during input validation
https://bugs.webkit.org/show_bug.cgi?id=310977
Reviewed by Anne van Kesteren.
The isInvalidInputType and validateInputType templates called stepMismatch(),
rangeUnderflow(), and rangeOverflow() individually. Each of those methods
independently parses the value string to a Decimal and constructs a StepRange,
resulting in 3 redundant parses and 3 redundant StepRange constructions per
validation for steppable input types.
Add InputType::hasStepRangeViolation() which performs a single parse and creates
a single StepRange, then checks all three constraints against it.
No behavior change for non-steppable types — hasStepRangeViolation() returns
false immediately, same as the three individual methods.
* Source/WebCore/html/InputType.cpp:
(WebCore::isInvalidInputType):
(WebCore::validateInputType):
(WebCore::InputType::parsedValueAndStepRange const):
(WebCore::InputType::rangeUnderflow const):
(WebCore::InputType::rangeOverflow const):
(WebCore::InputType::stepMismatch const):
(WebCore::InputType::hasStepRangeViolation const):
* Source/WebCore/html/InputType.h:
* Source/WebCore/html/StepRange.cpp:
(WebCore::StepRange::StepRange):
Canonical link: https://commits.webkit.org/310176@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications