/src/serenity/Userland/Libraries/LibWeb/Painting/ClippableAndScrollable.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/Painting/ClipFrame.h> |
10 | | |
11 | | namespace Web::Painting { |
12 | | |
13 | | struct ScrollFrame : public RefCounted<ScrollFrame> { |
14 | | i32 id { -1 }; |
15 | | CSSPixelPoint offset; |
16 | | }; |
17 | | |
18 | | class ClippableAndScrollable { |
19 | | public: |
20 | 0 | virtual ~ClippableAndScrollable() = default; |
21 | | |
22 | 0 | void set_enclosing_scroll_frame(RefPtr<ScrollFrame> scroll_frame) { m_enclosing_scroll_frame = scroll_frame; } |
23 | 0 | void set_enclosing_clip_frame(RefPtr<ClipFrame> clip_frame) { m_enclosing_clip_frame = clip_frame; } |
24 | | |
25 | | [[nodiscard]] Optional<int> scroll_frame_id() const; |
26 | | [[nodiscard]] Optional<CSSPixelPoint> enclosing_scroll_frame_offset() const; |
27 | | [[nodiscard]] Optional<CSSPixelRect> clip_rect() const; |
28 | | [[nodiscard]] Span<BorderRadiiClip const> border_radii_clips() const; |
29 | | |
30 | 0 | Gfx::AffineTransform const& combined_css_transform() const { return m_combined_css_transform; } |
31 | 0 | void set_combined_css_transform(Gfx::AffineTransform const& transform) { m_combined_css_transform = transform; } |
32 | | |
33 | | private: |
34 | | RefPtr<ScrollFrame const> m_enclosing_scroll_frame; |
35 | | RefPtr<ClipFrame const> m_enclosing_clip_frame; |
36 | | |
37 | | Gfx::AffineTransform m_combined_css_transform; |
38 | | }; |
39 | | |
40 | | } |