Title: corner-shape: squircle renders Apple continuous, not CSS superellipse(2): make corner-shape spec-correct and add -ios-corner-shape: continuous · Issue #11452 · NativeScript/NativeScript · GitHub
Open Graph Title: corner-shape: squircle renders Apple continuous, not CSS superellipse(2): make corner-shape spec-correct and add -ios-corner-shape: continuous · Issue #11452 · NativeScript/NativeScript
X Title: corner-shape: squircle renders Apple continuous, not CSS superellipse(2): make corner-shape spec-correct and add -ios-corner-shape: continuous · Issue #11452 · NativeScript/NativeScript
Description: Summary corner-shape: squircle (added in #11365) maps to kCACornerCurveContinuous on iOS. I wrote that mapping believing Apple's continuous corner and the CSS squircle are the same curve. They are not, and the difference is large. Propos...
Open Graph Description: Summary corner-shape: squircle (added in #11365) maps to kCACornerCurveContinuous on iOS. I wrote that mapping believing Apple's continuous corner and the CSS squircle are the same curve. They are ...
X Description: Summary corner-shape: squircle (added in #11365) maps to kCACornerCurveContinuous on iOS. I wrote that mapping believing Apple's continuous corner and the CSS squircle are the same curve. They ...
Opengraph URL: https://github.com/NativeScript/NativeScript/issues/11452
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"corner-shape: squircle renders Apple continuous, not CSS superellipse(2): make corner-shape spec-correct and add -ios-corner-shape: continuous","articleBody":"## Summary\n\n`corner-shape: squircle` (added in #11365) maps to `kCACornerCurveContinuous` on iOS. I wrote that mapping believing Apple's continuous corner and the CSS `squircle` are the same curve. They are not, and the difference is large. Proposal: make `corner-shape` follow the [CSS Borders Level 4](https://drafts.csswg.org/css-borders-4/#corner-shaping) definitions, and expose Apple's continuous corner through a separate iOS-only property, `-ios-corner-shape`. Target: 9.2.\n\n## What is wrong\n\nMeasured on the iOS simulator against a real `CALayer` with `cornerCurve = .continuous` (200×100 layer, r=20, 4× raster diff):\n\n| Shape at the same `border-radius` | Max gap from Apple continuous | Pixels differing |\n|---|---|---|\n| Circle (CSS `round`, `kCACornerCurveCircular`) | 0.019 r (~0.3 pt at r=16) | 756 |\n| CSS `squircle` = `superellipse(2)` | 0.187 r (~3 pt at r=16) | 4368 |\n\nApple's continuous corner is essentially CSS `round` with the curvature eased in over a `1.528665 r` run-up (`CALayer.cornerCurveExpansionFactor(.continuous)`). The CSS squircle is a much squarer corner. No `superellipse(K)` at any radius gets closer to continuous than a plain circle does, so the two cannot be reconciled by picking a different K.\n\nConsequences today:\n\n- A web developer reading `corner-shape: squircle` expects the Chrome/Safari shape and gets something visually indistinguishable from `round`.\n- Non-uniform radii, borders and shadows fall back to circular arcs (documented limitation of #11365). #11451 tries to close that gap and correctly draws the CSS `superellipse(2)`, which means that after it merges, uniform and non-uniform squircle views would disagree by ~0.19 r, worse than the circular fallback.\n- `CALayerCornerCurve` only has `circular` and `continuous`. There is no native way to draw the CSS shape, so the two curves need different rendering strategies anyway.\n\n## Proposal\n\n1. **`corner-shape` follows the spec.**\n - `round` = `kCACornerCurveCircular` (unchanged; it is exactly `superellipse(1)`).\n - `squircle` = `superellipse(2)`, drawn as a `CAShapeLayer` mask path on every branch, including the uniform-radius fast path, since Core Animation cannot draw it. Each corner is two cubic Béziers (one per half-corner, mirrored across the diagonal): in a unit corner box from `(0, 1)` to the diagonal point `(h, h)` with `h = 0.5^(1/4) = 0.840896`, control points `(0.38905, 1)` and `(h − 0.1678, h + 0.1678)`. Max deviation from the exact curve is 1.65e-4 r. This is how Blink renders it, and `superellipse(K)` can be added later on the same path by refitting the three constants per K.\n - Android can implement the same path with `Path.cubicTo`.\n2. **`-ios-corner-shape: continuous`** (iOS-only property, ignored elsewhere) maps to `kCACornerCurveContinuous` on the uniform fast path, so it stays free. For non-uniform radii, borders and shadows it draws Apple's curve, which is three cubic Béziers per corner. With `d1`/`d2` the edge vectors from the vertex (length r each), every point is `v + a·d1 + b·d2`:\n ```\n line to (1.528665, 0)\n cubic cp (1.08849, 0) cp (0.868407, 0) to (0.631494, 0.074911)\n cubic cp (0.372824, 0.169060) cp (0.169060, 0.372824) to (0.074911, 0.631494)\n cubic cp (0, 0.868407) cp (0, 1.08849) to (0, 1.528665)\n ```\n This is byte-for-byte what `UIBezierPath(roundedRect:byRoundingCorners:cornerRadii:)` emits and renders pixel-identical to the layer. The corner consumes `cornerCurveExpansionFactor(.continuous) × r` of each edge, so the radius cap needs that factor. When the non-zero radii are equal, `maskedCorners` + `cornerRadius` + `cornerCurve` renders a subset of corners natively with no mask at all.\n3. If both are set, `-ios-corner-shape` wins on iOS (platform override), otherwise `corner-shape` applies.\n\n## Breaking change\n\n`corner-shape: squircle` was released recently and currently renders continuous. After this change it renders the (squarer) spec shape and goes through a mask. Anyone who adopted it for the iOS system look migrates to `-ios-corner-shape: continuous`. Doing this early keeps the blast radius small; the changelog should call it out explicitly.\n\n## Related\n\n- #11365 added `corner-shape` with the continuous mapping.\n- #11451 implements the spec squircle for non-uniform radii and is deferred until this lands.\n","author":{"url":"https://github.com/edusperoni","@type":"Person","name":"edusperoni"},"datePublished":"2026-09-25T19:03:46Z","url":"https://github.com/NativeScript/NativeScript/issues/11452"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:dac8af60-c466-ee3c-3d50-400c5b721b4b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C47A:842EC:13F8468:1AAC942:6B012DDD |
| html-safe-nonce | 2beb827243a9d116146aedde53f065bb4bf856d2fd0e83d38d03c4044587da64 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNDdBOjg0MkVDOjEzRjg0Njg6MUFBQzk0Mjo2QjAxMkRERCIsInZpc2l0b3JfaWQiOiIyNjAzNDQ4ODcxMjcxMDgzNDg1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 4b414acf2b10de51b90ae7fb050def2f0f4c469eece30e2e39f6eeb3263e51cb |
| hovercard-subject-tag | issue:5587270485 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/NativeScript/NativeScript/11452/issue_layout |
| twitter:image | https://opengraph.githubassets.com/dc988c356e80a779efe9bf5bf1be84cd8dc9a64d255d86e1e2852142ccea2d75/NativeScript/NativeScript/issues/11452 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/dc988c356e80a779efe9bf5bf1be84cd8dc9a64d255d86e1e2852142ccea2d75/NativeScript/NativeScript/issues/11452 |
| og:image:alt | Summary corner-shape: squircle (added in #11365) maps to kCACornerCurveContinuous on iOS. I wrote that mapping believing Apple's continuous corner and the CSS squircle are the same curve. They are ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | edusperoni |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/NativeScript/NativeScript git https://github.com/NativeScript/NativeScript.git |
| octolytics-dimension-user_id | 7392261 |
| octolytics-dimension-user_login | NativeScript |
| octolytics-dimension-repository_id | 31492490 |
| octolytics-dimension-repository_nwo | NativeScript/NativeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 31492490 |
| octolytics-dimension-repository_network_root_nwo | NativeScript/NativeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width