diff options
author | Simon Sapin <simon.sapin@exyr.org> | 2019-12-07 22:04:41 +0100 |
---|---|---|
committer | Simon Sapin <simon.sapin@exyr.org> | 2019-12-10 15:11:53 +0100 |
commit | 80b2b5fb5e60f10ddac23429bf8c4353b6317133 (patch) | |
tree | d0722ff33fd38f6ba4afc85a6e7004f2e1d4484b /components/layout_2020/formatting_contexts.rs | |
parent | 8996be3c5efa4ef93fd0af332a05bbcbb4905810 (diff) | |
download | servo-80b2b5fb5e60f10ddac23429bf8c4353b6317133.tar.gz servo-80b2b5fb5e60f10ddac23429bf8c4353b6317133.zip |
Fix min/max-content of replaced boxes
Diffstat (limited to 'components/layout_2020/formatting_contexts.rs')
-rw-r--r-- | components/layout_2020/formatting_contexts.rs | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/components/layout_2020/formatting_contexts.rs b/components/layout_2020/formatting_contexts.rs index f741e44affd..eb90d62c926 100644 --- a/components/layout_2020/formatting_contexts.rs +++ b/components/layout_2020/formatting_contexts.rs @@ -59,31 +59,30 @@ impl IndependentFormattingContext { contents: Contents<impl NodeExt<'dom>>, content_sizes: ContentSizesRequest, ) -> Self { - use self::IndependentFormattingContextContents as Contents; - let (contents, content_sizes) = match contents.try_into() { + match contents.try_into() { Ok(non_replaced) => match display_inside { DisplayInside::Flow | DisplayInside::FlowRoot => { - let (bfc, box_content_sizes) = BlockFormattingContext::construct( + let (bfc, content_sizes) = BlockFormattingContext::construct( context, &style, non_replaced, content_sizes, ); - (Contents::Flow(bfc), box_content_sizes) + Self { + style, + content_sizes, + contents: IndependentFormattingContextContents::Flow(bfc), + } }, }, Err(replaced) => { - // The `content_sizes` field is not used by layout code: - ( - Contents::Replaced(replaced), - BoxContentSizes::NoneWereRequested, - ) + let content_sizes = content_sizes.compute(|| replaced.inline_content_sizes(&style)); + Self { + style, + content_sizes, + contents: IndependentFormattingContextContents::Replaced(replaced), + } }, - }; - Self { - style, - contents, - content_sizes, } } |