LibWeb: Refactor SelectItem to allow selecting options without value

Currently the `<select>` dropdown IPC uses the option value attr to
find which option is selected. This won't work when options don't
have values or when multiple options have the same value. Also the
`SelectItem` contained so weird recursive structures that are
impossible to create with HTML. So I refactored `SelectItem` as a
variant, and gave the options a unique id. The id is send back to
`HTMLSelectElement` so it can find out exactly which option element
is selected.
This commit is contained in:
Bastiaan van der Plaat 2024-04-03 19:19:08 +02:00 committed by Tim Flynn
commit 4408581ee0
Notes: sideshowbarker 2024-07-18 02:47:59 +09:00
21 changed files with 243 additions and 152 deletions

View file

@ -290,9 +290,9 @@ void ViewImplementation::file_picker_closed(Vector<Web::HTML::SelectedFile> sele
client().async_file_picker_closed(page_id(), move(selected_files));
}
void ViewImplementation::select_dropdown_closed(Optional<String> value)
void ViewImplementation::select_dropdown_closed(Optional<u32> const& selected_item_id)
{
client().async_select_dropdown_closed(page_id(), value);
client().async_select_dropdown_closed(page_id(), selected_item_id);
}
void ViewImplementation::toggle_media_play_state()