mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 12:07:45 +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:
parent
759ad905de
commit
2995a2e212
14 changed files with 110 additions and 4 deletions
|
@ -13,6 +13,7 @@
|
|||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/HTML/BrowsingContext.h>
|
||||
#include <LibWeb/HTML/EventLoop/EventLoop.h>
|
||||
#include <LibWeb/HTML/HTMLInputElement.h>
|
||||
#include <LibWeb/HTML/HTMLMediaElement.h>
|
||||
#include <LibWeb/HTML/Scripting/Environments.h>
|
||||
#include <LibWeb/HTML/Scripting/TemporaryExecutionContext.h>
|
||||
|
@ -286,6 +287,28 @@ void Page::accept_dialog()
|
|||
}
|
||||
}
|
||||
|
||||
void Page::did_request_color_picker(WeakPtr<HTML::HTMLInputElement> target, Color current_color)
|
||||
{
|
||||
if (m_pending_non_blocking_dialog == PendingNonBlockingDialog::None) {
|
||||
m_pending_non_blocking_dialog = PendingNonBlockingDialog::ColorPicker;
|
||||
m_pending_non_blocking_dialog_target = move(target);
|
||||
|
||||
m_client.page_did_request_color_picker(current_color);
|
||||
}
|
||||
}
|
||||
|
||||
void Page::color_picker_closed(Optional<Color> picked_color)
|
||||
{
|
||||
if (m_pending_non_blocking_dialog == PendingNonBlockingDialog::ColorPicker) {
|
||||
m_pending_non_blocking_dialog = PendingNonBlockingDialog::None;
|
||||
|
||||
if (m_pending_non_blocking_dialog_target) {
|
||||
m_pending_non_blocking_dialog_target->did_pick_color(picked_color);
|
||||
m_pending_non_blocking_dialog_target.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Page::did_request_media_context_menu(i32 media_id, CSSPixelPoint position, DeprecatedString const& target, unsigned modifiers, MediaContextMenu menu)
|
||||
{
|
||||
m_media_context_menu_element_id = media_id;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue