Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Intent to ship: Percentage opacity

74 views
Skip to first unread message

Boris Chiou

unread,
Jul 9, 2019, 7:30:36 PM7/9/19
to dev-pl...@lists.mozilla.org
Hi,

Summary: Per the recent discussion of the spec, we would like to add
<percentage> to opacity related properties. The following properties will
support not only <number> but also <percentage>:
1. opacity <https://drafts.csswg.org/css-color/#propdef-opacity>
2. flood-opacity
<https://drafts.fxtf.org/filter-effects/#FloodOpacityProperty>
3. fill-opacity <https://drafts.fxtf.org/fill-stroke/#fill-opacity> (also
in SVG2 <https://svgwg.org/svg2-draft/painting.html#FillOpacity>)
4. stroke-opacity <https://drafts.fxtf.org/fill-stroke/#stroke-opacity>
(also in SVG2 <https://svgwg.org/svg2-draft/painting.html#StrokeOpacity>)
5. stop-opacity (in SVG2
<https://svgwg.org/svg2-draft/pservers.html#StopOpacityProperty>)
6. -moz-window-opacity
Basically, the percentage value is always converted into the equivalent
number.

Example: if opacity = "50%", the serializations of its specified value and
computed value are both "0.5".

Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1562086
Standard:
1. <alpha-value>: https://drafts.csswg.org/css-color/#typedef-alpha-value
2. Discussion: https://github.com/w3c/csswg-drafts/issues/3342
3. Decision: https://github.com/mozilla/wg-decisions/issues/69

Platform coverage: All.
Preference: No.
DevTools bug: No.

Other browsers:
* Chrome issue:
https://bugs.chromium.org/p/chromium/issues/detail?id=907787 (intent to
implement and ship doc)
<https://docs.google.com/document/d/1fT9WPUnS59h3vbxz2LuPgBUm89ynJ_sPEAuBRn-5Jeo/edit?usp=sharing>
* WebKit: Nope (I didn't find the opened WebKit issue.)

Web-platform-tests: I will add web-platform-tests for those properties in
the same bug. (It seems Chrome would like to add them, but I didn't see any
update in the Chrome issue recently, so I may add them first.)
1. opacity:
testing/web-platform/tests/css/css-color/parsing/opacity-valid.html
<https://searchfox.org/mozilla-central/source/testing/web-platform/tests/css/css-color/parsing/opacity-valid.html>
2. flood-opacity:
testing/web-platform/tests/css/filter-effects/parsing/flood-opacity-valid.svg
<https://searchfox.org/mozilla-central/source/testing/web-platform/tests/css/filter-effects/parsing/flood-opacity-valid.svg>
3. fill-opacity:
testing/web-platform/tests/svg/painting/parsing/fill-opacity-valid.svg
<https://searchfox.org/mozilla-central/source/testing/web-platform/tests/svg/painting/parsing/fill-opacity-valid.svg>
4. stroke-opacity:
testing/web-platform/tests/svg/painting/parsing/stroke-opacity-valid.svg
<https://searchfox.org/mozilla-central/source/testing/web-platform/tests/svg/painting/parsing/stroke-opacity-valid.svg>
5. stop-opacity:
testing/web-platform/tests/svg/pservers/parsing/stop-opacity-valid.svg
<https://searchfox.org/mozilla-central/source/testing/web-platform/tests/svg/pservers/parsing/stop-opacity-valid.svg>

Secure contexts: No. Just let parser support percentage value on `Opacity`
type.

Thanks.

Regards,
Boris Chiou

remi.g...@gmail.com

unread,
Jul 10, 2019, 3:19:21 AM7/10/19
to
Why fixing something that isn't broken and a well established standard for something longer?
50% = five chars, .5 is two.
47.5% must be parsed and truncated, .47 is already in the right type.

Also, % values in CSS are most of the time based on the cascading or element scope related. If the parent element is already at opacity: .5, would a opacity:50% makes it .5 or .25 ?

I honestly think we have bigger fish to catch...

Anne van Kesteren

unread,
Jul 10, 2019, 8:05:33 AM7/10/19
to remi.g...@gmail.com, dev-platform
On Wed, Jul 10, 2019 at 9:20 AM <remi.g...@gmail.com> wrote:
> Why fixing something that isn't broken and a well established standard for something longer?

https://github.com/w3c/csswg-drafts/issues/3342 as pointed out in OP
offers plenty of justification to make this change. That's also a
better forum if you want to give design feedback.
0 new messages