#478

fix(macos): canvas shadow, stroke, text font, and accessibility fixes

Openrdevwants to merge intofrom

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 NSShadow reads 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 NSFont in the attributes dictionary literal, which raised NSInvalidArgumentException and 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 test on macOS with Zig 0.16.0: passed.
  • scripts/gate.sh fast: every step passed except examples-mobile, which needs the Android NDK. The NDK isn't installed here, and upstream main fails the same way.
  • No automated tests: the AppKit drawing path has no pixel harness.

Activity

6