[csswg-drafts] [cssom-view] Define rounding for clientWidth & friends (#9866)

Loirooriol has just created a new issue for https://github.com/w3c/csswg-drafts:

== [cssom-view] Define rounding for clientWidth & friends ==
```html
<div id="target" style="width: 9.9px"></div>
```

| | Gecko | Blink & WebKit | Servo |
| - | - | - | - |
| `target.getBoundingClientRect().width` | 9.899993896484375 | 9.890625 | 9.9 |
| `target.clientWidth` | 10 | 10 | 9 |

The definition of `clientWidth` is

https://drafts.csswg.org/cssom-view/#extension-to-the-element-interface

```
readonly attribute long clientWidth;
```

https://drafts.csswg.org/cssom-view/#dom-element-clientwidth

> Return the width of the [padding edge](https://drafts.csswg.org/css-box-4/#padding-edge) excluding the width of any rendered scrollbar between the padding edge and the [border edge](https://drafts.csswg.org/css-box-4/#border-edge), ignoring any [transforms](https://drafts.csswg.org/cssom-view/#transforms) that apply to the element and its ancestors.


It doesn't mention any kind of rounding, I'm assuming this is handled by https://webidl.spec.whatwg.org/#js-long
If I'm getting it right, it's supposed to just truncate the number, like Servo, but that's not what the other browser are doing.


Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9866 using your GitHub account


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

Received on Friday, 26 January 2024 15:40:31 UTC