Closed Bug 1371480 Opened 7 years ago Closed 7 years ago

stylo: Paced animation of paint servers does not work

Categories

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

enhancement

Tracking

()

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: birtles, Assigned: mantaroh)

References

(Blocks 1 open bug)

Details

Attachments

(3 files, 1 obsolete file)

Debugging layout/reftests/svg/smil/style/anim-css-fill-2-paced-rgb.svg (which is failing on stylo) it seems that we always get back zero from Servo_AnimationValues_ComputeDistance.

The reason is that compute_distance for IntermediateSVGPaint does not work correctly.

IntermediateSVGPaint is an enum containing two members: a paint and a fallback color (for context-fill/stroke). We successfully calculate the distance of the paint member but the fallback color is an Option and the distance calculation for Option is as follows:

    fn compute_squared_distance(&self, other: &Self) -> Result<f64, ()> {
        match (self, other) {
            (&Some(ref this), &Some(ref other)) => {
                this.compute_squared_distance(other)
            },
            _ => Err(()),
        }
    }

In the case that the two paints have an empty fallback color this will return Err(()).

Since the compute_distance calculation for IntermediateSVGPaint is as follows:

    fn compute_squared_distance(&self, other: &Self) -> Result<f64, ()> {
        Ok(self.kind.compute_squared_distance(&other.kind)? +
            self.fallback.compute_squared_distance(&other.fallback)?)
    }

We will end up returning Err from there as well.

Then back in Servo_AnimationValues_ComputeDistance, we will convert that to zero:

  from_value.compute_distance(to_value).unwrap_or(0.0)

It seems like we just need to add a branch to Option's compute_distance calculation to handle the "both none" case (and return zero).
Attached image Reduced test case
Reduced test case. This will animate in discrete steps in stylo but it should animate smoothly.
stylo doesn't support fallback being none, it only supports fallback being a colour or not set.

Not set means use the default colour, for context-fill that's black, for everything else that's transparent. See bug 1360935, bug 1352258 and bug 1347409 comment 7 for more details.
(In reply to Robert Longson from comment #2)
> stylo doesn't support fallback being none, it only supports fallback being a
> colour or not set.

Sorry, by none I mean not set (since rust's Option type is either Some or None).
(In reply to Brian Birtles (:birtles) from comment #0)
> It seems like we just need to add a branch to Option's compute_distance
> calculation to handle the "both none" case (and return zero).

I tried this fix:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=7418b906bfdecbca64e153fa8097f458a0bba93c
Comment on attachment 8877030 [details]
Bug 1371480 - Return zero when computing distance of Option with both value is none.

https://reviewboard.mozilla.org/r/148364/#review152798
Attachment #8877030 - Flags: review?(bbirtles) → review+
Comment on attachment 8877031 [details]
Bug 1371480 - Remove test fail annotation of paced animation of paint servers on stylo.

https://reviewboard.mozilla.org/r/148370/#review152800
Attachment #8877031 - Flags: review?(bbirtles) → review+
Assignee: nobody → mantaroh
Status: NEW → ASSIGNED
hg error in cmd: hg push -r tip ssh://hg.mozilla.org/integration/autoland: pushing to ssh://hg.mozilla.org/integration/autoland
searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 2 changesets with 2 changes to 2 files
remote: (84157bfa7121 modifies servo/components/style/properties/helpers/animated_properties.mako.rs from Servo; not enforcing peer review)
remote: (1 changesets contain changes to protected servo/ directory: 84157bfa7121)
remote: ************************************************************************
remote: you do not have permissions to modify files under servo/
remote: 
remote: the servo/ directory is kept in sync with the canonical upstream
remote: repository at https://github.com/servo/servo
remote: 
remote: changes to servo/ are only allowed by the syncing tool and by sheriffs
remote: performing cross-repository "merges"
remote: 
remote: to make changes to servo/, submit a Pull Request against the servo/servo
remote: GitHub project
remote: ************************************************************************
remote: transaction abort!
remote: rollback completed
remote: pretxnchangegroup.e_prevent_vendored hook failed
abort: push failed on remote
Oops, I missed landing.
I forgot this patch included the servo part..
Priority: -- → P2
Attached file Servo PR, #17306
Attachment #8877030 - Attachment is obsolete: true
Pushed by mantaroh@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/012342c75d4b
Remove test fail annotation of paced animation of paint servers on stylo. r=birtles
https://hg.mozilla.org/mozilla-central/rev/012342c75d4b
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: