An element with outline: 5px solid red and an
outline-offset near INT_MAX is inflated in
LayoutUnit space inside
OutlinePainter::PaintOutlineRects. The sum saturates at
LayoutUnit::Max(), so the far edges of the ring fold back into
the paintable area and render as spurious red strokes near the element.
The bug has been open since 2016 and has outlived two re-enable attempts of
fast/css/outline-offset-large.html.
In the single-rect branch of
OutlinePainter::PaintOutlineRects, cap the per-side offset
passed to AdjustedOutlineOffset at
LayoutUnit::Max() / 4. That bounds the inflated rect to half
the LayoutUnit range, leaves room for the rect itself and the
outline width, and keeps any capped offset far outside the paintable area.
Gated by OutlineOffsetSaturationCap
(status: "stable") as a kill switch.
outline-offset: 2147483000px (near INT_MAX).
With the composited layer (transform: translateZ(0)) and a huge
offset, the pre-fix painter folds the far edges of the saturated rect back
into the viewport. After the fix, the capped offset lives far outside the
paintable area, so the outline is correctly invisible on this stage.
crbug.com/41269582 -- original report (filed 2016-08-11)
CL 8608187 -- Cap single-rect outline offset below LayoutUnit saturation
CL 1548423 / CL 1553953 -- 2019 re-enable + revert of the layout test