/* * Copyright (c) 2022, Andreas Kling * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include namespace Web::Painting { class InlinePaintable final : public Paintable { JS_CELL(InlinePaintable, Paintable); public: static JS::NonnullGCPtr create(Layout::InlineNode const&); virtual void paint(PaintContext&, PaintPhase) const override; Layout::InlineNode const& layout_node() const; auto const& box_model() const { return layout_node().box_model(); } CSSPixelRect bounding_rect() const; Vector const& fragments() const { return m_fragments; } Vector& fragments() { return m_fragments; } virtual bool is_inline_paintable() const override { return true; } virtual Optional hit_test(CSSPixelPoint, HitTestType) const override; void set_box_shadow_data(Vector&& box_shadow_data) { m_box_shadow_data = move(box_shadow_data); } Vector const& box_shadow_data() const { return m_box_shadow_data; } private: InlinePaintable(Layout::InlineNode const&); template void for_each_fragment(Callback) const; Vector m_box_shadow_data; Vector m_fragments; }; }