Repository navigation
Description
Context
Found while reviewing #19997. Neo.util.Rectangle#intersects(other) has two return types, and the size of the argument picks one silently:
- An
otherwith width and height: the overlapRectangle, orfalse. - An
otherwith zero width or height: a point-containment test,trueorfalse.
A caller that chains on the result therefore breaks as soon as a zero-size box shows up. On #19997's first head, DomAccess#getClippedRect intersected a torn-out pane's display: none ancestor (a 0×0 rect) and got true. The next .intersects() threw rect.intersects is not a function as a page error, which failed the hosted multi-window e2e specs. #19997 guards that call site. The trap is still in the API.
Design authority: none recorded. intersects() has no JSDoc, and its only statement of intent is the inline comment on the point branch ("We're dealing with a point here - zero dimensions").
The Problem
- One method carries two semantics, area overlap and point-in-rect, and only the caller's argument decides which.
- With no JSDoc, nothing tells a caller the result can be
true. - Three callers use the point branch deliberately and pass a point-shaped object (
{bottom: y, right: x, x, y}).contains()is not a drop-in for them: it delegates toRectangle.includes(), which readsleft/top, and those objects don't have them.
The Architectural Reality
src/util/Rectangle.mjs:intersects()(the area branch and the point branch),contains()and the staticincludes()(left/top/right/bottom), and the staticgetIntersection().- Point callers:
src/manager/Window.mjs(the window under a screen point) andsrc/manager/DragCoordinator.mjs(twice, cross-window targeting). All three pass{bottom: y, right: x, x, y}. - Area caller:
src/main/DomAccess.mjs#getClippedRect, guarded by fix(main): honor containing blocks in DomAccess#getClippedRect (#19984) #19997.
The Fix
intersects(other)always returns the overlapRectangleorfalse. A zero-sizeotherreturnsfalse, because it has no visible overlap.- Point containment gets its own method, for example
containsPoint(x, y), and the three point callers move to it. - Both methods get JSDoc, including their return types.
Acceptance Criteria
-
intersects()never returnstrue. Unit cases cover an overlapping, a disjoint, a touching and a zero-sizeother. -
containsPoint()has unit cases for points inside, on the edge and outside. -
Window.mjsandDragCoordinator.mjsusecontainsPoint(), and their existing unit and e2e coverage stays green. - No caller in
src/,apps/orexamples/still relies on a Boolean fromintersects().
Out of Scope
- Changing the semantics of
includes()orcontains().
Related
- fix(main): honor containing blocks in DomAccess#getClippedRect (#19984) #19997 / A maximized dock pane's tab overflow menu closes as it opens #19984: where the trap fired.
Live latest-open sweep: checked latest 20 open issues at 2026-10-22T13:12:53Z; no equivalent found.
Keyword sweep: gh issue list --search "Rectangle intersects" (all states): no match (only #17578, unrelated).
A2A claim sweep: last 15 lane-claims; no overlapping scope.
MC sweep: "Rectangle intersects returns boolean zero width height point": no prior decision.
Own-assignment sweep: none overlapping.
Origin Session ID: 678d216d-f4f7-41da-80d7-136e627522ff
Retrieval Hint: "Rectangle intersects mixed return Boolean zero-size point branch, getClippedRect page error"
Activity
fix(util): Rectangle#intersects never returns a Boolean; add contains…