mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 00:32:11 +00:00
Bug 1843622 - Better fix / workaround for invalid scale in ScaleOffset r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D183698
This commit is contained in:
parent
6cfd93eff9
commit
6cd2ae615b
11
gfx/tests/crashtests/1843622.html
Normal file
11
gfx/tests/crashtests/1843622.html
Normal file
@ -0,0 +1,11 @@
|
||||
<style>
|
||||
#a {
|
||||
transform: scale(0) rotate(0grad);
|
||||
will-change: opacity, contents, left, -webkit-transform;
|
||||
}
|
||||
:not(mpath) {
|
||||
-webkit-text-stroke-width: 1px;
|
||||
}
|
||||
</style>
|
||||
<textarea id="a" autofocus="autofocus">A</textarea>
|
||||
|
@ -227,4 +227,5 @@ load 1802382-1.html
|
||||
load 1808830.html
|
||||
load 1825450.html
|
||||
load 1683679.html
|
||||
load 1843622.html
|
||||
|
||||
|
@ -197,13 +197,12 @@ impl ScaleOffset {
|
||||
}
|
||||
|
||||
pub fn inverse(&self) -> Self {
|
||||
// If either of the scale factors is 0, all we can do is
|
||||
// return identity.
|
||||
// If either of the scale factors is 0, inverse also has scale 0
|
||||
// TODO(gw): Consider making this return Option<Self> in future
|
||||
// so that callers can detect and handle when inverse
|
||||
// fails here.
|
||||
if self.scale.x.approx_eq(&0.0) || self.scale.y.approx_eq(&0.0) {
|
||||
return ScaleOffset::identity();
|
||||
return ScaleOffset::new(0.0, 0.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
ScaleOffset {
|
||||
@ -867,11 +866,11 @@ pub mod test {
|
||||
fn scale_offset_invalid_scale() {
|
||||
let s0 = ScaleOffset::new(0.0, 1.0, 10.0, 20.0);
|
||||
let i0 = s0.inverse();
|
||||
assert_eq!(i0, ScaleOffset::identity());
|
||||
assert_eq!(i0, ScaleOffset::new(0.0, 0.0, 0.0, 0.0));
|
||||
|
||||
let s1 = ScaleOffset::new(1.0, 0.0, 10.0, 20.0);
|
||||
let i1 = s1.inverse();
|
||||
assert_eq!(i1, ScaleOffset::identity());
|
||||
assert_eq!(i1, ScaleOffset::new(0.0, 0.0, 0.0, 0.0));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
Loading…
Reference in New Issue
Block a user