mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-01 06:07:59 +00:00
LibGUI: Tighten paint invalidation rects in item views :^)
AbstractView now has a paint_invalidation_rect(index) function that subclasses can override to provide a tighter invalidation rect for an index.
This commit is contained in:
@@ -717,4 +717,20 @@ int TreeView::tree_column_x_offset() const
|
||||
return offset;
|
||||
}
|
||||
|
||||
Gfx::IntRect TreeView::content_rect(ModelIndex const& index) const
|
||||
{
|
||||
if (!index.is_valid())
|
||||
return {};
|
||||
|
||||
Gfx::IntRect found_rect;
|
||||
traverse_in_paint_order([&](ModelIndex const& current_index, Gfx::IntRect const& rect, Gfx::IntRect const&, int) {
|
||||
if (index == current_index) {
|
||||
found_rect = rect;
|
||||
return IterationDecision::Break;
|
||||
}
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
return found_rect;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user