Changeset 207514 in webkit


Ignore:
Timestamp:
Oct 18, 2016 7:03:07 PM (8 years ago)
Author:
Chris Dumez
Message:

Changing details.open should cause a toggle event to be fired asynchronously
https://bugs.webkit.org/show_bug.cgi?id=163568

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

  • web-platform-tests/html/dom/interfaces-expected.txt:

Rebaseline W3C test now that more checks are passing.

  • web-platform-tests/html/semantics/interactive-elements/the-details-element/toggleEvent-expected.txt: Added.
  • web-platform-tests/html/semantics/interactive-elements/the-details-element/toggleEvent.html: Added.
  • web-platform-tests/html/semantics/interactive-elements/the-details-element/w3c-import.log:

Import test coverage for the toggle event.

Source/WebCore:

Changing details.open should cause a toggle event to be fired asynchronously:

Firefox and Chrome implement this, we don't.

Test: imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-details-element/toggleEvent.html

  • dom/EventNames.h:
  • dom/GlobalEventHandlers.idl:
  • html/HTMLAttributeNames.in:
  • html/HTMLDetailsElement.cpp:

(WebCore::detailToggleEventSender):
(WebCore::HTMLDetailsElement::~HTMLDetailsElement):
(WebCore::HTMLDetailsElement::dispatchPendingEvent):
(WebCore::HTMLDetailsElement::parseAttribute):

  • html/HTMLDetailsElement.h:
  • html/HTMLElement.cpp:

(WebCore::HTMLElement::createEventHandlerNameMap):

LayoutTests:

Rebaseline existing test now that a new ontoggle attribute is exposed.

  • js/dom/dom-static-property-for-in-iteration-expected.txt:
