1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 21:37:35 +00:00

LibWeb+LibWebView+WebContent: Add support for <input type="color">

This commit introduces 3 things:
- Support for the color type in HTMLInputElement itself
- A mechanism for handling non event loop blocking dialogs in Page
- The associated plumbing up to ViewImplementation

Frontends may add support for the color picker with the
ViewImplementation.on_request_color_picker function
This commit is contained in:
circl 2023-09-04 11:32:40 +02:00 committed by Sam Atkins
parent 759ad905de
commit 2995a2e212
14 changed files with 110 additions and 4 deletions

View file

@ -207,6 +207,11 @@ void ViewImplementation::prompt_closed(Optional<String> response)
client().async_prompt_closed(move(response));
}
void ViewImplementation::color_picker_closed(Optional<Color> picked_color)
{
client().async_color_picker_closed(picked_color);
}
void ViewImplementation::toggle_media_play_state()
{
client().async_toggle_media_play_state();

View file

@ -82,6 +82,7 @@ public:
void alert_closed();
void confirm_closed(bool accepted);
void prompt_closed(Optional<String> response);
void color_picker_closed(Optional<Color> picked_color);
void toggle_media_play_state();
void toggle_media_mute_state();
@ -150,6 +151,7 @@ public:
Function<Gfx::IntRect()> on_maximize_window;
Function<Gfx::IntRect()> on_minimize_window;
Function<Gfx::IntRect()> on_fullscreen_window;
Function<void(Color current_color)> on_request_color_picker;
Function<void(bool)> on_finish_handling_input_event;
Function<void()> on_text_test_finish;

View file

@ -384,6 +384,12 @@ void WebContentClient::did_request_file(DeprecatedString const& path, i32 reques
m_view.on_request_file(path, request_id);
}
void WebContentClient::did_request_color_picker(Color const& current_color)
{
if (m_view.on_request_color_picker)
m_view.on_request_color_picker(current_color);
}
void WebContentClient::did_finish_handling_input_event(bool event_was_accepted)
{
if (m_view.on_finish_handling_input_event)

View file

@ -82,6 +82,7 @@ private:
virtual Messages::WebContentClient::DidRequestMinimizeWindowResponse did_request_minimize_window() override;
virtual Messages::WebContentClient::DidRequestFullscreenWindowResponse did_request_fullscreen_window() override;
virtual void did_request_file(DeprecatedString const& path, i32) override;
virtual void did_request_color_picker(Color const& current_color) override;
virtual void did_finish_handling_input_event(bool event_was_accepted) override;
virtual void did_finish_text_test() override;