/src/serenity/Userland/Libraries/LibWeb/Painting/SVGForeignObjectPaintable.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #pragma once |
8 | | |
9 | | #include <LibWeb/Layout/SVGForeignObjectBox.h> |
10 | | #include <LibWeb/Painting/PaintableBox.h> |
11 | | #include <LibWeb/Painting/SVGMaskable.h> |
12 | | |
13 | | namespace Web::Painting { |
14 | | |
15 | | class SVGForeignObjectPaintable final : public PaintableWithLines |
16 | | , public SVGMaskable { |
17 | | JS_CELL(SVGForeignObjectPaintable, PaintableWithLines); |
18 | | JS_DECLARE_ALLOCATOR(SVGForeignObjectPaintable); |
19 | | |
20 | | public: |
21 | | static JS::NonnullGCPtr<SVGForeignObjectPaintable> create(Layout::SVGForeignObjectBox const&); |
22 | | |
23 | | virtual TraversalDecision hit_test(CSSPixelPoint, HitTestType, Function<TraversalDecision(HitTestResult)> const& callback) const override; |
24 | | |
25 | | virtual void paint(PaintContext&, PaintPhase) const override; |
26 | | |
27 | | Layout::SVGForeignObjectBox const& layout_box() const; |
28 | | |
29 | 0 | virtual JS::GCPtr<DOM::Node const> dom_node_of_svg() const override { return dom_node(); } |
30 | 0 | virtual Optional<CSSPixelRect> get_masking_area() const override { return get_masking_area_of_svg(); } |
31 | 0 | virtual Optional<Gfx::Bitmap::MaskKind> get_mask_type() const override { return get_mask_type_of_svg(); } |
32 | 0 | virtual RefPtr<Gfx::Bitmap> calculate_mask(PaintContext& paint_context, CSSPixelRect const& masking_area) const override { return calculate_mask_of_svg(paint_context, masking_area); } |
33 | | |
34 | | protected: |
35 | | SVGForeignObjectPaintable(Layout::SVGForeignObjectBox const&); |
36 | | }; |
37 | | |
38 | | } |