You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Measured on gravitypdf at 60b82630, PHP 8.5.4, rasterised.
Rule on a 60 × 30 mm div
Browser
mPDF
box-shadow: inset 2mm 2mm 2mm #c00
a shadow inside the padding box, along the top and left edges
a shadow outside the box, along the bottom and right edges
Cause.ShadowParser sets inset (src/Css/ShadowParser.php:95-97), and nothing reads it. PaintDivBB() draws every shadow the same way (src/Mpdf.php:18303 onwards). It clips out the box with the even-odd rule, then fills the offset, spread and blurred shape around it.
Fix. For an inset shadow, clip to the padding box instead of clipping it out. Fill the area between the padding box and the shape, offset and shrunk by the spread. Blur the inner edge, not the outer one. Follow the inner radii when the box has a border-radius. CSS draws inset shadows above the background and below the content; outer shadows go below the background.
Tests. An inset shadow with an offset, with blur, with a spread, with a border-radius, and an inset and an outer shadow on the same box. The shadow's path and clip from the content stream, and a snapshot for the blur.
Activity