Repository navigation
Conversation
Also: - Test :in-range/:out-of-range and :valid/:invalid. - Test willValidate for missing input types.
sb3nder
force-pushed
the
form-constraint-2
branch
from
November 30, 2026 21:10
4c10d8c to
01b1828
Compare
sb3nder
marked this pull request as ready for review
November 30, 2026 21:42
wpt-pr-bot
requested review from
annevk,
foolip,
jdm,
jgraham,
lilles and
tkent-google
November 30, 2026 21:42
hjanuschka
added a commit
to hjanuschka/WebKit
that referenced
this pull request
Dec 5, 2026
https://bugs.webkit.org/show_bug.cgi?id=334543 Reviewed by NOBODY (OOPS!). Per the Range state value sanitization algorithm, the user agent only clamps an overflowing value to the maximum "if the maximum is not less than the minimum". A reversed range (e.g. <input type=range min=200>, where the maximum defaults to 100) is deliberately left suffering from an overflow: validity.rangeOverflow must be true, the control must match :invalid and :out-of-range, and form submission must be blocked. The "has a reversed range" carve-out requires a periodic domain and only applies to type=time. WebKit raised the parsed maximum up to the minimum in RangeInputType::createStepRange, making the control report itself as valid. Firefox implements the spec behavior and Chromium is working towards it. Keep the parsed maximum, and instead pin values to the minimum in StepRange::clampValue when the range is reversed and the type is not reversible, so the sanitized value is unchanged from the previous behavior (and identical to Firefox) in every case - only the validity flags change. Reversible time ranges (min=23:00 max=01:00) are unaffected. proportionFromValue returns 0 for a reversed range so the slider thumb stays pinned to the start, and keyboard stepping is a no-op since no valid value exists to step to. Sync the constraint-validation and pseudo-class WPTs with web-platform-tests/wpt#65927, which covers reversed ranges for type=range. The three new FAIL baselines in the willValidate and valid-invalid tests are a separate pre-existing divergence (WebKit bars <input type=image> from constraint validation; the spec does not) that the refreshed tests now cover. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-rangeOverflow-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-rangeOverflow.html: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-rangeUnderflow-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-rangeUnderflow.html: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-stepMismatch-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-stepMismatch.html: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid.html: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-willValidate-datalist-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-willValidate-datalist.html: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-willValidate-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-willValidate.html: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/inrange-outofrange-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/inrange-outofrange.html: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/utils.js: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/valid-invalid-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/valid-invalid.html: * Source/WebCore/html/RangeInputType.cpp: (WebCore::RangeInputType::createStepRange): (WebCore::RangeInputType::handleKeydownEvent): (WebCore::ensureMaximum): Deleted. * Source/WebCore/html/StepRange.cpp: (WebCore::StepRange::clampValue): * Source/WebCore/html/StepRange.h: (WebCore::StepRange::proportionFromValue):
hjanuschka
added a commit
to hjanuschka/WebKit
that referenced
this pull request
Dec 5, 2026
https://bugs.webkit.org/show_bug.cgi?id=334544 Reviewed by NOBODY (OOPS!). Per the Range state value sanitization algorithm, the user agent only clamps an overflowing value to the maximum "if the maximum is not less than the minimum". A reversed range (e.g. <input type=range min=200>, where the maximum defaults to 100) is deliberately left suffering from an overflow: validity.rangeOverflow must be true, the control must match :invalid and :out-of-range, and form submission must be blocked. The "has a reversed range" carve-out requires a periodic domain and only applies to type=time. WebKit raised the parsed maximum up to the minimum in RangeInputType::createStepRange, making the control report itself as valid. Firefox implements the spec behavior and Chromium is working towards it. Keep the parsed maximum, and instead pin values to the minimum in StepRange::clampValue when the range is reversed and the type is not reversible, so the sanitized value is unchanged from the previous behavior (and identical to Firefox) in every case - only the validity flags change. Reversible time ranges (min=23:00 max=01:00) are unaffected. proportionFromValue returns 0 for a reversed range so the slider thumb stays pinned to the start, and keyboard stepping is a no-op since no valid value exists to step to. Sync the constraint-validation and pseudo-class WPTs with web-platform-tests/wpt#65927, which covers reversed ranges for type=range. The three new FAIL baselines in the willValidate and valid-invalid tests are a separate pre-existing divergence (WebKit bars <input type=image> from constraint validation; the spec does not) that the refreshed tests now cover. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-rangeOverflow-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-rangeOverflow.html: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-rangeUnderflow-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-rangeUnderflow.html: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-stepMismatch-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-stepMismatch.html: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-validity-valid.html: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-willValidate-datalist-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-willValidate-datalist.html: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-willValidate-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/constraints/form-validation-willValidate.html: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/inrange-outofrange-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/inrange-outofrange.html: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/utils.js: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/valid-invalid-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/selectors/pseudo-classes/valid-invalid.html: * Source/WebCore/html/RangeInputType.cpp: (WebCore::RangeInputType::createStepRange): (WebCore::RangeInputType::handleKeydownEvent): (WebCore::ensureMaximum): Deleted. * Source/WebCore/html/StepRange.cpp: (WebCore::StepRange::clampValue): * Source/WebCore/html/StepRange.h: (WebCore::StepRange::proportionFromValue):
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tests that
validity.rangeOverflowof a input type=range is true when the value is greater that max;and that
validity.stepMismatchis true when the value is not an integral multiple of step.Also: