mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-08 17:19:13 +00:00
LibWeb: Reorder paintable hit-testing to account for pointer-events
Instead of ignoring any paintable immediately when they're invisible to hit-testing, consider every candidate and while the most specific candidate is invisible to hit-testing, traverse up to its parent paintable. This more closely reflects the behavior expected when wrapping block elements inside inline elements, where although the block element might have `pointer-events: none`, it still becomes part of the hit-test body of the inline parent. This makes the following link work as expected: <a href="https://ladybird.org"> <div style="pointer-events: none">Ladybird</div> </a>
This commit is contained in:
parent
e076cb9b0e
commit
b7a554d1f2
Notes:
github-actions[bot]
2025-01-23 08:34:09 +00:00
Author: https://github.com/gmta
Commit: b7a554d1f2
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3276
Reviewed-by: https://github.com/kalenikaliaksandr ✅
4 changed files with 76 additions and 10 deletions
|
@ -5315,7 +5315,7 @@ GC::RootVector<GC::Ref<Element>> Document::elements_from_point(double x, double
|
|||
if (auto const* paintable_box = this->paintable_box(); paintable_box) {
|
||||
(void)paintable_box->hit_test(position, Painting::HitTestType::Exact, [&](Painting::HitTestResult result) {
|
||||
auto* dom_node = result.dom_node();
|
||||
if (dom_node && dom_node->is_element())
|
||||
if (dom_node && dom_node->is_element() && result.paintable->visible_for_hit_testing())
|
||||
sequence.append(*static_cast<Element*>(dom_node));
|
||||
return TraversalDecision::Continue;
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue