mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:17:34 +00:00
LibWeb: Fix pointer-events check in hit_test
This commit is contained in:
parent
ebd93c8d57
commit
66e424a084
2 changed files with 8 additions and 10 deletions
|
@ -117,6 +117,8 @@ public:
|
||||||
|
|
||||||
auto const& computed_values() const { return m_layout_node.computed_values(); }
|
auto const& computed_values() const { return m_layout_node.computed_values(); }
|
||||||
|
|
||||||
|
bool visible_for_hit_testing() const { return computed_values().pointer_events() != CSS::PointerEvents::None; }
|
||||||
|
|
||||||
HTML::BrowsingContext const& browsing_context() const { return m_layout_node.browsing_context(); }
|
HTML::BrowsingContext const& browsing_context() const { return m_layout_node.browsing_context(); }
|
||||||
HTML::BrowsingContext& browsing_context() { return layout_node().browsing_context(); }
|
HTML::BrowsingContext& browsing_context() { return layout_node().browsing_context(); }
|
||||||
|
|
||||||
|
|
|
@ -379,10 +379,6 @@ Optional<HitTestResult> StackingContext::hit_test(Gfx::FloatPoint const& positio
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (paintable().computed_values().pointer_events() == CSS::PointerEvents::None) {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOTE: Hit testing basically happens in reverse painting order.
|
// NOTE: Hit testing basically happens in reverse painting order.
|
||||||
// https://www.w3.org/TR/CSS22/visuren.html#z-index
|
// https://www.w3.org/TR/CSS22/visuren.html#z-index
|
||||||
|
|
||||||
|
@ -393,7 +389,7 @@ Optional<HitTestResult> StackingContext::hit_test(Gfx::FloatPoint const& positio
|
||||||
if (child.m_box.computed_values().z_index().value_or(0) < 0)
|
if (child.m_box.computed_values().z_index().value_or(0) < 0)
|
||||||
break;
|
break;
|
||||||
auto result = child.hit_test(transformed_position, type);
|
auto result = child.hit_test(transformed_position, type);
|
||||||
if (result.has_value())
|
if (result.has_value() && result->paintable->visible_for_hit_testing())
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -413,13 +409,13 @@ Optional<HitTestResult> StackingContext::hit_test(Gfx::FloatPoint const& positio
|
||||||
}
|
}
|
||||||
return TraversalDecision::Continue;
|
return TraversalDecision::Continue;
|
||||||
});
|
});
|
||||||
if (result.has_value())
|
if (result.has_value() && result->paintable->visible_for_hit_testing())
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
// 5. the in-flow, inline-level, non-positioned descendants, including inline tables and inline blocks.
|
// 5. the in-flow, inline-level, non-positioned descendants, including inline tables and inline blocks.
|
||||||
if (m_box.children_are_inline() && is<Layout::BlockContainer>(m_box)) {
|
if (m_box.children_are_inline() && is<Layout::BlockContainer>(m_box)) {
|
||||||
auto result = paintable().hit_test(transformed_position, type);
|
auto result = paintable().hit_test(transformed_position, type);
|
||||||
if (result.has_value())
|
if (result.has_value() && result->paintable->visible_for_hit_testing())
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -438,7 +434,7 @@ Optional<HitTestResult> StackingContext::hit_test(Gfx::FloatPoint const& positio
|
||||||
}
|
}
|
||||||
return TraversalDecision::Continue;
|
return TraversalDecision::Continue;
|
||||||
});
|
});
|
||||||
if (result.has_value())
|
if (result.has_value() && result->paintable->visible_for_hit_testing())
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
// 3. the in-flow, non-inline-level, non-positioned descendants.
|
// 3. the in-flow, non-inline-level, non-positioned descendants.
|
||||||
|
@ -457,7 +453,7 @@ Optional<HitTestResult> StackingContext::hit_test(Gfx::FloatPoint const& positio
|
||||||
}
|
}
|
||||||
return TraversalDecision::Continue;
|
return TraversalDecision::Continue;
|
||||||
});
|
});
|
||||||
if (result.has_value())
|
if (result.has_value() && result->paintable->visible_for_hit_testing())
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -468,7 +464,7 @@ Optional<HitTestResult> StackingContext::hit_test(Gfx::FloatPoint const& positio
|
||||||
if (child.m_box.computed_values().z_index().value_or(0) >= 0)
|
if (child.m_box.computed_values().z_index().value_or(0) >= 0)
|
||||||
break;
|
break;
|
||||||
auto result = child.hit_test(transformed_position, type);
|
auto result = child.hit_test(transformed_position, type);
|
||||||
if (result.has_value())
|
if (result.has_value() && result->paintable->visible_for_hit_testing())
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue