mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Auto merge of #13175 - shinglyu:block-margin-patch, r=notriddle
Move collapse through margin to the top of block flow <!-- Please describe your changes on the following line: --> Based on the spec, a collapse through box should be put on the top edge of the flow. This fixed ~110 reftests --- <!-- 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 - [x] These changes fix #12824 (github issue number if applicable). <!-- Either: --> - [x] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- 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/13175) <!-- Reviewable:end -->
This commit is contained in:
commit
aa011ea275
109 changed files with 21 additions and 324 deletions
|
@ -895,6 +895,12 @@ impl BlockFlow {
|
|||
!had_children_with_clearance);
|
||||
translate_including_floats(&mut cur_b, delta, &mut floats);
|
||||
|
||||
// Collapse-through margins should be placed at the top edge,
|
||||
// so we'll handle the delta after the bottom margin is processed
|
||||
if let CollapsibleMargins::CollapseThrough(_) = flow::base(kid).collapsible_margins {
|
||||
cur_b = cur_b - delta;
|
||||
}
|
||||
|
||||
// Clear past the floats that came in, if necessary.
|
||||
let clearance = match (flow::base(kid).flags.contains(CLEARS_LEFT),
|
||||
flow::base(kid).flags.contains(CLEARS_RIGHT)) {
|
||||
|
@ -926,6 +932,17 @@ impl BlockFlow {
|
|||
margin_collapse_info.advance_block_end_margin(&kid_base.collapsible_margins);
|
||||
translate_including_floats(&mut cur_b, delta, &mut floats);
|
||||
|
||||
// Collapse-through margin should be placed at the top edge of the flow.
|
||||
let collapse_delta = match kid_base.collapsible_margins {
|
||||
CollapsibleMargins::CollapseThrough(_) => {
|
||||
let delta = margin_collapse_info.current_float_ceiling();
|
||||
cur_b = cur_b + delta;
|
||||
kid_base.position.start.b = kid_base.position.start.b + delta;
|
||||
delta
|
||||
}
|
||||
_ => Au(0)
|
||||
};
|
||||
|
||||
if break_at.is_some() {
|
||||
break
|
||||
}
|
||||
|
@ -938,6 +955,10 @@ impl BlockFlow {
|
|||
}
|
||||
ctx.this_fragment_is_empty = false
|
||||
}
|
||||
|
||||
// For consecutive collapse-through flows, their top margin should be calculated
|
||||
// from the same baseline.
|
||||
cur_b = cur_b - collapse_delta;
|
||||
}
|
||||
|
||||
// Add in our block-end margin and compute our collapsible margins.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue