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:
bors-servo 2016-09-08 17:43:50 -05:00 committed by GitHub
commit aa011ea275
109 changed files with 21 additions and 324 deletions

View file

@ -895,6 +895,12 @@ impl BlockFlow {
!had_children_with_clearance); !had_children_with_clearance);
translate_including_floats(&mut cur_b, delta, &mut floats); 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. // Clear past the floats that came in, if necessary.
let clearance = match (flow::base(kid).flags.contains(CLEARS_LEFT), let clearance = match (flow::base(kid).flags.contains(CLEARS_LEFT),
flow::base(kid).flags.contains(CLEARS_RIGHT)) { flow::base(kid).flags.contains(CLEARS_RIGHT)) {
@ -926,6 +932,17 @@ impl BlockFlow {
margin_collapse_info.advance_block_end_margin(&kid_base.collapsible_margins); margin_collapse_info.advance_block_end_margin(&kid_base.collapsible_margins);
translate_including_floats(&mut cur_b, delta, &mut floats); 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() { if break_at.is_some() {
break break
} }
@ -938,6 +955,10 @@ impl BlockFlow {
} }
ctx.this_fragment_is_empty = false 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. // Add in our block-end margin and compute our collapsible margins.

View file

@ -1,3 +0,0 @@
[css3-box-shadow.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[absolute-non-replaced-height-009.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[absolute-non-replaced-max-height-009.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[abspos-011.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[abspos-012.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[abspos-017.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[border-color-005.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[left-applies-to-009.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[left-offset-position-fixed-001.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[list-style-applies-to-009.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[list-style-applies-to-010.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[list-style-applies-to-011.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[list-style-type-applies-to-009.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[list-style-type-applies-to-010.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[list-style-type-applies-to-011.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[margin-003.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[margin-004.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[margin-005.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[margin-008.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[margin-009.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[margin-collapse-115.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[margin-collapse-116.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-001.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-002.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-007.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-008.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-013.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-018.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-023.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-024.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-025.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-031.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-036.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-041.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-046.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-047.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-048.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-049.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-050.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-051.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-052.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-053.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-054.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-058.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-059.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-061.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-062.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-069.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-070.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-071.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-072.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-073.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-074.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-075.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-079.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-081.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-082.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-089.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-090.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-091.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-092.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-093.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-094.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-095.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-099.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-101.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-102.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-109.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-110.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-111.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-112.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-113.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-114.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-115.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-119.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-121.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-122.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[outline-color-130.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[padding-003.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[padding-004.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[position-absolute-004.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[right-applies-to-009.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[table-anonymous-objects-115.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[table-anonymous-objects-116.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[table-anonymous-objects-121.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[table-anonymous-objects-122.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[table-anonymous-objects-173.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[table-anonymous-objects-174.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[table-anonymous-objects-175.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[table-anonymous-objects-176.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[text-align-white-space-002.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[text-align-white-space-004.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[text-align-white-space-006.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[text-align-white-space-008.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[z-index-001.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[z-index-002.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[z-index-003.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[z-index-004.htm]
type: reftest
expected: FAIL

View file

@ -1,3 +0,0 @@
[z-index-005.htm]
type: reftest
expected: FAIL

Some files were not shown because too many files have changed in this diff Show more