Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-transforms] Have scale function accept percentage value #3399

Closed
Ernedar opened this issue Dec 5, 2018 · 6 comments · Fixed by #4396
Closed

[css-transforms] Have scale function accept percentage value #3399

Ernedar opened this issue Dec 5, 2018 · 6 comments · Fixed by #4396

Comments

@Ernedar
Copy link

Ernedar commented Dec 5, 2018

Hello,
I would like to suggest adding percentage for scale function in transformations.

Current state: scale() is using [-NUM, NUM] where NUM is whole number (integer)
Suggestion: scale() will support [-NUM, NUM] and [-%, %]
Example:
transform: scale(120%) will work same as transform:scale(1.2) is working right now.

It is not a game-breaker but it is nice to have.

Thank you for your work.

@upsuper upsuper changed the title [css-transforms] [css-transforms] Have scale function accept percentage value Dec 7, 2018
@smfr smfr added the Agenda+ label Sep 12, 2019
@AmeliaBR
Copy link
Contributor

AmeliaBR commented Oct 2, 2019

Agree this is a nice to have, would be more intuitive for many authors (scale(50%) instead of scale(0.5), scale(150%) instead of scale(1.5)). The impact on implementations would be restricted to parsing time — computed/serialized values would remain numbers.

It's very similar to the change in alpha values to support percentages, which the WG re-affirmed in #3342 after browser teams emphasized their plan to ship.

@css-meeting-bot
Copy link
Member

The CSS Working Group just discussed Have scale function accept percentage value, and agreed to the following:

  • RESOLVED: Allow percentages inside the scale
The full IRC log of that discussion <dael> Topic: Have scale function accept percentage value
<dael> github: https://github.com//issues/3399
<dael> AmeliaBR: This was a community suggestion that scale transforms that current accept number also accept % values, transform-scale: 150% instead of 1.5
<dael> AmeliaBR: Question of author conveience and intuitiveness. We've done this recently for opacity. Just like that it would only effect parsing. Actual rendering wouldn't change.
<dael> AmeliaBR: Question of if people think it's enough value to users to change parsing code
<dael> Rossen_: Any expection for how computed serializes
<dael> AmeliaBR: I would assume convert to simple number
<dael> TabAtkins: Given this is a place where number represents same as % I'm fine with it. It's low value, but low effort and I'm good with being more consistent across the language.
<dael> TabAtkins: Idea is it would parse into a number internally and serialize as a number
<dael> AmeliaBR: smfr can correct, but I assume this is transforms 2. I don't think any rush to get that to PR so we have time to ship impl
<heycam> +1 for consistency across all values that accept a proportion-like value
<dael> smfr: I think that's true. Would effect 2d transform functions. New in transforms 2. Fine with this
<dael> Rossen_: Obj to accept proposal Allow percentages inside the scale
<dael> RESOLVED: Allow percentages inside the scale

@birtles
Copy link
Contributor

birtles commented Oct 2, 2019

Presumably this should also apply to the individual scale property (and not just the scale() function).

@Crissov
Copy link
Contributor

Crissov commented Oct 3, 2019

A convenient way, e.g. a keyword, to scale by √2 ≈ 1.414 or √½ ≈ 0.707 (as in ISO paper and pens) might also be nice. scale(sqrt(2)) also works, of course.

ewilligers pushed a commit to ewilligers/csswg-drafts that referenced this issue Oct 4, 2019
Allow percentages inside the scale functions,
and the scale property.

resolves w3c#3399
ewilligers pushed a commit to ewilligers/csswg-drafts that referenced this issue Oct 4, 2019
Allow percentages inside the scale functions,
and the scale property.

resolves w3c#3399
@tabatkins
Copy link
Member

Yes, now that sqrt() exists, that case is well handled.

ewilligers pushed a commit to ewilligers/csswg-drafts that referenced this issue Oct 10, 2019
Allow percentages inside the scale functions,
and the scale property.

resolves w3c#3399
ewilligers pushed a commit to ewilligers/csswg-drafts that referenced this issue Dec 2, 2019
Allow percentages inside the scale functions,
and the scale property.

resolves w3c#3399
@BorisChiou
Copy link
Contributor

Presumably this should also apply to the individual scale property (and not just the scale() function).

Agree, and Gecko just landed it (based on the spec PR).

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Mar 27, 2021
The functions  scale() scaleX() scaleY() scaleZ() scale3d()  and the
property  scale  each accept percentages, that serialize as numbers.

