Skip to content

Commit

Permalink
Merge pull request #3 from wechat-miniprogram/refactor-special-position
Browse files Browse the repository at this point in the history
refactor: special position layout
  • Loading branch information
LastLeaf authored Dec 10, 2024
2 parents 24a66e2 + c9ee263 commit 3e1a942
Show file tree
Hide file tree
Showing 4 changed files with 360 additions and 522 deletions.
16 changes: 10 additions & 6 deletions float-pigment-layout/src/algo/flex_box.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1303,9 +1303,11 @@ impl<T: LayoutTreeNode> FlexBox<T> for LayoutUnit<T> {
}
};
let baseline_diff = child.gen_origin(
dir,
main_dir_rev,
cross_dir_rev,
AxisInfo {
main_dir_rev,
cross_dir_rev,
dir,
},
*container_size,
offset_main,
offset_cross,
Expand Down Expand Up @@ -1344,9 +1346,11 @@ impl<T: LayoutTreeNode> FlexBox<T> for LayoutUnit<T> {
&ret,
border,
padding_border,
dir,
main_dir_rev,
AxisReverse::NotReversed,
AxisInfo {
dir,
main_dir_rev,
cross_dir_rev: AxisReverse::NotReversed,
},
true,
);
self.result = Rect::new(Point::zero(), ret.size.0);
Expand Down
25 changes: 13 additions & 12 deletions float-pigment-layout/src/algo/flow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,10 @@ impl<T: LayoutTreeNode> Flow<T> for LayoutUnit<T> {
&ret,
border,
padding_border,
axis_info.dir,
axis_info.main_dir_rev,
AxisReverse::NotReversed,
AxisInfo {
cross_dir_rev: AxisReverse::NotReversed,
..axis_info
},
false,
);
self.result = Rect::new(Point::zero(), ret.size.0);
Expand Down Expand Up @@ -491,9 +492,10 @@ impl<T: LayoutTreeNode> Flow<T> for LayoutUnit<T> {
.or_zero()
};
let baseline_diff = child.gen_origin(
axis_info.dir,
axis_info.main_dir_rev,
AxisReverse::NotReversed,
AxisInfo {
cross_dir_rev: AxisReverse::NotReversed,
..axis_info
},
node_inner_size.or_zero(),
main_offset,
cross_offset,
Expand Down Expand Up @@ -616,9 +618,10 @@ impl<T: LayoutTreeNode> Flow<T> for LayoutUnit<T> {
child.result = Rect::new(Point::zero(), child_res.size);
child.cache.touch(child_node);
child.gen_origin(
axis_info.dir,
axis_info.main_dir_rev,
AxisReverse::NotReversed,
AxisInfo {
cross_dir_rev: AxisReverse::NotReversed,
..axis_info
},
node_inner_size.or_zero(),
main_offset + child_origin.main_axis(axis_info.dir),
cross_offset + child_origin.cross_axis(axis_info.dir),
Expand Down Expand Up @@ -671,9 +674,7 @@ impl<T: LayoutTreeNode> Flow<T> for LayoutUnit<T> {
},
border,
padding_border,
axis_info.dir,
axis_info.main_dir_rev,
axis_info.cross_dir_rev,
axis_info,
false,
)
}
Expand Down
Loading

0 comments on commit 3e1a942

Please sign in to comment.