mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01: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
|
|
@ -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
|
// 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
|
// 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.
|
// 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) {
|
(void)paintable_box->hit_test(position, Painting::HitTestType::Exact, [&](Painting::HitTestResult result) {
|
||||||
auto* dom_node = result.dom_node();
|
if (auto* element = as_if<Element>(result.dom_node()))
|
||||||
if (dom_node && dom_node->is_element() && result.paintable->visible_for_hit_testing())
|
sequence.append(*element);
|
||||||
sequence.append(*static_cast<Element*>(dom_node));
|
|
||||||
return TraversalDecision::Continue;
|
return TraversalDecision::Continue;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user