LibWeb: Make selection state recomputation implicit

Add a LayoutDocument API for modifying the selection and make clients
call that so we can recompute selection states automatically.
This commit is contained in:
Andreas Kling 2020-08-21 17:54:44 +02:00
parent d47f77169f
commit 684fa0f99b
Notes: sideshowbarker 2024-07-19 03:21:01 +09:00
4 changed files with 18 additions and 8 deletions

View file

@ -109,8 +109,7 @@ void InProcessWebView::select_all()
if (is<LayoutText>(*last_layout_node))
last_layout_node_index_in_node = downcast<LayoutText>(*last_layout_node).text_for_rendering().length() - 1;
layout_root->selection().set({ first_layout_node, 0 }, { last_layout_node, last_layout_node_index_in_node });
layout_root->recompute_selection_states();
layout_root->set_selection({ { first_layout_node, 0 }, { last_layout_node, last_layout_node_index_in_node } });
update();
}