1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-10 10:01:13 +09:00

LibGUI: Calculate width of table headers when there is no content

In order to correctly calculate the width of the header add the
top left x coordinate + the width of the content. Previously was
using the width returned by the visible_content_rect(), which
when there was no content would be null. This would be problematic
as it would lead to not rendering the headers of tables when there was
no content (for example in the SystemsMonitor in the Networks tab).

Now, regardless of whether there is content or not in the table,
the header is visible.
This commit is contained in:
martinfalisse 2022-04-09 19:39:56 +02:00 committed by Andreas Kling
parent 1682b0b6d8
commit 472a3df03b
Notes: sideshowbarker 2024-07-17 14:14:10 +09:00

View file

@ -82,7 +82,7 @@ HeaderView::VisibleSectionRange HeaderView::visible_section_range() const
auto is_horizontal = m_orientation == Orientation::Horizontal;
auto rect = m_table_view.visible_content_rect();
auto start = is_horizontal ? rect.top_left().x() : rect.top_left().y();
auto end = is_horizontal ? rect.top_right().x() : rect.bottom_left().y();
auto end = is_horizontal ? (rect.top_left().x() + m_table_view.content_width()) : rect.bottom_left().y();
auto offset = 0;
VisibleSectionRange range;
for (; range.end < section_count; ++range.end) {