mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:48:12 +00:00

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.
36 lines
824 B
C++
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;
|
|
};
|
|
|
|
}
|