Closed Bug 2024171 Opened 2 months ago Closed 2 months ago

[css-color] Enable layout.css.color-mix-multi-color.enabled for multi-color color-mix()

Categories

(Core :: CSS Parsing and Computation, task, P3)

task

Tracking

()

RESOLVED FIXED
150 Branch
Tracking Status
relnote-firefox --- 150+
firefox150 --- fixed

People

(Reporter: tlouw, Assigned: tlouw)

References

Details

(Keywords: dev-doc-complete)

Attachments

(1 file)

No description provided.

I'd like to know the maximum number of colors that can be mixed in the comma list of the current Firefox implementation of color-mix()? Are there any performance issues if this exceeds a certain number, and is a performance test necessary?

(In reply to 一丝 from comment #1)

I'd like to know the maximum number of colors that can be mixed in the comma list of the current Firefox implementation of color-mix()? Are there any performance issues if this exceeds a certain number, and is a performance test necessary?

In terms of performance, parse time increases linearly per color, but the mixing algorithm is a very right loop doing some floating point math and should not be a performance issue.

Right now there is no color limit (as per spec), but it might be worth adding an artificial limit (100?) to avoid abuse. With the limit in place I don't believe testing for a performance issue would be required.

Thanks, could you submit a CSSWG issue?

After discussing with :emilio, limiting the number of colors in the list doesn’t really solve the underlying issue. Like other CSS functions such as calc(), there’s no practical limit on item count or nesting, and excessive use will simply crash the content process (e.g., via stack overflow).

That said, the performance characteristics remain acceptable: parsing scales linearly, and mixing has minimal overhead. In normal use, this shouldn’t be a problem unless deliberately abused.

[Why is this notable]: New CSS feature
[Affects Firefox for Android]: yes
[Suggested wording]: The color-mix() function previously accepted only two color values. This limitation has now been removed, allowing the function to accept an arbitrary number of colors.
[Links (documentation, blog post, etc)]: https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/color_value/color-mix

Sebastian

relnote-firefox: --- → ?
Blocks: 2023933

Enable the pref: layout.css.color-mix-multi-color.enabled

Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 150 Branch

Thanks, added to the Fx150 nightly release notes, please allow 30 minutes for the site to update.

QA Whiteboard: [qa-triage-done-c151/b150]

Related pull requests

Are you shipping this with no test at all? In https://phabricator.services.mozilla.com/D278117 you said:

Tests for the serialization is pending here: https://github.com/web-platform-tests/wpt/pull/57234

That PR still hasn't landed.

Flags: needinfo?(tlouw)
Flags: needinfo?(tlouw)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: