1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-25 19:15:06 +00:00
serenity/Userland/Libraries/LibWeb/Layout/Viewport.h
Andreas Kling c01c4b41e2 LibWeb: Add ViewportPaintable to represent viewports in the paint tree
This patch just adds the new root paintable and updates the tests
expectations. The next patch will move painting logic from the layout
viewport to the paint viewport.
2023-08-20 05:02:59 +02:00

41 lines
1 KiB
C++

/*
* Copyright (c) 2018-2023, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/DOM/Document.h>
#include <LibWeb/Layout/BlockContainer.h>
#include <LibWeb/Selection/Selection.h>
namespace Web::Layout {
class Viewport final : public BlockContainer {
JS_CELL(Viewport, BlockContainer);
public:
explicit Viewport(DOM::Document&, NonnullRefPtr<CSS::StyleProperties>);
virtual ~Viewport() override;
const DOM::Document& dom_node() const { return static_cast<const DOM::Document&>(*Node::dom_node()); }
void paint_all_phases(PaintContext&);
JS::GCPtr<Selection::Selection> selection() const;
void build_stacking_context_tree_if_needed();
void recompute_selection_states();
private:
virtual JS::GCPtr<Painting::Paintable> create_paintable() const override;
void build_stacking_context_tree();
virtual bool is_viewport() const override { return true; }
};
template<>
inline bool Node::fast_is<Viewport>() const { return is_viewport(); }
}