stylo: Preserve the variant of translate() values in computed transforms

This commit is contained in:
Manish Goregaokar 2017-09-11 16:26:49 -07:00 committed by Manish Goregaokar
parent d461347adf
commit 83e3394904
4 changed files with 57 additions and 14 deletions

View file

@ -92,6 +92,23 @@ impl TransformList {
ComputedOperation::Scale(sx, sy, sz) => {
Transform3D::create_scale(sx, sy, sz)
}
ComputedOperation::TranslateX(tx) => {
let tx = match reference_box {
Some(relative_border_box) => tx.to_used_value(relative_border_box.size.width).to_f32_px(),
None => extract_pixel_length(&tx),
};
Transform3D::create_translation(tx, 0., 0.)
}
ComputedOperation::TranslateY(ty) => {
let ty = match reference_box {
Some(relative_border_box) => ty.to_used_value(relative_border_box.size.height).to_f32_px(),
None => extract_pixel_length(&ty),
};
Transform3D::create_translation(0., ty, 0.)
}
ComputedOperation::TranslateZ(tz) => {
Transform3D::create_translation(0., 0., tz.to_f32_px())
}
ComputedOperation::Translate(tx, ty, tz) => {
let (tx, ty) = match reference_box {
Some(relative_border_box) => {