mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:47:44 +00:00
LibWeb: Implement user navigation involvement helper for MouseEvents
This commit is contained in:
parent
aef5932235
commit
567bb0f6a2
2 changed files with 16 additions and 0 deletions
|
@ -8,6 +8,7 @@
|
|||
#include <LibWeb/Crypto/Crypto.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/DocumentLoading.h>
|
||||
#include <LibWeb/DOM/Event.h>
|
||||
#include <LibWeb/Fetch/Fetching/Fetching.h>
|
||||
#include <LibWeb/Fetch/Infrastructure/FetchAlgorithms.h>
|
||||
#include <LibWeb/Fetch/Infrastructure/FetchController.h>
|
||||
|
@ -2099,4 +2100,18 @@ void Navigable::paint(Painting::RecordingPainter& recording_painter, PaintConfig
|
|||
}
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#event-uni
|
||||
UserNavigationInvolvement user_navigation_involvement(DOM::Event const& event)
|
||||
{
|
||||
// For convenience at certain call sites, the user navigation involvement for an Event event is defined as follows:
|
||||
|
||||
// 1. Assert: this algorithm is being called as part of an activation behavior definition.
|
||||
// 2. Assert: event's type is "click".
|
||||
VERIFY(event.type() == "click"_fly_string);
|
||||
|
||||
// 3. If event's isTrusted is initialized to true, then return "activation".
|
||||
// 4. Return "none".
|
||||
return event.is_trusted() ? UserNavigationInvolvement::Activation : UserNavigationInvolvement::None;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue