mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:47:44 +00:00
Browser+LibWeb+WebContent: Broadcast video element context menu requests
This just sets up the IPC to notify the browser process of context menu requests on video elements. The IPC contains a few pieces of information about the state of the video element.
This commit is contained in:
parent
5f473bcb5f
commit
d8f03dda08
14 changed files with 54 additions and 0 deletions
|
@ -13,6 +13,7 @@
|
|||
#include <LibWeb/HTML/HTMLAnchorElement.h>
|
||||
#include <LibWeb/HTML/HTMLIFrameElement.h>
|
||||
#include <LibWeb/HTML/HTMLImageElement.h>
|
||||
#include <LibWeb/HTML/HTMLVideoElement.h>
|
||||
#include <LibWeb/Layout/Viewport.h>
|
||||
#include <LibWeb/Page/EventHandler.h>
|
||||
#include <LibWeb/Page/Page.h>
|
||||
|
@ -302,6 +303,17 @@ bool EventHandler::handle_mouseup(CSSPixelPoint position, unsigned button, unsig
|
|||
auto image_url = image_element.document().parse_url(image_element.src());
|
||||
if (auto* page = m_browsing_context->page())
|
||||
page->client().page_did_request_image_context_menu(m_browsing_context->to_top_level_position(position), image_url, "", modifiers, image_element.bitmap());
|
||||
} else if (is<HTML::HTMLVideoElement>(*node)) {
|
||||
auto& video_element = verify_cast<HTML::HTMLVideoElement>(*node);
|
||||
|
||||
auto video_id = video_element.id();
|
||||
auto video_url = video_element.document().parse_url(video_element.current_src());
|
||||
auto is_playing = !video_element.potentially_playing();
|
||||
auto has_user_agent_controls = video_element.has_attribute(HTML::AttributeNames::controls);
|
||||
auto is_looping = video_element.has_attribute(HTML::AttributeNames::loop);
|
||||
|
||||
if (auto* page = m_browsing_context->page())
|
||||
page->did_request_video_context_menu(video_id, m_browsing_context->to_top_level_position(position), video_url, "", modifiers, is_playing, has_user_agent_controls, is_looping);
|
||||
} else if (auto* page = m_browsing_context->page()) {
|
||||
page->client().page_did_request_context_menu(m_browsing_context->to_top_level_position(position));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue