diff options
author | Anthony Ramine <nox@nox.paris> | 2019-11-26 16:21:11 +0100 |
---|---|---|
committer | Simon Sapin <simon.sapin@exyr.org> | 2019-11-26 16:36:24 +0100 |
commit | 858bc5aca681fae70ce640d70d5fa80f7edd3dc9 (patch) | |
tree | 1ddb1cbd9486e443dc02bddb6d24a44da5d7a629 /components/layout_2020/formatting_contexts.rs | |
parent | 24b7eadfff33fd822dadbb9b76692fcfca7810d2 (diff) | |
download | servo-858bc5aca681fae70ce640d70d5fa80f7edd3dc9.tar.gz servo-858bc5aca681fae70ce640d70d5fa80f7edd3dc9.zip |
Split FlowChildren in IndependentLayout and FlowLayout
The result of doing the layout of an independent formatting context
should be unconcerned with margin collapsing.
Diffstat (limited to 'components/layout_2020/formatting_contexts.rs')
-rw-r--r-- | components/layout_2020/formatting_contexts.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/components/layout_2020/formatting_contexts.rs b/components/layout_2020/formatting_contexts.rs index b4f9552dff0..96294947720 100644 --- a/components/layout_2020/formatting_contexts.rs +++ b/components/layout_2020/formatting_contexts.rs @@ -4,7 +4,8 @@ use crate::context::LayoutContext; use crate::dom_traversal::{Contents, NodeExt}; -use crate::flow::{BlockFormattingContext, FlowChildren}; +use crate::flow::BlockFormattingContext; +use crate::fragments::Fragment; use crate::geom::flow_relative::Vec2; use crate::positioned::AbsolutelyPositionedFragment; use crate::replaced::ReplacedContent; @@ -14,6 +15,7 @@ use servo_arc::Arc; use std::convert::TryInto; use style::context::SharedStyleContext; use style::properties::ComputedValues; +use style::values::computed::Length; /// https://drafts.csswg.org/css-display/#independent-formatting-context #[derive(Debug)] @@ -22,6 +24,11 @@ pub(crate) struct IndependentFormattingContext { contents: IndependentFormattingContextContents, } +pub(crate) struct IndependentLayout { + pub fragments: Vec<Fragment>, + pub content_block_size: Length, +} + // Private so that code outside of this module cannot match variants. // It should got through methods instead. #[derive(Debug)] @@ -74,7 +81,7 @@ impl IndependentFormattingContext { containing_block: &ContainingBlock, tree_rank: usize, absolutely_positioned_fragments: &mut Vec<AbsolutelyPositionedFragment<'a>>, - ) -> FlowChildren { + ) -> IndependentLayout { match self.as_replaced() { Ok(replaced) => match *replaced {}, Err(ifc) => ifc.layout( @@ -94,7 +101,7 @@ impl<'a> NonReplacedIFC<'a> { containing_block: &ContainingBlock, tree_rank: usize, absolutely_positioned_fragments: &mut Vec<AbsolutelyPositionedFragment<'a>>, - ) -> FlowChildren { + ) -> IndependentLayout { match &self.0 { NonReplacedIFCKind::Flow(bfc) => bfc.layout( layout_context, |