Skip to content

Add CanvasRenderingContext2D.isPointInStroke - #2618

Open
GtechGovind wants to merge 1 commit into
Automattic:masterfrom
GtechGovind:feat/is-point-in-stroke
Open

Add CanvasRenderingContext2D.isPointInStroke#2618
GtechGovind wants to merge 1 commit into
Automattic:masterfrom
GtechGovind:feat/is-point-in-stroke

Conversation

@GtechGovind

Copy link
Copy Markdown

Fixes #1770.

I added CanvasRenderingContext2D.isPointInStroke() using Cairo's native stroke hit testing.

  • Expose the method through the native binding and TypeScript declarations.
  • Convert canvas-space hit-test coordinates into Cairo's current user space so transformed paths behave like the browser API.
  • Normalize ellipse angles before creating the Cairo arc, which makes the bundled full-circle, scaled-dash WPT exercise the new API correctly.
  • Add behavioral coverage for hits, misses, invalid arguments, and transformed paths, plus a type-definition regression test and changelog entries.

Validation on macOS Apple Silicon with Node 26.0.0 and Zig 0.16.0:

  • zig build -j4: passed.

  • Focused Context2d#isPointInStroke() unit test: passed.

  • Bundled 2d.path.isPointInStroke.scaleddashes WPT: passed.

  • npm test -- --reporter dot: 306 passed, six pending.

  • npm run lint and npm run tsd: passed.

  • The complete generated WPT corpus is not currently green: 338 passed, nine pending, and 118 failures across unrelated unsupported APIs and harness gaps.

  • Have you updated CHANGELOG.md?

@GtechGovind
GtechGovind marked this pull request as ready for review August 29, 2026 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: isPointInStroke

1 participant