Auto merge of #25818 - mrobinson:transforms, r=SimonSapin

Add initial support for transforms to layout_2020

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix #___ (GitHub issue number if applicable)

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
bors-servo 2020-02-24 12:45:43 -05:00 committed by GitHub
commit 9c6897c967
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
174 changed files with 6374 additions and 59 deletions

View file

@ -61,7 +61,7 @@ use style::selector_parser::RestyleDamage;
use style::servo::restyle_damage::ServoRestyleDamage;
use style::str::char_is_whitespace;
use style::values::computed::counters::ContentItem;
use style::values::computed::{Size, VerticalAlign};
use style::values::computed::{Length, Size, VerticalAlign};
use style::values::generics::box_::{Perspective, VerticalAlignKeyword};
use style::values::generics::transform;
use webrender_api;
@ -3169,9 +3169,19 @@ impl Fragment {
stacking_relative_border_box: &Rect<Au>,
) -> Option<LayoutTransform> {
let list = &self.style.get_box().transform;
let border_box_as_length = Rect::new(
Point2D::new(
Length::new(stacking_relative_border_box.origin.x.to_f32_px()),
Length::new(stacking_relative_border_box.origin.y.to_f32_px()),
),
Size2D::new(
Length::new(stacking_relative_border_box.size.width.to_f32_px()),
Length::new(stacking_relative_border_box.size.height.to_f32_px()),
),
);
let transform = LayoutTransform::from_untyped(
&list
.to_transform_3d_matrix(Some(stacking_relative_border_box))
.to_transform_3d_matrix(Some(&border_box_as_length))
.ok()?
.0,
);