diff options
author | Simon Sapin <simon.sapin@exyr.org> | 2020-06-19 15:38:15 +0200 |
---|---|---|
committer | Simon Sapin <simon.sapin@exyr.org> | 2020-06-19 15:38:15 +0200 |
commit | 42e9d2450e69ab94adbef9458389e836cf38e8ca (patch) | |
tree | 169b00e0bf7b0b5747aab158885df291e06022be /components/layout_2020/flow/mod.rs | |
parent | 5fed956d65a92b1e36377b7ab96578f051ca090c (diff) | |
download | servo-42e9d2450e69ab94adbef9458389e836cf38e8ca.tar.gz servo-42e9d2450e69ab94adbef9458389e836cf38e8ca.zip |
Parallelize `BlockContainer::inline_content_sizes`
Diffstat (limited to 'components/layout_2020/flow/mod.rs')
-rw-r--r-- | components/layout_2020/flow/mod.rs | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/components/layout_2020/flow/mod.rs b/components/layout_2020/flow/mod.rs index 205acad83dd..de22f1a427d 100644 --- a/components/layout_2020/flow/mod.rs +++ b/components/layout_2020/flow/mod.rs @@ -141,17 +141,13 @@ impl BlockContainer { containing_block_writing_mode: WritingMode, ) -> ContentSizes { match &self { - Self::BlockLevelBoxes(boxes) => { - let mut content_sizes = ContentSizes::zero(); - for box_ in boxes { - content_sizes.max_assign( - &box_ - .borrow_mut() - .inline_content_sizes(layout_context, containing_block_writing_mode), - ); - } - content_sizes - }, + Self::BlockLevelBoxes(boxes) => boxes + .par_iter() + .map(|box_| { + box_.borrow_mut() + .inline_content_sizes(layout_context, containing_block_writing_mode) + }) + .reduce(ContentSizes::zero, ContentSizes::max), Self::InlineFormattingContext(context) => { context.inline_content_sizes(layout_context, containing_block_writing_mode) }, |