зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #13175 - Move collapse through margin to the top of block flow (from shinglyu:block-margin-patch); r=notriddle
<!-- 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. --> Source-Repo: https://github.com/servo/servo Source-Revision: aa011ea2759683ede76639a1ea889c93c21d1cb8
This commit is contained in:
Родитель
26c91514d6
Коммит
c852686abe
|
@ -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.
|
||||
|
|
Загрузка…
Ссылка в новой задаче