Repository navigation
Conversation
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Heads up: you’re close to your flex budget. Increase your flex budget so reviews don’t pause.
View guided diff | Re-trigger cubic
…occlusion flag The collapsed-bounds guard ran before the `contains` check, so a zero-area node covered by a real element stopped being marked `ignored_by_paint_order`. Its rect only has to stay out of the union; occlusion detection still applies to it. Adds the x-only / y-only inversion cases and a zero-height collapsed case, plus a regression test for the covered-collapsed-node path.
|
Retargeted this to No code changed: the branch was cut from the The bug, briefly: the paint-order walk accepted any rect as a paint candidate, including inverted ones ( Happy to close it if 0.x is no longer taking fixes. |
Summary
Rect.__post_init__validated the corner order withreturn False, which dataclasses ignore:Rect(x1=100, y1=50, x2=20, y2=10)was constructed silently with a negative area and then entered occlusion calculations.PaintOrderRemover.calculate_paint_order()also built rects from any non-emptybounds, including collapsed elements withwidth <= 0orheight <= 0, so zero-area rects could take part in the union and flag other nodes as occluded.This makes
RectraiseValueErrorfor inverted bounds and skips non-positive bounds before the rect is created.Tests
tests/ci/test_paint_order_rect_validation.pycovers:ValueError(horizontal and vertical inversion)ignored_by_paint_orderThe validation tests fail on unmodified
main(DID NOT RAISE ValueError), and the existingtests/ci/test_dom_paint_order_serialization.pystill passes with the change.Fixes #5987
Summary by cubic
Fixes #5987: inverted rectangle bounds silently corrupted occlusion math, and collapsed elements could mark other nodes as occluded.
Rect.__post_init__returnedFalse, which dataclasses ignore, so inverted bounds produced negative-area rects that entered paint-order calculations. It now raisesValueError.collect_paint_orderalso builds rects from collapsed elements (width or height ≤ 0) and let their zero-area rects join the union, so two collapsed siblings at the same point could flag each other as occluded. Collapsed rects now stay out of the union, but the check runs after occlusion detection so a collapsed node covered by a real element is still markedignored_by_paint_order.Written for commit 14d4e82. Summary will update on new commits.