diff options
author | Simon Sapin <simon.sapin@exyr.org> | 2019-12-02 22:26:49 +0100 |
---|---|---|
committer | Simon Sapin <simon.sapin@exyr.org> | 2019-12-02 22:26:49 +0100 |
commit | 4e6e31a76cd3cae986039fe27da15a9036b1d0ed (patch) | |
tree | cd6252de26f36f07531077884516255078641965 /components/layout_2020/flow/construct.rs | |
parent | 9c5a59504460cd291f21fc5db747bbf8cefe84eb (diff) | |
download | servo-4e6e31a76cd3cae986039fe27da15a9036b1d0ed.tar.gz servo-4e6e31a76cd3cae986039fe27da15a9036b1d0ed.zip |
Pass a LayoutContext through box construction
Diffstat (limited to 'components/layout_2020/flow/construct.rs')
-rw-r--r-- | components/layout_2020/flow/construct.rs | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/components/layout_2020/flow/construct.rs b/components/layout_2020/flow/construct.rs index 5ac85dd47d9..79c44911f47 100644 --- a/components/layout_2020/flow/construct.rs +++ b/components/layout_2020/flow/construct.rs @@ -2,6 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ +use crate::context::LayoutContext; use crate::dom_traversal::{BoxSlot, Contents, NodeExt, NonReplacedContents, TraversalHandler}; use crate::element_data::LayoutBox; use crate::flow::float::FloatBox; @@ -14,13 +15,12 @@ use rayon::iter::{IntoParallelIterator, ParallelIterator}; use rayon_croissant::ParallelIteratorExt; use servo_arc::Arc; use std::convert::TryInto; -use style::context::SharedStyleContext; use style::properties::ComputedValues; use style::selector_parser::PseudoElement; impl BlockFormattingContext { pub fn construct<'dom>( - context: &SharedStyleContext<'_>, + context: &LayoutContext, style: &Arc<ComputedValues>, contents: NonReplacedContents<impl NodeExt<'dom>>, ) -> Self { @@ -71,7 +71,7 @@ enum IntermediateBlockContainer<Node> { /// This builder starts from the first child of a given DOM node /// and does a preorder traversal of all of its inclusive siblings. struct BlockContainerBuilder<'dom, 'style, Node> { - context: &'style SharedStyleContext<'style>, + context: &'style LayoutContext<'style>, block_container_style: &'style Arc<ComputedValues>, @@ -123,11 +123,11 @@ struct BlockContainerBuilder<'dom, 'style, Node> { } impl BlockContainer { - pub fn construct<'dom, 'style>( - context: &SharedStyleContext<'style>, + pub fn construct<'dom>( + context: &LayoutContext, block_container_style: &Arc<ComputedValues>, contents: NonReplacedContents<impl NodeExt<'dom>>, - // intrinsic_sizes_requested: bool, + //intrinsic_sizes_requested: bool, ) -> (BlockContainer, ContainsFloats) { let mut builder = BlockContainerBuilder { context, @@ -510,9 +510,10 @@ where let block_container_style = self.block_container_style; let anonymous_style = self.anonymous_style.get_or_insert_with(|| { context + .shared_context() .stylist .style_for_anonymous::<Node::ConcreteElement>( - &context.guards, + &context.shared_context().guards, &PseudoElement::ServoText, &block_container_style, ) @@ -547,9 +548,9 @@ impl<'dom, Node> IntermediateBlockLevelBox<Node> where Node: NodeExt<'dom>, { - fn finish<'style>( + fn finish( self, - context: &SharedStyleContext<'style>, + context: &LayoutContext, ) -> (Arc<BlockLevelBox>, ContainsFloats) { match self { IntermediateBlockLevelBox::SameFormattingContextBlock { style, contents } => { @@ -614,9 +615,9 @@ impl<'dom, Node> IntermediateBlockContainer<Node> where Node: NodeExt<'dom>, { - fn finish<'style>( + fn finish( self, - context: &SharedStyleContext<'style>, + context: &LayoutContext, style: &Arc<ComputedValues>, ) -> (BlockContainer, ContainsFloats) { match self { |