Re: [csswg-drafts] [cssom][css-break] getComputedStyle and fragmentation (#6513)

> In general I think we should discourage use of getComputedStyle for asking questions about geometry.

Agreed, and it seemed to me that returning a not-too-smart but simple answer (like "always first fragment") is kind of going in that direction, but on the call, we did seem to want to try a bit harder and get something roughly sensible, for the sake of people who do geometry with it.

The growing proposal seems to be:
* return the inline-start / block-start values of the first fragment for margins / borders / paddings / offsets
* return the inline-end / block-end values of the last fragment for margins / borders / paddings / offsets
* return the sum of the block-sizes for elements other than non-replaced inlines
* return the maximum inline-size (or maybe the one of the first fragment) for elements other than non-replaced inlines

(for non-replaced inlines, it's already defined to return the computed value, not used value, so don't try to do any math on that.)

For everything else, it doesn't seem to make a difference until we introduce the ability to style differently per fragment. Except arguably, we already have the ability to style different fragment differently, though in a limited and quirky fashion :(
```html
<p><span id=nowwhat>a sufficiently long piece of text that takes up more than one line and wraps</span>
```
```css
p::first-line { font-weight: 800; }
p { font-weight: 100;}
```
```js
console.log(getComputedStyle(document.getElementById("nowwhat")).fontWeight);
```
But `::first-line` and `first-letter` are plenty quirky, so I'd be tempted to not generalize from them, and to the extend that something needs to be specified for them, I'd go with a specific rule that covers them and them only (possibly hosted in css-pseudo), and not try to address them via something generic about fragmentation.

-- 
GitHub Notification of comment by frivoal
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6513#issuecomment-1006214369 using your GitHub account


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

Received on Thursday, 6 January 2022 01:36:58 UTC