Re: [csswg-drafts] [css-sizing] Adding a 'size' shorthand for 'width'/'height' (#820)

> Documents accessing the size property of an @page rule in the CSSOM via JS will stop working. So at least technically the change is breaking. 

Yes, `pagerule.getPropertyValue('size')` would stop working; this is indeed a breaking API change.

> We also agree that paper sizes like A4 can be handled at the shorthand level and think that would be an elegant solution, also allowing to style any box to have one of the standardized sizes.

A problem here is that shorthands have to re-synthesize themselves from the longhands, but the keywords do *not* map cleanly to integer `px` values (and lengths in all UAs are stored as some fixed fraction of a `px`), which means that if you, say, set `size: A4;`, you'll read back two decimal-heavy `px` lengths unless we specify a "close enough" rounding that must return the keyword.

(That's not impossible, but it is new.)

> [suggestion to switch @page/width and height to setting the page margin box and making them shorthands of size]

Hm, that's interesting. If you're right that the usage of width/height on @page is lower (and thus will cause less breakage) than the JS querying of size, then that's a reasonable alternative. Getting some feedback from other printing software would be useful here.

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

Received on Tuesday, 22 October 2019 16:59:04 UTC