-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update input[type=*]'s step base handling to match spec
https://bugs.webkit.org/show_bug.cgi?id=254761 rdar://problem/107721910 Reviewed by Aditya Keerthi. This patch aligns WebKit with Gecko / Firefox and Blink / Chromium. Merge [1]: https://chromium.googlesource.com/chromium/src.git/+/0f836e3f330abbd76df604090db47c6e8fccd5b1 Determine the step base for an input element per spec: Spec: https://html.spec.whatwg.org/#concept-input-min-zero That is, consult the 'value' attribute if 'min' is not present, and then fallback to the default step base for the input type if that isn't present either. Previously, 'value' was not considered. Merge [2]: https://chromium.googlesource.com/chromium/src.git/+/f0af3d9cd0b5e0b05f20cd8c4f20103f572f14ef The HTML spec recently shifted to using 'value' as the first fallback option for an input element's "step base" (if no 'min' attribute): Spec: https://html.spec.whatwg.org/#concept-input-min-zero Also bring type=range elements into line with that, including using that step base when clamping values to the supported range. Merge [3]: https://chromium.googlesource.com/chromium/src.git/+/807ab32fd2e5accda8c5cef2678e0e0af23158b0 According to the specification, we should not resolve step-mismatch if there are no step-matched values in the range. So, StepRange::clampValue() should return the minimum value or the maximum value. Spec: https://html.spec.whatwg.org/multipage/input.html#range-state-(type%3Drange) Merge [4]: chromium/chromium@fb67b32 The spec for stepUp()/stepDown(): Spec: https://html.spec.whatwg.org/#dom-input-stepdown requires that out-of-step values snap to step, just like the UI implementation will do. Hence, bring the required clamping/snapping handling into scope. NOTE - It matches Blink from top of tree to avoid stack overflow issue: Stack Overflow: https://source.chromium.org/chromium/chromium/src/+/ebc1f01b3fdba6c8b1b2b1075e029cd317c685ee * Source/WebCore/html/InputType.cpp: (InputType::findStepBase): Add Helping function (InputType::applyStep): Update to spec * Source/WebCore/html/InputType.h: Helper function definition * Source/WebCore/html/MonthInputType.cpp: (MonthInputType::defaultValueForStepUp): Use ’findStepBase’ * Source/WebCore/html/NumberInputType.cpp: (NumberInputType::createStepRange): Use ’findStepBase’ and remove already covered ‘NaN’ handling * Source/WebCore/html/TimeInputType.cpp: (TimeInputType:: createStepRange): Use ’findStepBase’ * Source/WebCore/html/WeekInputType.cpp: (WeekInputType:: createStepRange): Use ’findStepBase’ * Source/WebCore/html/RangeInputType.cpp: (RangeInputType::createStepRange): Use 'findStepBase' * Source/WebCore/html/StepRange.cpp: (StepRange::clampValue): clampValue but respect 'stepBase' * LayoutTests/fast/forms/week/week-stepup-stepdown.html: * LayoutTests/fast/forms/time/time-stepup-stepdown.html: * LayoutTests/fast/forms/range/range-stepup-stepdown.html: Removed duplicate tests as well * LayoutTests/fast/forms/number/number-stepup-stepdown.html: Ditto * LayoutTests/fast/forms/month/month-stepup-stepdown.html: * LayoutTests/fast/forms/datetimelocal/datetimelocal-stepup-stepdown.html: * LayoutTests/fast/forms/date/date-stepup-stepdown.html: * LayoutTests/fast/forms/date/date-stepup-stepdown-expected.txt: Rebaselined * LayoutTests/fast/forms/datetimelocal/datetimelocal-stepup-stepdown-expected.txt: Ditto * LayoutTests/fast/forms/month/month-stepup-stepdown-expected.txt: Ditto * LayoutTests/fast/forms/range/range-stepup-stepdown-expected.txt: Ditto * LayoutTests/fast/forms/time/time-stepup-stepdown-expected.txt: Fail Tests also fail in Blink * LayoutTests/fast/forms/week/week-stepup-stepdown-expected.txt: Rebaselined * LayoutTests/fast/forms/number/number-stepup-stepdown-expected.txt: Rebaselined * LayoutTests/fast/forms/date/input-date-validation-message.html: Rebaselined Canonical link: https://commits.webkit.org/280127@main
- Loading branch information
1 parent
118f42b
commit 5b73f8e
Showing
26 changed files
with
291 additions
and
740 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.