LibWeb+LibGfx: Make IntersectionObserver checks edge-inclusive

This fixes an issue where 0x0 rectangles were not considered to be
intersecting, even when they fell inside (or were adjacent to) the
viewport.
This commit is contained in:
Andreas Kling 2025-02-16 12:17:07 +01:00 committed by Andreas Kling
commit 31a69ce887
Notes: github-actions[bot] 2025-02-16 17:10:02 +00:00
3 changed files with 11 additions and 6 deletions

View file

@ -395,6 +395,12 @@ public:
&& other.top() < bottom();
}
[[nodiscard]] bool edge_adjacent_intersects(Rect<T> const& other) const
{
return max(left(), other.left()) <= min(right(), other.right())
&& max(top(), other.top()) <= min(bottom(), other.bottom());
}
template<typename Container>
[[nodiscard]] bool intersects(Container const& others) const
{