diff options
author | Timothy Flynn <trflynn89@pm.me> | 2023-04-03 11:11:18 -0400 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-04-07 16:02:22 +0200 |
commit | 6d5893a12187d585580819c2bc17b234940bd152 (patch) | |
tree | e69952192ffae7a668a5ad945b80e46f68eaa0c3 /Userland/Libraries | |
parent | 9a370a5eedd0fe53d01b8fdf19f69de98630a312 (diff) | |
download | serenity-6d5893a12187d585580819c2bc17b234940bd152.zip |
LibWeb: Implement HTMLMediaElement's networkState attribute
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/HTMLMediaElement.h | 12 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/HTMLMediaElement.idl | 6 |
2 files changed, 18 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.h b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.h index 126c24299c..82d4307e1d 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.h @@ -16,6 +16,14 @@ class HTMLMediaElement : public HTMLElement { public: virtual ~HTMLMediaElement() override; + enum class NetworkState : u16 { + Empty, + Idle, + Loading, + NoSource, + }; + NetworkState network_state() const { return m_network_state; } + Bindings::CanPlayTypeResult can_play_type(DeprecatedString const& type) const; void load() const; @@ -25,6 +33,10 @@ protected: HTMLMediaElement(DOM::Document&, DOM::QualifiedName); virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; + +private: + // https://html.spec.whatwg.org/multipage/media.html#dom-media-networkstate + NetworkState m_network_state { NetworkState::Empty }; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.idl index a27c4912de..c53aac2b9c 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.idl +++ b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.idl @@ -10,7 +10,13 @@ enum CanPlayTypeResult { [Exposed=Window] interface HTMLMediaElement : HTMLElement { + // network state [Reflect, CEReactions] attribute DOMString src; + const unsigned short NETWORK_EMPTY = 0; + const unsigned short NETWORK_IDLE = 1; + const unsigned short NETWORK_LOADING = 2; + const unsigned short NETWORK_NO_SOURCE = 3; + readonly attribute unsigned short networkState; [Reflect, CEReactions] attribute boolean autoplay; [Reflect, CEReactions] attribute boolean loop; |