Diff
Modified: trunk/LayoutTests/ChangeLog (260242 => 260243)
--- trunk/LayoutTests/ChangeLog 2020-04-17 09:35:49 UTC (rev 260242)
+++ trunk/LayoutTests/ChangeLog 2020-04-17 10:16:36 UTC (rev 260243)
@@ -1,3 +1,14 @@
+2020-04-17 Alexey Shvayka <[email protected]>
+
+ MediaQueryList should extend EventTarget
+ https://bugs.webkit.org/show_bug.cgi?id=203288
+
+ Reviewed by Darin Adler.
+
+ * TestExpectations:
+ * fast/media/media-query-list-07-expected.txt:
+ * fast/media/media-query-list-07.html:
+
2020-04-17 Tomoki Imai <[email protected]>
Fix an integer overflow in WebCrypto AES-CTR Mac implementation, which may detect a false loop
Modified: trunk/LayoutTests/TestExpectations (260242 => 260243)
--- trunk/LayoutTests/TestExpectations 2020-04-17 09:35:49 UTC (rev 260242)
+++ trunk/LayoutTests/TestExpectations 2020-04-17 10:16:36 UTC (rev 260243)
@@ -764,7 +764,6 @@
webkit.org/b/184066 imported/w3c/web-platform-tests/IndexedDB/nested-cloning-large-multiple.html [ Skip ]
webkit.org/b/184066 imported/w3c/web-platform-tests/IndexedDB/nested-cloning-large.html [ Skip ]
webkit.org/b/184066 imported/w3c/web-platform-tests/IndexedDB/nested-cloning-small.html [ Skip ]
-imported/w3c/web-platform-tests/css/cssom/interfaces.html [ Pass Timeout ]
[ Debug ] imported/w3c/web-platform-tests/css/cssom-view/idlharness.html [ Skip ]
webkit.org/b/182292 imported/w3c/web-platform-tests/css/cssom-view/scrollingElement-quirks-dynamic-001.html [ ImageOnlyFailure ]
webkit.org/b/182292 imported/w3c/web-platform-tests/css/cssom-view/scrollingElement-quirks-dynamic-002.html [ ImageOnlyFailure ]
Modified: trunk/LayoutTests/fast/media/media-query-list-07-expected.txt (260242 => 260243)
--- trunk/LayoutTests/fast/media/media-query-list-07-expected.txt 2020-04-17 09:35:49 UTC (rev 260242)
+++ trunk/LayoutTests/fast/media/media-query-list-07-expected.txt 2020-04-17 10:16:36 UTC (rev 260243)
@@ -2,9 +2,9 @@
Invalid listeners. Two callbacks are expected.
+EventListener is optional
query.addListener(5) threw exception as expected
query.addListener('cinco') threw exception as expected
-query.addListener([1,2]) threw exception as expected
[1] - query screen changed to false
[2] - query screen changed to false
Modified: trunk/LayoutTests/fast/media/media-query-list-07.html (260242 => 260243)
--- trunk/LayoutTests/fast/media/media-query-list-07.html 2020-04-17 09:35:49 UTC (rev 260242)
+++ trunk/LayoutTests/fast/media/media-query-list-07.html 2020-04-17 10:16:36 UTC (rev 260243)
@@ -29,6 +29,12 @@
var query = window.matchMedia("screen");
+ query.addListener(null);
+ query.addListener(undefined);
+ query.removeListener(null);
+ query.removeListener(undefined);
+ log("EventListener is optional");
+
query.addListener(callback1);
try {
@@ -41,13 +47,8 @@
query.addListener('cinco');
} catch (e) {
log("query.addListener('cinco') threw exception as expected");
-
}
- try {
- query.addListener([1,2]);
- } catch (e) {
- log("query.addListener([1,2]) threw exception as expected");
- }
+
query.addListener(callback2);
window.internals.settings.setMediaTypeOverride("handheld");
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (260242 => 260243)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2020-04-17 09:35:49 UTC (rev 260242)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2020-04-17 10:16:36 UTC (rev 260243)
@@ -1,3 +1,18 @@
+2020-04-17 Alexey Shvayka <[email protected]>
+
+ MediaQueryList should extend EventTarget
+ https://bugs.webkit.org/show_bug.cgi?id=203288
+
+ Reviewed by Darin Adler.
+
+ * web-platform-tests/css/cssom-view/MediaQueryList-addListener-handleEvent-expected.txt:
+ * web-platform-tests/css/cssom-view/MediaQueryList-addListener-removeListener-expected.txt:
+ * web-platform-tests/css/cssom-view/MediaQueryList-extends-EventTarget-expected.txt:
+ * web-platform-tests/css/cssom-view/MediaQueryList-extends-EventTarget-interop-expected.txt:
+ * web-platform-tests/css/cssom-view/MediaQueryListEvent-expected.txt:
+ * web-platform-tests/css/cssom-view/idlharness-expected.txt:
+ * web-platform-tests/css/cssom-view/matchMedia-expected.txt:
+
2020-04-15 Antoine Quint <[email protected]>
[Web Animations] Add support for `pseudoElement` on `KeyframeEffect` and `KeyframeEffectOptions`
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/MediaQueryList-addListener-handleEvent-expected.txt (260242 => 260243)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/MediaQueryList-addListener-handleEvent-expected.txt 2020-04-17 09:35:49 UTC (rev 260242)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/MediaQueryList-addListener-handleEvent-expected.txt 2020-04-17 10:16:36 UTC (rev 260243)
@@ -1,8 +1,11 @@
+CONSOLE MESSAGE: line 102: [object Object]
+CONSOLE MESSAGE: TypeError: 'handleEvent' property of event listener should be callable
+CONSOLE MESSAGE: TypeError: 'handleEvent' property of event listener should be callable
-FAIL calls handleEvent method of event listener promise_test: Unhandled rejection with value: object "TypeError: Argument 1 ('listener') to MediaQueryList.addListener must be a function"
-FAIL looks up handleEvent method on every event dispatch promise_test: Unhandled rejection with value: object "TypeError: Argument 1 ('listener') to MediaQueryList.addListener must be a function"
+PASS calls handleEvent method of event listener
+PASS looks up handleEvent method on every event dispatch
PASS doesn't look up handleEvent method on callable event listeners
-FAIL rethrows errors when getting handleEvent assert_equals: handleEvent property was not looked up expected 1 but got 0
-FAIL throws if handleEvent is falsy and not callable assert_equals: handleEvent property was not looked up expected 1 but got 0
-FAIL throws if handleEvent is thruthy and not callable assert_equals: handleEvent property was not looked up expected 1 but got 0
+FAIL rethrows errors when getting handleEvent assert_true: Timed out waiting for error expected true got false
+FAIL throws if handleEvent is falsy and not callable assert_true: Timed out waiting for error expected true got false
+FAIL throws if handleEvent is thruthy and not callable assert_true: Timed out waiting for error expected true got false
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/MediaQueryList-addListener-removeListener-expected.txt (260242 => 260243)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/MediaQueryList-addListener-removeListener-expected.txt 2020-04-17 09:35:49 UTC (rev 260242)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/MediaQueryList-addListener-removeListener-expected.txt 2020-04-17 10:16:36 UTC (rev 260243)
@@ -3,7 +3,7 @@
PASS listeners are called correct number of times
PASS listeners are called in order they were added
PASS listener that was added twice is called only once
-FAIL listeners are called in order their MQLs were created assert_array_equals: property 0, expected "mql1" but got "mql2"
+PASS listeners are called in order their MQLs were created
PASS removing listener from one MQL doesn't remove it from all MQLs
PASS MediaQueryList::removeListener removes added listener
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/MediaQueryList-extends-EventTarget-expected.txt (260242 => 260243)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/MediaQueryList-extends-EventTarget-expected.txt 2020-04-17 09:35:49 UTC (rev 260242)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/MediaQueryList-extends-EventTarget-expected.txt 2020-04-17 10:16:36 UTC (rev 260243)
@@ -1,20 +1,9 @@
-FAIL onchange adds listener promise_test: Unhandled rejection with value: object "TypeError: undefined is not an object (evaluating '_event.media')"
-FAIL onchange removes listener assert_equals: expected 1 but got 0
-FAIL listeners for "change" type are called promise_test: Unhandled rejection with value: object "TypeError: mql.addEventListener is not a function. (In 'mql.addEventListener("change", {
- handleEvent() {
- calls++;
- },
- })', 'mql.addEventListener' is undefined)"
-FAIL listeners with different type are not called promise_test: Unhandled rejection with value: object "TypeError: mql.addEventListener is not a function. (In 'mql.addEventListener("matches", t.unreached_func("should not be called"))', 'mql.addEventListener' is undefined)"
-FAIL addEventListener "once" option is respected promise_test: Unhandled rejection with value: object "TypeError: mql.addEventListener is not a function. (In 'mql.addEventListener("change", {
- handleEvent() {
- calls++;
- },
- }, {once: true})', 'mql.addEventListener' is undefined)"
-FAIL removeEventListener removes listener promise_test: Unhandled rejection with value: object "TypeError: mql.addEventListener is not a function. (In 'mql.addEventListener("change", listener)', 'mql.addEventListener' is undefined)"
-FAIL dispatchEvent works as expected mql.addEventListener is not a function. (In 'mql.addEventListener("custom", event => {
- receivedEvent = event;
- event.preventDefault();
- }, true)', 'mql.addEventListener' is undefined)
+PASS onchange adds listener
+PASS onchange removes listener
+PASS listeners for "change" type are called
+PASS listeners with different type are not called
+PASS addEventListener "once" option is respected
+PASS removeEventListener removes listener
+PASS dispatchEvent works as expected
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/MediaQueryList-extends-EventTarget-interop-expected.txt (260242 => 260243)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/MediaQueryList-extends-EventTarget-interop-expected.txt 2020-04-17 09:35:49 UTC (rev 260242)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/MediaQueryList-extends-EventTarget-interop-expected.txt 2020-04-17 10:16:36 UTC (rev 260243)
@@ -1,14 +1,10 @@
-FAIL dispatchEvent triggers listener added with addListener mql.dispatchEvent is not a function. (In 'mql.dispatchEvent(dispatchedEvent)', 'mql.dispatchEvent' is undefined)
-FAIL listener added with addListener and addEventListener is called once promise_test: Unhandled rejection with value: object "TypeError: Argument 1 ('listener') to MediaQueryList.addListener must be a function"
-FAIL listener added with addListener and addEventListener (capture) is called twice promise_test: Unhandled rejection with value: object "TypeError: mql.addEventListener is not a function. (In 'mql.addEventListener("change", listener, true)', 'mql.addEventListener' is undefined)"
-FAIL removeEventListener removes listener added with addListener promise_test: Unhandled rejection with value: object "TypeError: Argument 1 ('listener') to MediaQueryList.addListener must be a function"
-FAIL removeEventListener (capture) doesn't remove listener added with addListener promise_test: Unhandled rejection with value: object "TypeError: mql.removeEventListener is not a function. (In 'mql.removeEventListener("change", listener, true)', 'mql.removeEventListener' is undefined)"
-FAIL removeListener removes listener added with addEventListener promise_test: Unhandled rejection with value: object "TypeError: mql.addEventListener is not a function. (In 'mql.addEventListener("change", listener)', 'mql.addEventListener' is undefined)"
-FAIL removeListener doesn't remove listener added with addEventListener (capture) promise_test: Unhandled rejection with value: object "TypeError: mql.addEventListener is not a function. (In 'mql.addEventListener("change", listener, true)', 'mql.addEventListener' is undefined)"
-FAIL capturing event listener fires before non-capturing listener at target promise_test: Unhandled rejection with value: object "TypeError: mql.addEventListener is not a function. (In 'mql.addEventListener("change", {
- handleEvent() {
- calls.push("addEventListener");
- },
- }, true)', 'mql.addEventListener' is undefined)"
+PASS dispatchEvent triggers listener added with addListener
+PASS listener added with addListener and addEventListener is called once
+PASS listener added with addListener and addEventListener (capture) is called twice
+PASS removeEventListener removes listener added with addListener
+PASS removeEventListener (capture) doesn't remove listener added with addListener
+PASS removeListener removes listener added with addEventListener
+PASS removeListener doesn't remove listener added with addEventListener (capture)
+PASS capturing event listener fires before non-capturing listener at target
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/MediaQueryListEvent-expected.txt (260242 => 260243)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/MediaQueryListEvent-expected.txt 2020-04-17 09:35:49 UTC (rev 260242)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/MediaQueryListEvent-expected.txt 2020-04-17 10:16:36 UTC (rev 260243)
@@ -1,10 +1,8 @@
-FAIL type can be different from "change" Can't find variable: MediaQueryListEvent
-FAIL init dictionary default values Can't find variable: MediaQueryListEvent
-FAIL init dictionary overrides Can't find variable: MediaQueryListEvent
-FAIL argument of addListener promise_test: Unhandled rejection with value: object "TypeError: Right hand side of instanceof is not an object"
-FAIL argument of onchange promise_test: Unhandled rejection with value: object "TypeError: Right hand side of instanceof is not an object"
-FAIL constructor of "change" event promise_test: Unhandled rejection with value: object "TypeError: mql.addEventListener is not a function. (In 'mql.addEventListener("change", event => {
- _event = event;
- })', 'mql.addEventListener' is undefined)"
+PASS type can be different from "change"
+PASS init dictionary default values
+PASS init dictionary overrides
+PASS argument of addListener
+PASS argument of onchange
+PASS constructor of "change" event
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/idlharness-expected.txt (260242 => 260243)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/idlharness-expected.txt 2020-04-17 09:35:49 UTC (rev 260242)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/idlharness-expected.txt 2020-04-17 10:16:36 UTC (rev 260243)
@@ -55,42 +55,38 @@
PASS Window includes WindowLocalStorage: member names are unique
PASS CharacterData includes NonDocumentTypeChildNode: member names are unique
PASS CharacterData includes ChildNode: member names are unique
-FAIL MediaQueryList interface: existence and properties of interface object assert_own_property: self does not have own property "MediaQueryList" expected property "MediaQueryList" missing
-FAIL MediaQueryList interface object length assert_own_property: self does not have own property "MediaQueryList" expected property "MediaQueryList" missing
-FAIL MediaQueryList interface object name assert_own_property: self does not have own property "MediaQueryList" expected property "MediaQueryList" missing
-FAIL MediaQueryList interface: existence and properties of interface prototype object assert_own_property: self does not have own property "MediaQueryList" expected property "MediaQueryList" missing
-FAIL MediaQueryList interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "MediaQueryList" expected property "MediaQueryList" missing
-FAIL MediaQueryList interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "MediaQueryList" expected property "MediaQueryList" missing
-FAIL MediaQueryList interface: attribute media assert_own_property: self does not have own property "MediaQueryList" expected property "MediaQueryList" missing
-FAIL MediaQueryList interface: attribute matches assert_own_property: self does not have own property "MediaQueryList" expected property "MediaQueryList" missing
-FAIL MediaQueryList interface: operation addListener(EventListener) assert_own_property: self does not have own property "MediaQueryList" expected property "MediaQueryList" missing
-FAIL MediaQueryList interface: operation removeListener(EventListener) assert_own_property: self does not have own property "MediaQueryList" expected property "MediaQueryList" missing
-FAIL MediaQueryList interface: attribute onchange assert_own_property: self does not have own property "MediaQueryList" expected property "MediaQueryList" missing
-FAIL MediaQueryList must be primary interface of matchMedia("all") assert_own_property: self does not have own property "MediaQueryList" expected property "MediaQueryList" missing
+PASS MediaQueryList interface: existence and properties of interface object
+PASS MediaQueryList interface object length
+PASS MediaQueryList interface object name
+PASS MediaQueryList interface: existence and properties of interface prototype object
+PASS MediaQueryList interface: existence and properties of interface prototype object's "constructor" property
+PASS MediaQueryList interface: existence and properties of interface prototype object's @@unscopables property
+PASS MediaQueryList interface: attribute media
+PASS MediaQueryList interface: attribute matches
+PASS MediaQueryList interface: operation addListener(EventListener)
+PASS MediaQueryList interface: operation removeListener(EventListener)
+PASS MediaQueryList interface: attribute onchange
+PASS MediaQueryList must be primary interface of matchMedia("all")
PASS Stringification of matchMedia("all")
PASS MediaQueryList interface: matchMedia("all") must inherit property "media" with the proper type
PASS MediaQueryList interface: matchMedia("all") must inherit property "matches" with the proper type
PASS MediaQueryList interface: matchMedia("all") must inherit property "addListener(EventListener)" with the proper type
-FAIL MediaQueryList interface: calling addListener(EventListener) on matchMedia("all") with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
- fn.apply(obj, args);
- }" did not throw
+PASS MediaQueryList interface: calling addListener(EventListener) on matchMedia("all") with too few arguments must throw TypeError
PASS MediaQueryList interface: matchMedia("all") must inherit property "removeListener(EventListener)" with the proper type
-FAIL MediaQueryList interface: calling removeListener(EventListener) on matchMedia("all") with too few arguments must throw TypeError assert_throws: Called with 0 arguments function "function () {
- fn.apply(obj, args);
- }" did not throw
-FAIL MediaQueryList interface: matchMedia("all") must inherit property "onchange" with the proper type assert_inherits: property "onchange" not found in prototype chain
-FAIL MediaQueryListEvent interface: existence and properties of interface object assert_own_property: self does not have own property "MediaQueryListEvent" expected property "MediaQueryListEvent" missing
-FAIL MediaQueryListEvent interface object length assert_own_property: self does not have own property "MediaQueryListEvent" expected property "MediaQueryListEvent" missing
-FAIL MediaQueryListEvent interface object name assert_own_property: self does not have own property "MediaQueryListEvent" expected property "MediaQueryListEvent" missing
-FAIL MediaQueryListEvent interface: existence and properties of interface prototype object assert_own_property: self does not have own property "MediaQueryListEvent" expected property "MediaQueryListEvent" missing
-FAIL MediaQueryListEvent interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "MediaQueryListEvent" expected property "MediaQueryListEvent" missing
-FAIL MediaQueryListEvent interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "MediaQueryListEvent" expected property "MediaQueryListEvent" missing
-FAIL MediaQueryListEvent interface: attribute media assert_own_property: self does not have own property "MediaQueryListEvent" expected property "MediaQueryListEvent" missing
-FAIL MediaQueryListEvent interface: attribute matches assert_own_property: self does not have own property "MediaQueryListEvent" expected property "MediaQueryListEvent" missing
-FAIL MediaQueryListEvent must be primary interface of new MediaQueryListEvent("change") assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: MediaQueryListEvent"
-FAIL Stringification of new MediaQueryListEvent("change") assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: MediaQueryListEvent"
-FAIL MediaQueryListEvent interface: new MediaQueryListEvent("change") must inherit property "media" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: MediaQueryListEvent"
-FAIL MediaQueryListEvent interface: new MediaQueryListEvent("change") must inherit property "matches" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: Can't find variable: MediaQueryListEvent"
+PASS MediaQueryList interface: calling removeListener(EventListener) on matchMedia("all") with too few arguments must throw TypeError
+PASS MediaQueryList interface: matchMedia("all") must inherit property "onchange" with the proper type
+PASS MediaQueryListEvent interface: existence and properties of interface object
+PASS MediaQueryListEvent interface object length
+PASS MediaQueryListEvent interface object name
+PASS MediaQueryListEvent interface: existence and properties of interface prototype object
+PASS MediaQueryListEvent interface: existence and properties of interface prototype object's "constructor" property
+PASS MediaQueryListEvent interface: existence and properties of interface prototype object's @@unscopables property
+PASS MediaQueryListEvent interface: attribute media
+PASS MediaQueryListEvent interface: attribute matches
+PASS MediaQueryListEvent must be primary interface of new MediaQueryListEvent("change")
+PASS Stringification of new MediaQueryListEvent("change")
+PASS MediaQueryListEvent interface: new MediaQueryListEvent("change") must inherit property "media" with the proper type
+PASS MediaQueryListEvent interface: new MediaQueryListEvent("change") must inherit property "matches" with the proper type
PASS Screen interface: existence and properties of interface object
PASS Screen interface object length
PASS Screen interface object name
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/matchMedia-expected.txt (260242 => 260243)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/matchMedia-expected.txt 2020-04-17 09:35:49 UTC (rev 260242)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/matchMedia-expected.txt 2020-04-17 10:16:36 UTC (rev 260243)
@@ -3,7 +3,7 @@
PASS window.matchMedia("all") matches
PASS window.matchMedia("") matches
PASS window.matchMedia("(min-width: 1px)") matches
-FAIL media query with syntax error is serialized as "not all" Can't find variable: MediaQueryList
+PASS media query with syntax error is serialized as "not all"
PASS iframe.matchMedia("(max-width: 199px), all and (min-width: 200px)") is serialized w/o "all"
PASS iframe.matchMedia("(min-aspect-ratio: 1/1)") matches
PASS iframe.matchMedia("(width: 200px)") matches
Modified: trunk/Source/WebCore/CMakeLists.txt (260242 => 260243)
--- trunk/Source/WebCore/CMakeLists.txt 2020-04-17 09:35:49 UTC (rev 260242)
+++ trunk/Source/WebCore/CMakeLists.txt 2020-04-17 10:16:36 UTC (rev 260243)
@@ -638,7 +638,7 @@
css/FontFaceSet.idl
css/MediaList.idl
css/MediaQueryList.idl
- css/MediaQueryListListener.idl
+ css/MediaQueryListEvent.idl
css/StyleMedia.idl
css/StyleSheet.idl
css/StyleSheetList.idl
Modified: trunk/Source/WebCore/ChangeLog (260242 => 260243)
--- trunk/Source/WebCore/ChangeLog 2020-04-17 09:35:49 UTC (rev 260242)
+++ trunk/Source/WebCore/ChangeLog 2020-04-17 10:16:36 UTC (rev 260243)
@@ -1,3 +1,68 @@
+2020-04-17 Alexey Shvayka <[email protected]>
+
+ MediaQueryList should extend EventTarget
+ https://bugs.webkit.org/show_bug.cgi?id=203288
+
+ Reviewed by Darin Adler.
+
+ Initially, CSSOM View Module specification [1] had a custom callback mechanism with addListener() and removeListener(),
+ and the callback was invoked with the associated MediaQueryList as argument.
+
+ Now the normal event mechanism [2] is used instead. For backwards compatibility, addListener() and removeListener()
+ methods are basically aliases for addEventListener() and removeEventListener(), respectively, and the "change" event
+ masquerades as a MediaQueryList.
+
+ This patch implements new event mechanism, aligning WebKit with Blink and SpiderMonkey, and also fixes
+ a few minor spec incompatibilities: mandatory listener argument, "handleEvent" support, and listeners call order.
+
+ [1]: https://www.w3.org/TR/2011/WD-cssom-view-20110804/#mediaquerylist
+ [2]: https://www.w3.org/TR/cssom-view-1/#mediaquerylist
+
+ Tests: fast/media/media-query-list-07.html
+ web-platform-tests/css/cssom-view/MediaQueryList-addListener-handleEvent.html
+ web-platform-tests/css/cssom-view/MediaQueryList-addListener-removeListener.html
+ web-platform-tests/css/cssom-view/MediaQueryList-extends-EventTarget.html
+ web-platform-tests/css/cssom-view/MediaQueryList-extends-EventTarget-interop.html
+ web-platform-tests/css/cssom-view/MediaQueryListEvent.html
+ web-platform-tests/css/cssom-view/idlharness.html
+ web-platform-tests/css/cssom-view/matchMedia.html
+
+ * CMakeLists.txt:
+ * DerivedSources-input.xcfilelist:
+ * DerivedSources-output.xcfilelist:
+ * DerivedSources.make:
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/WebCoreBuiltinNames.h:
+ * bindings/scripts/test/JS/*: Updated.
+ * css/MediaQueryList.cpp:
+ (WebCore::MediaQueryList::MediaQueryList):
+ (WebCore::MediaQueryList::create):
+ (WebCore::MediaQueryList::~MediaQueryList):
+ (WebCore::MediaQueryList::addListener):
+ (WebCore::MediaQueryList::removeListener):
+ * css/MediaQueryList.h:
+ * css/MediaQueryList.idl:
+ * css/MediaQueryListEvent.cpp: Added.
+ (WebCore::MediaQueryListEvent::MediaQueryListEvent):
+ * css/MediaQueryListEvent.h: Added.
+ * css/MediaQueryListEvent.idl: Added.
+ * css/MediaQueryListListener.h: Removed.
+ * css/MediaQueryListListener.idl: Removed.
+ * css/MediaQueryMatcher.cpp:
+ (WebCore::MediaQueryMatcher::documentDestroyed):
+ (WebCore::MediaQueryMatcher::addMediaQueryList):
+ (WebCore::MediaQueryMatcher::removeMediaQueryList):
+ (WebCore::MediaQueryMatcher::matchMedia):
+ (WebCore::MediaQueryMatcher::evaluateAll):
+ (WebCore::MediaQueryMatcher::addListener): Deleted.
+ (WebCore::MediaQueryMatcher::removeListener): Deleted.
+ * css/MediaQueryMatcher.h:
+ * dom/EventNames.in:
+ * dom/EventTarget.h:
+ (WebCore::EventTarget::removeEventListener):
+ * dom/EventTargetFactory.in:
+
2020-04-17 Adrian Perez de Castro <[email protected]>
Unreviewed build fix after r260123
Modified: trunk/Source/WebCore/DerivedSources-input.xcfilelist (260242 => 260243)
--- trunk/Source/WebCore/DerivedSources-input.xcfilelist 2020-04-17 09:35:49 UTC (rev 260242)
+++ trunk/Source/WebCore/DerivedSources-input.xcfilelist 2020-04-17 10:16:36 UTC (rev 260243)
@@ -546,7 +546,7 @@
$(PROJECT_DIR)/css/FontFaceSet.idl
$(PROJECT_DIR)/css/MediaList.idl
$(PROJECT_DIR)/css/MediaQueryList.idl
-$(PROJECT_DIR)/css/MediaQueryListListener.idl
+$(PROJECT_DIR)/css/MediaQueryListEvent.idl
$(PROJECT_DIR)/css/SVGCSSValueKeywords.in
$(PROJECT_DIR)/css/SelectorPseudoClassAndCompatibilityElementMap.in
$(PROJECT_DIR)/css/SelectorPseudoElementTypeMap.in
Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (260242 => 260243)
--- trunk/Source/WebCore/DerivedSources-output.xcfilelist 2020-04-17 09:35:49 UTC (rev 260242)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist 2020-04-17 10:16:36 UTC (rev 260243)
@@ -1032,8 +1032,8 @@
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMediaList.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMediaQueryList.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMediaQueryList.h
-$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMediaQueryListListener.cpp
-$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMediaQueryListListener.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMediaQueryListEvent.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMediaQueryListEvent.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMediaRecorder.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMediaRecorder.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSMediaRecorderErrorEvent.cpp
Modified: trunk/Source/WebCore/DerivedSources.make (260242 => 260243)
--- trunk/Source/WebCore/DerivedSources.make 2020-04-17 09:35:49 UTC (rev 260242)
+++ trunk/Source/WebCore/DerivedSources.make 2020-04-17 10:16:36 UTC (rev 260243)
@@ -579,7 +579,7 @@
$(WebCore)/css/FontFaceSet.idl \
$(WebCore)/css/MediaList.idl \
$(WebCore)/css/MediaQueryList.idl \
- $(WebCore)/css/MediaQueryListListener.idl \
+ $(WebCore)/css/MediaQueryListEvent.idl \
$(WebCore)/css/StyleMedia.idl \
$(WebCore)/css/StyleSheet.idl \
$(WebCore)/css/StyleSheetList.idl \
Modified: trunk/Source/WebCore/Sources.txt (260242 => 260243)
--- trunk/Source/WebCore/Sources.txt 2020-04-17 09:35:49 UTC (rev 260242)
+++ trunk/Source/WebCore/Sources.txt 2020-04-17 10:16:36 UTC (rev 260243)
@@ -790,6 +790,7 @@
css/MediaQueryEvaluator.cpp
css/MediaQueryExpression.cpp
css/MediaQueryList.cpp
+css/MediaQueryListEvent.cpp
css/MediaQueryMatcher.cpp
css/MediaQueryParserContext.cpp
css/PropertySetCSSStyleDeclaration.cpp
@@ -3109,7 +3110,7 @@
JSMediaError.cpp
JSMediaList.cpp
JSMediaQueryList.cpp
-JSMediaQueryListListener.cpp
+JSMediaQueryListEvent.cpp
JSMediaRecorder.cpp
JSMediaRecorderErrorEvent.cpp
JSMediaRemoteControls.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (260242 => 260243)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-04-17 09:35:49 UTC (rev 260242)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-04-17 10:16:36 UTC (rev 260243)
@@ -2260,7 +2260,6 @@
7C5222991E1DAE1C002CB8F7 /* ActiveDOMCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C5222981E1DAE16002CB8F7 /* ActiveDOMCallback.h */; settings = {ATTRIBUTES = (Private, ); }; };
7C52229E1E1DAE47002CB8F7 /* RuntimeEnabledFeatures.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C52229C1E1DAE47002CB8F7 /* RuntimeEnabledFeatures.h */; settings = {ATTRIBUTES = (Private, ); }; };
7C5266981F1B0302000F068B /* StringAdaptors.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C5266961F1B02FC000F068B /* StringAdaptors.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 7C5343FD17B74B63004232F0 /* JSMediaQueryListListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C5343FB17B74B63004232F0 /* JSMediaQueryListListener.h */; };
7C57BFE71EDE2F6100534A48 /* JSDOMAbstractOperations.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C57BFE61EDE2F5B00534A48 /* JSDOMAbstractOperations.h */; settings = {ATTRIBUTES = (Private, ); }; };
7C5F28FC1A827D8400C0F31F /* HTMLAttachmentElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C5F28FA1A827D8400C0F31F /* HTMLAttachmentElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
7C6522EF1E00A4C700677F22 /* ApplePayPaymentMethod.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C6522EC1E00A4C700677F22 /* ApplePayPaymentMethod.h */; };
@@ -2506,6 +2505,7 @@
84300BD8120C9AD40021954A /* SVGPathSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 84300BD7120C9AD40021954A /* SVGPathSource.h */; };
845E72F80FD261EE00A87D79 /* Filter.h in Headers */ = {isa = PBXBuildFile; fileRef = 845E72F70FD261EE00A87D79 /* Filter.h */; };
845E72FC0FD2623900A87D79 /* SVGFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 845E72FA0FD2623900A87D79 /* SVGFilter.h */; };
+ 84650E7E2387AD7D006266E2 /* MediaQueryListEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 84650E7C2387AD7C006266E2 /* MediaQueryListEvent.h */; };
84730D771248F0B300D3A9C9 /* DistantLightSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 84730D5A1248F0B300D3A9C9 /* DistantLightSource.h */; };
84730D791248F0B300D3A9C9 /* FEConvolveMatrix.h in Headers */ = {isa = PBXBuildFile; fileRef = 84730D5C1248F0B300D3A9C9 /* FEConvolveMatrix.h */; };
84730D7B1248F0B300D3A9C9 /* FEDiffuseLighting.h in Headers */ = {isa = PBXBuildFile; fileRef = 84730D5E1248F0B300D3A9C9 /* FEDiffuseLighting.h */; };
@@ -4305,7 +4305,6 @@
D359D78A129CA2710006E5D2 /* HTMLDetailsElement.h in Headers */ = {isa = PBXBuildFile; fileRef = D359D787129CA2710006E5D2 /* HTMLDetailsElement.h */; };
D359D8BF129CA55C0006E5D2 /* JSHTMLDetailsElement.h in Headers */ = {isa = PBXBuildFile; fileRef = D359D8BD129CA55C0006E5D2 /* JSHTMLDetailsElement.h */; };
D3A94A39122DABAC00A37BBC /* MediaQueryList.h in Headers */ = {isa = PBXBuildFile; fileRef = D3A94A32122DABAC00A37BBC /* MediaQueryList.h */; };
- D3A94A3B122DABAC00A37BBC /* MediaQueryListListener.h in Headers */ = {isa = PBXBuildFile; fileRef = D3A94A34122DABAC00A37BBC /* MediaQueryListListener.h */; };
D3A94A47122DC40F00A37BBC /* JSMediaQueryList.h in Headers */ = {isa = PBXBuildFile; fileRef = D3A94A43122DC40F00A37BBC /* JSMediaQueryList.h */; };
D3AA10F4123A98AA0092152B /* MediaQueryMatcher.h in Headers */ = {isa = PBXBuildFile; fileRef = D3AA10F2123A98AA0092152B /* MediaQueryMatcher.h */; };
D3D4E973130C7CFE007BA540 /* HTMLSummaryElement.h in Headers */ = {isa = PBXBuildFile; fileRef = D3D4E971130C7CFE007BA540 /* HTMLSummaryElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -9969,8 +9968,6 @@
7C522D4915B477E8009B7C95 /* InspectorOverlay.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorOverlay.cpp; sourceTree = "<group>"; };
7C522D4A15B478B2009B7C95 /* InspectorOverlay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorOverlay.h; sourceTree = "<group>"; };
7C5266961F1B02FC000F068B /* StringAdaptors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringAdaptors.h; sourceTree = "<group>"; };
- 7C5343FA17B74B63004232F0 /* JSMediaQueryListListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaQueryListListener.cpp; sourceTree = "<group>"; };
- 7C5343FB17B74B63004232F0 /* JSMediaQueryListListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = JSMediaQueryListListener.h; sourceTree = "<group>"; };
7C57BFE61EDE2F5B00534A48 /* JSDOMAbstractOperations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMAbstractOperations.h; sourceTree = "<group>"; };
7C5BEA3A1E9EE77100CC517B /* NavigatorID.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NavigatorID.idl; sourceTree = "<group>"; };
7C5BEA3B1E9EE77100CC517B /* NavigatorLanguage.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NavigatorLanguage.idl; sourceTree = "<group>"; };
@@ -10477,6 +10474,9 @@
845E72F70FD261EE00A87D79 /* Filter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Filter.h; sourceTree = "<group>"; };
845E72F90FD2623900A87D79 /* SVGFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGFilter.cpp; sourceTree = "<group>"; };
845E72FA0FD2623900A87D79 /* SVGFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGFilter.h; sourceTree = "<group>"; };
+ 84650E7C2387AD7C006266E2 /* MediaQueryListEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaQueryListEvent.h; sourceTree = "<group>"; };
+ 84650E7F2387AD8A006266E2 /* MediaQueryListEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaQueryListEvent.cpp; sourceTree = "<group>"; };
+ 84650E802387AD8B006266E2 /* MediaQueryListEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MediaQueryListEvent.idl; sourceTree = "<group>"; };
84730D5A1248F0B300D3A9C9 /* DistantLightSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DistantLightSource.h; sourceTree = "<group>"; };
84730D5B1248F0B300D3A9C9 /* FEConvolveMatrix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FEConvolveMatrix.cpp; sourceTree = "<group>"; };
84730D5C1248F0B300D3A9C9 /* FEConvolveMatrix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FEConvolveMatrix.h; sourceTree = "<group>"; };
@@ -14537,8 +14537,6 @@
D3A94A31122DABAC00A37BBC /* MediaQueryList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaQueryList.cpp; sourceTree = "<group>"; };
D3A94A32122DABAC00A37BBC /* MediaQueryList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaQueryList.h; sourceTree = "<group>"; };
D3A94A33122DABAC00A37BBC /* MediaQueryList.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MediaQueryList.idl; sourceTree = "<group>"; };
- D3A94A34122DABAC00A37BBC /* MediaQueryListListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaQueryListListener.h; sourceTree = "<group>"; };
- D3A94A35122DABAC00A37BBC /* MediaQueryListListener.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MediaQueryListListener.idl; sourceTree = "<group>"; };
D3A94A42122DC40F00A37BBC /* JSMediaQueryList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaQueryList.cpp; sourceTree = "<group>"; };
D3A94A43122DC40F00A37BBC /* JSMediaQueryList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMediaQueryList.h; sourceTree = "<group>"; };
D3AA10F1123A98AA0092152B /* MediaQueryMatcher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaQueryMatcher.cpp; sourceTree = "<group>"; };
@@ -24148,8 +24146,6 @@
BC3C39B50C0D3D8D005F4D7A /* JSMediaList.h */,
D3A94A42122DC40F00A37BBC /* JSMediaQueryList.cpp */,
D3A94A43122DC40F00A37BBC /* JSMediaQueryList.h */,
- 7C5343FA17B74B63004232F0 /* JSMediaQueryListListener.cpp */,
- 7C5343FB17B74B63004232F0 /* JSMediaQueryListListener.h */,
0FF50267102BA9430066F39A /* JSStyleMedia.cpp */,
0FF50268102BA9430066F39A /* JSStyleMedia.h */,
BCE013980C0BEF180043860A /* JSStyleSheet.cpp */,
@@ -27969,8 +27965,9 @@
D3A94A31122DABAC00A37BBC /* MediaQueryList.cpp */,
D3A94A32122DABAC00A37BBC /* MediaQueryList.h */,
D3A94A33122DABAC00A37BBC /* MediaQueryList.idl */,
- D3A94A34122DABAC00A37BBC /* MediaQueryListListener.h */,
- D3A94A35122DABAC00A37BBC /* MediaQueryListListener.idl */,
+ 84650E7F2387AD8A006266E2 /* MediaQueryListEvent.cpp */,
+ 84650E7C2387AD7C006266E2 /* MediaQueryListEvent.h */,
+ 84650E802387AD8B006266E2 /* MediaQueryListEvent.idl */,
D3AA10F1123A98AA0092152B /* MediaQueryMatcher.cpp */,
D3AA10F2123A98AA0092152B /* MediaQueryMatcher.h */,
4471710B205AF945000A116E /* MediaQueryParserContext.cpp */,
@@ -31256,7 +31253,6 @@
BC3C39B70C0D3D8D005F4D7A /* JSMediaList.h in Headers */,
93D437A31D57B7E200AB85EA /* JSMediaListCustom.h in Headers */,
D3A94A47122DC40F00A37BBC /* JSMediaQueryList.h in Headers */,
- 7C5343FD17B74B63004232F0 /* JSMediaQueryListListener.h in Headers */,
CD9DE17517AAC74C00EA386D /* JSMediaSource.h in Headers */,
07277E4D17D018CC0015534D /* JSMediaStream.h in Headers */,
07277E4F17D018CC0015534D /* JSMediaStreamAudioDestinationNode.h in Headers */,
@@ -31874,7 +31870,7 @@
4E19592C0A39DACC00220FE5 /* MediaQueryEvaluator.h in Headers */,
7CB5CA401E525C7300FAEF13 /* MediaQueryExpression.h in Headers */,
D3A94A39122DABAC00A37BBC /* MediaQueryList.h in Headers */,
- D3A94A3B122DABAC00A37BBC /* MediaQueryListListener.h in Headers */,
+ 84650E7E2387AD7D006266E2 /* MediaQueryListEvent.h in Headers */,
D3AA10F4123A98AA0092152B /* MediaQueryMatcher.h in Headers */,
9493B6C11D74B4120088E780 /* MediaQueryParser.h in Headers */,
4471710E205AF945000A116E /* MediaQueryParserContext.h in Headers */,
Modified: trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h (260242 => 260243)
--- trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h 2020-04-17 09:35:49 UTC (rev 260242)
+++ trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h 2020-04-17 10:16:36 UTC (rev 260243)
@@ -149,6 +149,7 @@
macro(MediaKeyStatusMap) \
macro(MediaKeySystemAccess) \
macro(MediaKeys) \
+ macro(MediaQueryListEvent) \
macro(MediaRecorder) \
macro(MediaRecorderErrorEvent) \
macro(MediaSource) \
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp (260242 => 260243)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp 2020-04-17 09:35:49 UTC (rev 260242)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp 2020-04-17 10:16:36 UTC (rev 260243)
@@ -54,7 +54,6 @@
#include "JSTestIterable.h"
#include "JSTestJSBuiltinConstructor.h"
#include "JSTestMapLike.h"
-#include "JSTestMediaQueryListListener.h"
#include "JSTestNamedAndIndexedSetterNoIdentifier.h"
#include "JSTestNamedAndIndexedSetterThrowingException.h"
#include "JSTestNamedAndIndexedSetterWithIdentifier.h"
@@ -209,8 +208,6 @@
bool setJSTestGlobalObjectTestJSBuiltinConstructorConstructor(JSC::JSGlobalObject*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsTestGlobalObjectTestMapLikeConstructor(JSC::JSGlobalObject*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSTestGlobalObjectTestMapLikeConstructor(JSC::JSGlobalObject*, JSC::EncodedJSValue, JSC::EncodedJSValue);
-JSC::EncodedJSValue jsTestGlobalObjectTestMediaQueryListListenerConstructor(JSC::JSGlobalObject*, JSC::EncodedJSValue, JSC::PropertyName);
-bool setJSTestGlobalObjectTestMediaQueryListListenerConstructor(JSC::JSGlobalObject*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsTestGlobalObjectTestNamedAndIndexedSetterNoIdentifierConstructor(JSC::JSGlobalObject*, JSC::EncodedJSValue, JSC::PropertyName);
bool setJSTestGlobalObjectTestNamedAndIndexedSetterNoIdentifierConstructor(JSC::JSGlobalObject*, JSC::EncodedJSValue, JSC::EncodedJSValue);
JSC::EncodedJSValue jsTestGlobalObjectTestNamedAndIndexedSetterThrowingExceptionConstructor(JSC::JSGlobalObject*, JSC::EncodedJSValue, JSC::PropertyName);
@@ -302,11 +299,11 @@
static const struct CompactHashIndex JSTestGlobalObjectTableIndex[266] = {
{ -1, -1 },
- { 37, -1 },
+ { 36, -1 },
{ -1, -1 },
{ 0, -1 },
{ 4, 262 },
- { 41, -1 },
+ { 40, -1 },
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
@@ -314,7 +311,7 @@
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
- { 51, -1 },
+ { 50, -1 },
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
@@ -322,7 +319,7 @@
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
- { 63, -1 },
+ { 62, -1 },
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
@@ -336,13 +333,13 @@
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
- { 31, -1 },
+ { 30, -1 },
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
- { 66, -1 },
+ { 65, -1 },
{ 9, 258 },
{ -1, -1 },
{ -1, -1 },
@@ -351,7 +348,7 @@
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
- { 35, -1 },
+ { 34, -1 },
{ 16, 263 },
{ 6, -1 },
{ -1, -1 },
@@ -364,7 +361,7 @@
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
- { 33, -1 },
+ { 32, -1 },
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
@@ -386,7 +383,7 @@
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
- { 57, -1 },
+ { 56, -1 },
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
@@ -395,17 +392,17 @@
{ -1, -1 },
{ 20, 256 },
{ -1, -1 },
- { 58, -1 },
+ { 57, -1 },
{ 15, -1 },
{ -1, -1 },
{ -1, -1 },
- { 43, -1 },
+ { 42, -1 },
{ 14, -1 },
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
- { 32, -1 },
+ { 31, -1 },
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
@@ -412,11 +409,11 @@
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
- { 47, -1 },
+ { 46, -1 },
{ 21, -1 },
{ -1, -1 },
{ 2, -1 },
- { 34, -1 },
+ { 33, -1 },
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
@@ -426,23 +423,23 @@
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
- { 55, -1 },
+ { 54, -1 },
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
- { 28, -1 },
- { 24, -1 },
+ { 27, -1 },
{ -1, -1 },
- { 39, -1 },
{ -1, -1 },
+ { 38, -1 },
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
- { 50, -1 },
{ -1, -1 },
+ { 49, -1 },
+ { -1, -1 },
{ 10, -1 },
{ -1, -1 },
{ -1, -1 },
@@ -459,12 +456,12 @@
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
- { 64, -1 },
+ { 63, -1 },
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
- { 29, -1 },
- { 26, 261 },
+ { 28, -1 },
+ { 25, 261 },
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
@@ -476,7 +473,7 @@
{ -1, -1 },
{ 12, 257 },
{ -1, -1 },
- { 59, -1 },
+ { 58, -1 },
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
@@ -485,17 +482,17 @@
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
- { 30, 265 },
+ { 29, 265 },
{ -1, -1 },
{ 13, -1 },
{ -1, -1 },
- { 62, -1 },
+ { 61, -1 },
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
- { 45, -1 },
+ { 44, -1 },
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
@@ -508,7 +505,7 @@
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
- { 53, -1 },
+ { 52, -1 },
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
@@ -530,12 +527,12 @@
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
- { 46, -1 },
+ { 45, -1 },
{ 7, 260 },
{ -1, -1 },
- { 60, -1 },
+ { 59, -1 },
{ -1, -1 },
- { 44, -1 },
+ { 43, -1 },
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
@@ -545,28 +542,28 @@
{ 22, -1 },
{ -1, -1 },
{ -1, -1 },
- { 25, -1 },
+ { 24, -1 },
{ -1, -1 },
{ -1, -1 },
- { 42, -1 },
+ { 41, -1 },
{ 3, -1 },
+ { 47, -1 },
+ { -1, -1 },
{ 48, -1 },
{ -1, -1 },
- { 49, -1 },
{ -1, -1 },
{ -1, -1 },
{ -1, -1 },
- { -1, -1 },
{ 23, 259 },
- { 27, -1 },
- { 36, -1 },
- { 38, -1 },
- { 40, -1 },
- { 52, -1 },
- { 54, -1 },
- { 56, -1 },
- { 61, -1 },
- { 65, -1 },
+ { 26, -1 },
+ { 35, -1 },
+ { 37, -1 },
+ { 39, -1 },
+ { 51, -1 },
+ { 53, -1 },
+ { 55, -1 },
+ { 60, -1 },
+ { 64, -1 },
};
@@ -608,7 +605,6 @@
{ "TestIterable", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestGlobalObjectTestIterableConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestGlobalObjectTestIterableConstructor) } },
{ "TestJSBuiltinConstructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestGlobalObjectTestJSBuiltinConstructorConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestGlobalObjectTestJSBuiltinConstructorConstructor) } },
{ "TestMapLike", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestGlobalObjectTestMapLikeConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestGlobalObjectTestMapLikeConstructor) } },
- { "TestMediaQueryListListener", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestGlobalObjectTestMediaQueryListListenerConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestGlobalObjectTestMediaQueryListListenerConstructor) } },
{ "TestNamedAndIndexedSetterNoIdentifier", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestGlobalObjectTestNamedAndIndexedSetterNoIdentifierConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestGlobalObjectTestNamedAndIndexedSetterNoIdentifierConstructor) } },
{ "TestNamedAndIndexedSetterThrowingException", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestGlobalObjectTestNamedAndIndexedSetterThrowingExceptionConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestGlobalObjectTestNamedAndIndexedSetterThrowingExceptionConstructor) } },
{ "TestNamedAndIndexedSetterWithIdentifier", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestGlobalObjectTestNamedAndIndexedSetterWithIdentifierConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestGlobalObjectTestNamedAndIndexedSetterWithIdentifierConstructor) } },
@@ -657,7 +653,7 @@
{ "regularOperation", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestGlobalObjectInstanceFunctionRegularOperation), (intptr_t) (1) } },
};
-static const HashTable JSTestGlobalObjectTable = { 67, 255, true, JSTestGlobalObject::info(), JSTestGlobalObjectTableValues, JSTestGlobalObjectTableIndex };
+static const HashTable JSTestGlobalObjectTable = { 66, 255, true, JSTestGlobalObject::info(), JSTestGlobalObjectTableValues, JSTestGlobalObjectTableIndex };
/* Hash table for constructor */
static const HashTableValue JSTestGlobalObjectConstructorTableValues[] =
@@ -1503,31 +1499,6 @@
return IDLAttribute<JSTestGlobalObject>::set<setJSTestGlobalObjectTestMapLikeConstructorSetter>(*lexicalGlobalObject, thisValue, encodedValue, "TestMapLike");
}
-static inline JSValue jsTestGlobalObjectTestMediaQueryListListenerConstructorGetter(JSGlobalObject& lexicalGlobalObject, JSTestGlobalObject& thisObject, ThrowScope& throwScope)
-{
- UNUSED_PARAM(throwScope);
- UNUSED_PARAM(lexicalGlobalObject);
- return JSTestMediaQueryListListener::getConstructor(JSC::getVM(&lexicalGlobalObject), thisObject.globalObject());
-}
-
-EncodedJSValue jsTestGlobalObjectTestMediaQueryListListenerConstructor(JSGlobalObject* lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)
-{
- return IDLAttribute<JSTestGlobalObject>::get<jsTestGlobalObjectTestMediaQueryListListenerConstructorGetter>(*lexicalGlobalObject, thisValue, "TestMediaQueryListListener");
-}
-
-static inline bool setJSTestGlobalObjectTestMediaQueryListListenerConstructorSetter(JSGlobalObject& lexicalGlobalObject, JSTestGlobalObject& thisObject, JSValue value, ThrowScope& throwScope)
-{
- UNUSED_PARAM(lexicalGlobalObject);
- VM& vm = throwScope.vm();
- // Shadowing a built-in constructor.
- return thisObject.putDirect(vm, Identifier::fromString(vm, reinterpret_cast<const LChar*>("TestMediaQueryListListener"), strlen("TestMediaQueryListListener")), value);
-}
-
-bool setJSTestGlobalObjectTestMediaQueryListListenerConstructor(JSGlobalObject* lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue)
-{
- return IDLAttribute<JSTestGlobalObject>::set<setJSTestGlobalObjectTestMediaQueryListListenerConstructorSetter>(*lexicalGlobalObject, thisValue, encodedValue, "TestMediaQueryListListener");
-}
-
static inline JSValue jsTestGlobalObjectTestNamedAndIndexedSetterNoIdentifierConstructorGetter(JSGlobalObject& lexicalGlobalObject, JSTestGlobalObject& thisObject, ThrowScope& throwScope)
{
UNUSED_PARAM(throwScope);
Deleted: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp (260242 => 260243)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp 2020-04-17 09:35:49 UTC (rev 260242)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp 2020-04-17 10:16:36 UTC (rev 260243)
@@ -1,298 +0,0 @@
-/*
- This file is part of the WebKit open source project.
- This file has been generated by generate-bindings.pl. DO NOT MODIFY!
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "config.h"
-#include "JSTestMediaQueryListListener.h"
-
-#include "ActiveDOMObject.h"
-#include "DOMIsoSubspaces.h"
-#include "JSDOMBinding.h"
-#include "JSDOMConstructorNotConstructable.h"
-#include "JSDOMConvertCallbacks.h"
-#include "JSDOMExceptionHandling.h"
-#include "JSDOMGlobalObject.h"
-#include "JSDOMOperation.h"
-#include "JSDOMWrapperCache.h"
-#include "JSMediaQueryListListener.h"
-#include "ScriptExecutionContext.h"
-#include "WebCoreJSClientData.h"
-#include <_javascript_Core/FunctionPrototype.h>
-#include <_javascript_Core/HeapAnalyzer.h>
-#include <_javascript_Core/JSCInlines.h>
-#include <_javascript_Core/JSDestructibleObjectHeapCellType.h>
-#include <_javascript_Core/SubspaceInlines.h>
-#include <wtf/GetPtr.h>
-#include <wtf/PointerPreparations.h>
-#include <wtf/URL.h>
-
-
-namespace WebCore {
-using namespace JSC;
-
-// Functions
-
-JSC::EncodedJSValue JSC_HOST_CALL jsTestMediaQueryListListenerPrototypeFunctionMethod(JSC::JSGlobalObject*, JSC::CallFrame*);
-
-// Attributes
-
-JSC::EncodedJSValue jsTestMediaQueryListListenerConstructor(JSC::JSGlobalObject*, JSC::EncodedJSValue, JSC::PropertyName);
-bool setJSTestMediaQueryListListenerConstructor(JSC::JSGlobalObject*, JSC::EncodedJSValue, JSC::EncodedJSValue);
-
-class JSTestMediaQueryListListenerPrototype final : public JSC::JSNonFinalObject {
-public:
- using Base = JSC::JSNonFinalObject;
- static JSTestMediaQueryListListenerPrototype* create(JSC::VM& vm, JSDOMGlobalObject* globalObject, JSC::Structure* structure)
- {
- JSTestMediaQueryListListenerPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestMediaQueryListListenerPrototype>(vm.heap)) JSTestMediaQueryListListenerPrototype(vm, globalObject, structure);
- ptr->finishCreation(vm);
- return ptr;
- }
-
- DECLARE_INFO;
- template<typename CellType, JSC::SubspaceAccess>
- static JSC::IsoSubspace* subspaceFor(JSC::VM& vm)
- {
- STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSTestMediaQueryListListenerPrototype, Base);
- return &vm.plainObjectSpace;
- }
- static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
- {
- return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
- }
-
-private:
- JSTestMediaQueryListListenerPrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
- : JSC::JSNonFinalObject(vm, structure)
- {
- }
-
- void finishCreation(JSC::VM&);
-};
-STATIC_ASSERT_ISO_SUBSPACE_SHARABLE(JSTestMediaQueryListListenerPrototype, JSTestMediaQueryListListenerPrototype::Base);
-
-using JSTestMediaQueryListListenerConstructor = JSDOMConstructorNotConstructable<JSTestMediaQueryListListener>;
-
-template<> JSValue JSTestMediaQueryListListenerConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
-{
- UNUSED_PARAM(vm);
- return globalObject.functionPrototype();
-}
-
-template<> void JSTestMediaQueryListListenerConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
-{
- putDirect(vm, vm.propertyNames->prototype, JSTestMediaQueryListListener::prototype(vm, globalObject), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
- putDirect(vm, vm.propertyNames->name, jsNontrivialString(vm, String("TestMediaQueryListListener"_s)), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
- putDirect(vm, vm.propertyNames->length, jsNumber(0), JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::DontEnum);
-}
-
-template<> const ClassInfo JSTestMediaQueryListListenerConstructor::s_info = { "TestMediaQueryListListener", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestMediaQueryListListenerConstructor) };
-
-/* Hash table for prototype */
-
-static const HashTableValue JSTestMediaQueryListListenerPrototypeTableValues[] =
-{
- { "constructor", static_cast<unsigned>(JSC::PropertyAttribute::DontEnum), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestMediaQueryListListenerConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestMediaQueryListListenerConstructor) } },
- { "method", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestMediaQueryListListenerPrototypeFunctionMethod), (intptr_t) (1) } },
-};
-
-const ClassInfo JSTestMediaQueryListListenerPrototype::s_info = { "TestMediaQueryListListenerPrototype", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestMediaQueryListListenerPrototype) };
-
-void JSTestMediaQueryListListenerPrototype::finishCreation(VM& vm)
-{
- Base::finishCreation(vm);
- reifyStaticProperties(vm, JSTestMediaQueryListListener::info(), JSTestMediaQueryListListenerPrototypeTableValues, *this);
-}
-
-const ClassInfo JSTestMediaQueryListListener::s_info = { "TestMediaQueryListListener", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestMediaQueryListListener) };
-
-JSTestMediaQueryListListener::JSTestMediaQueryListListener(Structure* structure, JSDOMGlobalObject& globalObject, Ref<TestMediaQueryListListener>&& impl)
- : JSDOMWrapper<TestMediaQueryListListener>(structure, globalObject, WTFMove(impl))
-{
-}
-
-void JSTestMediaQueryListListener::finishCreation(VM& vm)
-{
- Base::finishCreation(vm);
- ASSERT(inherits(vm, info()));
-
- static_assert(!std::is_base_of<ActiveDOMObject, TestMediaQueryListListener>::value, "Interface is not marked as [ActiveDOMObject] even though implementation class subclasses ActiveDOMObject.");
-
-}
-
-JSObject* JSTestMediaQueryListListener::createPrototype(VM& vm, JSDOMGlobalObject& globalObject)
-{
- return JSTestMediaQueryListListenerPrototype::create(vm, &globalObject, JSTestMediaQueryListListenerPrototype::createStructure(vm, &globalObject, globalObject.objectPrototype()));
-}
-
-JSObject* JSTestMediaQueryListListener::prototype(VM& vm, JSDOMGlobalObject& globalObject)
-{
- return getDOMPrototype<JSTestMediaQueryListListener>(vm, globalObject);
-}
-
-JSValue JSTestMediaQueryListListener::getConstructor(VM& vm, const JSGlobalObject* globalObject)
-{
- return getDOMConstructor<JSTestMediaQueryListListenerConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
-}
-
-void JSTestMediaQueryListListener::destroy(JSC::JSCell* cell)
-{
- JSTestMediaQueryListListener* thisObject = static_cast<JSTestMediaQueryListListener*>(cell);
- thisObject->JSTestMediaQueryListListener::~JSTestMediaQueryListListener();
-}
-
-template<> inline JSTestMediaQueryListListener* IDLOperation<JSTestMediaQueryListListener>::cast(JSGlobalObject& lexicalGlobalObject, CallFrame& callFrame)
-{
- return jsDynamicCast<JSTestMediaQueryListListener*>(JSC::getVM(&lexicalGlobalObject), callFrame.thisValue());
-}
-
-EncodedJSValue jsTestMediaQueryListListenerConstructor(JSGlobalObject* lexicalGlobalObject, EncodedJSValue thisValue, PropertyName)
-{
- VM& vm = JSC::getVM(lexicalGlobalObject);
- auto throwScope = DECLARE_THROW_SCOPE(vm);
- auto* prototype = jsDynamicCast<JSTestMediaQueryListListenerPrototype*>(vm, JSValue::decode(thisValue));
- if (UNLIKELY(!prototype))
- return throwVMTypeError(lexicalGlobalObject, throwScope);
- return JSValue::encode(JSTestMediaQueryListListener::getConstructor(JSC::getVM(lexicalGlobalObject), prototype->globalObject()));
-}
-
-bool setJSTestMediaQueryListListenerConstructor(JSGlobalObject* lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue)
-{
- VM& vm = JSC::getVM(lexicalGlobalObject);
- auto throwScope = DECLARE_THROW_SCOPE(vm);
- auto* prototype = jsDynamicCast<JSTestMediaQueryListListenerPrototype*>(vm, JSValue::decode(thisValue));
- if (UNLIKELY(!prototype)) {
- throwVMTypeError(lexicalGlobalObject, throwScope);
- return false;
- }
- // Shadowing a built-in constructor
- return prototype->putDirect(vm, vm.propertyNames->constructor, JSValue::decode(encodedValue));
-}
-
-static inline JSC::EncodedJSValue jsTestMediaQueryListListenerPrototypeFunctionMethodBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSTestMediaQueryListListener>::ClassParameter castedThis, JSC::ThrowScope& throwScope)
-{
- UNUSED_PARAM(lexicalGlobalObject);
- UNUSED_PARAM(callFrame);
- UNUSED_PARAM(throwScope);
- auto& impl = castedThis->wrapped();
- if (UNLIKELY(callFrame->argumentCount() < 1))
- return throwVMError(lexicalGlobalObject, throwScope, createNotEnoughArgumentsError(lexicalGlobalObject));
- EnsureStillAliveScope argument0 = callFrame->uncheckedArgument(0);
- auto listener = convert<IDLCallbackFunction<JSMediaQueryListListener>>(*lexicalGlobalObject, argument0.value(), *castedThis->globalObject(), [](JSC::JSGlobalObject& lexicalGlobalObject, JSC::ThrowScope& scope) { throwArgumentMustBeFunctionError(lexicalGlobalObject, scope, 0, "listener", "TestMediaQueryListListener", "method"); });
- RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
- impl.method(listener.releaseNonNull());
- return JSValue::encode(jsUndefined());
-}
-
-EncodedJSValue JSC_HOST_CALL jsTestMediaQueryListListenerPrototypeFunctionMethod(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame)
-{
- return IDLOperation<JSTestMediaQueryListListener>::call<jsTestMediaQueryListListenerPrototypeFunctionMethodBody>(*lexicalGlobalObject, *callFrame, "method");
-}
-
-JSC::IsoSubspace* JSTestMediaQueryListListener::subspaceForImpl(JSC::VM& vm)
-{
- auto& clientData = *static_cast<JSVMClientData*>(vm.clientData);
- auto& spaces = clientData.subspaces();
- if (auto* space = spaces.m_subspaceForTestMediaQueryListListener.get())
- return space;
- static_assert(std::is_base_of_v<JSC::JSDestructibleObject, JSTestMediaQueryListListener> || !JSTestMediaQueryListListener::needsDestruction);
- if constexpr (std::is_base_of_v<JSC::JSDestructibleObject, JSTestMediaQueryListListener>)
- spaces.m_subspaceForTestMediaQueryListListener = makeUnique<IsoSubspace> ISO_SUBSPACE_INIT(vm.heap, vm.destructibleObjectHeapCellType.get(), JSTestMediaQueryListListener);
- else
- spaces.m_subspaceForTestMediaQueryListListener = makeUnique<IsoSubspace> ISO_SUBSPACE_INIT(vm.heap, vm.cellHeapCellType.get(), JSTestMediaQueryListListener);
- auto* space = spaces.m_subspaceForTestMediaQueryListListener.get();
-IGNORE_WARNINGS_BEGIN("unreachable-code")
-IGNORE_WARNINGS_BEGIN("tautological-compare")
- if (&JSTestMediaQueryListListener::visitOutputConstraints != &JSC::JSCell::visitOutputConstraints)
- clientData.outputConstraintSpaces().append(space);
-IGNORE_WARNINGS_END
-IGNORE_WARNINGS_END
- return space;
-}
-
-void JSTestMediaQueryListListener::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer)
-{
- auto* thisObject = jsCast<JSTestMediaQueryListListener*>(cell);
- analyzer.setWrappedObjectForCell(cell, &thisObject->wrapped());
- if (thisObject->scriptExecutionContext())
- analyzer.setLabelForCell(cell, "url " + thisObject->scriptExecutionContext()->url().string());
- Base::analyzeHeap(cell, analyzer);
-}
-
-bool JSTestMediaQueryListListenerOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor, const char** reason)
-{
- UNUSED_PARAM(handle);
- UNUSED_PARAM(visitor);
- UNUSED_PARAM(reason);
- return false;
-}
-
-void JSTestMediaQueryListListenerOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
-{
- auto* jsTestMediaQueryListListener = static_cast<JSTestMediaQueryListListener*>(handle.slot()->asCell());
- auto& world = *static_cast<DOMWrapperWorld*>(context);
- uncacheWrapper(world, &jsTestMediaQueryListListener->wrapped(), jsTestMediaQueryListListener);
-}
-
-#if ENABLE(BINDING_INTEGRITY)
-#if PLATFORM(WIN)
-#pragma warning(disable: 4483)
-extern "C" { extern void (*const __identifier("??_7TestMediaQueryListListener@WebCore@@6B@")[])(); }
-#else
-extern "C" { extern void* _ZTVN7WebCore26TestMediaQueryListListenerE[]; }
-#endif
-#endif
-
-JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject* globalObject, Ref<TestMediaQueryListListener>&& impl)
-{
-
-#if ENABLE(BINDING_INTEGRITY)
- const void* actualVTablePointer = getVTablePointer(impl.ptr());
-#if PLATFORM(WIN)
- void* expectedVTablePointer = __identifier("??_7TestMediaQueryListListener@WebCore@@6B@");
-#else
- void* expectedVTablePointer = &_ZTVN7WebCore26TestMediaQueryListListenerE[2];
-#endif
-
- // If this fails TestMediaQueryListListener does not have a vtable, so you need to add the
- // ImplementationLacksVTable attribute to the interface definition
- static_assert(std::is_polymorphic<TestMediaQueryListListener>::value, "TestMediaQueryListListener is not polymorphic");
-
- // If you hit this assertion you either have a use after free bug, or
- // TestMediaQueryListListener has subclasses. If TestMediaQueryListListener has subclasses that get passed
- // to toJS() we currently require TestMediaQueryListListener you to opt out of binding hardening
- // by adding the SkipVTableValidation attribute to the interface IDL definition
- RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
-#endif
- return createWrapper<TestMediaQueryListListener>(globalObject, WTFMove(impl));
-}
-
-JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, TestMediaQueryListListener& impl)
-{
- return wrap(lexicalGlobalObject, globalObject, impl);
-}
-
-TestMediaQueryListListener* JSTestMediaQueryListListener::toWrapped(JSC::VM& vm, JSC::JSValue value)
-{
- if (auto* wrapper = jsDynamicCast<JSTestMediaQueryListListener*>(vm, value))
- return &wrapper->wrapped();
- return nullptr;
-}
-
-}
Deleted: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.h (260242 => 260243)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.h 2020-04-17 09:35:49 UTC (rev 260242)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.h 2020-04-17 10:16:36 UTC (rev 260243)
@@ -1,93 +0,0 @@
-/*
- This file is part of the WebKit open source project.
- This file has been generated by generate-bindings.pl. DO NOT MODIFY!
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#pragma once
-
-#include "JSDOMWrapper.h"
-#include "TestMediaQueryListListener.h"
-#include <wtf/NeverDestroyed.h>
-
-namespace WebCore {
-
-class JSTestMediaQueryListListener : public JSDOMWrapper<TestMediaQueryListListener> {
-public:
- using Base = JSDOMWrapper<TestMediaQueryListListener>;
- static JSTestMediaQueryListListener* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<TestMediaQueryListListener>&& impl)
- {
- JSTestMediaQueryListListener* ptr = new (NotNull, JSC::allocateCell<JSTestMediaQueryListListener>(globalObject->vm().heap)) JSTestMediaQueryListListener(structure, *globalObject, WTFMove(impl));
- ptr->finishCreation(globalObject->vm());
- return ptr;
- }
-
- static JSC::JSObject* createPrototype(JSC::VM&, JSDOMGlobalObject&);
- static JSC::JSObject* prototype(JSC::VM&, JSDOMGlobalObject&);
- static TestMediaQueryListListener* toWrapped(JSC::VM&, JSC::JSValue);
- static void destroy(JSC::JSCell*);
-
- DECLARE_INFO;
-
- static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
- {
- return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info(), JSC::NonArray);
- }
-
- static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
- template<typename, JSC::SubspaceAccess mode> static JSC::IsoSubspace* subspaceFor(JSC::VM& vm)
- {
- if constexpr (mode == JSC::SubspaceAccess::Concurrently)
- return nullptr;
- return subspaceForImpl(vm);
- }
- static JSC::IsoSubspace* subspaceForImpl(JSC::VM& vm);
- static void analyzeHeap(JSCell*, JSC::HeapAnalyzer&);
-protected:
- JSTestMediaQueryListListener(JSC::Structure*, JSDOMGlobalObject&, Ref<TestMediaQueryListListener>&&);
-
- void finishCreation(JSC::VM&);
-};
-
-class JSTestMediaQueryListListenerOwner : public JSC::WeakHandleOwner {
-public:
- virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&, const char**);
- virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
-};
-
-inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestMediaQueryListListener*)
-{
- static NeverDestroyed<JSTestMediaQueryListListenerOwner> owner;
- return &owner.get();
-}
-
-inline void* wrapperKey(TestMediaQueryListListener* wrappableObject)
-{
- return wrappableObject;
-}
-
-JSC::JSValue toJS(JSC::JSGlobalObject*, JSDOMGlobalObject*, TestMediaQueryListListener&);
-inline JSC::JSValue toJS(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, TestMediaQueryListListener* impl) { return impl ? toJS(lexicalGlobalObject, globalObject, *impl) : JSC::jsNull(); }
-JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject*, JSDOMGlobalObject*, Ref<TestMediaQueryListListener>&&);
-inline JSC::JSValue toJSNewlyCreated(JSC::JSGlobalObject* lexicalGlobalObject, JSDOMGlobalObject* globalObject, RefPtr<TestMediaQueryListListener>&& impl) { return impl ? toJSNewlyCreated(lexicalGlobalObject, globalObject, impl.releaseNonNull()) : JSC::jsNull(); }
-
-template<> struct JSDOMWrapperConverterTraits<TestMediaQueryListListener> {
- using WrapperClass = JSTestMediaQueryListListener;
- using ToWrappedReturnType = TestMediaQueryListListener*;
-};
-
-} // namespace WebCore
Deleted: trunk/Source/WebCore/bindings/scripts/test/TestMediaQueryListListener.idl (260242 => 260243)
--- trunk/Source/WebCore/bindings/scripts/test/TestMediaQueryListListener.idl 2020-04-17 09:35:49 UTC (rev 260242)
+++ trunk/Source/WebCore/bindings/scripts/test/TestMediaQueryListListener.idl 2020-04-17 10:16:36 UTC (rev 260243)
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-// This IDL file is for testing the bindings code generator with an interface
-// that has methods receiving a parameter of the type MediaQueryListListener.
-interface TestMediaQueryListListener {
- void method(MediaQueryListListener listener);
-};
Modified: trunk/Source/WebCore/css/MediaQueryList.cpp (260242 => 260243)
--- trunk/Source/WebCore/css/MediaQueryList.cpp 2020-04-17 09:35:49 UTC (rev 260242)
+++ trunk/Source/WebCore/css/MediaQueryList.cpp 2020-04-17 10:16:36 UTC (rev 260243)
@@ -20,28 +20,33 @@
#include "config.h"
#include "MediaQueryList.h"
-#include "MediaList.h"
-#include "MediaQueryEvaluator.h"
-#include "MediaQueryListListener.h"
-#include "MediaQueryMatcher.h"
+#include "EventNames.h"
+#include <wtf/IsoMallocInlines.h>
namespace WebCore {
-inline MediaQueryList::MediaQueryList(MediaQueryMatcher& matcher, Ref<MediaQuerySet>&& media, bool matches)
- : m_matcher(matcher)
+WTF_MAKE_ISO_ALLOCATED_IMPL(MediaQueryList);
+
+MediaQueryList::MediaQueryList(Document& document, MediaQueryMatcher& matcher, Ref<MediaQuerySet>&& media, bool matches)
+ : ContextDestructionObserver(&document)
+ , m_matcher(matcher)
, m_media(WTFMove(media))
, m_evaluationRound(m_matcher->evaluationRound())
, m_changeRound(m_evaluationRound - 1) // Any value that is not the same as m_evaluationRound would do.
, m_matches(matches)
{
+ m_matcher->addMediaQueryList(*this);
}
-Ref<MediaQueryList> MediaQueryList::create(MediaQueryMatcher& matcher, Ref<MediaQuerySet>&& media, bool matches)
+Ref<MediaQueryList> MediaQueryList::create(Document& document, MediaQueryMatcher& matcher, Ref<MediaQuerySet>&& media, bool matches)
{
- return adoptRef(*new MediaQueryList(matcher, WTFMove(media), matches));
+ return adoptRef(*new MediaQueryList(document, matcher, WTFMove(media), matches));
}
-MediaQueryList::~MediaQueryList() = default;
+MediaQueryList::~MediaQueryList()
+{
+ m_matcher->removeMediaQueryList(*this);
+}
String MediaQueryList::media() const
{
@@ -48,20 +53,20 @@
return m_media->mediaText();
}
-void MediaQueryList::addListener(RefPtr<MediaQueryListListener>&& listener)
+void MediaQueryList::addListener(RefPtr<EventListener>&& listener)
{
if (!listener)
return;
- m_matcher->addListener(listener.releaseNonNull(), *this);
+ addEventListener(eventNames().changeEvent, listener.releaseNonNull());
}
-void MediaQueryList::removeListener(RefPtr<MediaQueryListListener>&& listener)
+void MediaQueryList::removeListener(RefPtr<EventListener>&& listener)
{
if (!listener)
return;
- m_matcher->removeListener(*listener, *this);
+ removeEventListener(eventNames().changeEvent, *listener);
}
void MediaQueryList::evaluate(MediaQueryEvaluator& evaluator, bool& notificationNeeded)
Modified: trunk/Source/WebCore/css/MediaQueryList.h (260242 => 260243)
--- trunk/Source/WebCore/css/MediaQueryList.h 2020-04-17 09:35:49 UTC (rev 260242)
+++ trunk/Source/WebCore/css/MediaQueryList.h 2020-04-17 10:16:36 UTC (rev 260243)
@@ -19,40 +19,46 @@
#pragma once
-#include <wtf/Forward.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
+#include "ContextDestructionObserver.h"
+#include "EventTarget.h"
+#include "MediaList.h"
+#include "MediaQueryEvaluator.h"
+#include "MediaQueryMatcher.h"
namespace WebCore {
-class MediaQueryListListener;
-class MediaQueryEvaluator;
-class MediaQueryMatcher;
-class MediaQuerySet;
-
-// MediaQueryList interface is specified at http://dev.w3.org/csswg/cssom-view/#the-mediaquerylist-interface
+// MediaQueryList interface is specified at https://drafts.csswg.org/cssom-view/#the-mediaquerylist-interface
// The objects of this class are returned by window.matchMedia. They may be used to
// retrieve the current value of the given media query and to add/remove listeners that
// will be called whenever the value of the query changes.
-class MediaQueryList final : public RefCounted<MediaQueryList> {
+class MediaQueryList final : public RefCounted<MediaQueryList>, public EventTargetWithInlineData, public CanMakeWeakPtr<MediaQueryList>, private ContextDestructionObserver {
+ WTF_MAKE_ISO_ALLOCATED(MediaQueryList);
public:
- static Ref<MediaQueryList> create(MediaQueryMatcher&, Ref<MediaQuerySet>&&, bool);
+ static Ref<MediaQueryList> create(Document&, MediaQueryMatcher&, Ref<MediaQuerySet>&&, bool matches);
~MediaQueryList();
String media() const;
bool matches();
- void addListener(RefPtr<MediaQueryListListener>&&);
- void removeListener(RefPtr<MediaQueryListListener>&&);
+ void addListener(RefPtr<EventListener>&&);
+ void removeListener(RefPtr<EventListener>&&);
void evaluate(MediaQueryEvaluator&, bool& notificationNeeded);
+ using RefCounted::ref;
+ using RefCounted::deref;
+
private:
- MediaQueryList(MediaQueryMatcher&, Ref<MediaQuerySet>&&, bool matches);
+ MediaQueryList(Document&, MediaQueryMatcher&, Ref<MediaQuerySet>&&, bool matches);
void setMatches(bool);
+ EventTargetInterface eventTargetInterface() const final { return MediaQueryListEventTargetInterfaceType; }
+ ScriptExecutionContext* scriptExecutionContext() const final { return ContextDestructionObserver::scriptExecutionContext(); }
+ void refEventTarget() final { ref(); }
+ void derefEventTarget() final { deref(); }
+
Ref<MediaQueryMatcher> m_matcher;
Ref<MediaQuerySet> m_media;
unsigned m_evaluationRound; // Indicates if the query has been evaluated after the last style selector change.
Modified: trunk/Source/WebCore/css/MediaQueryList.idl (260242 => 260243)
--- trunk/Source/WebCore/css/MediaQueryList.idl 2020-04-17 09:35:49 UTC (rev 260242)
+++ trunk/Source/WebCore/css/MediaQueryList.idl 2020-04-17 10:16:36 UTC (rev 260243)
@@ -17,13 +17,12 @@
* Boston, MA 02110-1301, USA.
*/
[
- NoInterfaceObject,
- ImplementationLacksVTable,
-] interface MediaQueryList {
+ Exposed=Window
+] interface MediaQueryList : EventTarget {
readonly attribute DOMString media;
readonly attribute boolean matches;
- // FIXME: The listener parameter should not be optional.
- void addListener(optional MediaQueryListListener? listener = null);
- void removeListener(optional MediaQueryListListener? listener = null);
+ void addListener(EventListener? listener);
+ void removeListener(EventListener? listener);
+ attribute EventHandler onchange;
};
Added: trunk/Source/WebCore/css/MediaQueryListEvent.cpp (0 => 260243)
--- trunk/Source/WebCore/css/MediaQueryListEvent.cpp (rev 0)
+++ trunk/Source/WebCore/css/MediaQueryListEvent.cpp 2020-04-17 10:16:36 UTC (rev 260243)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2020 Alexey Shvayka <[email protected]>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "MediaQueryListEvent.h"
+
+namespace WebCore {
+
+WTF_MAKE_ISO_ALLOCATED_IMPL(MediaQueryListEvent);
+
+MediaQueryListEvent::MediaQueryListEvent(const AtomString& type, const String& media, bool matches)
+ : Event(type, CanBubble::No, IsCancelable::No)
+ , m_media(media)
+ , m_matches(matches)
+{
+}
+
+MediaQueryListEvent::MediaQueryListEvent(const AtomString& type, const Init& init, IsTrusted isTrusted)
+ : Event(type, init, isTrusted)
+ , m_media(init.media)
+ , m_matches(init.matches)
+{
+}
+
+Ref<MediaQueryListEvent> MediaQueryListEvent::create(const AtomString& type, const String& media, bool matches)
+{
+ return adoptRef(*new MediaQueryListEvent(type, media, matches));
+}
+
+Ref<MediaQueryListEvent> MediaQueryListEvent::create(const AtomString& type, const Init& init, IsTrusted isTrusted)
+{
+ return adoptRef(*new MediaQueryListEvent(type, init, isTrusted));
+}
+
+} // namespace WebCore
Added: trunk/Source/WebCore/css/MediaQueryListEvent.h (0 => 260243)
--- trunk/Source/WebCore/css/MediaQueryListEvent.h (rev 0)
+++ trunk/Source/WebCore/css/MediaQueryListEvent.h 2020-04-17 10:16:36 UTC (rev 260243)
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2020 Alexey Shvayka <[email protected]>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "Event.h"
+
+namespace WebCore {
+
+class MediaQueryListEvent final : public Event {
+ WTF_MAKE_ISO_ALLOCATED(MediaQueryListEvent);
+public:
+ struct Init : EventInit {
+ String media;
+ bool matches { false };
+ };
+
+ static Ref<MediaQueryListEvent> create(const AtomString& type, const String& media, bool matches);
+ static Ref<MediaQueryListEvent> create(const AtomString& type, const Init&, IsTrusted = IsTrusted::No);
+
+ const String& media() const { return m_media; }
+ bool matches() const { return m_matches; }
+
+ EventInterface eventInterface() const final { return MediaQueryListEventInterfaceType; }
+
+private:
+ MediaQueryListEvent(const AtomString& type, const String& media, bool matches);
+ MediaQueryListEvent(const AtomString& type, const Init&, IsTrusted);
+
+ String m_media;
+ bool m_matches;
+};
+
+} // namespace WebCore
Added: trunk/Source/WebCore/css/MediaQueryListEvent.idl (0 => 260243)
--- trunk/Source/WebCore/css/MediaQueryListEvent.idl (rev 0)
+++ trunk/Source/WebCore/css/MediaQueryListEvent.idl 2020-04-17 10:16:36 UTC (rev 260243)
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2020 Alexey Shvayka <[email protected]>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+ Constructor(DOMString type, optional MediaQueryListEventInit mediaQueryListEventInit),
+] interface MediaQueryListEvent : Event {
+ readonly attribute DOMString media;
+ readonly attribute boolean matches;
+};
+
+dictionary MediaQueryListEventInit : EventInit {
+ DOMString media = "";
+ boolean matches = false;
+};
Deleted: trunk/Source/WebCore/css/MediaQueryListListener.h (260242 => 260243)
--- trunk/Source/WebCore/css/MediaQueryListListener.h 2020-04-17 09:35:49 UTC (rev 260242)
+++ trunk/Source/WebCore/css/MediaQueryListListener.h 2020-04-17 10:16:36 UTC (rev 260243)
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#pragma once
-
-#include "ActiveDOMCallback.h"
-#include "CallbackResult.h"
-#include <wtf/RefCounted.h>
-
-namespace WebCore {
-
-class MediaQueryList;
-
-class MediaQueryListListener : public RefCounted<MediaQueryListListener>, public ActiveDOMCallback {
-public:
- enum Type {
- JSMediaQueryListListenerType
- };
-
- virtual CallbackResult<void> handleEvent(MediaQueryList&) = 0;
- virtual bool operator==(const MediaQueryListListener&) const = 0;
-
- Type type() const { return m_type; }
-
-protected:
- explicit MediaQueryListListener(ScriptExecutionContext* context, Type type)
- : ActiveDOMCallback(context)
- , m_type(type)
- {
- }
-
-private:
- Type m_type;
-};
-
-} // namespace WebCore
Deleted: trunk/Source/WebCore/css/MediaQueryListListener.idl (260242 => 260243)
--- trunk/Source/WebCore/css/MediaQueryListListener.idl 2020-04-17 09:35:49 UTC (rev 260242)
+++ trunk/Source/WebCore/css/MediaQueryListListener.idl 2020-04-17 10:16:36 UTC (rev 260243)
@@ -1,23 +0,0 @@
-/*
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-[
- CallbackNeedsOperatorEqual
-] callback MediaQueryListListener = void (MediaQueryList list);
-
Modified: trunk/Source/WebCore/css/MediaQueryMatcher.cpp (260242 => 260243)
--- trunk/Source/WebCore/css/MediaQueryMatcher.cpp 2020-04-17 09:35:49 UTC (rev 260242)
+++ trunk/Source/WebCore/css/MediaQueryMatcher.cpp 2020-04-17 10:16:36 UTC (rev 260243)
@@ -21,6 +21,7 @@
#include "MediaQueryMatcher.h"
#include "Document.h"
+#include "EventNames.h"
#include "Frame.h"
#include "FrameView.h"
#include "Logging.h"
@@ -27,7 +28,6 @@
#include "MediaList.h"
#include "MediaQueryEvaluator.h"
#include "MediaQueryList.h"
-#include "MediaQueryListListener.h"
#include "MediaQueryParserContext.h"
#include "NodeRenderStyle.h"
#include "RenderElement.h"
@@ -46,8 +46,8 @@
void MediaQueryMatcher::documentDestroyed()
{
- m_listeners.clear();
m_document = nullptr;
+ m_mediaQueryLists.clear();
}
String MediaQueryMatcher::mediaType() const
@@ -78,6 +78,17 @@
return MediaQueryEvaluator { mediaType(), *m_document, style.get() }.evaluate(media);
}
+void MediaQueryMatcher::addMediaQueryList(MediaQueryList& list)
+{
+ ASSERT(!m_mediaQueryLists.contains(&list));
+ m_mediaQueryLists.append(makeWeakPtr(&list));
+}
+
+void MediaQueryMatcher::removeMediaQueryList(MediaQueryList& list)
+{
+ m_mediaQueryLists.removeFirst(&list);
+}
+
RefPtr<MediaQueryList> MediaQueryMatcher::matchMedia(const String& query)
{
if (!m_document)
@@ -85,30 +96,10 @@
auto media = MediaQuerySet::create(query, MediaQueryParserContext(*m_document));
reportMediaQueryWarningIfNeeded(m_document.get(), media.ptr());
- bool result = evaluate(media.get());
- return MediaQueryList::create(*this, WTFMove(media), result);
+ bool matches = evaluate(media.get());
+ return MediaQueryList::create(*m_document, *this, WTFMove(media), matches);
}
-void MediaQueryMatcher::addListener(Ref<MediaQueryListListener>&& listener, MediaQueryList& query)
-{
- if (!m_document)
- return;
-
- for (auto& existingListener : m_listeners) {
- if (existingListener.listener.get() == listener.get() && existingListener.query.ptr() == &query)
- return;
- }
-
- m_listeners.append(Listener { WTFMove(listener), query });
-}
-
-void MediaQueryMatcher::removeListener(MediaQueryListListener& listener, MediaQueryList& query)
-{
- m_listeners.removeFirstMatching([&listener, &query](auto& existingListener) {
- return existingListener.listener.get() == listener && existingListener.query.ptr() == &query;
- });
-}
-
void MediaQueryMatcher::evaluateAll()
{
ASSERT(m_document);
@@ -122,15 +113,13 @@
LOG_WITH_STREAM(MediaQueries, stream << "MediaQueryMatcher::styleResolverChanged " << m_document->url());
MediaQueryEvaluator evaluator { mediaType(), *m_document, style.get() };
- Vector<Listener> listeners;
- listeners.reserveInitialCapacity(m_listeners.size());
- for (auto& listener : m_listeners)
- listeners.uncheckedAppend({ listener.listener.copyRef(), listener.query.copyRef() });
- for (auto& listener : listeners) {
+ for (auto& list : m_mediaQueryLists) {
+ if (!list)
+ continue;
bool notify;
- listener.query->evaluate(evaluator, notify);
+ list->evaluate(evaluator, notify);
if (notify)
- listener.listener->handleEvent(listener.query);
+ list->dispatchEvent(MediaQueryListEvent::create(eventNames().changeEvent, list->media(), list->matches()));
}
}
Modified: trunk/Source/WebCore/css/MediaQueryMatcher.h (260242 => 260243)
--- trunk/Source/WebCore/css/MediaQueryMatcher.h 2020-04-17 09:35:49 UTC (rev 260242)
+++ trunk/Source/WebCore/css/MediaQueryMatcher.h 2020-04-17 10:16:36 UTC (rev 260243)
@@ -29,15 +29,13 @@
class Document;
class MediaQueryList;
-class MediaQueryListListener;
class MediaQueryEvaluator;
class MediaQuerySet;
class RenderStyle;
-// MediaQueryMatcher class is responsible for keeping a vector of pairs
-// MediaQueryList x MediaQueryListListener. It is responsible for evaluating the queries
-// whenever it is needed and to call the listeners if the corresponding query has changed.
-// The listeners must be called in the order in which they were added.
+// MediaQueryMatcher class is responsible for evaluating the queries whenever it
+// is needed and dispatch "change" event on MediaQueryLists if the corresponding
+// query has changed. MediaQueryLists are invoked in the order in which they were added.
class MediaQueryMatcher final : public RefCounted<MediaQueryMatcher> {
public:
@@ -45,10 +43,9 @@
~MediaQueryMatcher();
void documentDestroyed();
+ void addMediaQueryList(MediaQueryList&);
+ void removeMediaQueryList(MediaQueryList&);
- void addListener(Ref<MediaQueryListListener>&&, MediaQueryList&);
- void removeListener(MediaQueryListListener&, MediaQueryList&);
-
RefPtr<MediaQueryList> matchMedia(const String&);
unsigned evaluationRound() const { return m_evaluationRound; }
@@ -58,17 +55,12 @@
bool evaluate(const MediaQuerySet&);
private:
- struct Listener {
- Ref<MediaQueryListListener> listener;
- Ref<MediaQueryList> query;
- };
-
explicit MediaQueryMatcher(Document&);
std::unique_ptr<RenderStyle> documentElementUserAgentStyle() const;
String mediaType() const;
WeakPtr<Document> m_document;
- Vector<Listener> m_listeners;
+ Vector<WeakPtr<MediaQueryList>> m_mediaQueryLists;
// This value is incremented at style selector changes.
// It is used to avoid evaluating queries more then once and to make sure
Modified: trunk/Source/WebCore/dom/EventNames.in (260242 => 260243)
--- trunk/Source/WebCore/dom/EventNames.in 2020-04-17 09:35:49 UTC (rev 260242)
+++ trunk/Source/WebCore/dom/EventNames.in 2020-04-17 10:16:36 UTC (rev 260243)
@@ -24,6 +24,7 @@
InputEvents interfaceName=InputEvent
KeyboardEvent
KeyboardEvents interfaceName=KeyboardEvent
+MediaQueryListEvent
MessageEvent
MouseEvent
MouseEvents interfaceName=MouseEvent
Modified: trunk/Source/WebCore/dom/EventTarget.h (260242 => 260243)
--- trunk/Source/WebCore/dom/EventTarget.h 2020-04-17 09:35:49 UTC (rev 260242)
+++ trunk/Source/WebCore/dom/EventTarget.h 2020-04-17 10:16:36 UTC (rev 260243)
@@ -91,7 +91,7 @@
WEBCORE_EXPORT ExceptionOr<bool> dispatchEventForBindings(Event&);
WEBCORE_EXPORT virtual bool addEventListener(const AtomString& eventType, Ref<EventListener>&&, const AddEventListenerOptions& = { });
- virtual bool removeEventListener(const AtomString& eventType, EventListener&, const ListenerOptions&);
+ virtual bool removeEventListener(const AtomString& eventType, EventListener&, const ListenerOptions& = { });
virtual void removeAllEventListeners();
virtual void dispatchEvent(Event&);
Modified: trunk/Source/WebCore/dom/EventTargetFactory.in (260242 => 260243)
--- trunk/Source/WebCore/dom/EventTargetFactory.in 2020-04-17 09:35:49 UTC (rev 260242)
+++ trunk/Source/WebCore/dom/EventTargetFactory.in 2020-04-17 10:16:36 UTC (rev 260243)
@@ -21,6 +21,7 @@
MediaController conditional=VIDEO
MediaDevices conditional=MEDIA_STREAM
MediaKeySession conditional=ENCRYPTED_MEDIA
+MediaQueryList
MediaRemoteControls conditional=MEDIA_SESSION
MediaRecorder conditional=MEDIA_STREAM
MediaSource conditional=MEDIA_SOURCE
Modified: trunk/Source/WebInspectorUI/ChangeLog (260242 => 260243)
--- trunk/Source/WebInspectorUI/ChangeLog 2020-04-17 09:35:49 UTC (rev 260242)
+++ trunk/Source/WebInspectorUI/ChangeLog 2020-04-17 10:16:36 UTC (rev 260243)
@@ -1,3 +1,12 @@
+2020-04-17 Alexey Shvayka <[email protected]>
+
+ MediaQueryList should extend EventTarget
+ https://bugs.webkit.org/show_bug.cgi?id=203288
+
+ Reviewed by Darin Adler.
+
+ * UserInterface/Models/NativeFunctionParameters.js:
+
2020-04-14 Devin Rousso <[email protected]>
Web Inspector: Debugger: add a Step next that steps by _expression_
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js (260242 => 260243)
--- trunk/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js 2020-04-17 09:35:49 UTC (rev 260242)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/NativeFunctionParameters.js 2020-04-17 10:16:36 UTC (rev 260243)
@@ -1095,11 +1095,6 @@
__proto__: null,
},
- MediaQueryListListener: {
- queryChanged: "[list]",
- __proto__: null,
- },
-
MediaSource: {
addSourceBuffer: "type",
endOfStream: "[error]",