mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Remove rayon_croissant and clean up contains_floats
(#29960)
Remove rayon_croissant and refactor the way that information about floats in flows bubbles up. This simplifies the code a good deal and lets us take advantage of some more optimized functions provided by rayon. This removes 2 crates from the dependency tree. In addition, this allows avoiding passing `contains_floats` up from every box tree construction function. This makes things simpler, but also opens up the possibility of passing more of these flags up in the future (such as `contains_counters`).
This commit is contained in:
parent
9c333ab1ee
commit
4f4c2a5922
7 changed files with 108 additions and 144 deletions
|
@ -49,6 +49,17 @@ pub(crate) enum BlockContainer {
|
|||
InlineFormattingContext(InlineFormattingContext),
|
||||
}
|
||||
|
||||
impl BlockContainer {
|
||||
fn contains_floats(&self) -> bool {
|
||||
match self {
|
||||
BlockContainer::BlockLevelBoxes(boxes) => boxes
|
||||
.iter()
|
||||
.any(|block_level_box| block_level_box.borrow().contains_floats()),
|
||||
BlockContainer::InlineFormattingContext { .. } => true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub(crate) enum BlockLevelBox {
|
||||
SameFormattingContextBlock {
|
||||
|
@ -56,6 +67,7 @@ pub(crate) enum BlockLevelBox {
|
|||
#[serde(skip_serializing)]
|
||||
style: Arc<ComputedValues>,
|
||||
contents: BlockContainer,
|
||||
contains_floats: bool,
|
||||
},
|
||||
OutOfFlowAbsolutelyPositionedBox(ArcRefCell<AbsolutelyPositionedBox>),
|
||||
OutOfFlowFloatBox(FloatBox),
|
||||
|
@ -63,6 +75,16 @@ pub(crate) enum BlockLevelBox {
|
|||
}
|
||||
|
||||
impl BlockLevelBox {
|
||||
fn contains_floats(&self) -> bool {
|
||||
match self {
|
||||
BlockLevelBox::SameFormattingContextBlock {
|
||||
contains_floats, ..
|
||||
} => *contains_floats,
|
||||
BlockLevelBox::OutOfFlowFloatBox { .. } => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
fn find_block_margin_collapsing_with_parent(
|
||||
&self,
|
||||
collected_margin: &mut CollapsedMargin,
|
||||
|
@ -496,6 +518,7 @@ impl BlockLevelBox {
|
|||
base_fragment_info: tag,
|
||||
style,
|
||||
contents,
|
||||
..
|
||||
} => Fragment::Box(positioning_context.layout_maybe_position_relative_fragment(
|
||||
layout_context,
|
||||
containing_block,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue