Skip to content

[css-borders-4] Merge border-limit and border-clip-*? #9634

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

Open
SebastianZ opened this issue Nov 25, 2023 · 0 comments
Open

[css-borders-4] Merge border-limit and border-clip-*? #9634

SebastianZ opened this issue Nov 25, 2023 · 0 comments

Comments

@SebastianZ
Copy link
Contributor

SebastianZ commented Nov 25, 2023

Currently, we have two properties that influence how parts of the border are drawn.
border-limit allows to specify which parts of a border to draw (everything or only specific sides or only the corners).
The border-clip-* properties allow to clip specific parts of the border after drawing it.

That's also outlined as an issue in the spec.

Here are two proposals for doing this: the second one is from GCPM, the first one is an attempt to recast it more readably. The names are terrible, known problem, proposals accepted. There is a problem with conceiving this as clipping: if you have dotted borders, you want whole dots always, not parts of dots. So it should be a drawing limit, not a clip.

As they are covering similar use cases, I suggest we merge the features of border-limit into border-clip-*.

The syntax would then be

normal | sides | corners | [ <length-percentage [0,∞]> | <flex> ]+

Where sides clips the sides up to but not including the corners and corners clips the corners.
Clipping is obviously the opposite of of limiting the drawing, though with the above authors can achieve the same effects as border-limit.

Here are examples for how the syntax above covers the use cases of border-limit:

border-clip: normal = border-limit: all
border-clip: sides = border-limit: corners
border-clip: corners = border-limit: sides
border-clip-top: 100%; border-clip-right: 100%; border-clip-bottom: 100%; = border-limit: left
border-clip: 0 1fr 50% 1fr = border-limit: sides 50%

Even without introducing the sides and corners keywords, authors could achieve the same effect when they know the border radius. E.g.

border-clip: var(--border-radius) 1fr = border-limit: corners
border-clip: 0 var(--border-radius) 1fr = border-limit: sides

If we want to use keywords, we need to discuss their names, because border-clip-top: sides sounds wrong.

The name is still up for bikeshedding, of course. As the spec. issue notes, authors probably don't actually want real clipping when using non-solid border styles. Though simple clipping is presumably much faster than an algorithm that takes the style into account.

Sebastian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant