Skip to content

Commit

Permalink
servo: Merge #15334 - Fix the panic when transform is non-invertible …
Browse files Browse the repository at this point in the history
…(from canaltinova:inverse); r=nox

<!-- Please describe your changes on the following line: -->
Fixes the panic when transform is non-invertible.
Counterpart of servo/webrender#823
r? @glennw

---
<!-- 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
- [X] These changes fix #13266 (github issue number if applicable).

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

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

Source-Repo: https://github.com/servo/servo
Source-Revision: d2ae3d8bedf99c97877ec944d94f2aa72e67478d

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 8d73f7ee9d060bf2daca6cf6ed2f709a439d0164
  • Loading branch information
canova committed Feb 19, 2017
1 parent 53e3a26 commit 82f1580
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion servo/components/gfx/display_list/mod.rs
Expand Up @@ -182,7 +182,14 @@ impl DisplayList {
*client_point
} else {
let point = *translated_point - stacking_context.bounds.origin;
let inv_transform = stacking_context.transform.inverse().unwrap();
let inv_transform = match stacking_context.transform.inverse() {
Some(transform) => transform,
None => {
// If a transform function causes the current transformation matrix of an object
// to be non-invertible, the object and its content do not get displayed.
return;
}
};
let frac_point = inv_transform.transform_point(&Point2D::new(point.x.to_f32_px(),
point.y.to_f32_px()));
Point2D::new(Au::from_f32_px(frac_point.x), Au::from_f32_px(frac_point.y))
Expand Down

0 comments on commit 82f1580

Please sign in to comment.