aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_2020/flexbox/construct.rs
diff options
context:
space:
mode:
authorOriol Brufau <obrufau@igalia.com>2024-11-13 10:56:02 +0100
committerGitHub <noreply@github.com>2024-11-13 09:56:02 +0000
commit91026444701cfd68658beb21fbf446f6ed8723e6 (patch)
treec74a51dd95d3832fcc4201e74e48dbf9ac9ba3d6 /components/layout_2020/flexbox/construct.rs
parentc00804190cdc256183ade8f050d5f0408b550303 (diff)
downloadservo-91026444701cfd68658beb21fbf446f6ed8723e6.tar.gz
servo-91026444701cfd68658beb21fbf446f6ed8723e6.zip
Use a RwLock to cache inline_content_sizes() (#34232)
In order to support size keywords in block layout, we may need to call `inline_content_sizes()` in order to compute the min/max-content sizes. But this required a mutable reference in order the update the cache, and in various places we already had mutable references. So this switches the cache into a RwLock to avoid needing mutable refs. Note OnceCell wouldn't work because it's not thread-safe. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Diffstat (limited to 'components/layout_2020/flexbox/construct.rs')
-rw-r--r--components/layout_2020/flexbox/construct.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/components/layout_2020/flexbox/construct.rs b/components/layout_2020/flexbox/construct.rs
index c4c5ff57d60..260e5266b82 100644
--- a/components/layout_2020/flexbox/construct.rs
+++ b/components/layout_2020/flexbox/construct.rs
@@ -171,7 +171,7 @@ where
let non_replaced = NonReplacedFormattingContext {
base_fragment_info: info.into(),
style: info.style.clone(),
- content_sizes_result: None,
+ content_sizes_result: Default::default(),
contents: NonReplacedFormattingContextContents::Flow(
block_formatting_context,
),