From 9af545e4e4a888aa73b1f775b58573c052a46813 Mon Sep 17 00:00:00 2001 From: Naveen Gattu Date: Tue, 30 Nov 2021 12:51:56 -0800 Subject: [PATCH 1/3] Do not use ParallelIterator if not using rayon --- components/layout_2020/flow/mod.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/components/layout_2020/flow/mod.rs b/components/layout_2020/flow/mod.rs index 1813e58daad..8331f54ea09 100644 --- a/components/layout_2020/flow/mod.rs +++ b/components/layout_2020/flow/mod.rs @@ -134,20 +134,27 @@ impl BlockContainer { ), } } - + pub(super) fn inline_content_sizes( &self, layout_context: &LayoutContext, writing_mode: WritingMode, ) -> ContentSizes { match &self { - Self::BlockLevelBoxes(boxes) => boxes + Self::BlockLevelBoxes(boxes) if layout_context.use_rayon => boxes .par_iter() .map(|box_| { box_.borrow_mut() .inline_content_sizes(layout_context, writing_mode) }) .reduce(ContentSizes::zero, ContentSizes::max), + Self::BlockLevelBoxes(boxes) => boxes + .iter() + .map(|box_| { + box_.borrow_mut() + .inline_content_sizes(layout_context, writing_mode) + }) + .reduce(ContentSizes::max).unwrap_or_else(ContentSizes::zero), Self::InlineFormattingContext(context) => { context.inline_content_sizes(layout_context, writing_mode) }, From 00a7c172e2cd392e73d893d556f9341861ebe0e0 Mon Sep 17 00:00:00 2001 From: Naveen Gattu Date: Tue, 30 Nov 2021 12:54:15 -0800 Subject: [PATCH 2/3] rm ws --- components/layout_2020/flow/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/layout_2020/flow/mod.rs b/components/layout_2020/flow/mod.rs index 8331f54ea09..2d2e4ee1e42 100644 --- a/components/layout_2020/flow/mod.rs +++ b/components/layout_2020/flow/mod.rs @@ -134,7 +134,7 @@ impl BlockContainer { ), } } - + pub(super) fn inline_content_sizes( &self, layout_context: &LayoutContext, From 0e3b52af2761d8aa1d31320b4b342d100f50e3ca Mon Sep 17 00:00:00 2001 From: Naveen Gattu Date: Tue, 30 Nov 2021 18:13:39 -0800 Subject: [PATCH 3/3] fmt --- components/layout_2020/flow/mod.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/layout_2020/flow/mod.rs b/components/layout_2020/flow/mod.rs index 2d2e4ee1e42..f46f2724f3d 100644 --- a/components/layout_2020/flow/mod.rs +++ b/components/layout_2020/flow/mod.rs @@ -152,9 +152,10 @@ impl BlockContainer { .iter() .map(|box_| { box_.borrow_mut() - .inline_content_sizes(layout_context, writing_mode) + .inline_content_sizes(layout_context, writing_mode) }) - .reduce(ContentSizes::max).unwrap_or_else(ContentSizes::zero), + .reduce(ContentSizes::max) + .unwrap_or_else(ContentSizes::zero), Self::InlineFormattingContext(context) => { context.inline_content_sizes(layout_context, writing_mode) },