Coverage Report

Created: 2025-08-28 06:26

/src/serenity/Userland/Libraries/LibWeb/Painting/TextPaintable.h
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
3
 *
4
 * SPDX-License-Identifier: BSD-2-Clause
5
 */
6
7
#pragma once
8
9
#include <LibWeb/Painting/PaintableBox.h>
10
11
namespace Web::Painting {
12
13
class TextPaintable final : public Paintable {
14
    JS_CELL(TextPaintable, Paintable);
15
    JS_DECLARE_ALLOCATOR(TextPaintable);
16
17
public:
18
    static JS::NonnullGCPtr<TextPaintable> create(Layout::TextNode const&, String const& text_for_rendering);
19
20
0
    Layout::TextNode const& layout_node() const { return static_cast<Layout::TextNode const&>(Paintable::layout_node()); }
21
22
    virtual bool wants_mouse_events() const override;
23
    virtual DOM::Node* mouse_event_target() const override;
24
    virtual DispatchEventOfSameName handle_mousedown(Badge<EventHandler>, CSSPixelPoint, unsigned button, unsigned modifiers) override;
25
    virtual DispatchEventOfSameName handle_mouseup(Badge<EventHandler>, CSSPixelPoint, unsigned button, unsigned modifiers) override;
26
    virtual DispatchEventOfSameName handle_mousemove(Badge<EventHandler>, CSSPixelPoint, unsigned button, unsigned modifiers) override;
27
28
0
    void set_text_decoration_thickness(CSSPixels thickness) { m_text_decoration_thickness = thickness; }
29
0
    CSSPixels text_decoration_thickness() const { return m_text_decoration_thickness; }
30
31
0
    String const& text_for_rendering() const { return m_text_for_rendering; }
32
33
private:
34
0
    virtual bool is_text_paintable() const override { return true; }
35
36
    TextPaintable(Layout::TextNode const&, String const& text_for_rendering);
37
38
    String m_text_for_rendering;
39
    CSSPixels m_text_decoration_thickness { 0 };
40
};
41
42
}