Coverage Report

Created: 2025-11-16 07:46

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/serenity/Userland/Libraries/LibWeb/WebVTT/VTTRegion.h
Line
Count
Source
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 <LibWeb/Bindings/PlatformObject.h>
10
#include <LibWeb/Bindings/VTTRegionPrototype.h>
11
#include <LibWeb/WebIDL/Types.h>
12
13
namespace Web::WebVTT {
14
15
// https://w3c.github.io/webvtt/#vttregion
16
class VTTRegion final : public Bindings::PlatformObject {
17
    WEB_PLATFORM_OBJECT(VTTRegion, Bindings::PlatformObject);
18
    JS_DECLARE_ALLOCATOR(VTTRegion);
19
20
public:
21
    static WebIDL::ExceptionOr<JS::NonnullGCPtr<VTTRegion>> construct_impl(JS::Realm&);
22
0
    virtual ~VTTRegion() override = default;
23
24
0
    String const& id() const { return m_identifier; }
25
0
    void set_id(String const& id) { m_identifier = id; }
26
27
0
    double width() const { return m_width; }
28
    WebIDL::ExceptionOr<void> set_width(double width);
29
30
0
    WebIDL::UnsignedLong lines() const { return m_lines; }
31
0
    void set_lines(WebIDL::UnsignedLong lines) { m_lines = lines; }
32
33
0
    double region_anchor_x() const { return m_anchor_x; }
34
    WebIDL::ExceptionOr<void> set_region_anchor_x(double region_anchor_x);
35
36
0
    double region_anchor_y() const { return m_anchor_y; }
37
    WebIDL::ExceptionOr<void> set_region_anchor_y(double region_anchor_y);
38
39
0
    double viewport_anchor_x() const { return m_viewport_anchor_x; }
40
    WebIDL::ExceptionOr<void> set_viewport_anchor_x(double viewport_anchor_x);
41
42
0
    double viewport_anchor_y() const { return m_viewport_anchor_y; }
43
    WebIDL::ExceptionOr<void> set_viewport_anchor_y(double viewport_anchor_y);
44
45
0
    Bindings::ScrollSetting scroll() const { return m_scroll_setting; }
46
0
    void set_scroll(Bindings::ScrollSetting scroll) { m_scroll_setting = scroll; }
47
48
private:
49
    VTTRegion(JS::Realm&);
50
51
    virtual void initialize(JS::Realm&) override;
52
53
    // https://w3c.github.io/webvtt/#webvtt-region-identifier
54
    String m_identifier {};
55
56
    // https://w3c.github.io/webvtt/#webvtt-region-width
57
    double m_width { 100 };
58
59
    // https://w3c.github.io/webvtt/#webvtt-region-lines
60
    WebIDL::UnsignedLong m_lines { 3 };
61
62
    // https://w3c.github.io/webvtt/#webvtt-region-anchor
63
    double m_anchor_x { 0 };
64
    double m_anchor_y { 100 };
65
66
    // https://w3c.github.io/webvtt/#webvtt-region-viewport-anchor
67
    double m_viewport_anchor_x { 0 };
68
    double m_viewport_anchor_y { 100 };
69
70
    // https://w3c.github.io/webvtt/#webvtt-region-scroll
71
    Bindings::ScrollSetting m_scroll_setting { Bindings::ScrollSetting::Empty };
72
};
73
74
}