mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Improve containing block creation for position:absolute flows
Instead of only promoting flows with positioned fragments to containing blocks, also do this for flows which have the transform, perspective or filter properties set. This is what the spec requires and also fixes some failing tests. It will allow us to stop creating stacking contexts for overflow:hidden and overflow:scroll flows. Fixes #18091.
This commit is contained in:
parent
0a24c2f03c
commit
57704b0481
15 changed files with 107 additions and 43 deletions
|
@ -2487,6 +2487,13 @@ impl Fragment {
|
|||
stacking_relative_border_box.size.height - border_padding.vertical()))
|
||||
}
|
||||
|
||||
/// Returns true if this fragment has a filter, transform, or perspective property set.
|
||||
pub fn has_filter_transform_or_perspective(&self) -> bool {
|
||||
self.style().get_box().transform.0.is_some() ||
|
||||
!self.style().get_effects().filter.0.is_empty() ||
|
||||
self.style().get_box().perspective != Either::Second(values::None_)
|
||||
}
|
||||
|
||||
/// Returns true if this fragment establishes a new stacking context and false otherwise.
|
||||
pub fn establishes_stacking_context(&self) -> bool {
|
||||
// Text fragments shouldn't create stacking contexts.
|
||||
|
@ -2500,22 +2507,17 @@ impl Fragment {
|
|||
if self.style().get_effects().opacity != 1.0 {
|
||||
return true
|
||||
}
|
||||
if !self.style().get_effects().filter.0.is_empty() {
|
||||
return true
|
||||
}
|
||||
|
||||
if self.style().get_effects().mix_blend_mode != mix_blend_mode::T::normal {
|
||||
return true
|
||||
}
|
||||
|
||||
if self.style().get_box().transform.0.is_some() ||
|
||||
self.style().get_box().transform_style == transform_style::T::preserve_3d ||
|
||||
self.style().overrides_transform_style() {
|
||||
return true
|
||||
if self.has_filter_transform_or_perspective() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO(mrobinson): Determine if this is necessary, since blocks with
|
||||
// transformations already create stacking contexts.
|
||||
if let Either::First(ref _length) = self.style().get_box().perspective {
|
||||
if self.style().get_box().transform_style == transform_style::T::preserve_3d ||
|
||||
self.style().overrides_transform_style() {
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue