mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-30 06:06:48 +00:00
LibWeb: Simplify Document::elements_from_point()
We should not need to check if the result of a hit test is actually visible for hit testing, because if it wasn't, it should not have been returned from PaintableBox::hit_test() in the first place.
This commit is contained in:
parent
22dacde2c5
commit
1ec3b1c6df
Notes:
github-actions[bot]
2025-07-05 22:58:04 +00:00
Author: https://github.com/gmta
Commit: 1ec3b1c6df
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5298
Reviewed-by: https://github.com/tcl3 ✅
1 changed files with 3 additions and 4 deletions
|
@ -5660,11 +5660,10 @@ GC::RootVector<GC::Ref<Element>> Document::elements_from_point(double x, double
|
|||
// 3. For each box in the viewport, in paint order, starting with the topmost box, that would be a target for
|
||||
// hit testing at coordinates x,y even if nothing would be overlapping it, when applying the transforms that
|
||||
// apply to the descendants of the viewport, append the associated element to sequence.
|
||||
if (auto const* paintable_box = this->paintable_box(); paintable_box) {
|
||||
if (auto const* paintable_box = this->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() && result.paintable->visible_for_hit_testing())
|
||||
sequence.append(*static_cast<Element*>(dom_node));
|
||||
if (auto* element = as_if<Element>(result.dom_node()))
|
||||
sequence.append(*element);
|
||||
return TraversalDecision::Continue;
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue