mirror of
https://github.com/servo/servo.git
synced 2025-08-16 19:05: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,8 +23,8 @@ use crate::fragment_tree::{
|
|||
BoxFragment, CollapsedBlockMargins, Fragment, FragmentFlags, SpecificLayoutInfo,
|
||||
};
|
||||
use crate::geom::{
|
||||
LogicalSides, LogicalVec2, PhysicalPoint, PhysicalRect, PhysicalSides, PhysicalSize, Size,
|
||||
SizeConstraint, Sizes,
|
||||
LogicalVec2, PhysicalPoint, PhysicalRect, PhysicalSides, PhysicalSize, Size, SizeConstraint,
|
||||
Sizes,
|
||||
};
|
||||
use crate::layout_box_base::CacheableLayoutResult;
|
||||
use crate::positioned::{AbsolutelyPositionedBox, PositioningContext, PositioningContextLength};
|
||||
|
@ -486,15 +486,6 @@ impl TaffyContainer {
|
|||
.map(|child| (**child).borrow_mut())
|
||||
.enumerate()
|
||||
.map(|(child_id, mut child)| {
|
||||
fn rect_to_logical_sides<T>(rect: taffy::Rect<T>) -> LogicalSides<T> {
|
||||
LogicalSides {
|
||||
inline_start: rect.left,
|
||||
inline_end: rect.right,
|
||||
block_start: rect.top,
|
||||
block_end: rect.bottom,
|
||||
}
|
||||
}
|
||||
|
||||
fn rect_to_physical_sides<T>(rect: taffy::Rect<T>) -> PhysicalSides<T> {
|
||||
PhysicalSides::new(rect.top, rect.right, rect.bottom, rect.left)
|
||||
}
|
||||
|
@ -514,8 +505,6 @@ impl TaffyContainer {
|
|||
let padding = rect_to_physical_sides(layout.padding.map(Au::from_f32_px));
|
||||
let border = rect_to_physical_sides(layout.border.map(Au::from_f32_px));
|
||||
let margin = rect_to_physical_sides(layout.margin.map(Au::from_f32_px));
|
||||
let logical_margin = rect_to_logical_sides(layout.margin.map(Au::from_f32_px));
|
||||
let collapsed_margin = CollapsedBlockMargins::from_margin(&logical_margin);
|
||||
|
||||
// Compute content box size and position.
|
||||
//
|
||||
|
@ -576,7 +565,6 @@ impl TaffyContainer {
|
|||
border,
|
||||
margin,
|
||||
None, /* clearance */
|
||||
collapsed_margin,
|
||||
)
|
||||
.with_baselines(Baselines {
|
||||
first: output.first_baselines.y.map(Au::from_f32_px),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue