mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
layout_2020: Add 'establishes_block_formatting_context' method to 'ComputedValuesExt'
This method checks whether the style of a normal block would establish a block formatting context.
This commit is contained in:
parent
fb91a5c0f5
commit
b8a037fc1f
1 changed files with 21 additions and 0 deletions
|
@ -11,6 +11,7 @@ use style::computed_values::transform_style::T as ComputedTransformStyle;
|
||||||
use style::logical_geometry::WritingMode;
|
use style::logical_geometry::WritingMode;
|
||||||
use style::properties::longhands::backface_visibility::computed_value::T as BackfaceVisiblity;
|
use style::properties::longhands::backface_visibility::computed_value::T as BackfaceVisiblity;
|
||||||
use style::properties::longhands::box_sizing::computed_value::T as BoxSizing;
|
use style::properties::longhands::box_sizing::computed_value::T as BoxSizing;
|
||||||
|
use style::properties::longhands::column_span::computed_value::T as ColumnSpan;
|
||||||
use style::properties::ComputedValues;
|
use style::properties::ComputedValues;
|
||||||
use style::values::computed::image::Image as ComputedImageLayer;
|
use style::values::computed::image::Image as ComputedImageLayer;
|
||||||
use style::values::computed::{Length, LengthPercentage};
|
use style::values::computed::{Length, LengthPercentage};
|
||||||
|
@ -112,6 +113,7 @@ pub(crate) trait ComputedValuesExt {
|
||||||
) -> flow_relative::Sides<LengthPercentageOrAuto<'_>>;
|
) -> flow_relative::Sides<LengthPercentageOrAuto<'_>>;
|
||||||
fn has_transform_or_perspective(&self) -> bool;
|
fn has_transform_or_perspective(&self) -> bool;
|
||||||
fn effective_z_index(&self) -> i32;
|
fn effective_z_index(&self) -> i32;
|
||||||
|
fn establishes_block_formatting_context(&self) -> bool;
|
||||||
fn establishes_stacking_context(&self) -> bool;
|
fn establishes_stacking_context(&self) -> bool;
|
||||||
fn establishes_containing_block_for_absolute_descendants(&self) -> bool;
|
fn establishes_containing_block_for_absolute_descendants(&self) -> bool;
|
||||||
fn establishes_containing_block_for_all_descendants(&self) -> bool;
|
fn establishes_containing_block_for_all_descendants(&self) -> bool;
|
||||||
|
@ -365,6 +367,25 @@ impl ComputedValuesExt for ComputedValues {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Return true if this style is a normal block and establishes
|
||||||
|
/// a new block formatting context.
|
||||||
|
fn establishes_block_formatting_context(&self) -> bool {
|
||||||
|
if self.get_box().overflow_x.is_scrollable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if self.get_column().is_multicol() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if self.get_column().column_span == ColumnSpan::All {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: We need to handle CSS Contain here.
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns true if this fragment establishes a new stacking context and false otherwise.
|
/// Returns true if this fragment establishes a new stacking context and false otherwise.
|
||||||
fn establishes_stacking_context(&self) -> bool {
|
fn establishes_stacking_context(&self) -> bool {
|
||||||
let effects = self.get_effects();
|
let effects = self.get_effects();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue