diff --git a/components/layout/display_list/builder.rs b/components/layout/display_list/builder.rs index 5d9a738606e..c963322323a 100644 --- a/components/layout/display_list/builder.rs +++ b/components/layout/display_list/builder.rs @@ -79,8 +79,13 @@ use webrender_api::StickyOffsetBounds; fn establishes_containing_block_for_absolute( flags: StackingContextCollectionFlags, positioning: StylePosition, + established_reference_frame: bool, ) -> bool { - !flags.contains(StackingContextCollectionFlags::NEVER_CREATES_CONTAINING_BLOCK) && + if established_reference_frame { + return true; + } + + !flags.contains(StackingContextCollectionFlags::POSITION_NEVER_CREATES_CONTAINING_BLOCK) && StylePosition::Static != positioning } @@ -2167,7 +2172,7 @@ impl FragmentDisplayListBuilding for Fragment { bitflags! { pub struct StackingContextCollectionFlags: u8 { /// This flow never establishes a containing block. - const NEVER_CREATES_CONTAINING_BLOCK = 0b001; + const POSITION_NEVER_CREATES_CONTAINING_BLOCK = 0b001; /// This flow never creates a ClipScrollNode. const NEVER_CREATES_CLIP_SCROLL_NODE = 0b010; /// This flow never creates a stacking context. @@ -2445,7 +2450,11 @@ impl BlockFlowDisplayListBuilding for BlockFlow { flags, ); - if establishes_containing_block_for_absolute(flags, self.positioning()) { + if establishes_containing_block_for_absolute( + flags, + self.positioning(), + established_reference_frame.is_some() + ) { state.containing_block_clipping_and_scrolling = state.current_clipping_and_scrolling; } @@ -2534,7 +2543,7 @@ impl BlockFlowDisplayListBuilding for BlockFlow { // We keep track of our position so that any stickily positioned elements can // properly determine the extent of their movement relative to scrolling containers. - if !flags.contains(StackingContextCollectionFlags::NEVER_CREATES_CONTAINING_BLOCK) { + if !flags.contains(StackingContextCollectionFlags::POSITION_NEVER_CREATES_CONTAINING_BLOCK) { let border_box = if self.fragment.establishes_stacking_context() { stacking_relative_border_box } else { @@ -2911,6 +2920,7 @@ impl InlineFlowDisplayListBuilding for InlineFlow { if establishes_containing_block_for_absolute( StackingContextCollectionFlags::empty(), fragment.style.get_box().position, + false, ) { state.containing_block_clipping_and_scrolling = state.current_clipping_and_scrolling; diff --git a/components/layout/table_rowgroup.rs b/components/layout/table_rowgroup.rs index 85bccb18ade..8934f77a266 100644 --- a/components/layout/table_rowgroup.rs +++ b/components/layout/table_rowgroup.rs @@ -186,7 +186,7 @@ impl Flow for TableRowGroupFlow { fn collect_stacking_contexts(&mut self, state: &mut StackingContextCollectionState) { self.block_flow.collect_stacking_contexts_for_block(state, - StackingContextCollectionFlags::NEVER_CREATES_CONTAINING_BLOCK); + StackingContextCollectionFlags::POSITION_NEVER_CREATES_CONTAINING_BLOCK); } fn repair_style(&mut self, new_style: &::ServoArc) { diff --git a/components/layout/table_wrapper.rs b/components/layout/table_wrapper.rs index 7336efa41e9..90be14876cc 100644 --- a/components/layout/table_wrapper.rs +++ b/components/layout/table_wrapper.rs @@ -464,7 +464,7 @@ impl Flow for TableWrapperFlow { fn collect_stacking_contexts(&mut self, state: &mut StackingContextCollectionState) { self.block_flow.collect_stacking_contexts_for_block( state, - StackingContextCollectionFlags::NEVER_CREATES_CONTAINING_BLOCK | + StackingContextCollectionFlags::POSITION_NEVER_CREATES_CONTAINING_BLOCK | StackingContextCollectionFlags::NEVER_CREATES_CLIP_SCROLL_NODE); }