mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 20:59:16 +00:00
LibWeb: Move event handling & cursor from BrowsingContext to Navigable
This was a long standing FIXME since the introduction of navigables.
This commit is contained in:
parent
9cd4a65071
commit
0ebfc0a4c4
Notes:
sideshowbarker
2024-07-17 01:46:43 +09:00
Author: https://github.com/awesomekling
Commit: 0ebfc0a4c4
Pull-request: https://github.com/SerenityOS/serenity/pull/24123
26 changed files with 364 additions and 360 deletions
|
@ -209,13 +209,13 @@ void run_focusing_steps(DOM::Node* new_focus_target, DOM::Node* fallback_target,
|
|||
// 5. If new focus target is the currently focused area of a top-level browsing context, then return.
|
||||
if (!new_focus_target->document().browsing_context())
|
||||
return;
|
||||
auto top_level_browsing_context = new_focus_target->document().browsing_context()->top_level_browsing_context();
|
||||
if (new_focus_target == top_level_browsing_context->currently_focused_area().ptr())
|
||||
auto top_level_traversable = new_focus_target->document().browsing_context()->top_level_traversable();
|
||||
if (new_focus_target == top_level_traversable->currently_focused_area().ptr())
|
||||
return;
|
||||
|
||||
// 6. Let old chain be the current focus chain of the top-level browsing context in which
|
||||
// new focus target finds itself.
|
||||
auto old_chain = focus_chain(top_level_browsing_context->currently_focused_area());
|
||||
auto old_chain = focus_chain(top_level_traversable->currently_focused_area());
|
||||
|
||||
// 7. Let new chain be the focus chain of new focus target.
|
||||
auto new_chain = focus_chain(new_focus_target);
|
||||
|
@ -243,8 +243,8 @@ void run_unfocusing_steps(DOM::Node* old_focus_target)
|
|||
if (is_shadow_host(old_focus_target)) {
|
||||
auto* shadow_root = static_cast<DOM::Element*>(old_focus_target)->shadow_root_internal();
|
||||
if (shadow_root->delegates_focus()) {
|
||||
auto top_level_browsing_context = old_focus_target->document().browsing_context()->top_level_browsing_context();
|
||||
if (auto currently_focused_area = top_level_browsing_context->currently_focused_area()) {
|
||||
auto top_level_traversable = old_focus_target->document().browsing_context()->top_level_traversable();
|
||||
if (auto currently_focused_area = top_level_traversable->currently_focused_area()) {
|
||||
if (shadow_root->is_shadow_including_ancestor_of(*currently_focused_area)) {
|
||||
old_focus_target = currently_focused_area;
|
||||
}
|
||||
|
@ -261,10 +261,10 @@ void run_unfocusing_steps(DOM::Node* old_focus_target)
|
|||
|
||||
// NOTE: HTMLAreaElement is currently missing the shapes property
|
||||
|
||||
auto top_level_browsing_context = old_focus_target->document().browsing_context()->top_level_browsing_context();
|
||||
auto top_level_traversable = old_focus_target->document().browsing_context()->top_level_traversable();
|
||||
|
||||
// 4. Let old chain be the current focus chain of the top-level browsing context in which old focus target finds itself.
|
||||
auto old_chain = focus_chain(top_level_browsing_context->currently_focused_area());
|
||||
auto old_chain = focus_chain(top_level_traversable->currently_focused_area());
|
||||
|
||||
// 5. If old focus target is not one of the entries in old chain, then return.
|
||||
auto it = old_chain.find_if([&](auto const& node) { return old_focus_target == node; });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue