1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:48:12 +00:00
serenity/Userland/Libraries/LibWeb/Painting/InlinePaintable.h
Aliaksandr Kalenik 6c645f3a9f LibWeb: Paint fragments contained by inline node as part of this node
Fragments contained by the inline node should be painted in the
foreground phase for this node, instead of being painted as a part of
the containing PaintableWithLines. This change implements that by
marking all fragments contained by inline nodes so they can be skipped
while painting the content of PaintableWithLines. This is an ugly way,
and instead, we should make InlinePaintables own all fragments
contained by them.
2024-01-05 19:36:55 +01:00

36 lines
824 B
C++

/*
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/Layout/InlineNode.h>
#include <LibWeb/Painting/PaintableBox.h>
namespace Web::Painting {
class InlinePaintable final : public Paintable {
JS_CELL(InlinePaintable, Paintable);
public:
static JS::NonnullGCPtr<InlinePaintable> create(Layout::InlineNode const&);
virtual void paint(PaintContext&, PaintPhase) const override;
Layout::InlineNode const& layout_node() const;
auto const& box_model() const { return layout_node().box_model(); }
CSSPixelRect bounding_rect() const;
void mark_contained_fragments();
private:
InlinePaintable(Layout::InlineNode const&);
template<typename Callback>
void for_each_fragment(Callback) const;
};
}