Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rfc: Corner Smoothing #12

Merged
merged 17 commits into from
Feb 3, 2025
Merged

Conversation

clavin
Copy link
Member

@clavin clavin commented Nov 27, 2024

Applying border-radius to an element makes its corners circular. This proposal adds "smoother" round corners, controlled by a prefixed CSS property. Applications can use this feature to further integrate with macOS's design language, or simply for aesthetic purposes.

📄 Read rendered document

There is a black rectangle on the left using simple rounded corners, and a blue rectangle on the right using smooth rounded corners. Inbetween those rectangles is a magnified view of the same corner from both rectangles overlapping to show the subtle difference in shape.

@clavin clavin requested a review from a team as a code owner November 27, 2024 01:21
@samuelmaddock samuelmaddock added the pending-review Waiting for reviewers to give feedback on the PR specifications label Dec 3, 2024
@clavin
Copy link
Member Author

clavin commented Jan 13, 2025

I've opened a PR for the reference implementation of this RFC: electron/electron#45185

@clavin
Copy link
Member Author

clavin commented Jan 16, 2025

Looks like the brilliant folks working on Flutter are also working in this problem space! flutter/engine#56726

Might see if we can join forces and land some of this work at the Skia level.

Copy link
Member

@erickzhao erickzhao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

We reviewed this API together with @clavin in a synchronous API working group meeting last week.

Some conclusions from the meeting:

  • Adding the electron vendor prefix to the CSS property is good enough to mark it as experimental/nonstandard.
  • The final implementation PR should address whether or not the new property should be available on macOS only be default, or on all systems. It may be a pain point for users to need to turn off the rule only on Windows/Linux if they only want this prop enabled on macOS. CSS doesn't have a way to apply rules only on specific operating systems.

Copy link
Member

@samuelmaddock samuelmaddock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RFC LGTM


The `-electron-corner-smoothing` CSS rule controls how much of the edge can be used for corner curvature:
* It is a percentage between `0%` (default) and `100%`. The value `100%` represents maximum smoothing, but may not consume the full edge.
* The keyword `system-ui` can be used to pick a value that matches the current OS UI.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice idea!

@erickzhao erickzhao added final-comment-period and removed pending-review Waiting for reviewers to give feedback on the PR specifications labels Jan 23, 2025
@samuelmaddock samuelmaddock merged commit 08d00c6 into electron:main Feb 3, 2025
2 checks passed
@clavin clavin deleted the clavin/corner-smoothing branch February 4, 2025 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants