Commit 146a312e authored by rbpotter's avatar rbpotter Committed by Commit Bot

Ensure 'input' event always fires with the 'composed' flag true.

Bug: 879261
Change-Id: I5513a889df874bef4157245d7ad7454e79777cfa
Reviewed-on: https://chromium-review.googlesource.com/c/1211669Reviewed-by: default avatarHayato Ito <hayato@chromium.org>
Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#603973}
parent add16aa8
<!DOCTYPE html>
<html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../resources/common.js"></script>
<body>
<input id="test" type="number" value="5" min="1" max="10"/>
<script type="text/javascript">
var test = document.getElementById("test");
var spinButton = getElementByPseudoId(internals.shadowRoot(test), "-webkit-inner-spin-button");
var rect = spinButton.getBoundingClientRect();
var spinButtonUpX = rect.left + rect.width / 2;
var spinButtonUpY = rect.top + rect.height / 4;
var expectedValue = 6;
var t = async_test('Test for a bug in setting composed flag for input events in a type=number input.');
test.addEventListener('input', t.step_func(e => {
assert_true(e.composed);
assert_equals(test.value, expectedValue.toString());
if (expectedValue === 7)
t.done();
expectedValue++;
}));
test.focus();
t.step(() => {
chrome.gpuBenchmarking.pointerActionSequence(
[{ source: 'mouse',
actions: [
{ name: 'pointerMove', x: spinButtonUpX, y: spinButtonUpY },
{ name: 'pointerDown', x: spinButtonUpX, y: spinButtonUpY },
{ name: 'pointerUp' }]}]
);
});
eventSender.keyDown('ArrowUp');
</script>
</body>
</html>
...@@ -2573,7 +2573,9 @@ void Node::DispatchSimulatedClick(Event* underlying_event, ...@@ -2573,7 +2573,9 @@ void Node::DispatchSimulatedClick(Event* underlying_event,
void Node::DispatchInputEvent() { void Node::DispatchInputEvent() {
// Legacy 'input' event for forms set value and checked. // Legacy 'input' event for forms set value and checked.
DispatchScopedEvent(*Event::CreateBubble(EventTypeNames::input)); Event* event = Event::CreateBubble(EventTypeNames::input);
event->SetComposed(true);
DispatchScopedEvent(*event);
} }
void Node::DefaultEventHandler(Event& event) { void Node::DefaultEventHandler(Event& event) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment