mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
LibWeb: Stub out "focus-without-user-activation" feature policy
For now this always returns that focus is allowed, as that matches our
previous behavior.
Corresponds to d7053d86ad
This commit is contained in:
parent
7902d13c28
commit
70e3a48892
Notes:
github-actions[bot]
2025-03-14 20:34:25 +00:00
Author: https://github.com/AtkinsSJ
Commit: 70e3a48892
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3945
Reviewed-by: https://github.com/tcl3 ✅
5 changed files with 62 additions and 15 deletions
|
@ -26,24 +26,28 @@ GC::Ref<DOMStringMap> HTMLOrSVGElement<ElementBase>::dataset()
|
|||
template<typename ElementBase>
|
||||
void HTMLOrSVGElement<ElementBase>::focus()
|
||||
{
|
||||
// FIXME: below are the focus(options) steps, also implement focus()
|
||||
// 1. If the allow focus steps given the element's node document return false, then return.
|
||||
if (!static_cast<ElementBase*>(this)->document().allow_focus())
|
||||
return;
|
||||
|
||||
// 1. If the element is marked as locked for focus, then return.
|
||||
// 2. If the element is marked as locked for focus, then return.
|
||||
if (m_locked_for_focus)
|
||||
return;
|
||||
|
||||
// 2. Mark the element as locked for focus.
|
||||
// 3. Mark the element as locked for focus.
|
||||
m_locked_for_focus = true;
|
||||
|
||||
// 3. Run the focusing steps for the element.
|
||||
// 4. Run the focusing steps for the element.
|
||||
run_focusing_steps(static_cast<ElementBase*>(this));
|
||||
|
||||
// FIXME: 4. If the value of the preventScroll dictionary member of options is false,
|
||||
// FIXME: 5. If the value of the focusVisible dictionary member of options is true, or is not present but in an implementation-defined way the user agent determines it would be best to do so, then indicate focus.
|
||||
|
||||
// FIXME: 6. If the value of the preventScroll dictionary member of options is false,
|
||||
// then scroll the element into view with scroll behavior "auto",
|
||||
// block flow direction position set to an implementation-defined value,
|
||||
// and inline base direction position set to an implementation-defined value.
|
||||
|
||||
// 5. Unmark the element as locked for focus.
|
||||
// 7. Unmark the element as locked for focus.
|
||||
m_locked_for_focus = false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue