mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:27:45 +00:00
Ladybird+LibWeb+WebContent: Parse the <input type=file> accept attribute
This parses the accept attribute value for file input types and passes it along to the browser chromes.
This commit is contained in:
parent
e4213f5767
commit
6760d236e4
20 changed files with 267 additions and 24 deletions
|
@ -18,6 +18,7 @@
|
|||
#include <LibWeb/Forward.h>
|
||||
#include <LibWeb/HTML/ActivateTab.h>
|
||||
#include <LibWeb/HTML/ColorPickerUpdateState.h>
|
||||
#include <LibWeb/HTML/FileFilter.h>
|
||||
#include <LibWeb/HTML/SelectItem.h>
|
||||
#include <LibWeb/Page/InputEvent.h>
|
||||
#include <LibWebView/Forward.h>
|
||||
|
@ -170,7 +171,7 @@ public:
|
|||
Function<Gfx::IntRect()> on_minimize_window;
|
||||
Function<Gfx::IntRect()> on_fullscreen_window;
|
||||
Function<void(Color current_color)> on_request_color_picker;
|
||||
Function<void(Web::HTML::AllowMultipleFiles)> on_request_file_picker;
|
||||
Function<void(Web::HTML::FileFilter const& accepted_file_types, Web::HTML::AllowMultipleFiles)> on_request_file_picker;
|
||||
Function<void(Gfx::IntPoint content_position, i32 minimum_width, Vector<Web::HTML::SelectItem> items)> on_request_select_dropdown;
|
||||
Function<void(Web::KeyEvent const&)> on_finish_handling_key_event;
|
||||
Function<void()> on_text_test_finish;
|
||||
|
|
|
@ -806,7 +806,7 @@ void WebContentClient::did_request_color_picker(u64 page_id, Color const& curren
|
|||
view.on_request_color_picker(current_color);
|
||||
}
|
||||
|
||||
void WebContentClient::did_request_file_picker(u64 page_id, Web::HTML::AllowMultipleFiles allow_multiple_files)
|
||||
void WebContentClient::did_request_file_picker(u64 page_id, Web::HTML::FileFilter const& accepted_file_types, Web::HTML::AllowMultipleFiles allow_multiple_files)
|
||||
{
|
||||
auto maybe_view = m_views.get(page_id);
|
||||
if (!maybe_view.has_value()) {
|
||||
|
@ -816,7 +816,7 @@ void WebContentClient::did_request_file_picker(u64 page_id, Web::HTML::AllowMult
|
|||
auto& view = *maybe_view.value();
|
||||
|
||||
if (view.on_request_file_picker)
|
||||
view.on_request_file_picker(allow_multiple_files);
|
||||
view.on_request_file_picker(accepted_file_types, allow_multiple_files);
|
||||
}
|
||||
|
||||
void WebContentClient::did_request_select_dropdown(u64 page_id, Gfx::IntPoint content_position, i32 minimum_width, Vector<Web::HTML::SelectItem> const& items)
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <AK/HashMap.h>
|
||||
#include <LibIPC/ConnectionToServer.h>
|
||||
#include <LibWeb/HTML/ActivateTab.h>
|
||||
#include <LibWeb/HTML/FileFilter.h>
|
||||
#include <LibWeb/HTML/SelectItem.h>
|
||||
#include <LibWeb/HTML/WebViewHints.h>
|
||||
#include <WebContent/WebContentClientEndpoint.h>
|
||||
|
@ -89,7 +90,7 @@ private:
|
|||
virtual Messages::WebContentClient::DidRequestFullscreenWindowResponse did_request_fullscreen_window(u64 page_id) override;
|
||||
virtual void did_request_file(u64 page_id, ByteString const& path, i32) override;
|
||||
virtual void did_request_color_picker(u64 page_id, Color const& current_color) override;
|
||||
virtual void did_request_file_picker(u64 page_id, Web::HTML::AllowMultipleFiles) override;
|
||||
virtual void did_request_file_picker(u64 page_id, Web::HTML::FileFilter const& accepted_file_types, Web::HTML::AllowMultipleFiles) override;
|
||||
virtual void did_request_select_dropdown(u64 page_id, Gfx::IntPoint content_position, i32 minimum_width, Vector<Web::HTML::SelectItem> const& items) override;
|
||||
virtual void did_finish_handling_input_event(u64 page_id, bool event_was_accepted) override;
|
||||
virtual void did_finish_text_test(u64 page_id) override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue