File tree Expand file tree Collapse file tree 3 files changed +25
-6
lines changed
float-pigment-forest/tests/custom
float-pigment-layout/src/algo Expand file tree Collapse file tree 3 files changed +25
-6
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,19 @@ fn margin_collapse_1() {
8181 )
8282}
8383
84+ #[ test]
85+ fn margin_collapse_empty_inline_nodes ( ) {
86+ assert_xml ! (
87+ r#"
88+ <div style="height: 800px;">
89+ <div style="height: 100px; margin-bottom: 50px;"></div>
90+ <div style="display: inline; height: 0;"></div>
91+ <div style="margin-top: 40px;" expect_top="150"></div>
92+ </div>
93+ "#
94+ )
95+ }
96+
8497#[ test]
8598fn margin_collapse_negative ( ) {
8699 assert_xml ! (
Original file line number Diff line number Diff line change @@ -674,17 +674,19 @@ impl<T: LayoutTreeNode> Flow<T> for LayoutUnit<T> {
674674 request. kind == ComputeRequestKind :: Position ,
675675 ) ;
676676
677- if let Some ( ( prev_collapsed_margin, prev_collapsed_through) ) =
678- prev_sibling_collapsed_margin
679- {
680- if !prev_collapsed_through {
681- total_main_size += prev_collapsed_margin. solve ( ) ;
677+ if block_size. main_size ( axis_info. dir ) > T :: Length :: zero ( ) {
678+ if let Some ( ( prev_collapsed_margin, prev_collapsed_through) ) =
679+ prev_sibling_collapsed_margin
680+ {
681+ if !prev_collapsed_through {
682+ total_main_size += prev_collapsed_margin. solve ( ) ;
683+ }
682684 }
685+ prev_sibling_collapsed_margin. replace ( ( CollapsedMargin :: zero ( ) , false ) ) ;
683686 }
684687 let main_offset = padding_border
685688 . main_axis_start ( axis_info. dir , axis_info. main_dir_rev )
686689 + total_main_size;
687- prev_sibling_collapsed_margin. replace ( ( CollapsedMargin :: zero ( ) , false ) ) ;
688690
689691 total_main_size += block_size. main_size ( axis_info. dir ) ;
690692 max_cross_size = max_cross_size. max ( block_size. cross_size ( axis_info. dir ) ) ;
Original file line number Diff line number Diff line change 1+ [toolchain ]
2+ channel = " 1.81.0"
3+ components = [ " rustfmt" , " clippy" ]
4+ profile = " minimal"
You can’t perform that action at this time.
0 commit comments