#478
fix(macos): canvas shadow, stroke, text font, and accessibility fixes
Summary
- Cast drop shadows from an opaque source. CoreGraphics scales a shadow by its source's alpha, and the source was filled at 1% to stay invisible, so every drop shadow rendered at about 1% of its strength. The shape's interior is now clipped out of the spill region instead.
- Cast vertical shadow offsets downward. Packets use the top-left convention, but
NSShadowreads height in bottom-left space, so every vertical shadow was inverted on macOS. - Honor sub-point and zero stroke widths. Widths were clamped to at least 1 pt, so a 0.5 pt hairline drew twice as heavy as the reference renderer, and zero drew AppKit's thinnest line instead of nothing.
- Guard packet text font resolution. A non-finite size or an unresolvable face left a nil
NSFontin the attributes dictionary literal, which raisedNSInvalidArgumentExceptionand terminated the app. The size now falls back to 12 pt, the face to the system font, and the command is rejected if even that fails. - Answer accessibility settable-attribute queries without forwarding the informal
accessibilityIsAttributeSettable:selector to a superclass that doesn't implement it. It raised and unwound an exception for every attribute of every element in each published tree.
Verification
zig build teston macOS with Zig 0.16.0: passed.scripts/gate.sh fast: every step passed exceptexamples-mobile, which needs the Android NDK. The NDK isn't installed here, and upstreammainfails the same way.- No automated tests: the AppKit drawing path has no pixel harness.
@rdev is attempting to deploy a commit to the Vercel Labs Team on Vercel.
A member of the Team first needs to authorize it.