-
Notifications
You must be signed in to change notification settings - Fork 719
[css-overflow-3] overflow-clip-margin + border-radius continuity adjustment #5896
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
Comments
Here's an example of the question: suppose we have a border-radius that's less than the thickness of the border (which is, let's say, 10px). The border-edge is curved, the padding edge is square. If we specify |
I suspect the difference here is not use-case driven, so we should define, but it doesn't particularly matter what we pick as long as it's interoperable. Do implementers have a preference? How was it done in Blink? cc: @chrishtr |
Re implementation: there's a related (not the same) bug I'm looking into at crbug.com/1200163. |
I think this means that the question in this issue is moot, unless we want to consider new ways to round corners at places other than the border. Perhaps that should be considered - I've already heard a request to have a way to apply the border radius to the padding or other boxes. |
The CSS Working Group just discussed The full IRC log of that discussion |
A bit of background here: The backgrounds spec describes how to map the rounding of the border edge to rounding of the padding edge, content edge, or margin edge. The last (margin edge) uses a more complicated formula because it has the goal of not creating a lot of curvature where there wasn't much curvature at the border. For example, with a 2px border-radius and a 10px margin, it produces curvature at the margin edge of 6.88px rather than the 12px produced by the naive formula. The definition of box-shadow separately describes the same formula. The overflow-clip-margin spec says:
which links to the previously-cited section about border-radius (but not the box-shadow section where the rules for box-shadow are defined, in the same way). I think if this formula is generalized to apply to things involving more than one offset from the border edge, it would be best to (1) first combine the offsets and then (2) apply the border-radius adjustment formula a single time, to the combined offset. This will prevent inconsistent curvature resulting from multiple applications of the formula with different combinations of offsets that add to the same or similar results. |
Oh, and the point @chrishtr makes is that §4.3 Corner Clipping defines I think the intent of the overflow-clip-margin wording is probably that it overrides this behavior, but I don't see a place the spec says to do that. |
@dbaron OK, closed out the issue in line with your recommendation from #5896 (comment) in 7493d0c As for #5896 (comment) the backgrounds spec doesn't define which edge is clipped to, it just requires that the clipped edges are curved and gives examples, so I'm not convinced there's an actual problem here.
Where Agenda+ to confirm with the WG that we accumulate the offset from the border edge and apply the same formulas used for margin/padding/box-shadow edges. |
I think the problem is that it's not clear to many people. In particular, I think you're thinking of this in a manner similar to the way the color property works across elements in the tree -- the color on a descendant replaces the color on an ancestor. However, I think people who work with code that implements clipping almost always think of clips the way we (in the CSS world) think of background-color. When multiple things define a (clip / background-color), all of the (clips apply / backgrounds paint), and they then (intersect with each other / draw on top of each other). So if there's spec text that says X creates a clip, and that clip should be different in some cases, the spec text really needs to say so right there, since otherwise the general rule for combining clips is to intersect all the relevant ones. |
I think it would also be very helpful to put the corner adjustment text in one place rather than two, and make it more direct about how it deals with offsets in each direction (rather than very specific to the properties talked about in the two current places it lives). (For example, the text on margins in Corner Shaping looks like it only handles negative margins correctly by accident, and the text in Shadow Shape, Spread, and Knockout relies heavily on shadow concepts in a way that makes it hard to easily apply it to other things.) |
The CSS Working Group just discussed
The full IRC log of that discussion |
border-radius
andbox-shadow
have a continuity adjustment to ensure that zero radius is pointy. Foroverflow-clip-margin
, do we apply this adjustment to the resulting offsetted position of the overflow clip edge, or do we apply it to the position of its origin edge (border-box/padding-box/content-box) and then apply an absolute offset from that curve?The text was updated successfully, but these errors were encountered: