mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:47:36 +00:00
LibWeb: Run the unfocusing steps when a click does not focus anything
For example, when clicking the document body outside of a focused input element, we should unfocus that element.
This commit is contained in:
parent
48240a6fc3
commit
fd297a3248
6 changed files with 42 additions and 0 deletions
|
@ -84,6 +84,16 @@ void Internals::commit_text()
|
|||
page->handle_keydown(Key_Return, 0, 0);
|
||||
}
|
||||
|
||||
void Internals::click(double x, double y)
|
||||
{
|
||||
auto* page = global_object().browsing_context()->page();
|
||||
if (!page)
|
||||
return;
|
||||
|
||||
page->handle_mousedown({ x, y }, { x, y }, 1, 0, 0);
|
||||
page->handle_mouseup({ x, y }, { x, y }, 1, 0, 0);
|
||||
}
|
||||
|
||||
WebIDL::ExceptionOr<bool> Internals::dispatch_user_activated_event(DOM::EventTarget& target, DOM::Event& event)
|
||||
{
|
||||
event.set_is_trusted(true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue