Closed Bug 1371150 Opened 6 years ago Closed 6 years ago

stylo: Support negative opacity for SMIL


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




Tracking Status
firefox56 --- fixed


(Reporter: birtles, Assigned: heycam)


(Blocks 1 open bug)



(2 files, 1 obsolete file)

Attached image Test case
The attached test case is a reduced test case from a failing test in dom/smil/test/test_smilCSSFromBy.xhtml

The square should fade from opacity 1 to 0 because we have:

  <rect x="20" y="20" width="200" height="200" fill="purple">
    <animate attributeName="opacity" from="1" by="-1" dur="3s"
      fill="freeze" />

However, it doesn't.

When I debug it I see:

  Parsed opacity property value '1' => 1
  Parsed opacity property value '-1' => 0

So it would appear that we are either failing to parse the negative value, or clamping it too early.

As a result we effectively do:

  <animate attributeName="opacity" from="1" by="0" dur="3s"
    fill="freeze" />
Priority: -- → P2
I am leaving comments for someone who are going to fix this bug. 

What we need to do here is:

1) Add a flag that represents that current mode allows all numeric values for converting specified value to computed value
2) Set the flag true in Servo_GetAnimationValues (that is used only for SMIL)
3) Check the flag in Opacity.to_computed_value() and clamp the value only if the flag is false.

Once we allow negative color component (bug 1364279), we also need to change Color.to_computed_value, I guess.
Assignee: nobody → cam
I didn't add a separate test case, but I checked that the sub-test in dom/smil/test/test_smilCSSFromBy.xhtml started passing.
Comment on attachment 8889331 [details]
Bug 1371150 - Update test expectations.

Thanks for fixing this!
Attachment #8889331 - Flags: review?(hikezoe) → review+
Comment on attachment 8889332 [details]
Bug 1371150 - style: Don't clamp Opacity values when computing them for SMIL.
Attachment #8889332 - Flags: review?(hikezoe) → review+
Attachment #8889332 - Attachment is obsolete: true
Comment on attachment 8889331 [details]
Bug 1371150 - Update test expectations.
Attachment #8889331 - Flags: review?(cam) → review+
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in before you can comment on or make changes to this bug.