mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Update euclid.
There are a few canvas2d-related dependencies that haven't updated, but they only use euclid internally so that's not blocking landing the rest of the changes. Given the size of this patch, I think it's useful to get this landed as-is.
This commit is contained in:
parent
2ff7cb5a37
commit
3d57c22e9c
133 changed files with 686 additions and 596 deletions
|
@ -20,7 +20,7 @@ use crate::dom::globalscope::GlobalScope;
|
|||
use crate::dom::window::Window;
|
||||
use cssparser::{Parser, ParserInput};
|
||||
use dom_struct::dom_struct;
|
||||
use euclid::{Angle, Transform3D};
|
||||
use euclid::{default::Transform3D, Angle};
|
||||
use js::jsapi::{JSContext, JSObject};
|
||||
use js::rust::CustomAutoRooterGuard;
|
||||
use js::typedarray::CreateWith;
|
||||
|
@ -180,7 +180,7 @@ impl DOMMatrixReadOnly {
|
|||
dommatrixinit_to_matrix(&other).map(|(is2D, other_matrix)| {
|
||||
// Step 2.
|
||||
let mut matrix = self.matrix.borrow_mut();
|
||||
*matrix = other_matrix.post_mul(&matrix);
|
||||
*matrix = other_matrix.post_transform(&matrix);
|
||||
// Step 3.
|
||||
if !is2D {
|
||||
self.is2D.set(false);
|
||||
|
@ -195,7 +195,7 @@ impl DOMMatrixReadOnly {
|
|||
dommatrixinit_to_matrix(&other).map(|(is2D, other_matrix)| {
|
||||
// Step 2.
|
||||
let mut matrix = self.matrix.borrow_mut();
|
||||
*matrix = other_matrix.pre_mul(&matrix);
|
||||
*matrix = other_matrix.pre_transform(&matrix);
|
||||
// Step 3.
|
||||
if !is2D {
|
||||
self.is2D.set(false);
|
||||
|
@ -209,7 +209,7 @@ impl DOMMatrixReadOnly {
|
|||
// Step 1.
|
||||
let translation = Transform3D::create_translation(tx, ty, tz);
|
||||
let mut matrix = self.matrix.borrow_mut();
|
||||
*matrix = translation.post_mul(&matrix);
|
||||
*matrix = translation.post_transform(&matrix);
|
||||
// Step 2.
|
||||
if tz != 0.0 {
|
||||
self.is2D.set(false);
|
||||
|
@ -235,7 +235,7 @@ impl DOMMatrixReadOnly {
|
|||
{
|
||||
let scale3D = Transform3D::create_scale(scaleX, scaleY, scaleZ);
|
||||
let mut matrix = self.matrix.borrow_mut();
|
||||
*matrix = scale3D.post_mul(&matrix);
|
||||
*matrix = scale3D.post_transform(&matrix);
|
||||
}
|
||||
// Step 4.
|
||||
originX = -originX;
|
||||
|
@ -258,7 +258,7 @@ impl DOMMatrixReadOnly {
|
|||
{
|
||||
let scale3D = Transform3D::create_scale(scale, scale, scale);
|
||||
let mut matrix = self.matrix.borrow_mut();
|
||||
*matrix = scale3D.post_mul(&matrix);
|
||||
*matrix = scale3D.post_transform(&matrix);
|
||||
}
|
||||
// Step 3.
|
||||
self.translate_self(-originX, -originY, -originZ);
|
||||
|
@ -291,7 +291,7 @@ impl DOMMatrixReadOnly {
|
|||
let rotation =
|
||||
Transform3D::create_rotation(0.0, 0.0, -1.0, Angle::radians(rotZ.to_radians()));
|
||||
let mut matrix = self.matrix.borrow_mut();
|
||||
*matrix = rotation.post_mul(&matrix);
|
||||
*matrix = rotation.post_transform(&matrix);
|
||||
}
|
||||
if rotY != 0.0 {
|
||||
// Step 6.
|
||||
|
@ -299,7 +299,7 @@ impl DOMMatrixReadOnly {
|
|||
let rotation =
|
||||
Transform3D::create_rotation(0.0, -1.0, 0.0, Angle::radians(rotY.to_radians()));
|
||||
let mut matrix = self.matrix.borrow_mut();
|
||||
*matrix = rotation.post_mul(&matrix);
|
||||
*matrix = rotation.post_transform(&matrix);
|
||||
}
|
||||
if rotX != 0.0 {
|
||||
// Step 7.
|
||||
|
@ -307,7 +307,7 @@ impl DOMMatrixReadOnly {
|
|||
let rotation =
|
||||
Transform3D::create_rotation(-1.0, 0.0, 0.0, Angle::radians(rotX.to_radians()));
|
||||
let mut matrix = self.matrix.borrow_mut();
|
||||
*matrix = rotation.post_mul(&matrix);
|
||||
*matrix = rotation.post_transform(&matrix);
|
||||
}
|
||||
// Step 8 in DOMMatrix.RotateSelf
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ impl DOMMatrixReadOnly {
|
|||
// Beware: pass negated value until https://github.com/servo/euclid/issues/354
|
||||
let rotation = Transform3D::create_rotation(0.0, 0.0, -1.0, rotZ);
|
||||
let mut matrix = self.matrix.borrow_mut();
|
||||
*matrix = rotation.post_mul(&matrix);
|
||||
*matrix = rotation.post_transform(&matrix);
|
||||
}
|
||||
// Step 2 in DOMMatrix.RotateFromVectorSelf
|
||||
}
|
||||
|
@ -338,7 +338,7 @@ impl DOMMatrixReadOnly {
|
|||
Angle::radians(angle.to_radians()),
|
||||
);
|
||||
let mut matrix = self.matrix.borrow_mut();
|
||||
*matrix = rotation.post_mul(&matrix);
|
||||
*matrix = rotation.post_transform(&matrix);
|
||||
// Step 2.
|
||||
if x != 0.0 || y != 0.0 {
|
||||
self.is2D.set(false);
|
||||
|
@ -351,7 +351,7 @@ impl DOMMatrixReadOnly {
|
|||
// Step 1.
|
||||
let skew = Transform3D::create_skew(Angle::radians(sx.to_radians()), Angle::radians(0.0));
|
||||
let mut matrix = self.matrix.borrow_mut();
|
||||
*matrix = skew.post_mul(&matrix);
|
||||
*matrix = skew.post_transform(&matrix);
|
||||
// Step 2 in DOMMatrix.SkewXSelf
|
||||
}
|
||||
|
||||
|
@ -360,7 +360,7 @@ impl DOMMatrixReadOnly {
|
|||
// Step 1.
|
||||
let skew = Transform3D::create_skew(Angle::radians(0.0), Angle::radians(sy.to_radians()));
|
||||
let mut matrix = self.matrix.borrow_mut();
|
||||
*matrix = skew.post_mul(&matrix);
|
||||
*matrix = skew.post_transform(&matrix);
|
||||
// Step 2 in DOMMatrix.SkewYSelf
|
||||
}
|
||||
|
||||
|
@ -629,7 +629,7 @@ impl DOMMatrixReadOnlyMethods for DOMMatrixReadOnly {
|
|||
let flip = Transform3D::row_major(
|
||||
-1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0,
|
||||
);
|
||||
let matrix = flip.post_mul(&self.matrix.borrow());
|
||||
let matrix = flip.post_transform(&self.matrix.borrow());
|
||||
DOMMatrix::new(&self.global(), is2D, matrix)
|
||||
}
|
||||
|
||||
|
@ -639,7 +639,7 @@ impl DOMMatrixReadOnlyMethods for DOMMatrixReadOnly {
|
|||
let flip = Transform3D::row_major(
|
||||
1.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0,
|
||||
);
|
||||
let matrix = flip.post_mul(&self.matrix.borrow());
|
||||
let matrix = flip.post_transform(&self.matrix.borrow());
|
||||
DOMMatrix::new(&self.global(), is2D, matrix)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue