Closed Bug 1602955 Opened 6 years ago Closed 6 years ago

[wpt-sync] Sync PR 20711 - Fixes stepUp() and stepDown() are inconsistent with up/down arrow.

Categories

(Core :: DOM: Core & HTML, task, P4)

task

Tracking

()

RESOLVED FIXED
mozilla73
Tracking Status
firefox73 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 20711 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/20711
Details from upstream follow.

yu han <yuzhehan@chromium.org> wrote:

Fixes stepUp() and stepDown() are inconsistent with up/down arrow.

Previous to this CL, for input type number, calling stepUp() when
its value is greater than max or call stepDown() when its value is
less than min resets its value to max-min boundary. However, if
up/down arrow is used, the value doesn't change.

https://html.spec.whatwg.org/multipage/input.html#dom-input-stepup.
The spec, in section 10 with an example, states that the value should
NOT change. Firefox's behavior matches this spec. Safari also follows
this behavior, but it does so by throwing "InvalidStateError".

I found that the difference in behavior is caused by two different
call path. Up/Down arrow handler takes care of this case.
Call Path:
KeyUp:
EventDispatcher::Dispatch()
->HTMLInputElement::DefaultEventHandler()
->NumberInputType::HandleKeydownEvent()
->TestFieldInputType::HandleKeydowEventForSpinButton()
->InputType::StepUpFromLayoutObject() // current value range check.

StepUp():
V8HTMLInputElement::StepUpMethodCallback()
->HTMLInputElement::stepUp()
->InputType::StepUp()
->InputType::ApplyStep()

The fix is to do a check in the StepUp() when input number type's
value and do nothing if the value overflows the corresponding max/min
barrier.

I had a general fix in patchset 1, which I reverted. In that patchset,
I do this check inside the InputType::ApplyStep(). However, it had an
unintended regression on time input invalid value test case,
time-stepup-stepdown.html::
shouldBeEqualToString('stepDown("", null, null)', '00:00');
With my previous fix, the value would still be "". Firefox and Safari
both reset the value to be "00:00". I think it's better to preserve the
current behavior and be interoperable. Thus, in the latest patchset, I
made the fix to be specific to input type number.

Bug:1019184
Change-Id: Ie6a6aef18b1d0c507b0208a7b5a89ab411bd4028

Reviewed-on: https://chromium-review.googlesource.com/1959631
WPT-Export-Revision: ff7af3afd5bfa3a63fd8a40a86a900d50402f44c

Component: web-platform-tests → DOM: Core & HTML
Product: Testing → Core

CI Results

Ran 13 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 2 tests and 7 subtests

Status Summary

Firefox

OK : 2
PASS: 14

Chrome

OK : 2
PASS: 2
FAIL: 12

Safari

OK : 2
PASS: 2
FAIL: 12

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

CI Results

Ran 13 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 2 tests and 7 subtests

Status Summary

Firefox

OK : 2
PASS: 14

Chrome

OK : 2
PASS: 2
FAIL: 12

Safari

OK : 2
PASS: 2
FAIL: 12

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

CI Results

Ran 13 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 2 tests and 7 subtests

Status Summary

Firefox

OK : 2
PASS: 14

Chrome

OK : 2
PASS: 2
FAIL: 12

Safari

OK : 2
PASS: 2
FAIL: 12

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Pushed by wptsync@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c825b120a19a [wpt PR 20711] - Fixes stepUp() and stepDown() issue with out of range values., a=testonly

CI Results

Ran 13 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 2 tests and 7 subtests

Status Summary

Firefox

OK : 2
PASS: 14

Chrome

OK : 2
PASS: 2
FAIL: 12

Safari

OK : 2
PASS: 2
FAIL: 12

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Test result changes from PR not available.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla73
You need to log in before you can comment on or make changes to this bug.