mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #16463 - mrobinson:various-overflow-fixes, r=emilio
Fix various issues with overflow clipping When dealing absolutely positioned items, we should use clip of our containing block, even if our containing block doesn't itself establish a new overflow clip. Additionally, we need to properly handle assigning scroll root ids to fragments of inline elements. We add a test for this behavior. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [x] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16463) <!-- Reviewable:end -->
This commit is contained in:
commit
b9274b7527
4 changed files with 111 additions and 6 deletions
|
@ -92,6 +92,13 @@ fn convert_repeat_mode(from: RepeatKeyword) -> RepeatMode {
|
|||
}
|
||||
}
|
||||
|
||||
fn establishes_containing_block_for_absolute(positioning: position::T) -> bool {
|
||||
match positioning {
|
||||
position::T::absolute | position::T::relative | position::T::fixed => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
trait RgbColor {
|
||||
fn rgb(r: u8, g: u8, b: u8) -> Self;
|
||||
}
|
||||
|
@ -1953,6 +1960,10 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
|||
// we don't want it to be clipped by its own scroll root.
|
||||
let containing_scroll_root_id = self.setup_scroll_root_for_block(state);
|
||||
|
||||
if establishes_containing_block_for_absolute(self.positioning()) {
|
||||
state.containing_block_scroll_root_id = state.current_scroll_root_id;
|
||||
}
|
||||
|
||||
match block_stacking_context_type {
|
||||
BlockStackingContextType::NonstackingContext => {
|
||||
self.base.collect_stacking_contexts_for_children(state);
|
||||
|
@ -2038,12 +2049,6 @@ impl BlockFlowDisplayListBuilding for BlockFlow {
|
|||
self.base.scroll_root_id = new_scroll_root_id;
|
||||
state.current_scroll_root_id = new_scroll_root_id;
|
||||
|
||||
match self.positioning() {
|
||||
position::T::absolute | position::T::relative | position::T::fixed =>
|
||||
state.containing_block_scroll_root_id = new_scroll_root_id,
|
||||
_ => {}
|
||||
}
|
||||
|
||||
containing_scroll_root_id
|
||||
}
|
||||
|
||||
|
@ -2153,6 +2158,11 @@ impl InlineFlowDisplayListBuilding for InlineFlow {
|
|||
self.base.scroll_root_id = state.current_scroll_root_id;
|
||||
|
||||
for mut fragment in self.fragments.fragments.iter_mut() {
|
||||
let previous_containing_block_scroll_root_id = state.containing_block_scroll_root_id;
|
||||
if establishes_containing_block_for_absolute(fragment.style.get_box().position) {
|
||||
state.containing_block_scroll_root_id = state.current_scroll_root_id;
|
||||
}
|
||||
|
||||
match fragment.specific {
|
||||
SpecificFragmentInfo::InlineBlock(ref mut block_flow) => {
|
||||
let block_flow = FlowRef::deref_mut(&mut block_flow.flow_ref);
|
||||
|
@ -2162,6 +2172,10 @@ impl InlineFlowDisplayListBuilding for InlineFlow {
|
|||
let block_flow = FlowRef::deref_mut(&mut block_flow.flow_ref);
|
||||
block_flow.collect_stacking_contexts(state);
|
||||
}
|
||||
SpecificFragmentInfo::InlineAbsolute(ref mut block_flow) => {
|
||||
let block_flow = FlowRef::deref_mut(&mut block_flow.flow_ref);
|
||||
block_flow.collect_stacking_contexts(state);
|
||||
}
|
||||
_ if fragment.establishes_stacking_context() => {
|
||||
fragment.stacking_context_id =
|
||||
StackingContextId::new_of_type(fragment.fragment_id(),
|
||||
|
@ -2178,6 +2192,7 @@ impl InlineFlowDisplayListBuilding for InlineFlow {
|
|||
}
|
||||
_ => fragment.stacking_context_id = state.current_stacking_context_id,
|
||||
}
|
||||
state.containing_block_scroll_root_id = previous_containing_block_scroll_root_id;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue