Skip to content

[css-borders-4] Specify how corner-shape affects outline #12194

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

Closed
noamr opened this issue May 14, 2025 · 11 comments · Fixed by #12278
Closed

[css-borders-4] Specify how corner-shape affects outline #12194

noamr opened this issue May 14, 2025 · 11 comments · Fixed by #12278

Comments

@noamr
Copy link
Collaborator

noamr commented May 14, 2025

Follow up to #11610 (comment).
Outlines are "special" because they create a path that's external to the original border, more like a stroke.
A concave corner (e.g. a star of scoop shape) with a big outline might end up with very long miters.

Note that currently outline rendering is specified in pretty vague terms.

Proposing (based on suggestion from @smfr) to advise implementations to render a round miter for concave corner-shaped outlines.

@tabatkins
Copy link
Member

Agree that we should aggressively cap the ability of corners to extend too much in a concave outline. I'm fine with a round miter, tho I don't think that's expressible in SVG right now? (stroke-linecap only affects the ends of segments.) I think that's just a lack in SVG tho; capping the mitered edges with as if stroke-linecap:arc applied to it sounds fine to me.

@fsoder
Copy link

fsoder commented May 16, 2025

I think the property you're looking for is stroke-linejoin (https://svgwg.org/svg2-draft/painting.html#LineJoin)

aarongable pushed a commit to chromium/chromium that referenced this issue May 20, 2025
When using an outline, use the border path's stroke
as the outline clip path.

This technique is possible in outlines and not in borders, because the outline thickness cannot change between sides.

Using round stroke caps/joins to avoid very long miters.
This is discussed in the CSSWG
(w3c/csswg-drafts#12194)
and can be amended if something else comes up, however currently outline
rendering is not specified in an interoperable way, so adding the tests
as regular pixel web-tests.

Note that dashed/dotted outlines are still not rendered correctly, so
not adding tests for them. The same goes for auto outlines, and for
complex outlines that span multiple boxes.

Bug: 417420173
Change-Id: I16bbae1b1ea3e5a29a33b6e60ae6a8c381082e4e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6551430
Reviewed-by: Fredrik Söderquist <fs@opera.com>
Commit-Queue: Noam Rosenthal <nrosenthal@google.com>
Cr-Commit-Position: refs/heads/main@{#1462900}
@noamr
Copy link
Collaborator Author

noamr commented May 21, 2025

Proposed async resolution:
Outlines with concave corner-shapes should be rendered as an outer stroke with round caps & joins.

@noamr noamr added the Async Resolution: Proposed Candidate for auto-resolve with stated time limit label May 21, 2025
@yisibl
Copy link
Contributor

yisibl commented May 22, 2025

Thinking further, should outline be rendered as sharp corners when border is not present?

@noamr
Copy link
Collaborator Author

noamr commented May 22, 2025

Thinking further, should outline be rendered as sharp corners when border is not present?

I don't think the outline should be affected by the present of a border?

@noamr noamr added css-borders-4 and removed css-borders-4 Async Resolution: Proposed Candidate for auto-resolve with stated time limit labels May 24, 2025
@noamr
Copy link
Collaborator Author

noamr commented May 24, 2025

I tried this a bit and it has parts that don't make sense or need further clarification:

  • if the whole border is rendered with rounded joins when there is concave corners, a square corner is going to be affected by an unrelated scoop corner.
  • Concave corners in themselves are not really problematic, rather it's when the distance between them is smaller than the outline which shoots the join to a distance.

Judging from how current outline wording is written, I believe this can be worded in a way that leaves it to implementations.

@css-meeting-bot
Copy link
Member

The CSS Working Group just discussed [css-borders-4] Specify how `corner-shape` affects `outline` , and agreed to the following:

  • RESOLVED: Add corner-shape to the border-radius clause in outline definition
The full IRC log of that discussion <emilio> noamr: there was a question about how does corner-shape matches outline. Current spec is not interoperable, rather handwavy
<emilio> ... spec says it generally should follow the border
<emilio> ... should I continue that path for border-shape?
<florian> q+
<emilio> ... following the border
<emilio> Q+
<emilio> ... should we try to make that interoperable?
<astearns> ack florian
<emilio> florian: I think short term is to extend the current spec
<emilio> ... going beyond it is a big project, there are a lot of other issues with outline
<emilio> ... defining would be a good project but a big project
<astearns> ack emilio
<fantasai> [missed]
<fantasai> emilio: we have the magic thing, which is outline-style: auto
<fantasai> emilio: for easy cases we can more easily define
<fantasai> emilio: handwaving fragmentation cases can be fine
<fantasai> emilio: agree we shouldn't need to fix everything
<fantasai> emilio: but let's get interop on some cases
<fantasai> florian: two resolutions
<fantasai> florian: 1. Follow corner-shape
<fantasai> florian: 2. WG will attempt to outline in more detail
<fantasai> florian: we don't have a definition, but we can try
<fantasai> emilio: the non-auto cases seem pretty definable
<fantasai> florian: definable, but is not currently defined
<fantasai> florian: I used to have an art gallery of interesting outline rendering, so there is a lot to define!
<fantasai> astearns: out of time, but I think it sounded like we have consensus to at least add corner-shape to the bit that defines how we deal with border-radius
<fantasai> astearns: add it to that vagueness, and perhaps a note to better specify this later
<fantasai> noamr: sgtm
<fantasai> florian: I agree with the direction, probably issue rather than note though
<fantasai> noamr: open a separate issue
<fantasai> PROPOSED: Add corner-shape to the border-radius clause in outline
<fantasai> RESOLVED: Add corner-shape to the border-radius clause in outline definition

@Loirooriol
Copy link
Contributor

I want to point out that just using rounded border-radius already breaks spec assumptions about negative outline-offset: #8786. With corner-shape the situation gets crazier.

@frivoal
Copy link
Collaborator

frivoal commented May 29, 2025

@Loirooriol I agree with you that there is a lot of undefined territory in outlines, and that bringing in outline-offset allows for some pretty crazy situations. Reminds me of this old thread: https://x.com/Martijn_Cuppens/status/1015169981368225793
In any case, getting full interop on outlines is going to be an interesting project…

@frivoal frivoal closed this as completed May 29, 2025
frivoal added a commit that referenced this issue May 30, 2025
@yisibl
Copy link
Contributor

yisibl commented Jun 4, 2025

So what's the conclusion here? Is the outline with rounded corners even if the corner-shape value is notch or bevel?

Please reopen this issue, I think the specification needs to be updated.

@noamr
Copy link
Collaborator Author

noamr commented Jun 4, 2025

So what's the conclusion here? Is the outline with rounded corners even if the corner-shape value is notch or bevel?

No, it should follow the curve, but without specifying more than that, as outline in general is not specified to that extent.

Please reopen this issue, I think the specification needs to be updated.

I agree, there needs to be a note about this before closing. Reopening and will close with a note PR.

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

Successfully merging a pull request may close this issue.

8 participants