1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 08:37:46 +00:00

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.
This commit is contained in:
Aliaksandr Kalenik 2024-01-03 19:00:04 +01:00 committed by Andreas Kling
parent c5187c6bb3
commit 6c645f3a9f
6 changed files with 45 additions and 3 deletions

View file

@ -460,6 +460,18 @@ void LayoutState::commit(Box& root)
resolve_border_radii();
resolve_box_shadow_data();
for (auto& it : used_values_per_layout_node) {
auto& used_values = *it.value;
auto& node = const_cast<NodeWithStyle&>(used_values.node());
auto* paintable = node.paintable();
if (paintable && is<Painting::InlinePaintable>(*paintable)) {
auto& inline_paintable = static_cast<Painting::InlinePaintable&>(*paintable);
// FIXME: Marking fragments contained by inline node is a hack required to skip them while painting
// PaintableWithLines content.
inline_paintable.mark_contained_fragments();
}
}
}
void LayoutState::UsedValues::set_node(NodeWithStyle& node, UsedValues const* containing_block_used_values)

View file

@ -79,6 +79,9 @@ public:
Painting::BorderRadiiData const& border_radii_data() const { return m_border_radii_data; }
void set_border_radii_data(Painting::BorderRadiiData const& border_radii_data) { m_border_radii_data = border_radii_data; }
bool contained_by_inline_node() const { return m_contained_by_inline_node; }
void set_contained_by_inline_node() { m_contained_by_inline_node = true; }
private:
JS::NonnullGCPtr<Node const> m_layout_node;
int m_start { 0 };
@ -90,6 +93,7 @@ private:
CSSPixels m_baseline { 0 };
Vector<Gfx::DrawGlyphOrEmoji> m_glyph_run;
Painting::BorderRadiiData m_border_radii_data;
bool m_contained_by_inline_node { false };
};
}