Auto merge of #18234 - BorisChiou:stylo/transform/distance_mismatch, r=birtles,nox

stylo: Bug 1390039 - Implement compute_distance for mismatched transform lists.

Implement ComputeSquaredDistance for mismatched transform lists.
In order to do this, we have to convert a transform list into a 3d matrix,
so I move the code from layout module into style module for reusing it.

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix [Bug 1390039](https://bugzilla.mozilla.org/show_bug.cgi?id=1390039).
- [X] These changes do not require tests because this is a Gecko feature and I add many tests in Gecko already.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18234)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-08-30 06:03:32 -05:00 committed by GitHub
commit 3fa5d83ab7
5 changed files with 191 additions and 151 deletions

View file

@ -4,6 +4,7 @@
//! Computed angles.
use euclid::Radians;
use std::{f32, f64, fmt};
use std::f64::consts::PI;
use style_traits::ToCss;
@ -99,3 +100,10 @@ impl ToCss for Angle {
}
}
}
impl From<Angle> for Radians<CSSFloat> {
#[inline]
fn from(a: Angle) -> Self {
Radians::new(a.radians())
}
}