[css-backgrounds-4] Extruding border corners (negative border-radius) #2811
Just leaving a quick thought here, think it might be worth exploring further.
We can currently give a corner a border-radius, giving us rounded borders. But what if we don't want them rounded, but rahter want them extra spiky?
This could be used just to create some fun spiky corners, or it could be used to create interior corners. these interior corners were the main motivation behind this suggestion.
Here an example of how a new setting with some kind of negative ratio could be used to create the illusion of a nagative corner between two divs.
See also w3c/ttml2#189 for a real world example where interior corners would be useful; in that case they cannot necessarily be defined at authoring time because the direction of the corner rounding depends on the length of adjacent line area backgrounds, so a more dynamic run-time decision is needed.
changed the title
[CSS Backgrounds and Borders Level 4] Extruding border corners (negative border-radius)
Jul 24, 2018
@nigelmegitt Wow. That TTML issue... it totally makes sense what you want to do, but actually doing it seems crazy from the model we have! Not only do we have to automatically flip the curve based on the location of sibling boxes (which sibling boxes?) but also truncate the radii to create a tighter S-curve if the edges of two boxes are too near each other...
@fantasai I agree, there are two things to think about here:
Thinking about the general model first, I think a way that could work here is:
In step 3, since the background instructions are all known, if there is additional "clever" stuff to do like setting corner rounding and corner rounding axes, or combining areas into complex polygons, then the information should be available to allow that to happen, and cannot affect foreground layout.
Specific computation for this case
I'm not sure the best mathematical approach to take but it seems to be known art, in that there are drawing tools (for example) that can combine multiple rectangles into complex polygons and apply vertex effects.
This is definitely known art; there's nothing theoretically difficult about drawing such a border curve around intersecting rectangles.
But yeah, as @fantasai said, this is dramatically different from our current model, both in details and in broad strokes. It's probably not realistic to make this sort of thing happen in native CSS.
That said, it's a pretty perfect example of something that can be done via Custom Paint.
Creating interior corner effect has to be done with the knowledge that one box will expand further than the other.
Or both boxes might be set to a border-box, be contained by the same partent, and both have min-height: 100%;. In such case the height of a box should be computed as the furthest extending corner.
I think the TTML issue which @nigelmegitt brought forward has more complexities than what I initally preposed for CSS.