Coverage Report

Created: 2025-12-18 07:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/serenity/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.h
Line
Count
Source
1
/*
2
 * Copyright (c) 2020, the SerenityOS developers.
3
 * Copyright (c) 2022, Luke Wilde <lukew@serenityos.org>
4
 * Copyright (c) 2023, Bastiaan van der Plaat <bastiaan.v.d.plaat@gmail.com>
5
 *
6
 * SPDX-License-Identifier: BSD-2-Clause
7
 */
8
9
#pragma once
10
11
#include <LibWeb/ARIA/Roles.h>
12
#include <LibWeb/HTML/HTMLElement.h>
13
14
namespace Web::HTML {
15
16
class HTMLMeterElement final : public HTMLElement {
17
    WEB_PLATFORM_OBJECT(HTMLMeterElement, HTMLElement);
18
    JS_DECLARE_ALLOCATOR(HTMLMeterElement);
19
20
public:
21
    virtual ~HTMLMeterElement() override;
22
23
    double value() const;
24
    WebIDL::ExceptionOr<void> set_value(double);
25
    double min() const;
26
    WebIDL::ExceptionOr<void> set_min(double value);
27
    double max() const;
28
    WebIDL::ExceptionOr<void> set_max(double value);
29
    double low() const;
30
    WebIDL::ExceptionOr<void> set_low(double value);
31
    double high() const;
32
    WebIDL::ExceptionOr<void> set_high(double value);
33
    double optimum() const;
34
    WebIDL::ExceptionOr<void> set_optimum(double value);
35
36
    // ^HTMLElement
37
    virtual void inserted() override;
38
    virtual void removed_from(DOM::Node*) override;
39
40
    // https://html.spec.whatwg.org/multipage/forms.html#category-label
41
0
    virtual bool is_labelable() const override { return true; }
42
43
    // https://www.w3.org/TR/html-aria/#el-meter
44
0
    virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::meter; }
45
46
private:
47
    HTMLMeterElement(DOM::Document&, DOM::QualifiedName);
48
49
    virtual void initialize(JS::Realm&) override;
50
    virtual void visit_edges(Cell::Visitor&) override;
51
52
    void create_shadow_tree_if_needed();
53
54
    void update_meter_value_element();
55
56
    JS::GCPtr<DOM::Element> m_meter_value_element;
57
};
58
59
}