mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 10:07:34 +00:00
LibWeb: Add missing null checks in Layout::Node::set_needs_display()
Let's not assume the containing block has a paintable box just because someone is calling set_needs_display(). It can just be a no-op in that case, and nobody gets hurt.
This commit is contained in:
parent
385657a4bf
commit
8fa459f2d6
1 changed files with 11 additions and 8 deletions
|
@ -127,14 +127,17 @@ InitialContainingBlock& Node::root()
|
||||||
|
|
||||||
void Node::set_needs_display()
|
void Node::set_needs_display()
|
||||||
{
|
{
|
||||||
if (auto* block = containing_block()) {
|
auto* containing_block = this->containing_block();
|
||||||
block->paint_box()->for_each_fragment([&](auto& fragment) {
|
if (!containing_block)
|
||||||
if (&fragment.layout_node() == this || is_ancestor_of(fragment.layout_node())) {
|
return;
|
||||||
browsing_context().set_needs_display(enclosing_int_rect(fragment.absolute_rect()));
|
if (!containing_block->paint_box())
|
||||||
}
|
return;
|
||||||
return IterationDecision::Continue;
|
containing_block->paint_box()->for_each_fragment([&](auto& fragment) {
|
||||||
});
|
if (&fragment.layout_node() == this || is_ancestor_of(fragment.layout_node())) {
|
||||||
}
|
browsing_context().set_needs_display(enclosing_int_rect(fragment.absolute_rect()));
|
||||||
|
}
|
||||||
|
return IterationDecision::Continue;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Gfx::FloatPoint Node::box_type_agnostic_position() const
|
Gfx::FloatPoint Node::box_type_agnostic_position() const
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue