diff --git a/dom/base/ShadowRoot.h b/dom/base/ShadowRoot.h index 1486de23fd762..19e575479a964 100644 --- a/dom/base/ShadowRoot.h +++ b/dom/base/ShadowRoot.h @@ -7,6 +7,7 @@ #ifndef mozilla_dom_shadowroot_h__ #define mozilla_dom_shadowroot_h__ +#include "mozilla/DOMEventTargetHelper.h" #include "mozilla/dom/DocumentBinding.h" #include "mozilla/dom/DocumentFragment.h" #include "mozilla/dom/DocumentOrShadowRoot.h" @@ -163,6 +164,8 @@ class ShadowRoot final : public DocumentFragment, void PartAdded(const Element&); void PartRemoved(const Element&); + IMPL_EVENT_HANDLER(slotchange); + const nsTArray& Parts() const { return mParts; } const RawServoAuthorStyles* GetServoStyles() const { diff --git a/dom/events/EventNameList.h b/dom/events/EventNameList.h index cf24e9de8cb94..803c9a54b5000 100644 --- a/dom/events/EventNameList.h +++ b/dom/events/EventNameList.h @@ -237,6 +237,7 @@ EVENT(seeked, eSeeked, EventNameType_HTML, eBasicEventClass) EVENT(seeking, eSeeking, EventNameType_HTML, eBasicEventClass) EVENT(select, eFormSelect, EventNameType_HTMLXUL, eBasicEventClass) EVENT(show, eShow, EventNameType_HTML, eBasicEventClass) +EVENT(slotchange, eSlotChange, EventNameType_All, eBasicEventClass) EVENT(stalled, eStalled, EventNameType_HTML, eBasicEventClass) EVENT(start, eMarqueeStart, EventNameType_HTMLMarqueeOnly, eBasicEventClass) EVENT(submit, eFormSubmit, EventNameType_HTMLXUL, eBasicEventClass) diff --git a/dom/webidl/EventHandler.webidl b/dom/webidl/EventHandler.webidl index 4df341643a21d..1fa2894812482 100644 --- a/dom/webidl/EventHandler.webidl +++ b/dom/webidl/EventHandler.webidl @@ -85,6 +85,7 @@ interface mixin GlobalEventHandlers { attribute EventHandler onselect; [Pref="dom.menuitem.enabled"] attribute EventHandler onshow; + attribute EventHandler onslotchange; //(Not implemented)attribute EventHandler onsort; attribute EventHandler onstalled; attribute EventHandler onsubmit; diff --git a/dom/webidl/ShadowRoot.webidl b/dom/webidl/ShadowRoot.webidl index d8cdcc0ea2fdc..aac2af9b2c2f8 100644 --- a/dom/webidl/ShadowRoot.webidl +++ b/dom/webidl/ShadowRoot.webidl @@ -27,6 +27,7 @@ interface ShadowRoot : DocumentFragment [Pref="dom.shadowdom.slot.assign.enabled"] readonly attribute SlotAssignmentMode slotAssignment; readonly attribute Element host; + attribute EventHandler onslotchange; Element? getElementById(DOMString elementId); diff --git a/testing/web-platform/meta/dom/idlharness.window.js.ini b/testing/web-platform/meta/dom/idlharness.window.js.ini index a0e3706eb79b7..ecf28763b9395 100644 --- a/testing/web-platform/meta/dom/idlharness.window.js.ini +++ b/testing/web-platform/meta/dom/idlharness.window.js.ini @@ -4,9 +4,6 @@ [Document interface: existence and properties of interface prototype object's @@unscopables property] expected: FAIL - [ShadowRoot interface: attribute onslotchange] - expected: FAIL - [Stringification of document.createNSResolver(document.body)] expected: FAIL diff --git a/testing/web-platform/meta/html/dom/idlharness.https.html.ini b/testing/web-platform/meta/html/dom/idlharness.https.html.ini index 72a418a54dfd1..3e213f443f64b 100644 --- a/testing/web-platform/meta/html/dom/idlharness.https.html.ini +++ b/testing/web-platform/meta/html/dom/idlharness.https.html.ini @@ -552,9 +552,6 @@ prefs: [dom.security.featurePolicy.experimental.enabled:true, dom.security.featu [SVGElement interface: attribute autofocus] expected: FAIL - [SVGElement interface: attribute onslotchange] - expected: FAIL - [FormDataEvent interface object length] expected: FAIL @@ -750,24 +747,6 @@ prefs: [dom.security.featurePolicy.experimental.enabled:true, dom.security.featu [Window interface: attribute oncancel] expected: FAIL - [Document interface: new Document() must inherit property "onslotchange" with the proper type] - expected: FAIL - - [Document interface: documentWithHandlers must inherit property "onslotchange" with the proper type] - expected: FAIL - - [Window interface: window must inherit property "onslotchange" with the proper type] - expected: FAIL - - [Document interface: attribute onslotchange] - expected: FAIL - - [Window interface: attribute onslotchange] - expected: FAIL - - [Document interface: iframe.contentDocument must inherit property "onslotchange" with the proper type] - expected: FAIL - [Window interface: operation print()] expected: if os == "android": FAIL @@ -947,12 +926,6 @@ prefs: [dom.security.featurePolicy.experimental.enabled:true, dom.security.featu [HTMLElement interface: attribute autofocus] expected: FAIL - [HTMLElement interface: attribute onslotchange] - expected: FAIL - - [HTMLElement interface: document.createElement("noscript") must inherit property "onslotchange" with the proper type] - expected: FAIL - [HTMLIFrameElement interface: attribute loading] expected: FAIL diff --git a/testing/web-platform/meta/html/webappapis/scripting/events/event-handler-all-global-events.html.ini b/testing/web-platform/meta/html/webappapis/scripting/events/event-handler-all-global-events.html.ini index 8468b73a0fc8f..390f5fd0755e3 100644 --- a/testing/web-platform/meta/html/webappapis/scripting/events/event-handler-all-global-events.html.ini +++ b/testing/web-platform/meta/html/webappapis/scripting/events/event-handler-all-global-events.html.ini @@ -22,16 +22,3 @@ [onsecuritypolicyviolation: the content attribute must execute when an event is dispatched] expected: FAIL - - [onslotchange: must be on the appropriate locations for GlobalEventHandlers] - expected: FAIL - - [onslotchange: the content attribute must be compiled into a function as the corresponding property] - expected: FAIL - - [onslotchange: the default value must be null] - expected: FAIL - - [onslotchange: the content attribute must execute when an event is dispatched] - expected: FAIL - diff --git a/testing/web-platform/meta/html/webappapis/scripting/events/event-handler-attributes-body-window.html.ini b/testing/web-platform/meta/html/webappapis/scripting/events/event-handler-attributes-body-window.html.ini index 0403380c34eba..ed3f8d04fe069 100644 --- a/testing/web-platform/meta/html/webappapis/scripting/events/event-handler-attributes-body-window.html.ini +++ b/testing/web-platform/meta/html/webappapis/scripting/events/event-handler-attributes-body-window.html.ini @@ -55,13 +55,3 @@ if not debug and e10s and (os == "linux") and (processor == "x86_64"): FAIL if not debug and (os == "mac"): FAIL if not debug and (os == "win") and (version == "6.1.7601"): FAIL - - [not shadowed slotchange (window)] - expected: FAIL - - [not shadowed slotchange (document.createElement("body"))] - expected: FAIL - - [not shadowed slotchange (document.body)] - expected: FAIL - diff --git a/testing/web-platform/meta/html/webappapis/scripting/events/event-handler-attributes-frameset-window.html.ini b/testing/web-platform/meta/html/webappapis/scripting/events/event-handler-attributes-frameset-window.html.ini index 851e7e04d2f49..bb37071a75810 100644 --- a/testing/web-platform/meta/html/webappapis/scripting/events/event-handler-attributes-frameset-window.html.ini +++ b/testing/web-platform/meta/html/webappapis/scripting/events/event-handler-attributes-frameset-window.html.ini @@ -49,13 +49,3 @@ disabled: Bug 1485887 expected: if not debug and not webrender and e10s and (os == "linux"): FAIL - - [not shadowed slotchange (window)] - expected: FAIL - - [not shadowed slotchange (document.createElement("frameset"))] - expected: FAIL - - [not shadowed slotchange (document.body)] - expected: FAIL - diff --git a/testing/web-platform/meta/html/webappapis/scripting/events/event-handler-attributes-windowless-body.html.ini b/testing/web-platform/meta/html/webappapis/scripting/events/event-handler-attributes-windowless-body.html.ini index 5a00d9ec464e4..6c8f5415e0cb0 100644 --- a/testing/web-platform/meta/html/webappapis/scripting/events/event-handler-attributes-windowless-body.html.ini +++ b/testing/web-platform/meta/html/webappapis/scripting/events/event-handler-attributes-windowless-body.html.ini @@ -11,9 +11,3 @@ [securitypolicyviolation is unaffected on a windowless frameset] expected: FAIL - [slotchange is unaffected on a windowless frameset] - expected: FAIL - - [slotchange is unaffected on a windowless body] - expected: FAIL - diff --git a/testing/web-platform/meta/mathml/relations/html5-tree/math-global-event-handlers.tentative.html.ini b/testing/web-platform/meta/mathml/relations/html5-tree/math-global-event-handlers.tentative.html.ini index 1e67008bcfdfb..e5927866fd0e0 100644 --- a/testing/web-platform/meta/mathml/relations/html5-tree/math-global-event-handlers.tentative.html.ini +++ b/testing/web-platform/meta/mathml/relations/html5-tree/math-global-event-handlers.tentative.html.ini @@ -5,24 +5,12 @@ [oncancel: the default value must be null] expected: FAIL - [onslotchange: the default value must be null] - expected: FAIL - [oncancel: the content attribute must be compiled into a function as the corresponding property] expected: FAIL - [onslotchange: dynamic changes on the attribute] - expected: FAIL - [oncancel: dispatching an Event at a element must trigger element.oncancel] expected: FAIL - [onslotchange: must be on the appropriate locations for GlobalEventHandlers] - expected: FAIL - - [onslotchange: the content attribute must be compiled into a function as the corresponding property] - expected: FAIL - [oncancel: must be on the appropriate locations for GlobalEventHandlers] expected: FAIL @@ -40,7 +28,3 @@ [onsecuritypolicyviolation: the content attribute must be compiled into a function as the corresponding property] expected: FAIL - - [onslotchange: dispatching an Event at a element must trigger element.onslotchange] - expected: FAIL - diff --git a/widget/EventMessageList.h b/widget/EventMessageList.h index 20b7ee4cc2f2a..2fac01fa0b4ab 100644 --- a/widget/EventMessageList.h +++ b/widget/EventMessageList.h @@ -457,6 +457,7 @@ NS_EVENT_MESSAGE(eEditorBeforeInput) // selection events NS_EVENT_MESSAGE(eSelectStart) NS_EVENT_MESSAGE(eSelectionChange) +NS_EVENT_MESSAGE(eSlotChange) // visibility change NS_EVENT_MESSAGE(eVisibilityChange) diff --git a/xpcom/ds/StaticAtoms.py b/xpcom/ds/StaticAtoms.py index 72e4a1d8b71a1..3ff931eb9ee1e 100644 --- a/xpcom/ds/StaticAtoms.py +++ b/xpcom/ds/StaticAtoms.py @@ -897,6 +897,7 @@ Atom("onshippingaddresschange", "onshippingaddresschange"), Atom("onshippingoptionchange", "onshippingoptionchange"), Atom("onshow", "onshow"), + Atom("onslotchange", "onslotchange"), Atom("onsqueeze", "onsqueeze"), Atom("onsqueezeend", "onsqueezeend"), Atom("onsqueezestart", "onsqueezestart"),