From b9f22f60787a450925c5f0813e04070b355149f8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gabriel=20Iv=C4=83ncescu?= Date: Mon, 1 Aug 2022 17:52:36 +0300 Subject: [PATCH] mshtml: Implement MediaQueryList's matches prop. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/omnavigator.c | 10 ++++++++-- dlls/mshtml/tests/es5.js | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index 00f6c72894e..42e8149a602 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -2753,10 +2753,16 @@ static HRESULT WINAPI media_query_list_get_media(IWineMSHTMLMediaQueryList *ifac static HRESULT WINAPI media_query_list_get_matches(IWineMSHTMLMediaQueryList *iface, VARIANT_BOOL *p) { struct media_query_list *media_query_list = impl_from_IWineMSHTMLMediaQueryList(iface); + nsresult nsres; + cpp_bool b; - FIXME("(%p)->(%p)\n", media_query_list, p); + TRACE("(%p)->(%p)\n", media_query_list, p); - return E_NOTIMPL; + nsres = nsIDOMMediaQueryList_GetMatches(media_query_list->nsquerylist, &b); + if(NS_FAILED(nsres)) + return map_nsresult(nsres); + *p = b ? VARIANT_TRUE : VARIANT_FALSE; + return S_OK; } static HRESULT WINAPI media_query_list_addListener(IWineMSHTMLMediaQueryList *iface, VARIANT *listener) diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js index 5f9202b13c6..c18639582d0 100644 --- a/dlls/mshtml/tests/es5.js +++ b/dlls/mshtml/tests/es5.js @@ -2037,5 +2037,8 @@ sync_test("matchMedia", function() { mql = window.matchMedia(r[i][0]); todo_wine_if(r[i][0] !== 42). ok(mql.media === r[i][1], r[i][0] + " media = " + mql.media); + ok(mql.matches === false, r[i][0] + " matches"); } + mql = window.matchMedia("(max-width: 1000px)"); + ok(mql.matches === true, "(max-width: 1000px) does not match"); }); -- 2.11.4.GIT