summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Painting/TextPaintable.h
blob: 5c029062bb9ed33e5a893e6cd09743859d4c6946 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
 * Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <LibWeb/Painting/PaintableBox.h>

namespace Web::Painting {

class TextPaintable : public Paintable {
public:
    static NonnullRefPtr<TextPaintable> create(Layout::TextNode const&);

    Layout::TextNode const& layout_node() const { return static_cast<Layout::TextNode const&>(Paintable::layout_node()); }

    virtual bool wants_mouse_events() const override;
    virtual DOM::Node* mouse_event_target() const override;
    virtual DispatchEventOfSameName handle_mousedown(Badge<EventHandler>, Gfx::IntPoint const&, unsigned button, unsigned modifiers) override;
    virtual DispatchEventOfSameName handle_mouseup(Badge<EventHandler>, Gfx::IntPoint const&, unsigned button, unsigned modifiers) override;
    virtual DispatchEventOfSameName handle_mousemove(Badge<EventHandler>, Gfx::IntPoint const&, unsigned button, unsigned modifiers) override;

private:
    explicit TextPaintable(Layout::TextNode const&);
};

}