w3c/csswg-drafts#3399
w3c/csswg-drafts#4396
https://drafts.csswg.org/css-transforms-2/#transform-functions
https://drafts.csswg.org/css-transforms-2/#propdef-scale

Bug:  1179579
Change-Id: Icfbc42bf529c1c63045c3e918a6a1db2b14d1ae3
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Mar 27, 2021
The functions  scale() scaleX() scaleY() scaleZ() scale3d()  and the
property  scale  each accept percentages, that serialize as numbers.

w3c/csswg-drafts#3399
w3c/csswg-drafts#4396
https://drafts.csswg.org/css-transforms-2/#transform-functions
https://drafts.csswg.org/css-transforms-2/#propdef-scale

Bug: 1179579
Change-Id: Icfbc42bf529c1c63045c3e918a6a1db2b14d1ae3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2703674
Commit-Queue: Eric Willigers <[email protected]>
Reviewed-by: Anders Hartvoll Ruud <[email protected]>
Cr-Commit-Position: refs/heads/master@{#867008}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this issue Mar 27, 2021
The functions  scale() scaleX() scaleY() scaleZ() scale3d()  and the
property  scale  each accept percentages, that serialize as numbers.

w3c/csswg-drafts#3399
w3c/csswg-drafts#4396
https://drafts.csswg.org/css-transforms-2/#transform-functions
https://drafts.csswg.org/css-transforms-2/#propdef-scale

Bug: 1179579
Change-Id: Icfbc42bf529c1c63045c3e918a6a1db2b14d1ae3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2703674
Commit-Queue: Eric Willigers <[email protected]>
Reviewed-by: Anders Hartvoll Ruud <[email protected]>
Cr-Commit-Position: refs/heads/master@{#867008}
pull bot pushed a commit to luojiguicai/chromium that referenced this issue Mar 27, 2021
The functions  scale() scaleX() scaleY() scaleZ() scale3d()  and the
property  scale  each accept percentages, that serialize as numbers.

w3c/csswg-drafts#3399
w3c/csswg-drafts#4396
https://drafts.csswg.org/css-transforms-2/#transform-functions
https://drafts.csswg.org/css-transforms-2/#propdef-scale


Bug: 1179579
Change-Id: Icfbc42bf529c1c63045c3e918a6a1db2b14d1ae3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2703674
Commit-Queue: Eric Willigers <[email protected]>
Reviewed-by: Anders Hartvoll Ruud <[email protected]>
Cr-Commit-Position: refs/heads/master@{#867008}
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Mar 27, 2021
…ges., a=testonly

Automatic update from web-platform-tests
CSS Transforms: scale() accepts percentages.

The functions  scale() scaleX() scaleY() scaleZ() scale3d()  and the
property  scale  each accept percentages, that serialize as numbers.

w3c/csswg-drafts#3399
w3c/csswg-drafts#4396
https://drafts.csswg.org/css-transforms-2/#transform-functions
https://drafts.csswg.org/css-transforms-2/#propdef-scale

Bug: 1179579
Change-Id: Icfbc42bf529c1c63045c3e918a6a1db2b14d1ae3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2703674
Commit-Queue: Eric Willigers <[email protected]>
Reviewed-by: Anders Hartvoll Ruud <[email protected]>
Cr-Commit-Position: refs/heads/master@{#867008}

--

wpt-commits: 808a9ed80e45a9da615fb930d212fcc7461648e6
wpt-pr: 28267
mjfroman pushed a commit to mjfroman/moz-libwebrtc-third-party that referenced this issue Oct 14, 2022
The functions  scale() scaleX() scaleY() scaleZ() scale3d()  and the
property  scale  each accept percentages, that serialize as numbers.

w3c/csswg-drafts#3399
w3c/csswg-drafts#4396
https://drafts.csswg.org/css-transforms-2/#transform-functions
https://drafts.csswg.org/css-transforms-2/#propdef-scale

Bug: 1179579
Change-Id: Icfbc42bf529c1c63045c3e918a6a1db2b14d1ae3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2703674
Commit-Queue: Eric Willigers <[email protected]>
Reviewed-by: Anders Hartvoll Ruud <[email protected]>
Cr-Commit-Position: refs/heads/master@{#867008}
GitOrigin-RevId: f31adb81393ef56e06da6d2a3e5ec42ef19a25b1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants