Changeset 286898 in webkit


Ignore:
Timestamp:
Dec 10, 2021, 7:02:38 PM (4 years ago)
Author:
Alexey Shvayka
Message:

Setting "onselectionchange" content attribute should add an event listener
https://bugs.webkit.org/show_bug.cgi?id=234167

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

Import WPT tests from https://github.com/web-platform-tests/wpt/pull/32013.

  • web-platform-tests/selection/textcontrols: Added.
  • web-platform-tests/selection/textcontrols/onselectionchange-content-attribute-expected.txt: Added.
  • web-platform-tests/selection/textcontrols/onselectionchange-content-attribute.html: Added.

Source/WebCore:

This patch implements full support for "onselectionchange" content attribute,
enabling it to add an event listener on any element, which fixes regression
introduced in r268745 and aligns "onselectionchange" with "onselectstart".

Aligns WebKit with Gecko and the spec [1].

[1] https://w3c.github.io/selection-api/#extensions-to-globaleventhandlers-interface

Tests: fast/dom/event-handler-attributes.html

imported/w3c/web-platform-tests/selection/textcontrols/onselectionchange-content-attribute.html

  • html/HTMLElement.cpp:

(WebCore::HTMLElement::createEventHandlerNameMap):

LayoutTests:

  • fast/dom/event-handler-attributes-expected.txt:
Location:
trunk
Files:
3 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r286897 r286898  
     12021-12-10  Alexey Shvayka  <[email protected]>
     2
     3        Setting "onselectionchange" content attribute should add an event listener
     4        https://bugs.webkit.org/show_bug.cgi?id=234167
     5
     6        Reviewed by Darin Adler.
     7
     8        * fast/dom/event-handler-attributes-expected.txt:
     9
    1102021-12-10  Joonghun Park  <[email protected]>
    211
  • trunk/LayoutTests/fast/dom/event-handler-attributes-expected.txt

    r268745 r286898  
    253253PASS testElementAttribute(element, "seeking") is "target"
    254254PASS testElementAttribute(element, "select") is "target"
    255 FAIL testElementAttribute(element, "selectionchange") should be target. Was script: target; content: none.
     255PASS testElementAttribute(element, "selectionchange") is "target"
    256256PASS testElementAttribute(element, "selectstart") is "target"
    257257PASS testElementAttribute(element, "stalled") is "target"
     
    346346PASS testElementAttribute(inputElement, "seeking") is "target"
    347347PASS testElementAttribute(inputElement, "select") is "target"
    348 FAIL testElementAttribute(inputElement, "selectionchange") should be target. Was script: target; content: none.
     348PASS testElementAttribute(inputElement, "selectionchange") is "target"
    349349PASS testElementAttribute(inputElement, "selectstart") is "target"
    350350PASS testElementAttribute(inputElement, "stalled") is "target"
     
    439439PASS testElementAttribute(audioElement, "seeking") is "target"
    440440PASS testElementAttribute(audioElement, "select") is "target"
    441 FAIL testElementAttribute(audioElement, "selectionchange") should be target. Was script: target; content: none.
     441PASS testElementAttribute(audioElement, "selectionchange") is "target"
    442442PASS testElementAttribute(audioElement, "selectstart") is "target"
    443443PASS testElementAttribute(audioElement, "stalled") is "target"
     
    532532PASS testElementAttribute(videoElement, "seeking") is "target"
    533533PASS testElementAttribute(videoElement, "select") is "target"
    534 FAIL testElementAttribute(videoElement, "selectionchange") should be target. Was script: target; content: none.
     534PASS testElementAttribute(videoElement, "selectionchange") is "target"
    535535PASS testElementAttribute(videoElement, "selectstart") is "target"
    536536PASS testElementAttribute(videoElement, "stalled") is "target"
     
    683683Event names we expect to be forwarded from <frameset> element to document)
    684684
    685 FAIL testElementAttribute(framesetElement, "selectionchange") should be document. Was script: target; content: none.
     685FAIL testElementAttribute(framesetElement, "selectionchange") should be document. Was target.
    686686
    687687Non-forwarded event names on <frameset> element
     
    823823PASS testElementAttribute(rectElement, "seeking") is "target"
    824824PASS testElementAttribute(rectElement, "select") is "target"
    825 FAIL testElementAttribute(rectElement, "selectionchange") should be target. Was script: target; content: none.
     825PASS testElementAttribute(rectElement, "selectionchange") is "target"
    826826PASS testElementAttribute(rectElement, "selectstart") is "target"
    827827PASS testElementAttribute(rectElement, "stalled") is "target"
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r286897 r286898  
     12021-12-10  Alexey Shvayka  <[email protected]>
     2
     3        Setting "onselectionchange" content attribute should add an event listener
     4        https://bugs.webkit.org/show_bug.cgi?id=234167
     5
     6        Reviewed by Darin Adler.
     7
     8        Import WPT tests from https://github.com/web-platform-tests/wpt/pull/32013.
     9
     10        * web-platform-tests/selection/textcontrols: Added.
     11        * web-platform-tests/selection/textcontrols/onselectionchange-content-attribute-expected.txt: Added.
     12        * web-platform-tests/selection/textcontrols/onselectionchange-content-attribute.html: Added.
     13
    1142021-12-10  Joonghun Park  <[email protected]>
    215
  • trunk/Source/WebCore/ChangeLog

    r286897 r286898  
     12021-12-10  Alexey Shvayka  <[email protected]>
     2
     3        Setting "onselectionchange" content attribute should add an event listener
     4        https://bugs.webkit.org/show_bug.cgi?id=234167
     5
     6        Reviewed by Darin Adler.
     7
     8        This patch implements full support for "onselectionchange" content attribute,
     9        enabling it to add an event listener on any element, which fixes regression
     10        introduced in r268745 and aligns "onselectionchange" with "onselectstart".
     11
     12        Aligns WebKit with Gecko and the spec [1].
     13
     14        [1] https://w3c.github.io/selection-api/#extensions-to-globaleventhandlers-interface
     15
     16        Tests: fast/dom/event-handler-attributes.html
     17               imported/w3c/web-platform-tests/selection/textcontrols/onselectionchange-content-attribute.html
     18
     19        * html/HTMLElement.cpp:
     20        (WebCore::HTMLElement::createEventHandlerNameMap):
     21
    1222021-12-10  Joonghun Park  <[email protected]>
    223
  • trunk/Source/WebCore/html/HTMLElement.cpp

    r286223 r286898  
    328328        &onseekingAttr.get(),
    329329        &onselectAttr.get(),
     330        &onselectionchangeAttr.get(),
    330331        &onselectstartAttr.get(),
    331332        &onslotchangeAttr.get(),
Note: See TracChangeset for help on using the changeset viewer.