Last Comment Bug 1371150 - stylo: Support negative opacity for SMIL
: stylo: Support negative opacity for SMIL
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: CSS Parsing and Computation (show other bugs)
: Trunk
: All All
P2 normal (vote)
: mozilla56
Assigned To: Cameron McCormack (:heycam)
:
: Sean Voisen (:svoisen)
Mentors:
Depends on:
Blocks: stylo-smil
  Show dependency treegraph
 
Reported: 2017-06-07 21:06 PDT by Brian Birtles (:birtles)
Modified: 2017-07-25 05:29 PDT (History)
4 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
fixed


Attachments
Test case (247 bytes, image/svg+xml)
2017-06-07 21:06 PDT, Brian Birtles (:birtles)
no flags Details
Bug 1371150 - Update test expectations. (59 bytes, text/x-review-board-request)
2017-07-24 02:02 PDT, Cameron McCormack (:heycam)
heycam: review+
Details
Bug 1371150 - style: Don't clamp Opacity values when computing them for SMIL. (59 bytes, text/x-review-board-request)
2017-07-24 02:02 PDT, Cameron McCormack (:heycam)
hiro: review+
Details

Description User image Brian Birtles (:birtles) 2017-06-07 21:06:45 PDT
Created attachment 8875567 [details]
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" />
  </rect>

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" />
Comment 1 User image Jeremy Chen [:jeremychen] (chenpighead@gmail.com) 2017-06-07 23:29:05 PDT
I think we're doing the clamping stuff during the computing... 

http://searchfox.org/mozilla-central/rev/1a054419976437d0778a2b89be1b00207a744e94/servo/components/style/values/specified/mod.rs#707
Comment 2 User image Hiroyuki Ikezoe (:hiro) 2017-06-18 17:51:08 PDT
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.
Comment 3 User image Cameron McCormack (:heycam) 2017-07-24 02:02:17 PDT
Thanks for the helpful instructions, Hiro. :-)

https://treeherder.mozilla.org/#/jobs?repo=try&revision=88c2da6603021b38d166e1232149d51372991167
Comment 4 User image Cameron McCormack (:heycam) 2017-07-24 02:02:32 PDT Comment hidden (mozreview-request)
Comment 5 User image Cameron McCormack (:heycam) 2017-07-24 02:02:32 PDT Comment hidden (mozreview-request)
Comment 6 User image Cameron McCormack (:heycam) 2017-07-24 02:03:36 PDT
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 7 User image Hiroyuki Ikezoe (:hiro) 2017-07-24 03:18:01 PDT
Comment on attachment 8889331 [details]
Bug 1371150 - Update test expectations.

https://reviewboard.mozilla.org/r/160406/#review165666

Thanks for fixing this!
Comment 8 User image Hiroyuki Ikezoe (:hiro) 2017-07-24 03:18:10 PDT
Comment on attachment 8889332 [details]
Bug 1371150 - style: Don't clamp Opacity values when computing them for SMIL.

https://reviewboard.mozilla.org/r/160408/#review165660
Comment 9 User image Cameron McCormack (:heycam) 2017-07-24 04:43:08 PDT Comment hidden (mozreview-request)
Comment 10 User image Cameron McCormack (:heycam) 2017-07-24 04:44:45 PDT
Comment on attachment 8889331 [details]
Bug 1371150 - Update test expectations.

https://reviewboard.mozilla.org/r/160406/#review165688
Comment 11 User image Pulsebot 2017-07-24 20:34:22 PDT
Pushed by cmccormack@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/26d556a0f07c
Update test expectations. r=hiro
Comment 12 User image Carsten Book [:Tomcat] 2017-07-25 05:29:53 PDT
https://hg.mozilla.org/mozilla-central/rev/26d556a0f07c

Note You need to log in before you can comment on or make changes to this bug.