summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2023-04-03 11:11:18 -0400
committerLinus Groh <mail@linusgroh.de>2023-04-07 16:02:22 +0200
commit6d5893a12187d585580819c2bc17b234940bd152 (patch)
treee69952192ffae7a668a5ad945b80e46f68eaa0c3 /Userland/Libraries/LibWeb
parent9a370a5eedd0fe53d01b8fdf19f69de98630a312 (diff)
downloadserenity-6d5893a12187d585580819c2bc17b234940bd152.zip
LibWeb: Implement HTMLMediaElement's networkState attribute
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLMediaElement.h12
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLMediaElement.idl6
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;