Restore nsIDOMMediaQueryList XPCOM interface.

Except for AddListener and RemoveListener as they would add unnecessary
complications not needed by wine.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
This commit is contained in:
Gabriel Ivăncescu 2022-06-28 15:46:07 +03:00
parent 1004e5f9fd
commit 0018fc6db4
No known key found for this signature in database
GPG Key ID: 4CEE4FF41CC69382
4 changed files with 29 additions and 4 deletions

View File

@ -19,6 +19,7 @@ XPIDL_SOURCES += [
'nsIDOMGlobalPropertyInitializer.idl',
'nsIDOMHistory.idl',
'nsIDOMLocation.idl',
'nsIDOMMediaQueryList.idl',
'nsIDOMModalContentWindow.idl',
'nsIDOMNavigator.idl',
'nsIDOMScreen.idl',

View File

@ -0,0 +1,13 @@
/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "domstubs.idl"
[builtinclass, uuid(e0e49c52-915b-40f9-9cba-6026305cdf3e)]
interface nsIDOMMediaQueryList : nsISupports
{
readonly attribute DOMString media;
readonly attribute boolean matches;
};

View File

@ -55,6 +55,7 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(MediaQueryList)
NS_INTERFACE_MAP_BEGIN(MediaQueryList)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsIDOMMediaQueryList)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(MediaQueryList)
NS_INTERFACE_MAP_END
@ -62,10 +63,18 @@ NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(MediaQueryList)
NS_IMPL_CYCLE_COLLECTING_RELEASE(MediaQueryList)
void
NS_IMETHODIMP
MediaQueryList::GetMedia(nsAString &aMedia)
{
mMediaList->GetText(aMedia);
return NS_OK;
}
NS_IMETHODIMP
MediaQueryList::GetMatches(bool *aMatches)
{
*aMatches = Matches();
return NS_OK;
}
bool

View File

@ -9,7 +9,7 @@
#ifndef mozilla_dom_MediaQueryList_h
#define mozilla_dom_MediaQueryList_h
#include "nsISupports.h"
#include "nsIDOMMediaQueryList.h"
#include "nsCycleCollectionParticipant.h"
#include "nsAutoPtr.h"
#include "nsCOMPtr.h"
@ -25,7 +25,7 @@ class nsMediaList;
namespace mozilla {
namespace dom {
class MediaQueryList final : public nsISupports,
class MediaQueryList final : public nsIDOMMediaQueryList,
public nsWrapperCache,
public PRCList
{
@ -41,6 +41,8 @@ public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(MediaQueryList)
NS_DECL_NSIDOMMEDIAQUERYLIST
nsISupports* GetParentObject() const;
struct HandleChangeData {
@ -58,7 +60,7 @@ public:
JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
// WebIDL methods
void GetMedia(nsAString& aMedia);
// The XPCOM GetMedia method is good
bool Matches();
void AddListener(mozilla::dom::MediaQueryListListener& aListener);
void RemoveListener(mozilla::dom::MediaQueryListListener& aListener);