Location:
trunk
Files:
2 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r207509 r207514  
     12016-10-18  Chris Dumez  <cdumez@apple.com>
     2
     3        Changing details.open should cause a toggle event to be fired asynchronously
     4        https://bugs.webkit.org/show_bug.cgi?id=163568
     5
     6        Reviewed by Darin Adler.
     7
     8        Rebaseline existing test now that a new ontoggle attribute is exposed.
     9
     10        * js/dom/dom-static-property-for-in-iteration-expected.txt:
     11
    1122016-10-18  Chris Dumez  <cdumez@apple.com>
    213
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r207497 r207514  
     12016-10-18  Chris Dumez  <cdumez@apple.com>
     2
     3        Changing details.open should cause a toggle event to be fired asynchronously
     4        https://bugs.webkit.org/show_bug.cgi?id=163568
     5
     6        Reviewed by Darin Adler.
     7
     8        * web-platform-tests/html/dom/interfaces-expected.txt:
     9        Rebaseline W3C test now that more checks are passing.
     10
     11        * web-platform-tests/html/semantics/interactive-elements/the-details-element/toggleEvent-expected.txt: Added.
     12        * web-platform-tests/html/semantics/interactive-elements/the-details-element/toggleEvent.html: Added.
     13        * web-platform-tests/html/semantics/interactive-elements/the-details-element/w3c-import.log:
     14        Import test coverage for the toggle event.
     15
    1162016-10-18  Chris Dumez  <cdumez@apple.com>
    217
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt

    r207380 r207514  
    115115PASS Document interface: attribute onsuspend
    116116PASS Document interface: attribute ontimeupdate
    117 FAIL Document interface: attribute ontoggle assert_true: The prototype object must have a property "ontoggle" expected true got false
     117PASS Document interface: attribute ontoggle
    118118PASS Document interface: attribute onvolumechange
    119119PASS Document interface: attribute onwaiting
     
    301301PASS Document interface: iframe.contentDocument must inherit property "onsuspend" with the proper type (145)
    302302PASS Document interface: iframe.contentDocument must inherit property "ontimeupdate" with the proper type (146)
    303 FAIL Document interface: iframe.contentDocument must inherit property "ontoggle" with the proper type (147) assert_inherits: property "ontoggle" not found in prototype chain
     303PASS Document interface: iframe.contentDocument must inherit property "ontoggle" with the proper type (147)
    304304PASS Document interface: iframe.contentDocument must inherit property "onvolumechange" with the proper type (148)
    305305PASS Document interface: iframe.contentDocument must inherit property "onwaiting" with the proper type (149)
     
    549549PASS Document interface: new Document() must inherit property "onsuspend" with the proper type (145)
    550550PASS Document interface: new Document() must inherit property "ontimeupdate" with the proper type (146)
    551 FAIL Document interface: new Document() must inherit property "ontoggle" with the proper type (147) assert_inherits: property "ontoggle" not found in prototype chain
     551PASS Document interface: new Document() must inherit property "ontoggle" with the proper type (147)
    552552PASS Document interface: new Document() must inherit property "onvolumechange" with the proper type (148)
    553553PASS Document interface: new Document() must inherit property "onwaiting" with the proper type (149)
     
    797797PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "onsuspend" with the proper type (145)
    798798PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "ontimeupdate" with the proper type (146)
    799 FAIL Document interface: document.implementation.createDocument(null, "", null) must inherit property "ontoggle" with the proper type (147) assert_inherits: property "ontoggle" not found in prototype chain
     799PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "ontoggle" with the proper type (147)
    800800PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "onvolumechange" with the proper type (148)
    801801PASS Document interface: document.implementation.createDocument(null, "", null) must inherit property "onwaiting" with the proper type (149)
     
    10141014PASS HTMLElement interface: attribute onsuspend
    10151015PASS HTMLElement interface: attribute ontimeupdate
    1016 FAIL HTMLElement interface: attribute ontoggle assert_true: The prototype object must have a property "ontoggle" expected true got false
     1016PASS HTMLElement interface: attribute ontoggle
    10171017PASS HTMLElement interface: attribute onvolumechange
    10181018PASS HTMLElement interface: attribute onwaiting
     
    10991099PASS HTMLElement interface: document.createElement("noscript") must inherit property "onsuspend" with the proper type (73)
    11001100PASS HTMLElement interface: document.createElement("noscript") must inherit property "ontimeupdate" with the proper type (74)
    1101 FAIL HTMLElement interface: document.createElement("noscript") must inherit property "ontoggle" with the proper type (75) assert_inherits: property "ontoggle" not found in prototype chain
     1101PASS HTMLElement interface: document.createElement("noscript") must inherit property "ontoggle" with the proper type (75)
    11021102PASS HTMLElement interface: document.createElement("noscript") must inherit property "onvolumechange" with the proper type (76)
    11031103PASS HTMLElement interface: document.createElement("noscript") must inherit property "onwaiting" with the proper type (77)
     
    50335033PASS Window interface: attribute onsuspend
    50345034PASS Window interface: attribute ontimeupdate
    5035 FAIL Window interface: attribute ontoggle assert_own_property: The global object must have a property "ontoggle" expected property "ontoggle" missing
     5035PASS Window interface: attribute ontoggle
    50365036PASS Window interface: attribute onvolumechange
    50375037PASS Window interface: attribute onwaiting
     
    51605160PASS Window interface: window must inherit property "onsuspend" with the proper type (93)
    51615161PASS Window interface: window must inherit property "ontimeupdate" with the proper type (94)
    5162 FAIL Window interface: window must inherit property "ontoggle" with the proper type (95) assert_own_property: expected property "ontoggle" missing
     5162PASS Window interface: window must inherit property "ontoggle" with the proper type (95)
    51635163PASS Window interface: window must inherit property "onvolumechange" with the proper type (96)
    51645164PASS Window interface: window must inherit property "onwaiting" with the proper type (97)
  • trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-details-element/w3c-import.log

    r200238 r207514  
    1717List of files:
    1818/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-details-element/details.html
     19/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-details-element/toggleEvent.html
  • trunk/LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt

    r204729 r207514  
    100100PASS a["onsuspend"] is null
    101101PASS a["ontimeupdate"] is null
     102PASS a["ontoggle"] is null
    102103PASS a["onvolumechange"] is null
    103104PASS a["onwaiting"] is null
     
    110111PASS a["localName"] is a
    111112PASS a["offsetLeft"] is 8
    112 PASS a["offsetTop"] is 1674
     113PASS a["offsetTop"] is 1689
    113114PASS a["offsetWidth"] is 40
    114115PASS a["offsetHeight"] is 18
  • trunk/Source/WebCore/ChangeLog

    r207513 r207514  
     12016-10-18  Chris Dumez  <cdumez@apple.com>
     2
     3        Changing details.open should cause a toggle event to be fired asynchronously
     4        https://bugs.webkit.org/show_bug.cgi?id=163568
     5
     6        Reviewed by Darin Adler.
     7
     8        Changing details.open should cause a toggle event to be fired asynchronously:
     9        - https://html.spec.whatwg.org/#details-notification-task-steps
     10
     11        Firefox and Chrome implement this, we don't.
     12
     13        Test: imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-details-element/toggleEvent.html
     14
     15        * dom/EventNames.h:
     16        * dom/GlobalEventHandlers.idl:
     17        * html/HTMLAttributeNames.in:
     18        * html/HTMLDetailsElement.cpp:
     19        (WebCore::detailToggleEventSender):
     20        (WebCore::HTMLDetailsElement::~HTMLDetailsElement):
     21        (WebCore::HTMLDetailsElement::dispatchPendingEvent):
     22        (WebCore::HTMLDetailsElement::parseAttribute):
     23        * html/HTMLDetailsElement.h:
     24        * html/HTMLElement.cpp:
     25        (WebCore::HTMLElement::createEventHandlerNameMap):
     26
    1272016-10-18  Dave Hyatt  <hyatt@apple.com>
    228
  • trunk/Source/WebCore/dom/EventNames.h

    r207040 r207514  
    219219    macro(timeout) \
    220220    macro(timeupdate) \
     221    macro(toggle) \
    221222    macro(tonechange) \
    222223    macro(touchcancel) \
  • trunk/Source/WebCore/dom/GlobalEventHandlers.idl

    r204729 r207514  
    9292    attribute EventHandler onsuspend;
    9393    attribute EventHandler ontimeupdate;
    94     // attribute EventHandler ontoggle;
     94    attribute EventHandler ontoggle;
    9595    attribute EventHandler onvolumechange;
    9696    attribute EventHandler onwaiting;
  • trunk/Source/WebCore/html/HTMLAttributeNames.in

    r207040 r207514  
    267267onsubmit
    268268ontimeupdate
     269ontoggle
    269270ontouchforcechange
    270271ontouchstart
  • trunk/Source/WebCore/html/HTMLDetailsElement.cpp

    r203302 r207514  
    2525#include "AXObjectCache.h"
    2626#include "ElementIterator.h"
     27#include "EventNames.h"
     28#include "EventSender.h"
    2729#include "HTMLSlotElement.h"
    2830#include "HTMLSummaryElement.h"
     
    3840
    3941using namespace HTMLNames;
     42
     43static DetailEventSender& detailToggleEventSender()
     44{
     45    static NeverDestroyed<DetailEventSender> sharedToggleEventSender(eventNames().toggleEvent);
     46    return sharedToggleEventSender;
     47}
    4048
    4149static const AtomicString& summarySlotName()
     
    8896}
    8997
     98HTMLDetailsElement::~HTMLDetailsElement()
     99{
     100    detailToggleEventSender().cancelEvent(*this);
     101}
     102
    90103RenderPtr<RenderElement> HTMLDetailsElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&)
    91104{
     
    124137}
    125138
     139void HTMLDetailsElement::dispatchPendingEvent(DetailEventSender* eventSender)
     140{
     141    ASSERT_UNUSED(eventSender, eventSender == &detailToggleEventSender());
     142    dispatchEvent(Event::create(eventNames().toggleEvent, false, false));
     143}
     144
    126145void HTMLDetailsElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
    127146{
     
    136155            else
    137156                root->removeChild(*m_defaultSlot);
     157
     158            // https://html.spec.whatwg.org/#details-notification-task-steps.
     159            detailToggleEventSender().cancelEvent(*this);
     160            detailToggleEventSender().dispatchEventSoon(*this);
    138161        }
    139162    } else
  • trunk/Source/WebCore/html/HTMLDetailsElement.h

    r203264 r207514  
    2828class HTMLSlotElement;
    2929
     30template<typename T> class EventSender;
     31typedef EventSender<HTMLDetailsElement> DetailEventSender;
     32
    3033class HTMLDetailsElement final : public HTMLElement {
    3134public:
    3235    static Ref<HTMLDetailsElement> create(const QualifiedName& tagName, Document&);
     36    ~HTMLDetailsElement();
     37
    3338    void toggleOpen();
    3439
    3540    bool isOpen() const { return m_isOpen; }
    3641    bool isActiveSummary(const HTMLSummaryElement&) const;
     42
     43    void dispatchPendingEvent(DetailEventSender*);
    3744   
    3845private:
  • trunk/Source/WebCore/html/HTMLElement.cpp

    r207458 r207514  
    296296        &onsuspendAttr,
    297297        &ontimeupdateAttr,
     298        &ontoggleAttr,
    298299        &ontouchcancelAttr,
    299300        &ontouchendAttr,
Note: See TracChangeset for help on using the changeset viewer.