Coverage Report

Created: 2025-03-04 07:22

/src/serenity/Userland/Libraries/LibWeb/HTML/TextTrackCue.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright (c) 2024, Jamie Mansfield <jmansfield@cadixdev.org>
3
 *
4
 * SPDX-License-Identifier: BSD-2-Clause
5
 */
6
7
#pragma once
8
9
#include <LibJS/Heap/MarkedVector.h>
10
#include <LibWeb/DOM/EventTarget.h>
11
#include <LibWeb/HTML/TextTrack.h>
12
13
namespace Web::HTML {
14
15
// https://html.spec.whatwg.org/multipage/media.html#texttrackcue
16
class TextTrackCue : public DOM::EventTarget {
17
    WEB_PLATFORM_OBJECT(TextTrackCue, DOM::EventTarget);
18
    JS_DECLARE_ALLOCATOR(TextTrackCue);
19
20
public:
21
    virtual ~TextTrackCue() override;
22
23
0
    JS::GCPtr<TextTrack> track() { return m_track; }
24
25
0
    String const& id() const { return m_identifier; }
26
0
    void set_id(String const& id) { m_identifier = id; }
27
28
0
    double start_time() const { return m_start_time; }
29
    void set_start_time(double start_time);
30
31
0
    double end_time() const { return m_end_time; }
32
    WebIDL::ExceptionOr<void> set_end_time(double end_time);
33
34
0
    bool pause_on_exit() const { return m_pause_on_exit; }
35
0
    void set_pause_on_exit(bool pause_on_exit) { m_pause_on_exit = pause_on_exit; }
36
37
    WebIDL::CallbackType* onenter();
38
    void set_onenter(WebIDL::CallbackType*);
39
40
    WebIDL::CallbackType* onexit();
41
    void set_onexit(WebIDL::CallbackType*);
42
43
protected:
44
    TextTrackCue(JS::Realm&, JS::GCPtr<TextTrack>);
45
46
    virtual void initialize(JS::Realm&) override;
47
    virtual void visit_edges(Visitor&) override;
48
49
    JS::GCPtr<TextTrack> m_track;
50
51
    // https://html.spec.whatwg.org/multipage/media.html#text-track-cue-identifier
52
    String m_identifier;
53
54
    // https://html.spec.whatwg.org/multipage/media.html#text-track-cue-start-time
55
    double m_start_time;
56
57
    // https://html.spec.whatwg.org/multipage/media.html#text-track-cue-end-time
58
    double m_end_time;
59
60
    // https://html.spec.whatwg.org/multipage/media.html#text-track-cue-pause-on-exit-flag
61
    bool m_pause_on_exit;
62
};
63
64
}