/src/serenity/Userland/Libraries/LibWeb/Painting/ViewportPaintable.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2023, Andreas Kling <kling@serenityos.org> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #pragma once |
8 | | |
9 | | #include <LibWeb/Painting/PaintableBox.h> |
10 | | |
11 | | namespace Web::Painting { |
12 | | |
13 | | class ViewportPaintable final : public PaintableWithLines { |
14 | | JS_CELL(ViewportPaintable, PaintableWithLines); |
15 | | JS_DECLARE_ALLOCATOR(ViewportPaintable); |
16 | | |
17 | | public: |
18 | | static JS::NonnullGCPtr<ViewportPaintable> create(Layout::Viewport const&); |
19 | | virtual ~ViewportPaintable() override; |
20 | | |
21 | | void paint_all_phases(PaintContext&); |
22 | | void build_stacking_context_tree_if_needed(); |
23 | | |
24 | | HashMap<JS::GCPtr<PaintableBox const>, RefPtr<ScrollFrame>> scroll_state; |
25 | | void assign_scroll_frames(); |
26 | | void refresh_scroll_state(); |
27 | | |
28 | | HashMap<JS::GCPtr<PaintableBox const>, RefPtr<ClipFrame>> clip_state; |
29 | | void assign_clip_frames(); |
30 | | void refresh_clip_state(); |
31 | | |
32 | | void resolve_paint_only_properties(); |
33 | | |
34 | | JS::GCPtr<Selection::Selection> selection() const; |
35 | | void recompute_selection_states(DOM::Range&); |
36 | | void update_selection(); |
37 | | |
38 | | bool handle_mousewheel(Badge<EventHandler>, CSSPixelPoint, unsigned, unsigned, int wheel_delta_x, int wheel_delta_y) override; |
39 | | |
40 | 0 | void set_needs_to_refresh_clip_state(bool value) { m_needs_to_refresh_clip_state = value; } |
41 | 0 | void set_needs_to_refresh_scroll_state(bool value) { m_needs_to_refresh_scroll_state = value; } |
42 | | |
43 | | private: |
44 | | void build_stacking_context_tree(); |
45 | | |
46 | | explicit ViewportPaintable(Layout::Viewport const&); |
47 | | |
48 | | virtual void visit_edges(Visitor&) override; |
49 | | |
50 | | bool m_needs_to_refresh_clip_state { true }; |
51 | | bool m_needs_to_refresh_scroll_state { true }; |
52 | | }; |
53 | | |
54 | | } |