2023-08-18 15:52:40 +02:00
|
|
|
/*
|
2024-10-04 13:19:50 +02:00
|
|
|
* Copyright (c) 2023, Andreas Kling <andreas@ladybird.org>
|
2024-10-13 21:29:47 +02:00
|
|
|
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
2023-08-18 15:52:40 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <LibWeb/Painting/PaintableBox.h>
|
2024-10-11 19:32:32 +02:00
|
|
|
#include <LibWeb/Painting/ScrollState.h>
|
2023-08-18 15:52:40 +02:00
|
|
|
|
|
|
|
|
namespace Web::Painting {
|
|
|
|
|
|
|
|
|
|
class ViewportPaintable final : public PaintableWithLines {
|
2024-11-15 04:01:23 +13:00
|
|
|
GC_CELL(ViewportPaintable, PaintableWithLines);
|
|
|
|
|
GC_DECLARE_ALLOCATOR(ViewportPaintable);
|
2023-08-18 15:52:40 +02:00
|
|
|
|
|
|
|
|
public:
|
2024-11-15 04:01:23 +13:00
|
|
|
static GC::Ref<ViewportPaintable> create(Layout::Viewport const&);
|
2023-08-18 15:52:40 +02:00
|
|
|
virtual ~ViewportPaintable() override;
|
|
|
|
|
|
2023-08-19 08:38:51 +02:00
|
|
|
void paint_all_phases(PaintContext&);
|
|
|
|
|
void build_stacking_context_tree_if_needed();
|
|
|
|
|
|
2024-02-08 17:30:07 +01:00
|
|
|
void assign_scroll_frames();
|
|
|
|
|
void refresh_scroll_state();
|
|
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
HashMap<GC::Ptr<PaintableBox const>, RefPtr<ClipFrame>> clip_state;
|
2024-02-08 17:30:07 +01:00
|
|
|
void assign_clip_frames();
|
|
|
|
|
|
2024-02-02 12:04:16 +01:00
|
|
|
void resolve_paint_only_properties();
|
2023-12-29 06:10:32 +01:00
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ptr<Selection::Selection> selection() const;
|
2024-09-16 19:38:14 +08:00
|
|
|
void recompute_selection_states(DOM::Range&);
|
2024-03-18 07:42:38 +01:00
|
|
|
|
2024-04-18 09:57:48 +02:00
|
|
|
bool handle_mousewheel(Badge<EventHandler>, CSSPixelPoint, unsigned, unsigned, int wheel_delta_x, int wheel_delta_y) override;
|
|
|
|
|
|
2024-05-28 13:47:00 +02:00
|
|
|
void set_needs_to_refresh_scroll_state(bool value) { m_needs_to_refresh_scroll_state = value; }
|
|
|
|
|
|
2024-10-11 19:32:32 +02:00
|
|
|
ScrollState const& scroll_state() const { return m_scroll_state; }
|
|
|
|
|
|
2023-08-18 15:52:40 +02:00
|
|
|
private:
|
2023-08-19 08:38:51 +02:00
|
|
|
void build_stacking_context_tree();
|
|
|
|
|
|
2023-08-18 15:52:40 +02:00
|
|
|
explicit ViewportPaintable(Layout::Viewport const&);
|
2024-04-06 10:30:13 -07:00
|
|
|
|
|
|
|
|
virtual void visit_edges(Visitor&) override;
|
2024-05-28 13:47:00 +02:00
|
|
|
|
2024-10-11 19:32:32 +02:00
|
|
|
ScrollState m_scroll_state;
|
2024-05-28 13:47:00 +02:00
|
|
|
bool m_needs_to_refresh_scroll_state { true };
|
2023-08-18 15:52:40 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|