LibWeb: Invalidate viewport's text blocks cache on layout update

156c1083e9 introduced a text blocks cache
for better performance when searching through text on a page, but when
we partially recreate the layout tree, this cache does not get
invalidated. We now rebuild the entire text blocks cache after a layout
update.
This commit is contained in:
Jelle Raaijmakers 2025-05-14 15:36:52 +02:00 committed by Tim Ledbetter
commit c3a5e8e266
Notes: github-actions[bot] 2025-05-15 10:45:40 +00:00
4 changed files with 38 additions and 0 deletions

View file

@ -1304,6 +1304,10 @@ void Document::update_layout(UpdateLayoutReason reason)
if (m_created_for_appropriate_template_contents)
return;
// Clear text blocks cache so we rebuild them on the next find action.
if (m_layout_root)
m_layout_root->invalidate_text_blocks_cache();
invalidate_display_list();
auto* document_element = this->document_element();