gpui: Fix anchored element size calculation with negative coordinates (#55124)

Closes #53202 

`Anchored::prepaint` computes the bounding box of its children to
determine the size used for fitting the anchored element in the window.

Previously, this calculation manually tracked the minimum origin and
maximum bottom-right point, initializing the maximum point to `(0, 0)`.
If child bounds were in negative coordinates, the maximum point could be
clamped to `(0, 0)`, inflating the computed size.

This replaces the manual min/max accumulation with `Bounds::union`,
starting from the actual child bounds instead of sentinel values. This
computes the child bounding box correctly regardless of coordinate sign.

---

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Fixed a bug where the context menu in the agent panel (and other
scrollable surfaces) would appear at the wrong location
b38194198bAgus Zubiaga committed on 4/29/2026, 7:12:21 AM· committed by GitHubparenta38fc8c
1 file changedLine totals unavailable