mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
New reference frames should create containing blocks
Transforms should always create containing blocks. This bug already existed in Servo, but was covered up by the reference frame id replacement feature in WebRender. Now that we create reference frames manually we need to fix it.
This commit is contained in:
parent
d41c512e98
commit
253117ece6
3 changed files with 16 additions and 6 deletions
|
@ -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;
|
||||
|
|
|
@ -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<ComputedValues>) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue