TextPaintable.h 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. /*
  2. * Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibWeb/Painting/PaintableBox.h>
  8. namespace Web::Painting {
  9. class TextPaintable final : public Paintable {
  10. JS_CELL(TextPaintable, Paintable);
  11. public:
  12. static JS::NonnullGCPtr<TextPaintable> create(Layout::TextNode const&);
  13. Layout::TextNode const& layout_node() const { return static_cast<Layout::TextNode const&>(Paintable::layout_node()); }
  14. virtual bool wants_mouse_events() const override;
  15. virtual DOM::Node* mouse_event_target() const override;
  16. virtual DispatchEventOfSameName handle_mousedown(Badge<EventHandler>, CSSPixelPoint, unsigned button, unsigned modifiers) override;
  17. virtual DispatchEventOfSameName handle_mouseup(Badge<EventHandler>, CSSPixelPoint, unsigned button, unsigned modifiers) override;
  18. virtual DispatchEventOfSameName handle_mousemove(Badge<EventHandler>, CSSPixelPoint, unsigned button, unsigned modifiers) override;
  19. private:
  20. explicit TextPaintable(Layout::TextNode const&);
  21. };
  22. }