Coverage Report

Created: 2026-07-25 07:46

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/serenity/Userland/Libraries/LibWeb/Painting/LabelablePaintable.h
Line
Count
Source
1
/*
2
 * Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
3
 * Copyright (c) 2022, sin-ack <sin-ack@protonmail.com>
4
 *
5
 * SPDX-License-Identifier: BSD-2-Clause
6
 */
7
8
#pragma once
9
10
#include <LibWeb/HTML/FormAssociatedElement.h>
11
#include <LibWeb/Layout/FormAssociatedLabelableNode.h>
12
#include <LibWeb/Painting/PaintableBox.h>
13
14
namespace Web::Painting {
15
16
// FIXME: Splinter this into FormAssociatedLabelablePaintable once
17
//        ProgressPaintable switches over to this.
18
class LabelablePaintable : public PaintableBox {
19
    JS_CELL(LabelablePaintable, PaintableBox);
20
21
public:
22
    Layout::FormAssociatedLabelableNode const& layout_box() const;
23
    Layout::FormAssociatedLabelableNode& layout_box();
24
25
0
    virtual bool wants_mouse_events() const override { return true; }
26
    virtual DispatchEventOfSameName handle_mousedown(Badge<EventHandler>, CSSPixelPoint, unsigned button, unsigned modifiers) override;
27
    virtual DispatchEventOfSameName handle_mouseup(Badge<EventHandler>, CSSPixelPoint, unsigned button, unsigned modifiers) override;
28
    virtual DispatchEventOfSameName handle_mousemove(Badge<EventHandler>, CSSPixelPoint, unsigned buttons, unsigned modifiers) override;
29
30
    void handle_associated_label_mousedown(Badge<Layout::Label>);
31
    void handle_associated_label_mouseup(Badge<Layout::Label>);
32
    void handle_associated_label_mousemove(Badge<Layout::Label>, bool is_inside_node_or_label);
33
34
0
    bool being_pressed() const { return m_being_pressed; }
35
    // NOTE: Only the HTML node associated with this paintable should call this!
36
    void set_being_pressed(bool being_pressed);
37
38
protected:
39
    LabelablePaintable(Layout::LabelableNode const&);
40
41
private:
42
    bool m_being_pressed { false };
43
    bool m_tracking_mouse { false };
44
};
45
46
}