diff options
author | atbrakhi <atbrakhi@igalia.com> | 2024-03-22 10:00:39 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-22 04:30:39 +0000 |
commit | 95e69fe4ffce23708608855720961741344bee07 (patch) | |
tree | 24a6082e751a9f3bbb14da1ae7fb3ba5d58e8f5f /components/layout_2020/flow/float.rs | |
parent | 0b863de8468ad2526bd9131243fd18cb3ba8b100 (diff) | |
download | servo-95e69fe4ffce23708608855720961741344bee07.tar.gz servo-95e69fe4ffce23708608855720961741344bee07.zip |
layout: use `Au` in `BoxFragment` (#31794)
* use au in BoxFragement
* review fix
Diffstat (limited to 'components/layout_2020/flow/float.rs')
-rw-r--r-- | components/layout_2020/flow/float.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/components/layout_2020/flow/float.rs b/components/layout_2020/flow/float.rs index 4fefe0620e5..4b620feba8b 100644 --- a/components/layout_2020/flow/float.rs +++ b/components/layout_2020/flow/float.rs @@ -25,7 +25,7 @@ use crate::dom::NodeExt; use crate::dom_traversal::{Contents, NodeAndStyleInfo}; use crate::formatting_contexts::IndependentFormattingContext; use crate::fragment_tree::{BoxFragment, CollapsedBlockMargins, CollapsedMargin, FloatFragment}; -use crate::geom::{LogicalRect, LogicalSides, LogicalVec2}; +use crate::geom::{LogicalRect, LogicalVec2}; use crate::positioned::PositioningContext; use crate::style_ext::{ComputedValuesExt, DisplayInside, PaddingBorderMargin}; use crate::ContainingBlock; @@ -989,9 +989,9 @@ impl FloatBox { style.clone(), children, content_rect, - pbm.padding.into(), - pbm.border.into(), - margin.into(), + pbm.padding, + pbm.border, + margin, // Clearance is handled internally by the float placement logic, so there's no need // to store it explicitly in the fragment. None, // clearance @@ -1215,9 +1215,8 @@ impl SequentialLayoutState { let pbm_sums = &(&box_fragment.padding + &box_fragment.border) + &box_fragment.margin; let content_rect: LogicalRect<Au> = box_fragment.content_rect.clone().into(); - let pbm_sums_all: LogicalSides<Au> = pbm_sums.map(|length| (*length).into()); let margin_box_start_corner = self.floats.add_float(&PlacementInfo { - size: &content_rect.size + &pbm_sums_all.sum(), + size: &content_rect.size + &pbm_sums.sum(), side: FloatSide::from_style(&box_fragment.style).expect("Float box wasn't floated!"), clear: box_fragment.style.get_box().clear, }); @@ -1225,7 +1224,7 @@ impl SequentialLayoutState { // This is the position of the float in the float-containing block formatting context. We add the // existing start corner here because we may have already gotten some relative positioning offset. let new_position_in_bfc = - &(&margin_box_start_corner + &pbm_sums_all.start_offset()) + &content_rect.start_corner; + &(&margin_box_start_corner + &pbm_sums.start_offset()) + &content_rect.start_corner; // This is the position of the float relative to the containing block start. let new_position_in_containing_block = LogicalVec2 { |