layout: use Au in BoxFragment (#31794)

* use au in BoxFragement

* review fix
This commit is contained in:
atbrakhi 2024-03-22 10:00:39 +05:30 committed by GitHub
parent 0b863de846
commit 95e69fe4ff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 98 additions and 100 deletions

View file

@ -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 {