mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 04:39:06 +00:00
LibWeb: Invalidate the display list when calling set_needs_display()
Calls to `Document::set_needs_display()` and `Paintable::set_needs_display()` now invalidate the display list by default. This behavior can be changed by passing `InvalidateDisplayList::No` to the function where invalidating the display list is not necessary.
This commit is contained in:
parent
46649fbe1b
commit
5800b7e884
Notes:
github-actions[bot]
2024-09-02 18:13:03 +00:00
Author: https://github.com/tcl3
Commit: 5800b7e884
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1240
Reviewed-by: https://github.com/kalenikaliaksandr ✅
Reviewed-by: https://github.com/trflynn89 ✅
12 changed files with 53 additions and 28 deletions
|
@ -128,24 +128,27 @@ void Paintable::invalidate_stacking_context()
|
|||
m_stacking_context = nullptr;
|
||||
}
|
||||
|
||||
void Paintable::set_needs_display()
|
||||
void Paintable::set_needs_display(InvalidateDisplayList should_invalidate_display_list)
|
||||
{
|
||||
auto& document = const_cast<DOM::Document&>(this->document());
|
||||
if (should_invalidate_display_list == InvalidateDisplayList::Yes)
|
||||
document.invalidate_display_list();
|
||||
|
||||
auto* containing_block = this->containing_block();
|
||||
if (!containing_block)
|
||||
return;
|
||||
|
||||
auto& document = const_cast<DOM::Document&>(this->document());
|
||||
|
||||
if (is<Painting::InlinePaintable>(*this)) {
|
||||
auto const& fragments = static_cast<Painting::InlinePaintable const*>(this)->fragments();
|
||||
for (auto const& fragment : fragments)
|
||||
document.set_needs_display(fragment.absolute_rect());
|
||||
for (auto const& fragment : fragments) {
|
||||
document.set_needs_display(fragment.absolute_rect(), InvalidateDisplayList::No);
|
||||
}
|
||||
}
|
||||
|
||||
if (!is<Painting::PaintableWithLines>(*containing_block))
|
||||
return;
|
||||
static_cast<Painting::PaintableWithLines const&>(*containing_block).for_each_fragment([&](auto& fragment) {
|
||||
document.set_needs_display(fragment.absolute_rect());
|
||||
document.set_needs_display(fragment.absolute_rect(), InvalidateDisplayList::No);
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue