diff --git a/Cargo.lock b/Cargo.lock index 562456fece0..7a7c5f5debc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4221,9 +4221,9 @@ dependencies = [ [[package]] name = "rayon_croissant" -version = "0.1.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b725e815f3aa08718063883a75003336889debafe2f8fa67fbe91563ddc4efa" +checksum = "3e4aafda434bd10fec689858e2b1d713d0b784b1e60df3761ac8fa727d7e8e27" dependencies = [ "moite_moite", "rayon", diff --git a/components/layout_2020/Cargo.toml b/components/layout_2020/Cargo.toml index 5a28da8d9ee..1d76d00af79 100644 --- a/components/layout_2020/Cargo.toml +++ b/components/layout_2020/Cargo.toml @@ -25,7 +25,7 @@ msg = {path = "../msg"} net_traits = {path = "../net_traits"} range = {path = "../range"} rayon = "1" -rayon_croissant = "0.1.1" +rayon_croissant = "0.2.0" script_layout_interface = {path = "../script_layout_interface"} script_traits = {path = "../script_traits"} serde = "1.0" diff --git a/components/layout_2020/flow/construct.rs b/components/layout_2020/flow/construct.rs index 4a397add2c3..25b401e5592 100644 --- a/components/layout_2020/flow/construct.rs +++ b/components/layout_2020/flow/construct.rs @@ -172,14 +172,6 @@ impl BlockContainer { contains_floats: ContainsFloats, outer_content_sizes_of_children: ContentSizes, } - impl Default for Accumulator { - fn default() -> Self { - Self { - contains_floats: ContainsFloats::No, - outer_content_sizes_of_children: ContentSizes::zero(), - } - } - } let mut acc = Accumulator { contains_floats: builder.contains_floats, outer_content_sizes_of_children: ContentSizes::zero(), @@ -199,13 +191,21 @@ impl BlockContainer { builder .block_level_boxes .into_par_iter() - .mapfold_reduce_into(&mut acc, mapfold, |left, right| { - left.contains_floats |= right.contains_floats; - if content_sizes.requests_inline() { - left.outer_content_sizes_of_children - .max_assign(&right.outer_content_sizes_of_children) - } - }) + .mapfold_reduce_into( + &mut acc, + mapfold, + || Accumulator { + contains_floats: ContainsFloats::No, + outer_content_sizes_of_children: ContentSizes::zero(), + }, + |left, right| { + left.contains_floats |= right.contains_floats; + if content_sizes.requests_inline() { + left.outer_content_sizes_of_children + .max_assign(&right.outer_content_sizes_of_children) + } + }, + ) .collect() } else { builder diff --git a/components/layout_2020/flow/mod.rs b/components/layout_2020/flow/mod.rs index 3c1df828d1f..449789530e6 100644 --- a/components/layout_2020/flow/mod.rs +++ b/components/layout_2020/flow/mod.rs @@ -235,6 +235,7 @@ fn layout_block_level_children<'a>( /* float_context = */ None, ) }, + Default::default, |left, right| left.append(right), ) .collect();