You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To compute the <dfn>adjusted untrimmed inner top-left corner starting point</dfn>:
373
+
374
+
1. Let |s| be the [=superellipse parameter=] of the element's 'corner-top-left-shape'.
375
+
1. Let |w| be the [=used value=] of the element's 'border-left-width'.
376
+
1. If |s| is equal or greater than 1, return <code>|w|, 0</code>.
377
+
1. If |s| is equal or less than -1, return <code>0, -|w|</code>.
378
+
1. Let |k| be <code>0.5<sup>|s|</sup></code>.
379
+
1. Let |normalizedHalfCorner| be <code>0.5<sup>|k|</sup></code>.
380
+
1. Let |offset| be <code>2 - √2</code>.
381
+
1. Let |adjustedX| be <code>max(0, 2 * |normalizedHalfCorner| - |offset|)</code>.
382
+
1. Let |adjustedY| be <code>max(0, 2 * (1 - |normalizedHalfCorner|) - |offset|)</code>.
383
+
1. Return <code>|adjustedX|, |adjustedY|</code>.
384
+
</div>
385
+
386
+
<div algorithm="corner-shape-path">
387
+
To compute the inner path of a corner:
388
+
389
+
1. Let |adjustedX|, |adjustedY| be the result of the [=adjusted untrimmed inner top-left corner starting point=] steps,
390
+
modified to consider the corresponding 'border-width' and 'corner-shape' values at the start and end of a path`.
391
+
1. Create a path based on the [=canonical superellipse formula=], with the outer corner as the center, starting from |adjustedX| and ending at |adjustedY|.
392
+
User agents MAY create an approximation of this path rather than try to follow the formula precisely, for performance reasons.
393
+
1. Trim the resulting path so that it starts at a point that has a 'border-width' distance from the outer.
394
+
</div>
395
+
396
+
<div class=note>
397
+
The superellipse quadrant is scaled so that:
398
+
* Its center stays at the outer corner.
399
+
* Its start and end point are perpendicular to the outer starting point.
400
+
* Its distance from the outer curve is the corresponding 'border-width'.
401
+
402
+
This is illustrated in the following chart:
403
+
<figure>
404
+
<img src="images/corner-shape-border.svg"
405
+
width="840" height="840"
406
+
style="background: white; padding: 8px;"
407
+
title="Border rendering with corner-shape"
408
+
alt="Border rendering with corner-shape">
409
+
<figcaption>Illustration of border path computation based on 'corner-shape'.
410
+
</figcaption>
411
+
</figure>
412
+
413
+
</div>
414
+
415
+
<h5 id=corner-shape-border-rendering>
416
+
Effect of 'corner-shape' on 'box-shadow' rendering</h5>
417
+
418
+
When rendering the 'box-shadow' of an element that has a 'corner-shape', the 'border-radius' of the rendered shadow is adjusted to account for the spread.
419
+
The resulting shape looks like a scaled version of the original shape, as if the shadow is at a distance in the z direction.
420
+
This is accomplished by computing the per-dimension scale given the spread, and applying that scale on each of radii separately.
0 commit comments