aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_2020/display_list
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2023-11-13 10:09:25 +0100
committerGitHub <noreply@github.com>2023-11-13 09:09:25 +0000
commit72cb34dc3def415b4c6e742d8897cb2425c1685a (patch)
tree13bb238fa2b7b7213f760c046130779e0ac3dfc6 /components/layout_2020/display_list
parent1915032f66a83c25b1134264c08cd1d500cc8271 (diff)
downloadservo-72cb34dc3def415b4c6e742d8897cb2425c1685a.tar.gz
servo-72cb34dc3def415b4c6e742d8897cb2425c1685a.zip
Fix transform assertion failures in Layout 2013 and Layout 2020 (#30713)
Layout asserts that it never creates stacking contexts that have a zero scale, yet it doesn't prevent the creation of those stacking contexts. This change stops their creation at an earlier stage. Fixes #30118.
Diffstat (limited to 'components/layout_2020/display_list')
-rw-r--r--components/layout_2020/display_list/stacking_context.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/components/layout_2020/display_list/stacking_context.rs b/components/layout_2020/display_list/stacking_context.rs
index 2ee572a805d..42d61f03c2f 100644
--- a/components/layout_2020/display_list/stacking_context.rs
+++ b/components/layout_2020/display_list/stacking_context.rs
@@ -787,8 +787,10 @@ impl Fragment {
// If this fragment has a transform applied that makes it take up no space
// then we don't need to create any stacking contexts for it.
- let has_non_invertible_transform =
- fragment.has_non_invertible_transform(&containing_block.rect.to_untyped());
+ let has_non_invertible_transform = fragment
+ .has_non_invertible_transform_or_zero_scale(
+ &containing_block.rect.to_untyped(),
+ );
if has_non_invertible_transform {
return;
}
@@ -1258,10 +1260,10 @@ impl BoxFragment {
}
/// Returns true if the given style contains a transform that is not invertible.
- fn has_non_invertible_transform(&self, containing_block: &Rect<Length>) -> bool {
+ fn has_non_invertible_transform_or_zero_scale(&self, containing_block: &Rect<Length>) -> bool {
let list = &self.style.get_box().transform;
match list.to_transform_3d_matrix(Some(containing_block)) {
- Ok(t) => !t.0.is_invertible(),
+ Ok(t) => !t.0.is_invertible() || t.0.m11 == 0. || t.0.m22 == 0.,
Err(_) => false,
}
}