Re: [csswg-drafts] [css-shapes-2][css-borders-4] Add a way to change an element's shape (#6997)

The CSS Working Group just discussed `[css-shapes-2][css-borders-4] Add a way to change an element's shape`, and agreed to the following:

* `RESOLVED: corner-shape and border-shape are independent properties`
* `RESOLVED: border-shape overrides corner-shape / border-radius`
* `RESOLVED: border-shape is a non-layout affecting property`
* `RESOLVED: default stroke width / color get taken from existing border props, specifics TBD`

<details><summary>The full IRC log of that discussion</summary>
&lt;emilio> noamr: I can give a bit of a recap<br>
&lt;emilio> ... we resolved at TPAC on having a draft for border-shape<br>
&lt;emilio> ... I started working on that and discovered some questions<br>
&lt;emilio> ... one of them is how it relates to corner-shape<br>
&lt;emilio> ... other one is how it works with border-width etc<br>
&lt;emilio> ... so wanted smfr to demo what he has<br>
&lt;emilio> ... and then talk demos<br>
&lt;emilio> smfr: [shows prototype]<br>
&lt;emilio> ... uses border-shape with the recent `shape()` function<br>
&lt;emilio> ... so it effectively takes over the rendering of the rounded rect<br>
&lt;emilio> ... and replace it with effectively two shapes<br>
&lt;emilio> ... one for the inside of the rect, one for the outside<br>
&lt;emilio> ... actually first outside, second inside<br>
&lt;emilio> ... it uses two different beziers, and it shows background-clip: border-area, and also box-shadow which both follow those shapes<br>
&lt;emilio> ... the way I think about this is replacing the rendering of the radius<br>
&lt;emilio> s/radius/border/<br>
&lt;emilio> ... it follows the same rules regarding clipping of the content etc, just like border-radius<br>
&lt;emilio> ... that's the two-shape version of this<br>
&lt;emilio> ... [switches demo]<br>
&lt;emilio> ... this one is the one-shape version, with a hole<br>
&lt;noamr> q+<br>
&lt;emilio> ... I think I used border-top-width for the line width<br>
&lt;emilio> ... but single-shape has issues re. that interaction<br>
&lt;emilio> ... a separate draft of mine just specifies effectively a stroke width<br>
&lt;emilio> ... interpolating seems hard<br>
&lt;emilio> ... also this is purely decorative. Affects clipping and ink overflow, but layout still uses the general box model<br>
&lt;emilio> q+<br>
&lt;emilio> ... what that means is that you might specify shape that allow the inside edge to project outside of the border-box<br>
&lt;emilio> ... which exposes things like extra background area or what not which are a bit weird<br>
&lt;TabAtkins> q+<br>
&lt;astearns> ack noamr<br>
&lt;emilio> ... one other thing I wanted to mention the connection between this and corner-shape is that this breaks assumptions<br>
&lt;emilio> noamr: one of the oddities is how it interacts with border-width<br>
&lt;emilio> ... with border-radius it kinda works<br>
&lt;emilio> ... so that's one oddity of this<br>
&lt;emilio> ... if your shape is kinda boxy you probably want your border-width to affect it<br>
&lt;emilio> ... I think border-width would be a default you can override<br>
&lt;emilio> ... same with border-color<br>
&lt;emilio> ... my thinking was that this could behave like a mask going through the borders<br>
&lt;noamr> https://github.com/w3c/csswg-drafts/issues/6997#issuecomment-2389134315<br>
&lt;emilio> ... would be a simple solution but not what people would want<br>
&lt;fserb> q+<br>
&lt;emilio> ... I think this should be separate from corner-shape<br>
&lt;emilio> ... we should restrict corner-shape to rectangles<br>
&lt;emilio> ... where we can use it with border-radius<br>
&lt;emilio> ... and this would smooth your radius rather than something that controls shape<br>
&lt;emilio> ... would be good to separate it at least in the beginning<br>
&lt;emilio> ... and we'd leave the interaction problems for later<br>
&lt;bramus> emilio: i was wwondering if this corrected border matches stuff how border-image works today<br>
&lt;bramus> … not sure how border-image and border-radius interact<br>
&lt;bramus> … feels similar<br>
&lt;bramus> … in the sense that b-i disregards b-w and layout<br>
&lt;bramus> … would be good to be consistent witht hat<br>
&lt;florian> q+<br>
&lt;astearns> ack emilio<br>
&lt;bramus> … can find some answers to the weird questions here<br>
&lt;astearns> ack TabAtkins<br>
&lt;emilio> TabAtkins: generally agree with emilio, border-image does use border-width for the area but you can override<br>
&lt;emilio> ... we should approach this to keep this simple, the geometry should be overridden by shape, which is what simon is suggesting as well<br>
&lt;emilio> ... supportive of not paying attention to color or width as much as possible<br>
&lt;emilio> ... had some suggestions but not fully fledges<br>
&lt;emilio> ... having some way of specifying variable colors along the path seems nicer than trying to interpolate based on existing border properties<br>
&lt;schenney> +1 to Tab's color/width idea.<br>
&lt;schenney> Interpolate between points.<br>
&lt;emilio> smfr: sounds hard, not sure if svg has a way of changing colors along the path<br>
&lt;emilio> ... nice suggestion<br>
&lt;emilio> TabAtkins: what about variable width stroke?<br>
&lt;emilio> smfr: you need to use multiple paths for that<br>
&lt;emilio> TabAtkins: that's kind of annoying<br>
&lt;emilio> ... quite a jump from border-radius to some two-path<br>
&lt;schenney> q+<br>
&lt;emilio> weinig: PostScript model is a bit old, updating it might be reasonable<br>
&lt;RRSAgent> I have made the request to generate https://www.w3.org/2025/01/29-css-minutes.html fantasai<br>
&lt;emilio> ... sticking just to pdfs had in late 90s got us pretty hard<br>
&lt;emilio> ... pushing that seems reasonable<br>
&lt;astearns> s/hard/far/<br>
&lt;emilio> ... we can build the paths and draw new stuff<br>
&lt;emilio> ... would just be slow<br>
&lt;emilio> ... doesn't mean that we need to be constrained, we should be able to push that<br>
&lt;emilio> ... we know how to do the conversion from border-radius to multiple paths<br>
&lt;emilio> TabAtkins: I agree that as long as it's not unusably slow we should be able to do this, authors would just have to wait for animation use cases<br>
&lt;emilio> fserb: two things<br>
&lt;astearns> ack fserb<br>
&lt;emilio> ... first, I think I tend to agree with Tab that it might be possible to given one shape and automatically build the two things<br>
&lt;emilio> ... it is probably possible<br>
&lt;emilio> ... need to be careful about where it begins<br>
&lt;emilio> ... I don't think we need more infrastructure from low level graphics APIs for this<br>
&lt;emilio> ... if we have a good way of determining how the inner shape works from the outer and a width<br>
&lt;emilio> smfr: I think some shapes might be pretty hard, like shapes with loops and what not<br>
&lt;emilio> fserb: I think that works less for colors than for width<br>
&lt;emilio> ... I don't know what colors mean on a shap<br>
&lt;emilio> ... I think leaverou wanted to do quadrants, but even that seems a bit sketchy<br>
&lt;TabAtkins> (i'm fine with abandoning gradient stroke)<br>
&lt;emilio> ... but would be nice to try this for border<br>
&lt;emilio> ... easy way is to lose some of those other properties, but maybe we regret this<br>
&lt;noamr> q+<br>
&lt;emilio> ... Maybe it's worth trying to connect border-width to this, even if it's probably hard<br>
&lt;astearns> ack florian<br>
&lt;fantasai> +1 fserb<br>
&lt;emilio> florian: back to an earlier point, the fact that this would be disconnected from layout border-width<br>
&lt;emilio> ... it might be seen as a feature<br>
&lt;emilio> ... controlling the layout so taht it doesn't interact with the border seems useful<br>
&lt;emilio> ... so defaulting stroke to top<br>
&lt;TabAtkins> yeah, taking the default width/color from border-top seems fine<br>
&lt;emilio> ... and using left/right/bottom for layout adjustments seems nice<br>
&lt;astearns> ack schenney<br>
&lt;emilio> ... maybe weird but convenient<br>
&lt;fantasai> or average all the colors? :)<br>
&lt;emilio> schenney: so in your original demo, where would scrollbars be if you had overflow: scroll?<br>
&lt;TabAtkins> scrollbar-path: shape(...)<br>
&lt;emilio> noamr: The problem with scrollbars is the same for border-radius, it appears on top<br>
&lt;emilio> ... ugly, but needed for a11y<br>
&lt;florian> scrollbar-path ?<br>
&lt;emilio> ... this conversation about the border stuff being this default makes sense<br>
&lt;emilio> schenney: so we're leaning towards making this not affect the layout right?<br>
&lt;emilio> correct<br>
&lt;emilio> smfr: Firefox applies extra constraints to border radius for scrollbars<br>
&lt;emilio> ... maybe the spec could allow that for border-shape too<br>
&lt;astearns> ack noamr<br>
&lt;emilio> noamr: wanted to go back to separate it from corner-shape<br>
&lt;emilio> ... so keep corner-shape for boxes, and border-shape for other stuff<br>
&lt;noamr> q+<br>
&lt;florian> q+<br>
&lt;emilio> smfr: so do we want to merge corner-shape and border-shape or keeping separate?<br>
&lt;TabAtkins> would prefer separate<br>
&lt;astearns> ack noamr<br>
&lt;fserb> +1 separate<br>
&lt;TabAtkins> q+<br>
&lt;emilio> noamr: one argument against combining is that corner-shape interacts with border-radius<br>
&lt;astearns> ack florian<br>
&lt;emilio> smfr: you could also see a border-shape that's mostly rounded as an enhancement on border-radius<br>
&lt;emilio> florian: so border-shape: auto uses the rest, and otherwise you override<br>
&lt;ydaniv> q+<br>
&lt;emilio> emilio: but you have two props at that point already<br>
&lt;emilio> q+<br>
&lt;bramus> emilio: dont think that is exclusive<br>
&lt;bramus> … if you keep the on the same property you can still define sth like that<br>
&lt;bramus> … if corner shape is superellipse then you account for border radius and take over<br>
&lt;bramus> florian: could be worng that corner shape thing has not 1 value but 1, 2,4 …<br>
&lt;bramus> … it has longhands to go along with this<br>
&lt;bramus> … whcih border-shape does not<br>
&lt;bramus> … its 4 props (or more) rolled into 1<br>
&lt;bramus> … where border-shape is 1 thing<br>
&lt;bramus> emilio: that’[s a good argument<br>
&lt;astearns> ack TabAtkins<br>
&lt;emilio> TabAtkins: pretty strong to keep them separate<br>
&lt;emilio> ... as it was brought up, generic paths have a lot of complexity<br>
&lt;emilio> ... that prevents us from making assumptions<br>
&lt;emilio> ... well defined corner shapes don't have those constraints, and we can use border-width etc<br>
&lt;emilio> ... so I think corner-shape should be on the general thing, and the path version should do its own thing on top<br>
&lt;astearns> ack ydaniv<br>
&lt;emilio> ydaniv: we could consider reversing the names, conceptually<br>
&lt;emilio> ... having a shape as the shorthand and border / corner as longhands<br>
&lt;emilio> ... maybe think how they interact<br>
&lt;emilio> ... may make it more complicated tho<br>
&lt;astearns> ack emilio<br>
&lt;emilio> astearns: so leaning about separate properties?<br>
&lt;emilio> smfr: yeah, modulo bikeshedding name<br>
&lt;emilio> noamr: yeah I think last bikeshed was border-shape, but we can always change it in the future<br>
&lt;emilio> border-shape: &lt;shape> &lt;shape>?; + strokes TBD (top border width default + override)<br>
&lt;astearns> ack fantasai<br>
&lt;emilio> fantasai: I agree we should have border-{width,color} in<br>
&lt;emilio> ... I think the border shorthand... ?<br>
&lt;emilio> ... what's the plan for corner-shape?<br>
&lt;emilio> fantasai: for color we might want the border-top-left color, or block-start, or averaging all the four colors<br>
&lt;emilio> ... all slightly awkward<br>
&lt;TabAtkins> block-start, definitely. i don't think averaging will produce anything meaningful. ^_^<br>
&lt;emilio> astearns: maybe separate issue?<br>
&lt;fantasai> s|colors|colors/widths|<br>
&lt;emilio> noamr: details I need is (1) corner-shape is different<br>
&lt;emilio> PROPOSED: corner-shape and border-shape are independent properties<br>
&lt;fantasai> none sgtm<br>
&lt;emilio> PROPOSED: border-shape overrides corner-shape/border-radius and co<br>
&lt;fserb> sgtm<br>
&lt;emilio> RESOLVED: corner-shape and border-shape are independent properties<br>
&lt;emilio> ack fantasai<br>
&lt;astearns> ack fantasai<br>
&lt;emilio> fantasai: I think necessarily one has to override the other, and border-shape needs to override the other<br>
&lt;emilio> ... we could create a shorthand for both border and corner shape<br>
&lt;emilio> ... I don't see how we could have both applying at the same time<br>
&lt;noamr> that shorthand would have to also have border-radius<br>
&lt;fantasai> yes<br>
&lt;bramus> emilio: consensus is that you cant have both appplied at th esame time and you cannot make them be the same property if you want corner-shape to be a shorthand<br>
&lt;bramus> florian: yes, and we could have a super shorthand but can discuss separately<br>
&lt;bramus> fantasai: yes, what i am saying<br>
&lt;bramus> emilio: should also discuss things like them being reset or not by the shorthand<br>
&lt;bramus> astearns: a super shorthand sound scary :)<br>
&lt;emilio> RESOLVED: border-shape overrides corner-shape / border-radius<br>
&lt;bramus> emilio: should we resolve on it not affecting layout too?<br>
&lt;bramus> astearns: yes<br>
&lt;bramus> PROPOSED RESOLUTION: border-shape is a non-layout affecting property<br>
&lt;bramus> RESOLVED: border-shape is a non-layout affecting property<br>
&lt;emilio> PROPOSED: border-shape doesn't affect layout, only ink overflow and graphic effects like clipping and shadows<br>
&lt;bramus> astearns: other things to discuss?<br>
&lt;bramus> noamr: the derfault stroke and color are taken from the existing border props. can say tbd which property exactly<br>
&lt;emilio> PRPOSED: default stroke width / color get taken from existing border props<br>
&lt;emilio> which ones TBD<br>
&lt;emilio> smfr: maybe TBD is ok but I think it's fine to do the diagonal color joint in the issue<br>
&lt;emilio> RESOLVED: default stroke width / color get taken from existing border props, specifics TBD<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6997#issuecomment-2622533926 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 29 January 2025 18:37:56 UTC