mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:18:11 +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()
|
||||
{
|
||||
if (auto* block = containing_block()) {
|
||||
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;
|
||||
});
|
||||
}
|
||||
auto* containing_block = this->containing_block();
|
||||
if (!containing_block)
|
||||
return;
|
||||
if (!containing_block->paint_box())
|
||||
return;
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue