mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Parallelize BlockContainer::inline_content_sizes
This commit is contained in:
parent
5fed956d65
commit
42e9d2450e
2 changed files with 12 additions and 14 deletions
|
@ -141,17 +141,13 @@ impl BlockContainer {
|
||||||
containing_block_writing_mode: WritingMode,
|
containing_block_writing_mode: WritingMode,
|
||||||
) -> ContentSizes {
|
) -> ContentSizes {
|
||||||
match &self {
|
match &self {
|
||||||
Self::BlockLevelBoxes(boxes) => {
|
Self::BlockLevelBoxes(boxes) => boxes
|
||||||
let mut content_sizes = ContentSizes::zero();
|
.par_iter()
|
||||||
for box_ in boxes {
|
.map(|box_| {
|
||||||
content_sizes.max_assign(
|
box_.borrow_mut()
|
||||||
&box_
|
.inline_content_sizes(layout_context, containing_block_writing_mode)
|
||||||
.borrow_mut()
|
})
|
||||||
.inline_content_sizes(layout_context, containing_block_writing_mode),
|
.reduce(ContentSizes::zero, ContentSizes::max),
|
||||||
);
|
|
||||||
}
|
|
||||||
content_sizes
|
|
||||||
},
|
|
||||||
Self::InlineFormattingContext(context) => {
|
Self::InlineFormattingContext(context) => {
|
||||||
context.inline_content_sizes(layout_context, containing_block_writing_mode)
|
context.inline_content_sizes(layout_context, containing_block_writing_mode)
|
||||||
},
|
},
|
||||||
|
|
|
@ -33,9 +33,11 @@ impl ContentSizes {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn max_assign(&mut self, other: &Self) {
|
pub fn max(self, other: Self) -> Self {
|
||||||
self.min_content.max_assign(other.min_content);
|
Self {
|
||||||
self.max_content.max_assign(other.max_content);
|
min_content: self.min_content.max(other.min_content),
|
||||||
|
max_content: self.max_content.max(other.max_content),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Relevant to outer intrinsic inline sizes, for percentages from padding and margin.
|
/// Relevant to outer intrinsic inline sizes, for percentages from padding and margin.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue