Fix an assertion failure in Layout 2020

The recent changes to containing blocks, exposed an issue in the
StyleExt trait:

 - When deciding whether an element creates a reference frame, whether
   or not it is a non-replaced inline is taken into account when
   determining if it has a transform.
 - When deciding whether an element creates a stacking context for all
   descendants, whether or not it is a non-replaced inline is *not*
   taken into account when determining if it has a transform.

In both cases, elements that are inline should not be considered to have
transforms. This commit fixes that issue as well as making it so that
inlines cannot be transformed. Note that is also breaks transforms on
replaced elements, but that functionality was fairly half-baked due to
the inconsistent determination of transforms.
This commit is contained in:
Martin Robinson 2023-05-03 17:53:27 +02:00
parent 4e37d07ea4
commit 932dc72402
13 changed files with 28 additions and 17 deletions

View file

@ -336,8 +336,22 @@ impl ComputedValuesExt for ComputedValues {
)
}
/// Returns true if this style has a transform, or perspective property set.
/// Returns true if this style has a transform, or perspective property set and
/// it applies to this element.
fn has_transform_or_perspective(&self) -> bool {
// "A transformable element is an element in one of these categories:
// * all elements whose layout is governed by the CSS box model except for
// non-replaced inline boxes, table-column boxes, and table-column-group
// boxes,
// * all SVG paint server elements, the clipPath element and SVG renderable
// elements with the exception of any descendant element of text content
// elements."
// https://drafts.csswg.org/css-transforms/#transformable-element
// FIXME(mrobinson): Properly handle tables and replaced elements here.
if self.get_box().display.is_inline_flow() {
return false;
}
!self.get_box().transform.0.is_empty() || self.get_box().perspective != Perspective::None
}
@ -414,9 +428,7 @@ impl ComputedValuesExt for ComputedValues {
/// Note that this also implies that it establishes a containing block
/// for absolute descendants (`position: absolute`).
fn establishes_containing_block_for_all_descendants(&self) -> bool {
if self.get_box().display.outside() != stylo::DisplayOutside::Inline &&
self.has_transform_or_perspective()
{
if self.has_transform_or_perspective() {
return true;
}

View file

@ -1,2 +0,0 @@
[css-transforms-3d-on-anonymous-block-001.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[perspective-untransformable-no-stacking-context.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[transform-applies-to-002.xht]
expected: FAIL

View file

@ -1,2 +0,0 @@
[transform-inline-001.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[transform-table-001.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[transform-table-002.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[transform-table-003.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[transform-table-004.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[transform-table-005.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[transform3d-image-scale-001.html]
expected: FAIL

View file

@ -1,2 +0,0 @@
[filter-cb-abspos-inline-002.html]
expected: FAIL

View file

@ -1,3 +0,0 @@
[element_parentOffset.html]
[element_parentOffset]
expected: FAIL