mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01:00
LibWeb: Simplify reverse child traversal in StackingContext::hit_test()
No need for manual index fiddling, use Vector::in_reverse().
This commit is contained in:
parent
2fa6655dcb
commit
8bbb3429b4
|
|
@ -398,11 +398,10 @@ TraversalDecision StackingContext::hit_test(CSSPixelPoint position, HitTestType
|
|||
|
||||
// 7. the child stacking contexts with positive stack levels (least positive first).
|
||||
// NOTE: Hit testing follows reverse painting order, that's why the conditions here are reversed.
|
||||
for (ssize_t i = m_children.size() - 1; i >= 0; --i) {
|
||||
auto const& child = *m_children[i];
|
||||
if (child.paintable_box().computed_values().z_index().value_or(0) <= 0)
|
||||
for (auto const* child : m_children.in_reverse()) {
|
||||
if (child->paintable_box().computed_values().z_index().value_or(0) <= 0)
|
||||
break;
|
||||
if (child.hit_test(transformed_position, type, callback) == TraversalDecision::Break)
|
||||
if (child->hit_test(transformed_position, type, callback) == TraversalDecision::Break)
|
||||
return TraversalDecision::Break;
|
||||
}
|
||||
|
||||
|
|
@ -449,11 +448,10 @@ TraversalDecision StackingContext::hit_test(CSSPixelPoint position, HitTestType
|
|||
|
||||
// 2. the child stacking contexts with negative stack levels (most negative first).
|
||||
// NOTE: Hit testing follows reverse painting order, that's why the conditions here are reversed.
|
||||
for (ssize_t i = m_children.size() - 1; i >= 0; --i) {
|
||||
auto const& child = *m_children[i];
|
||||
if (child.paintable_box().computed_values().z_index().value_or(0) >= 0)
|
||||
for (auto const* child : m_children.in_reverse()) {
|
||||
if (child->paintable_box().computed_values().z_index().value_or(0) >= 0)
|
||||
break;
|
||||
if (child.hit_test(transformed_position, type, callback) == TraversalDecision::Break)
|
||||
if (child->hit_test(transformed_position, type, callback) == TraversalDecision::Break)
|
||||
return TraversalDecision::Break;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user