From 4b16f1df05208e3ae15e4b2d2096e50045597252 Mon Sep 17 00:00:00 2001 From: Jamie Mansfield Date: Thu, 25 Jul 2024 20:21:06 +0100 Subject: [PATCH] LibWeb/HTML: Implement TextTrack.mode --- Userland/Libraries/LibWeb/HTML/TextTrack.cpp | 11 +++++++++++ Userland/Libraries/LibWeb/HTML/TextTrack.h | 5 +++++ Userland/Libraries/LibWeb/HTML/TextTrack.idl | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/HTML/TextTrack.cpp b/Userland/Libraries/LibWeb/HTML/TextTrack.cpp index 7e53d03622e..7f691ccc397 100644 --- a/Userland/Libraries/LibWeb/HTML/TextTrack.cpp +++ b/Userland/Libraries/LibWeb/HTML/TextTrack.cpp @@ -75,6 +75,17 @@ void TextTrack::set_id(String id) m_id = id; } +// https://html.spec.whatwg.org/multipage/media.html#dom-texttrack-mode +Bindings::TextTrackMode TextTrack::mode() +{ + return m_mode; +} + +void TextTrack::set_mode(Bindings::TextTrackMode mode) +{ + m_mode = mode; +} + // https://html.spec.whatwg.org/multipage/media.html#handler-texttrack-oncuechange void TextTrack::set_oncuechange(WebIDL::CallbackType* event_handler) { diff --git a/Userland/Libraries/LibWeb/HTML/TextTrack.h b/Userland/Libraries/LibWeb/HTML/TextTrack.h index cfb703ccfe6..45d37ec7e75 100644 --- a/Userland/Libraries/LibWeb/HTML/TextTrack.h +++ b/Userland/Libraries/LibWeb/HTML/TextTrack.h @@ -36,6 +36,9 @@ public: String id(); void set_id(String); + Bindings::TextTrackMode mode(); + void set_mode(Bindings::TextTrackMode); + void set_oncuechange(WebIDL::CallbackType*); WebIDL::CallbackType* oncuechange(); @@ -49,6 +52,8 @@ private: String m_language {}; String m_id {}; + + Bindings::TextTrackMode m_mode { Bindings::TextTrackMode::Disabled }; }; Bindings::TextTrackKind text_track_kind_from_string(String); diff --git a/Userland/Libraries/LibWeb/HTML/TextTrack.idl b/Userland/Libraries/LibWeb/HTML/TextTrack.idl index e8d81f720b5..acad53ddb7e 100644 --- a/Userland/Libraries/LibWeb/HTML/TextTrack.idl +++ b/Userland/Libraries/LibWeb/HTML/TextTrack.idl @@ -16,7 +16,7 @@ interface TextTrack : EventTarget { readonly attribute DOMString id; [FIXME] readonly attribute DOMString inBandMetadataTrackDispatchType; - [FIXME] attribute TextTrackMode mode; + attribute TextTrackMode mode; [FIXME] readonly attribute TextTrackCueList? cues; [FIXME] readonly attribute TextTrackCueList? activeCues;