LibWeb: Stub MediaCapabilities IDL interface

This commit is contained in:
Jamie Mansfield 2024-09-04 23:52:21 +01:00 committed by Tim Ledbetter
parent 1240aaa294
commit 4c5a176354
Notes: github-actions[bot] 2024-09-05 13:53:37 +00:00
8 changed files with 73 additions and 0 deletions

View file

@ -4197,6 +4197,7 @@ static void generate_using_namespace_definitions(SourceGenerator& generator)
using namespace Web::IndexedDB;
using namespace Web::Internals;
using namespace Web::IntersectionObserver;
using namespace Web::MediaCapabilitiesAPI;
using namespace Web::NavigationTiming;
using namespace Web::PerformanceTimeline;
using namespace Web::RequestIdleCallback;

View file

@ -206,6 +206,7 @@ KeyframeEffect
Location
Map
MathMLElement
MediaCapabilities
MediaError
MediaList
MediaQueryList

View file

@ -548,6 +548,7 @@ set(SOURCES
Loader/ResourceLoader.cpp
MathML/MathMLElement.cpp
MathML/TagNames.cpp
MediaCapabilitiesAPI/MediaCapabilities.cpp
MimeSniff/MimeType.cpp
MimeSniff/Resource.cpp
MixedContent/AbstractOperations.cpp

View file

@ -592,6 +592,10 @@ namespace Web::MathML {
class MathMLElement;
}
namespace Web::MediaCapabilitiesAPI {
class MediaCapabilities;
}
namespace Web::MimeSniff {
class MimeType;
}

View file

@ -0,0 +1,32 @@
/*
* Copyright (c) 2024, Jamie Mansfield <jmansfield@cadixdev.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/Bindings/MediaCapabilitiesPrototype.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/MediaCapabilitiesAPI/MediaCapabilities.h>
namespace Web::MediaCapabilitiesAPI {
JS_DEFINE_ALLOCATOR(MediaCapabilities);
JS::NonnullGCPtr<MediaCapabilities> MediaCapabilities::create(JS::Realm& realm)
{
return realm.heap().allocate<MediaCapabilities>(realm, realm);
}
MediaCapabilities::MediaCapabilities(JS::Realm& realm)
: PlatformObject(realm)
{
}
void MediaCapabilities::initialize(JS::Realm& realm)
{
Base::initialize(realm);
WEB_SET_PROTOTYPE_FOR_INTERFACE(MediaCapabilities);
}
}

View file

@ -0,0 +1,27 @@
/*
* Copyright (c) 2024, Jamie Mansfield <jmansfield@cadixdev.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/Bindings/PlatformObject.h>
namespace Web::MediaCapabilitiesAPI {
class MediaCapabilities final : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(MediaCapabilities, Bindings::PlatformObject);
JS_DECLARE_ALLOCATOR(MediaCapabilities);
public:
static JS::NonnullGCPtr<MediaCapabilities> create(JS::Realm&);
virtual ~MediaCapabilities() override = default;
private:
MediaCapabilities(JS::Realm&);
virtual void initialize(JS::Realm&) override;
};
}

View file

@ -0,0 +1,6 @@
// https://w3c.github.io/media-capabilities/#mediacapabilities
[Exposed=(Window, Worker)]
interface MediaCapabilities {
[FIXME, NewObject] Promise<MediaCapabilitiesDecodingInfo> decodingInfo(MediaDecodingConfiguration configuration);
[FIXME, NewObject] Promise<MediaCapabilitiesEncodingInfo> encodingInfo(MediaEncodingConfiguration configuration);
};

View file

@ -242,6 +242,7 @@ libweb_js_bindings(Internals/Internals)
libweb_js_bindings(IntersectionObserver/IntersectionObserver)
libweb_js_bindings(IntersectionObserver/IntersectionObserverEntry)
libweb_js_bindings(MathML/MathMLElement)
libweb_js_bindings(MediaCapabilitiesAPI/MediaCapabilities)
libweb_js_bindings(NavigationTiming/PerformanceNavigation)
libweb_js_bindings(NavigationTiming/PerformanceTiming)
libweb_js_bindings(PerformanceTimeline/PerformanceEntry)