haikuwebkit/LayoutTests/fast/media/media-query-list-07-expecte...

11 lines
353 B
Plaintext
Raw Permalink Normal View History

2010-10-21 Luiz Agostini <luiz.agostini@openbossa.org> Reviewed by Darin Adler. Implement CSSOM View matchMedia interface https://bugs.webkit.org/show_bug.cgi?id=37205 New property matchMedia was added to window. * fast/dom/Window/window-properties-expected.txt: * fast/dom/Window/window-property-descriptors-expected.txt: window.matchMedia and MediaQueryList tests. * fast/media/media-query-list-01-expected.txt: Added. * fast/media/media-query-list-01.html: Added. The following tests depend on LayoutTestController::setViewModeMediaFeature() to work. As it is only implemented by Qt and Gtk the tests needed to be skipped in all other platforms. * fast/media/media-query-list-02-expected.txt: Added. * fast/media/media-query-list-02.html: Added. * fast/media/media-query-list-03-expected.txt: Added. * fast/media/media-query-list-03.html: Added. * fast/media/media-query-list-04-expected.txt: Added. * fast/media/media-query-list-04.html: Added. * fast/media/media-query-list-05-expected.txt: Added. * fast/media/media-query-list-05.html: Added. * fast/media/media-query-list-06-expected.txt: Added. * fast/media/media-query-list-06.html: Added. * fast/media/media-query-list-07-expected.txt: Added. * fast/media/media-query-list-07.html: Added. * platform/chromium/test_expectations.txt: * platform/mac/Skipped: * platform/win/Skipped: 2010-10-21 Luiz Agostini <luiz.agostini@openbossa.org> Reviewed by Darin Adler. Implement CSSOM View matchMedia interface https://bugs.webkit.org/show_bug.cgi?id=37205 New interfaces may be used to evaluate media queries and to associate listeners to media queries. Those listeners are called whenever the associated query changes. Specification may be found at http://dev.w3.org/csswg/cssom-view/#the-mediaquerylist-interface operator== added to JS version of ScriptValue. Method isFunction added to JS and V8 versions of ScriptValue. * bindings/js/ScriptValue.cpp: (WebCore::ScriptValue::isFunction): * bindings/js/ScriptValue.h: (WebCore::ScriptValue::operator==): * bindings/v8/ScriptValue.h: (WebCore::ScriptValue::isFunction): Some changes were needed to the code generators to handle type MediaQueryListListener. * bindings/scripts/CodeGeneratorGObject.pm: * bindings/scripts/CodeGeneratorJS.pm: * bindings/scripts/CodeGeneratorV8.pm: Some changes to the bindings test results that were previously added. * bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.cpp: * bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.h: * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: (WebCore::jsTestMediaQueryListListenerPrototypeFunctionMethod): * bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp: (WebCore::TestMediaQueryListListenerInternal::methodCallback): (WebCore::ConfigureV8TestMediaQueryListListenerTemplate): New interfaces: * css/MediaQueryList.cpp: Added. * css/MediaQueryList.h: Added. * css/MediaQueryList.idl: Added. * css/MediaQueryListListener.cpp: Added. * css/MediaQueryListListener.h: Added. * css/MediaQueryListListener.idl: Added. To avoid adding code to classes DOMWindow and Document a new class MediaQueryMatcher was created. * css/MediaQueryMatcher.cpp: Added. * css/MediaQueryMatcher.h: Added. Document and DOMWindow have changed to support new features. DOMWindow is the class that publishes methods matchMedia but for page cache to work properly the reference to the MediaQueryMatcher must be in Document. * dom/Document.cpp: (WebCore::Document::~Document): (WebCore::Document::mediaQueryMatcher): (WebCore::Document::styleSelectorChanged): * dom/Document.h: * page/DOMWindow.cpp: (WebCore::DOMWindow::matchMedia): * page/DOMWindow.h: * page/DOMWindow.idl: Build systems * CMakeLists.txt: * DerivedSources.make: * GNUmakefile.am: * WebCore.gypi: * WebCore.pri: * WebCore.pro: * WebCore.vcproj/WebCore.vcproj: * WebCore.xcodeproj/project.pbxproj: * bindings/gobject/GNUmakefile.am: Tests: fast/media/media-query-list-01.html fast/media/media-query-list-02.html fast/media/media-query-list-03.html fast/media/media-query-list-04.html fast/media/media-query-list-05.html fast/media/media-query-list-06.html fast/media/media-query-list-07.html Canonical link: https://commits.webkit.org/63014@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@72552 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-11-22 21:02:27 +00:00
Test the MediaQueryList interface: http://dev.w3.org/csswg/cssom-view/#the-mediaquerylist-interface.
Invalid listeners. Two callbacks are expected.
MediaQueryList should extend EventTarget https://bugs.webkit.org/show_bug.cgi?id=203288 Reviewed by Darin Adler. LayoutTests/imported/w3c: * 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: Source/WebCore: 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: Source/WebInspectorUI: * UserInterface/Models/NativeFunctionParameters.js: LayoutTests: * TestExpectations: * fast/media/media-query-list-07-expected.txt: * fast/media/media-query-list-07.html: Canonical link: https://commits.webkit.org/223516@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@260243 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-04-17 10:16:36 +00:00
EventListener is optional
[Re-land] Cleanup MediaQueryListListener https://bugs.webkit.org/show_bug.cgi?id=119664 Reviewed by Andreas Kling. Source/WebCore: Make MediaQueryListListener a proper WebIDL callback. * CMakeLists.txt: * DerivedSources.cpp: * DerivedSources.make: * DerivedSources.pri: * GNUmakefile.list.am: * Target.pri: * WebCore.vcxproj/WebCore.vcxproj: * WebCore.vcxproj/WebCore.vcxproj.filters: * WebCore.xcodeproj/project.pbxproj: Update project files. * bindings/scripts/CodeGeneratorJS.pm: (GenerateCallbackHeader): (GenerateCallbackImplementation): (JSValueToNative): * bindings/scripts/IDLAttributes.txt: Add support for CallbackNeedsOperatorEqual, which adds an operator==. * css/MediaAllInOne.cpp: Remove MediaQueryListListener.cpp. * css/MediaQueryListListener.cpp: Removed. * css/MediaQueryListListener.h: (WebCore::MediaQueryListListener::~MediaQueryListListener): (WebCore::MediaQueryListListener::MediaQueryListListener): * css/MediaQueryListListener.idl: Convert to a proper WebIDL callback. * css/MediaQueryMatcher.cpp: (WebCore::MediaQueryMatcher::Listener::evaluate): (WebCore::MediaQueryMatcher::styleResolverChanged): * css/MediaQueryMatcher.h: Remove all traces of the ScriptState. LayoutTests: * fast/media/media-query-list-07-expected.txt: * fast/media/media-query-list-07.html: * platform/mac/TestExpectations: Update test to reflect that we are supposed to throw exceptions when when not passing a callback object to addListener/removeListener. Also update the test to use the internals interface that is supported by more ports. Canonical link: https://commits.webkit.org/137724@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@154035 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-08-14 01:21:38 +00:00
query.addListener(5) threw exception as expected
query.addListener('cinco') threw exception as expected
[1] - query screen changed to false
[2] - query screen changed to false
2010-10-21 Luiz Agostini <luiz.agostini@openbossa.org> Reviewed by Darin Adler. Implement CSSOM View matchMedia interface https://bugs.webkit.org/show_bug.cgi?id=37205 New property matchMedia was added to window. * fast/dom/Window/window-properties-expected.txt: * fast/dom/Window/window-property-descriptors-expected.txt: window.matchMedia and MediaQueryList tests. * fast/media/media-query-list-01-expected.txt: Added. * fast/media/media-query-list-01.html: Added. The following tests depend on LayoutTestController::setViewModeMediaFeature() to work. As it is only implemented by Qt and Gtk the tests needed to be skipped in all other platforms. * fast/media/media-query-list-02-expected.txt: Added. * fast/media/media-query-list-02.html: Added. * fast/media/media-query-list-03-expected.txt: Added. * fast/media/media-query-list-03.html: Added. * fast/media/media-query-list-04-expected.txt: Added. * fast/media/media-query-list-04.html: Added. * fast/media/media-query-list-05-expected.txt: Added. * fast/media/media-query-list-05.html: Added. * fast/media/media-query-list-06-expected.txt: Added. * fast/media/media-query-list-06.html: Added. * fast/media/media-query-list-07-expected.txt: Added. * fast/media/media-query-list-07.html: Added. * platform/chromium/test_expectations.txt: * platform/mac/Skipped: * platform/win/Skipped: 2010-10-21 Luiz Agostini <luiz.agostini@openbossa.org> Reviewed by Darin Adler. Implement CSSOM View matchMedia interface https://bugs.webkit.org/show_bug.cgi?id=37205 New interfaces may be used to evaluate media queries and to associate listeners to media queries. Those listeners are called whenever the associated query changes. Specification may be found at http://dev.w3.org/csswg/cssom-view/#the-mediaquerylist-interface operator== added to JS version of ScriptValue. Method isFunction added to JS and V8 versions of ScriptValue. * bindings/js/ScriptValue.cpp: (WebCore::ScriptValue::isFunction): * bindings/js/ScriptValue.h: (WebCore::ScriptValue::operator==): * bindings/v8/ScriptValue.h: (WebCore::ScriptValue::isFunction): Some changes were needed to the code generators to handle type MediaQueryListListener. * bindings/scripts/CodeGeneratorGObject.pm: * bindings/scripts/CodeGeneratorJS.pm: * bindings/scripts/CodeGeneratorV8.pm: Some changes to the bindings test results that were previously added. * bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.cpp: * bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.h: * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: (WebCore::jsTestMediaQueryListListenerPrototypeFunctionMethod): * bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp: (WebCore::TestMediaQueryListListenerInternal::methodCallback): (WebCore::ConfigureV8TestMediaQueryListListenerTemplate): New interfaces: * css/MediaQueryList.cpp: Added. * css/MediaQueryList.h: Added. * css/MediaQueryList.idl: Added. * css/MediaQueryListListener.cpp: Added. * css/MediaQueryListListener.h: Added. * css/MediaQueryListListener.idl: Added. To avoid adding code to classes DOMWindow and Document a new class MediaQueryMatcher was created. * css/MediaQueryMatcher.cpp: Added. * css/MediaQueryMatcher.h: Added. Document and DOMWindow have changed to support new features. DOMWindow is the class that publishes methods matchMedia but for page cache to work properly the reference to the MediaQueryMatcher must be in Document. * dom/Document.cpp: (WebCore::Document::~Document): (WebCore::Document::mediaQueryMatcher): (WebCore::Document::styleSelectorChanged): * dom/Document.h: * page/DOMWindow.cpp: (WebCore::DOMWindow::matchMedia): * page/DOMWindow.h: * page/DOMWindow.idl: Build systems * CMakeLists.txt: * DerivedSources.make: * GNUmakefile.am: * WebCore.gypi: * WebCore.pri: * WebCore.pro: * WebCore.vcproj/WebCore.vcproj: * WebCore.xcodeproj/project.pbxproj: * bindings/gobject/GNUmakefile.am: Tests: fast/media/media-query-list-01.html fast/media/media-query-list-02.html fast/media/media-query-list-03.html fast/media/media-query-list-04.html fast/media/media-query-list-05.html fast/media/media-query-list-06.html fast/media/media-query-list-07.html Canonical link: https://commits.webkit.org/63014@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@72552 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2010-11-22 21:02:27 +00:00