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() {
81
81
)
82
82
}
83
83
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
+
84
97
#[ test]
85
98
fn margin_collapse_negative ( ) {
86
99
assert_xml ! (
Original file line number Diff line number Diff line change @@ -674,17 +674,19 @@ impl<T: LayoutTreeNode> Flow<T> for LayoutUnit<T> {
674
674
request. kind == ComputeRequestKind :: Position ,
675
675
) ;
676
676
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
+ }
682
684
}
685
+ prev_sibling_collapsed_margin. replace ( ( CollapsedMargin :: zero ( ) , false ) ) ;
683
686
}
684
687
let main_offset = padding_border
685
688
. main_axis_start ( axis_info. dir , axis_info. main_dir_rev )
686
689
+ total_main_size;
687
- prev_sibling_collapsed_margin. replace ( ( CollapsedMargin :: zero ( ) , false ) ) ;
688
690
689
691
total_main_size += block_size. main_size ( axis_info. dir ) ;
690
692
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