Re: [csswg-drafts] [css-viewport] [cssom] [css-typed-om] Consider adding a way of exposing the effective zoom. (#9809)

The CSS Working Group just discussed `[css-viewport] [cssom] [css-typed-om] Consider adding a way of exposing the effective zoom.`, and agreed to the following:

* `RESOLVED: Add Element.currentCSSZoom into CSSOM-view as proposed in #9809; bikeshed later as needed`

<details><summary>The full IRC log of that discussion</summary>
&lt;fantasai> emilio: while prototyping zoom, the effective zoom is trivially accessible to the engine<br>
&lt;fantasai> emilio: but there's no way as an author to compute it, other than walking the entire ancestor chain<br>
&lt;fantasai> emilio: but you often need it for JS interactions<br>
&lt;fantasai> emilio: Does it seem fine to expose it?<br>
&lt;fantasai> emilio: if it seems fine, where do we expose it?<br>
&lt;fantasai> emilio: maybe just in Element is fine?<br>
&lt;fantasai> emilio: could put it in CSSComputedStyleDeclaration but we'd need a separate interface<br>
&lt;fantasai> emilio: already have the computed value of zoom<br>
&lt;bramus> q+<br>
&lt;fantasai> emilio: so maybe effectiveZoom? But not a page zoom so effectiveCSSZoom?<br>
&lt;TabAtkins> q+<br>
&lt;Rossen_> ack bramus<br>
&lt;fantasai> bramus: I like not exposing through getComputedStyle because that would be confusing<br>
&lt;fantasai> bramus: so other property seems reasonable to me<br>
&lt;Rossen_> ack fantasai<br>
&lt;TabAtkins> fantasai: would it make sense to call it "usedZoom"?<br>
&lt;fantasai> fantasai: isn't it the used zoom value?<br>
&lt;dholbert> TabAtkins (IRC): it's not the used value, it's the collective value from all the ancestors<br>
&lt;dholbert> fantasai (IRC): it's different from the computed value?<br>
&lt;dholbert> emilio (IRC): it's also different from the zoom property value<br>
&lt;dholbert> TabAtkins (IRC): we don't usually do that with used value. You could make the same argument about transform<br>
&lt;dholbert> TabAtkins (IRC): transforms accumulate, but we don't expose that in this way<br>
&lt;chrishtr> +1 to effectiveZoom on Element<br>
&lt;Rossen_> ack TabAtkins<br>
&lt;fantasai> TabAtkins: Do you have an example of how you would use this?<br>
&lt;fantasai> emilio: [gives an example]<br>
&lt;fantasai> emilio: to compare them you need to multiply by effective Zoom<br>
&lt;schenney> q+<br>
&lt;nicole> q+<br>
&lt;fantasai> emilio: it's the way to convert between local coordinate and global coordinate<br>
&lt;fantasai> TabAtkins: ok<br>
&lt;fantasai> emilio: same for scroll positions. scrollTop is in the local space<br>
&lt;fantasai> emilio: There's a lot of APIs that use local space, and some in global. To convert between them you need something<br>
&lt;bramus> s/[gives an example]/example: getBoundingClientRect values don’t take zoom into account, so you have to multiply their values such as clientWidth by the effective zoom<br>
&lt;Rossen_> ack schenney<br>
&lt;fantasai> schenney: in Chrome, would device scale factor be included?<br>
&lt;fantasai> emilio: no, you only want the effective zoom property<br>
&lt;fantasai> emilio: not device-pixel-ratio<br>
&lt;TabAtkins> yeah, you just walk the ancestor chain and multiple zoom values<br>
&lt;Rossen_> ack nicole<br>
&lt;fantasai> nicole: what about currentZoom, like currentColor<br>
&lt;matthieud> q+<br>
&lt;fantasai> emilio: I think I'd like currentCSSZoom, to differentiate from browser/viewport zoom<br>
&lt;fantasai> chrishtr: does "CSS" appear in other APIs?<br>
&lt;fantasai> TabAtkins: yes. bad ones<br>
&lt;bramus> q+<br>
&lt;Rossen_> ack matthieud<br>
&lt;fantasai> matthieud: If this isn't the used value, shouldn't we define what it is ?<br>
&lt;fantasai> chrishtr: Spec says it's the used value<br>
&lt;fantasai> emilio: It's not. Like if you nest transforms your used transform is just the one on your element.<br>
&lt;dholbert> fantasai (IRC): I agree with chris<br>
&lt;dholbert> fantasai (IRC): transforms don't collapse in the same way as zoom does<br>
&lt;dholbert> fantasai (IRC): this is like you're multiplying a bunch of numbers, and taking that final number and multiplying it by all the length values<br>
&lt;fantasai> dbaron: I think maybe used values round-trip, and this wouldn't round-trip<br>
&lt;fantasai> dbaron: there are some exceptions, but they should be weird<br>
&lt;Rossen_> q?<br>
&lt;fantasai> TabAtkins: Most, possibly all, places where we don't strictly round-trip will round-trip the second time<br>
&lt;fantasai> dholbert: current has a lot of temporal implications<br>
&lt;fantasai> dholbert: there's just currentColor which is weird<br>
&lt;dbaron> dbaron: though a counter migt be current transform matrix<br>
&lt;fantasai> dholbert: we also have currentTransformMatrix<br>
&lt;Rossen_> ack dbaron<br>
&lt;Zakim> dbaron, you wanted to comment about https://drafts.csswg.org/cssom-view-1/#the-geometryutils-interface<br>
&lt;fantasai> s/dholbert/dbaron/<br>
&lt;dbaron> https://drafts.csswg.org/cssom-view-1/#the-geometryutils-interface<br>
&lt;fantasai> dholbert: a bunch of the use cases you were talking about seem slightly related to this mostly-unimplemented section of CSSOM that maybe we shoudl think about implementing<br>
&lt;fantasai> s/dholbert/dbaron/<br>
&lt;fantasai> dbaron: roc proposed a decade ago<br>
&lt;fantasai> dbaron: Also, do the differences in coordinates here require flags in these interfaces?<br>
&lt;fantasai> emilio: I think box quads returns in client coordinates, so actual pixels not including zoom<br>
&lt;fantasai> chrishtr: it's same coordinate space as getBoundingClientRects<br>
&lt;dholbert> s/box quads/getBoxQuads/<br>
&lt;fantasai> emilio: depends what you mean by "include current zoom"...<br>
&lt;Rossen_> ack bramus<br>
&lt;fantasai> bramus: accumulatedCSSZoom<br>
&lt;fantasai> TabAtkins: Quick, Bramus, spell "accumulated", is it two "c"s, two "m"s?<br>
&lt;fantasai> TabAtkins: it's hard to spell even for native English speakers<br>
&lt;Rossen_> q?<br>
&lt;bramus> fair point<br>
&lt;emeyer> Seems like a great opportunity to teach a generation of coders how to spell the word!<br>
&lt;fantasai> abbreviate to aCSSZoom :)<br>
&lt;matthieud> renderedZoom() ? (is it 2 R ? )<br>
&lt;fantasai> Rossen_: Not hearing pushback on proposed behavior, good understanding of what we're exposing and where, just bikeshedding<br>
&lt;emilio> currentCSSZoom / effectiveCSSZoom?<br>
&lt;chrishtr> currentCSSZoom<br>
&lt;chrishtr> ccZoom<br>
&lt;bradk> zzzzZoooom<br>
&lt;fantasai> fantasai: lengthZoom, because it only multiplies lengths?<br>
&lt;dholbert> spelling-wise, CSS vs Css could be confusing<br>
&lt;dholbert> if this is a JS API<br>
&lt;dholbert> (authors might trip over currentCssZoom not working, maybe)<br>
&lt;dholbert> (but not an objection)<br>
&lt;fantasai> Rossen_: Let's call it currentCSSZoom and bikeshed it later<br>
&lt;emilio> PROPOSED: Accept the proposal for Element.prototype.currentCSSZoom<br>
&lt;fantasai> RESOLVED: Add Element.currentCSSZoom into CSSOM-view as proposed in #9809; bikeshed later as needed<br>
&lt;TabAtkins> (I don't remember where the style guide is that defines it, but it's definitely capital `CSS` in camel-case like this.)<br>
&lt;dbaron> https://www.w3.org/TR/design-principles/#casing-rules<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9809#issuecomment-1942836691 using your GitHub account


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

Received on Tuesday, 13 February 2024 23:25:28 UTC