Changeset 269452 in webkit


Ignore:
Timestamp:
Nov 5, 2020 11:12:23 AM (21 months ago)
Author:
Chris Dumez
Message:

<input disabled> does not fire click events after dispatchEvent
https://bugs.webkit.org/show_bug.cgi?id=215461
<rdar://problem/67030950>

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Rebaseline WPT tests that are now passing.

  • web-platform-tests/dom/events/Event-dispatch-click-expected.txt:
  • web-platform-tests/html/semantics/forms/the-input-element/radio-input-cancel-expected.txt:

Source/WebCore:

We should allow mouse events from JS to get dispatched on disabled form controls. Only mouse events from the
user and calling input.click() should not cause an event to get dispatched on disabled form controls.

Tests: fast/dom/HTMLInputElement/disabled-checkbox-click.html

fast/dom/HTMLInputElement/disabled-radio-click.html

  • dom/Node.cpp:

(WebCore::Node::handleLocalEvents):
Allow mouse events from JS to get dispatched on disabled form controls. Trusted mouse events (events from
the user-agent) are still not dispatched on disabled form controls.

  • html/RadioInputType.cpp:

(WebCore::RadioInputType::didDispatchClick):
Fix post activation behavior for radio input elements so that we set the elements' checkedness to false
if the activation was cancelled and we are not restoring the checkedness of the previously checked element
in the group.

LayoutTests:

Extend layout test coverage.

  • fast/dom/HTMLInputElement/disabled-checkbox-click-expected.txt: Added.
  • fast/dom/HTMLInputElement/disabled-checkbox-click.html: Added.
  • fast/dom/HTMLInputElement/disabled-radio-click-expected.txt: Added.
  • fast/dom/HTMLInputElement/disabled-radio-click.html: Added.
Location:
trunk
Files:
4 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r269451 r269452  
     12020-11-05  Chris Dumez  <cdumez@apple.com>
     2
     3        <input disabled> does not fire click events after dispatchEvent
     4        https://bugs.webkit.org/show_bug.cgi?id=215461
     5        <rdar://problem/67030950>
     6
     7        Reviewed by Darin Adler.
     8
     9        Extend layout test coverage.
     10
     11        * fast/dom/HTMLInputElement/disabled-checkbox-click-expected.txt: Added.
     12        * fast/dom/HTMLInputElement/disabled-checkbox-click.html: Added.
     13        * fast/dom/HTMLInputElement/disabled-radio-click-expected.txt: Added.
     14        * fast/dom/HTMLInputElement/disabled-radio-click.html: Added.
     15
    1162020-11-05  Chris Dumez  <cdumez@apple.com>
    217
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r269451 r269452  
     12020-11-05  Chris Dumez  <cdumez@apple.com>
     2
     3        <input disabled> does not fire click events after dispatchEvent
     4        https://bugs.webkit.org/show_bug.cgi?id=215461
     5        <rdar://problem/67030950>
     6
     7        Reviewed by Darin Adler.
     8
     9        Rebaseline WPT tests that are now passing.
     10
     11        * web-platform-tests/dom/events/Event-dispatch-click-expected.txt:
     12        * web-platform-tests/html/semantics/forms/the-input-element/radio-input-cancel-expected.txt:
     13
    1142020-11-05  Chris Dumez  <cdumez@apple.com>
    215
  • trunk/LayoutTests/imported/w3c/web-platform-tests/dom/events/Event-dispatch-click-expected.txt

    r269400 r269452  
    1 
    2 Harness Error (TIMEOUT), message = null
    31
    42PASS basic with click()
     
    1917PASS disabled checkbox should be checked from dispatchEvent(new MouseEvent("click"))
    2018PASS disabled radio should be checked from dispatchEvent(new MouseEvent("click"))
    21 TIMEOUT disabled checkbox should fire onclick Test timed out
    22 TIMEOUT disabled radio should fire onclick Test timed out
    23 TIMEOUT disabled checkbox should get legacy-canceled-activation behavior Test timed out
    24 TIMEOUT disabled radio should get legacy-canceled-activation behavior Test timed out
     19PASS disabled checkbox should fire onclick
     20PASS disabled radio should fire onclick
     21PASS disabled checkbox should get legacy-canceled-activation behavior
     22PASS disabled radio should get legacy-canceled-activation behavior
    2523PASS disabled checkbox should get legacy-canceled-activation behavior 2
    26 FAIL disabled radio should get legacy-canceled-activation behavior 2 assert_false: expected false got true
     24PASS disabled radio should get legacy-canceled-activation behavior 2
    2725PASS disconnected form should not submit
    2826PASS disabled submit button should not activate
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/radio-input-cancel-expected.txt

    r217225 r269452  
    11
    22
    3 FAIL radio input cancel behavior reverts state assert_false: expected false got true
     3PASS radio input cancel behavior reverts state
    44
  • trunk/Source/WebCore/ChangeLog

    r269450 r269452  
     12020-11-05  Chris Dumez  <cdumez@apple.com>
     2
     3        <input disabled> does not fire click events after dispatchEvent
     4        https://bugs.webkit.org/show_bug.cgi?id=215461
     5        <rdar://problem/67030950>
     6
     7        Reviewed by Darin Adler.
     8
     9        We should allow mouse events from JS to get dispatched on disabled form controls. Only mouse events from the
     10        user and calling input.click() should not cause an event to get dispatched on disabled form controls.
     11
     12        Tests: fast/dom/HTMLInputElement/disabled-checkbox-click.html
     13               fast/dom/HTMLInputElement/disabled-radio-click.html
     14
     15        * dom/Node.cpp:
     16        (WebCore::Node::handleLocalEvents):
     17        Allow mouse events from JS to get dispatched on disabled form controls. Trusted mouse events (events from
     18        the user-agent) are still not dispatched on disabled form controls.
     19
     20        * html/RadioInputType.cpp:
     21        (WebCore::RadioInputType::didDispatchClick):
     22        Fix post activation behavior for radio input elements so that we set the elements' checkedness to false
     23        if the activation was cancelled and we are not restoring the checkedness of the previously checked element
     24        in the group.
     25        - https://html.spec.whatwg.org/#the-input-element:legacy-canceled-activation-behavior (Step 2)
     26
    1272020-11-05  Antoine Quint  <graouts@webkit.org>
    228
  • trunk/Source/WebCore/dom/Node.cpp

    r269442 r269452  
    23722372
    23732373    // FIXME: Should we deliver wheel events to disabled form controls or not?
    2374     if (is<Element>(*this) && downcast<Element>(*this).isDisabledFormControl() && event.isMouseEvent() && !event.isWheelEvent())
     2374    if (is<Element>(*this) && downcast<Element>(*this).isDisabledFormControl() && event.isTrusted() && event.isMouseEvent() && !event.isWheelEvent())
    23752375        return;
    23762376
  • trunk/Source/WebCore/html/RadioInputType.cpp

    r246490 r269452  
    172172        if (button && button->isRadioButton() && button->form() == element()->form() && button->name() == element()->name())
    173173            button->setChecked(true);
     174        else
     175            element()->setChecked(false);
    174176    } else if (state.checked != element()->checked())
    175177        fireInputAndChangeEvents();
Note: See TracChangeset for help on using the changeset viewer.