aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_2020/style_ext.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/layout_2020/style_ext.rs')
-rw-r--r--components/layout_2020/style_ext.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/components/layout_2020/style_ext.rs b/components/layout_2020/style_ext.rs
index 44245e2c89d..7ed41d1cd91 100644
--- a/components/layout_2020/style_ext.rs
+++ b/components/layout_2020/style_ext.rs
@@ -56,6 +56,7 @@ pub(crate) trait ComputedValuesExt {
fn has_transform_or_perspective(&self) -> bool;
fn effective_z_index(&self) -> i32;
fn establishes_stacking_context(&self) -> bool;
+ fn establishes_containing_block(&self) -> bool;
fn establishes_containing_block_for_all_descendants(&self) -> bool;
}
@@ -233,6 +234,14 @@ impl ComputedValuesExt for ComputedValues {
!self.get_position().z_index.is_auto()
}
+ fn establishes_containing_block(&self) -> bool {
+ if self.establishes_containing_block_for_all_descendants() {
+ return true;
+ }
+
+ self.clone_position() != ComputedPosition::Static
+ }
+
/// Returns true if this style establishes a containing block for all descendants
/// including fixed and absolutely positioned ones.
fn establishes_containing_block_for_all_descendants(&self) -> bool {