LibWeb: Add view transition related user relevancy
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run

This commit is contained in:
Psychpsyo 2025-09-08 14:40:34 +02:00 committed by Sam Atkins
commit c04f83f5f4
Notes: github-actions[bot] 2025-09-10 16:38:48 +00:00

View file

@ -3282,21 +3282,25 @@ bool Element::is_relevant_to_the_user()
if (document().get_selection()->contains_node(*this, true)) if (document().get_selection()->contains_node(*this, true))
return true; return true;
// Either the element or its contents are placed in the top layer. bool has_relevant_contents = false;
bool is_in_top_layer = false;
for_each_in_inclusive_subtree_of_type<Element>([&](auto& element) { for_each_in_inclusive_subtree_of_type<Element>([&](auto& element) {
// Either the element or its contents are placed in the top layer.
if (element.in_top_layer()) { if (element.in_top_layer()) {
is_in_top_layer = true; has_relevant_contents = true;
return TraversalDecision::Break;
}
// The element has a flat tree descendant that is captured in a view transition.
if (&element != this && element.captured_in_a_view_transition()) {
has_relevant_contents = true;
return TraversalDecision::Break; return TraversalDecision::Break;
} }
return TraversalDecision::Continue; return TraversalDecision::Continue;
}); });
if (is_in_top_layer) if (has_relevant_contents)
return true; return true;
// FIXME: The element has a flat tree descendant that is captured in a view transition.
// NOTE: none of the above conditions are true, so the element is not relevant to the user. // NOTE: none of the above conditions are true, so the element is not relevant to the user.
return false; return false;
} }