Closed Bug 1399799 Opened 7 years ago Closed 7 years ago

stylo: Values of amount over 100% are allowed but UAs must clamp the values to 1 for some filter fuctions

Categories

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

enhancement

Tracking

()

RESOLVED FIXED
Tracking Status
firefox57 --- fixed

People

(Reporter: boris, Assigned: boris)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

41 bytes, text/x-github-pull-request
Details | Review
According to the spec [1]-[4], the filter functions, "grayscale", "invert", "opacity", and "sepia", should clamp its value. In other words, values of amount over 100% are allowed but UAs must clamp the values to 1.

However, we don't clamp its value on Servo, so if we do something like this:
  div.style.filter = "invert(9.9)";
  console.log(div.style.filter);               // output is 9.9, ERROR!!!
  console.log(getComputedStyle(div).filter);   // output is 9.9, ERROR!!!

On Gecko, both specified value and computed value are clamped to 1.0. I guess we clamp it in layout, so we cannot see the problem on the screen. However, if we create an animation:
  div.animate([ { filter: "invert(2.4)" },
                { filter: "invert(0.2)" } ],
              2000);
When the animation is at 50%, the computed value is 1.1, which means we cannot see an animation for more than 1000ms. The expected interpolation progress should be "from 1.0 to 0.2", instead of "from 2.4 to 0.2".

[1] https://drafts.fxtf.org/filter-effects/#funcdef-filter-grayscale
[2] https://drafts.fxtf.org/filter-effects/#funcdef-filter-invert
[3] https://drafts.fxtf.org/filter-effects/#funcdef-filter-opacity
[4] https://drafts.fxtf.org/filter-effects/#funcdef-filter-sepia
This is a bug, but not sure it should be P3 or P4?
Blocks: stylo-smil
Status: NEW → ASSIGNED
Priority: -- → P3
Attached file Servo PR, #18517
Blocks: 1388601
https://hg.mozilla.org/mozilla-central/rev/32bb0db8301d
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: