mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-06 08:10:02 +00:00
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:
parent
94d72c174a
commit
4408581ee0
Notes:
sideshowbarker
2024-07-18 02:47:59 +09:00
Author: https://github.com/bplaat
Commit: 4408581ee0
Pull-request: https://github.com/SerenityOS/serenity/pull/23511
Reviewed-by: https://github.com/trflynn89
21 changed files with 243 additions and 152 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue