mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
layout: Box block_margins_collapsed_with_children
member of BoxFragment
(#36474)
This reduces the size of `BoxFragment` by around 20 bytes. Testing: This just changes the layout of a data structure, so is covered by existing WPT tests. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
3c4ec17180
commit
a4a308e434
7 changed files with 29 additions and 42 deletions
|
@ -23,9 +23,7 @@ use webrender_api::FontInstanceKey;
|
|||
use super::inline_box::{InlineBoxContainerState, InlineBoxIdentifier, InlineBoxTreePathToken};
|
||||
use super::{InlineFormattingContextLayout, LineBlockSizes};
|
||||
use crate::cell::ArcRefCell;
|
||||
use crate::fragment_tree::{
|
||||
BaseFragmentInfo, BoxFragment, CollapsedBlockMargins, Fragment, TextFragment,
|
||||
};
|
||||
use crate::fragment_tree::{BaseFragmentInfo, BoxFragment, Fragment, TextFragment};
|
||||
use crate::geom::{LogicalRect, LogicalVec2, PhysicalRect, ToLogical};
|
||||
use crate::positioned::{
|
||||
AbsolutelyPositionedBox, PositioningContext, PositioningContextLength, relative_adjustement,
|
||||
|
@ -465,7 +463,6 @@ impl LineItemLayout<'_, '_> {
|
|||
border.to_physical(ifc_writing_mode),
|
||||
margin.to_physical(ifc_writing_mode),
|
||||
None, /* clearance */
|
||||
CollapsedBlockMargins::zero(),
|
||||
);
|
||||
|
||||
let offset_from_parent_ifc = LogicalVec2 {
|
||||
|
|
|
@ -355,7 +355,6 @@ impl OutsideMarker {
|
|||
PhysicalSides::zero(),
|
||||
PhysicalSides::zero(),
|
||||
None,
|
||||
CollapsedBlockMargins::zero(),
|
||||
)))
|
||||
}
|
||||
}
|
||||
|
@ -1105,9 +1104,9 @@ fn layout_in_flow_non_replaced_block_level_same_formatting_context(
|
|||
pbm.border.to_physical(containing_block_writing_mode),
|
||||
margin.to_physical(containing_block_writing_mode),
|
||||
clearance,
|
||||
block_margins_collapsed_with_children,
|
||||
)
|
||||
.with_baselines(flow_layout.baselines)
|
||||
.with_block_margins_collapsed_with_children(block_margins_collapsed_with_children)
|
||||
}
|
||||
|
||||
impl IndependentNonReplacedContents {
|
||||
|
@ -1211,10 +1210,10 @@ impl IndependentNonReplacedContents {
|
|||
pbm.border.to_physical(containing_block_writing_mode),
|
||||
margin.to_physical(containing_block_writing_mode),
|
||||
None, /* clearance */
|
||||
block_margins_collapsed_with_children,
|
||||
)
|
||||
.with_baselines(layout.baselines)
|
||||
.with_specific_layout_info(layout.specific_layout_info)
|
||||
.with_block_margins_collapsed_with_children(block_margins_collapsed_with_children)
|
||||
}
|
||||
|
||||
/// Lay out a normal in flow non-replaced block that establishes an independent
|
||||
|
@ -1516,10 +1515,10 @@ impl IndependentNonReplacedContents {
|
|||
pbm.border.to_physical(containing_block_writing_mode),
|
||||
margin.to_physical(containing_block_writing_mode),
|
||||
clearance,
|
||||
CollapsedBlockMargins::from_margin(&margin),
|
||||
)
|
||||
.with_baselines(layout.baselines)
|
||||
.with_specific_layout_info(layout.specific_layout_info)
|
||||
.with_block_margins_collapsed_with_children(CollapsedBlockMargins::from_margin(&margin))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1653,8 +1652,8 @@ impl ReplacedContents {
|
|||
pbm.border.to_physical(containing_block_writing_mode),
|
||||
margin.to_physical(containing_block_writing_mode),
|
||||
clearance,
|
||||
CollapsedBlockMargins::from_margin(&margin),
|
||||
)
|
||||
.with_block_margins_collapsed_with_children(CollapsedBlockMargins::from_margin(&margin))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2038,7 +2037,7 @@ impl<'container> PlacementState<'container> {
|
|||
return;
|
||||
}
|
||||
|
||||
let fragment_block_margins = &fragment.block_margins_collapsed_with_children;
|
||||
let fragment_block_margins = fragment.block_margins_collapsed_with_children();
|
||||
let mut fragment_block_size = fragment
|
||||
.border_rect()
|
||||
.size
|
||||
|
@ -2352,7 +2351,6 @@ impl IndependentFormattingContext {
|
|||
// so there's no need to store it explicitly in the fragment.
|
||||
// And atomic inlines don't have clearance.
|
||||
None, /* clearance */
|
||||
CollapsedBlockMargins::zero(),
|
||||
);
|
||||
|
||||
IndependentFloatOrAtomicLayoutResult {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue