diff options
author | bors-servo <servo-ops@mozilla.com> | 2020-03-28 13:37:31 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-28 13:37:31 -0400 |
commit | 15d8c6058bb5fd21036cb35500a0c2f23a9ef7f7 (patch) | |
tree | fde1850c9fe7f9050d0342a7c01f76f39985040f /components/layout/construct.rs | |
parent | e69de9bc9cf5cdd29d1c392c613bc1c1ad4815bf (diff) | |
parent | dba6a635e5df980b2837495aae59711739c23716 (diff) | |
download | servo-15d8c6058bb5fd21036cb35500a0c2f23a9ef7f7.tar.gz servo-15d8c6058bb5fd21036cb35500a0c2f23a9ef7f7.zip |
Auto merge of #26048 - nox:layout-2020-transparent-data, r=jdm
Give a lifetime parameter to LayoutDom
Diffstat (limited to 'components/layout/construct.rs')
-rw-r--r-- | components/layout/construct.rs | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/components/layout/construct.rs b/components/layout/construct.rs index aabb2e69b67..7078e063978 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -181,12 +181,15 @@ pub struct InlineBlockSplit { impl InlineBlockSplit { /// Flushes the given accumulator to the new split and makes a new accumulator to hold any /// subsequent fragments. - fn new<ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>( + fn new<'dom, ConcreteThreadSafeLayoutNode>( fragment_accumulator: &mut InlineFragmentsAccumulator, node: &ConcreteThreadSafeLayoutNode, style_context: &SharedStyleContext, flow: FlowRef, - ) -> InlineBlockSplit { + ) -> InlineBlockSplit + where + ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode<'dom>, + { fragment_accumulator.enclosing_node.as_mut().expect( "enclosing_node is None; Are {ib} splits being generated outside of an inline node?" ).flags.remove(InlineFragmentNodeFlags::LAST_FRAGMENT_OF_ELEMENT); @@ -272,13 +275,10 @@ impl InlineFragmentsAccumulator { } } - fn from_inline_node<N>( - node: &N, + fn from_inline_node<'dom>( + node: &impl ThreadSafeLayoutNode<'dom>, style_context: &SharedStyleContext, - ) -> InlineFragmentsAccumulator - where - N: ThreadSafeLayoutNode, - { + ) -> InlineFragmentsAccumulator { InlineFragmentsAccumulator { fragments: IntermediateInlineFragments::new(), enclosing_node: Some(InlineFragmentNodeInfo { @@ -305,12 +305,12 @@ impl InlineFragmentsAccumulator { .push_descendants(fragments.absolute_descendants); } - fn to_intermediate_inline_fragments<N>( + fn to_intermediate_inline_fragments<'dom, N>( self, context: &SharedStyleContext, ) -> IntermediateInlineFragments where - N: ThreadSafeLayoutNode, + N: ThreadSafeLayoutNode<'dom>, { let InlineFragmentsAccumulator { mut fragments, @@ -366,7 +366,7 @@ impl InlineFragmentsAccumulator { } /// An object that knows how to create flows. -pub struct FlowConstructor<'a, N: ThreadSafeLayoutNode> { +pub struct FlowConstructor<'a, N> { /// The layout context. pub layout_context: &'a LayoutContext<'a>, /// Satisfy the compiler about the unused parameters, which we use to improve the ergonomics of @@ -374,8 +374,9 @@ pub struct FlowConstructor<'a, N: ThreadSafeLayoutNode> { phantom2: PhantomData<N>, } -impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode> - FlowConstructor<'a, ConcreteThreadSafeLayoutNode> +impl<'a, 'dom, ConcreteThreadSafeLayoutNode> FlowConstructor<'a, ConcreteThreadSafeLayoutNode> +where + ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode<'dom>, { /// Creates a new flow constructor. pub fn new(layout_context: &'a LayoutContext<'a>) -> Self { @@ -1792,10 +1793,11 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode> } } -impl<'a, ConcreteThreadSafeLayoutNode> PostorderNodeMutTraversal<ConcreteThreadSafeLayoutNode> +impl<'a, 'dom, ConcreteThreadSafeLayoutNode> + PostorderNodeMutTraversal<'dom, ConcreteThreadSafeLayoutNode> for FlowConstructor<'a, ConcreteThreadSafeLayoutNode> where - ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode, + ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode<'dom>, { // Construct Flow based on 'display', 'position', and 'float' values. // @@ -1988,9 +1990,9 @@ trait NodeUtils { fn get_construction_result(self) -> ConstructionResult; } -impl<ConcreteThreadSafeLayoutNode> NodeUtils for ConcreteThreadSafeLayoutNode +impl<'dom, ConcreteThreadSafeLayoutNode> NodeUtils for ConcreteThreadSafeLayoutNode where - ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode, + ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode<'dom>, { fn is_replaced_content(&self) -> bool { match self.type_id() { |