mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
layout: Have current_block_direction_position
in PlacementState
use Au
(#31948)
This commit is contained in:
parent
007a72fe4d
commit
96c9a2a8bb
2 changed files with 14 additions and 13 deletions
|
@ -1516,7 +1516,7 @@ struct PlacementState {
|
||||||
last_in_flow_margin_collapses_with_parent_end_margin: bool,
|
last_in_flow_margin_collapses_with_parent_end_margin: bool,
|
||||||
start_margin: CollapsedMargin,
|
start_margin: CollapsedMargin,
|
||||||
current_margin: CollapsedMargin,
|
current_margin: CollapsedMargin,
|
||||||
current_block_direction_position: Length,
|
current_block_direction_position: Au,
|
||||||
inflow_baselines: Baselines,
|
inflow_baselines: Baselines,
|
||||||
is_inline_block_context: bool,
|
is_inline_block_context: bool,
|
||||||
}
|
}
|
||||||
|
@ -1534,7 +1534,7 @@ impl PlacementState {
|
||||||
last_in_flow_margin_collapses_with_parent_end_margin: true,
|
last_in_flow_margin_collapses_with_parent_end_margin: true,
|
||||||
start_margin: CollapsedMargin::zero(),
|
start_margin: CollapsedMargin::zero(),
|
||||||
current_margin: CollapsedMargin::zero(),
|
current_margin: CollapsedMargin::zero(),
|
||||||
current_block_direction_position: Length::zero(),
|
current_block_direction_position: Au::zero(),
|
||||||
inflow_baselines: Baselines::default(),
|
inflow_baselines: Baselines::default(),
|
||||||
is_inline_block_context,
|
is_inline_block_context,
|
||||||
}
|
}
|
||||||
|
@ -1595,7 +1595,7 @@ impl PlacementState {
|
||||||
// Setting `next_in_flow_margin_collapses_with_parent_start_margin` to false
|
// Setting `next_in_flow_margin_collapses_with_parent_start_margin` to false
|
||||||
// prevents collapsing with the start margin of the parent, and will set
|
// prevents collapsing with the start margin of the parent, and will set
|
||||||
// `collapsed_through` to false, preventing the parent from collapsing through.
|
// `collapsed_through` to false, preventing the parent from collapsing through.
|
||||||
self.current_block_direction_position += self.current_margin.solve().into();
|
self.current_block_direction_position += self.current_margin.solve();
|
||||||
self.current_margin = CollapsedMargin::zero();
|
self.current_margin = CollapsedMargin::zero();
|
||||||
self.next_in_flow_margin_collapses_with_parent_start_margin = false;
|
self.next_in_flow_margin_collapses_with_parent_start_margin = false;
|
||||||
if fragment_block_margins.collapsed_through {
|
if fragment_block_margins.collapsed_through {
|
||||||
|
@ -1619,25 +1619,24 @@ impl PlacementState {
|
||||||
.adjoin_assign(&fragment_block_margins.start);
|
.adjoin_assign(&fragment_block_margins.start);
|
||||||
}
|
}
|
||||||
fragment.content_rect.start_corner.block +=
|
fragment.content_rect.start_corner.block +=
|
||||||
Length::from(self.current_margin.solve()) +
|
(self.current_margin.solve() + self.current_block_direction_position).into();
|
||||||
self.current_block_direction_position;
|
|
||||||
|
|
||||||
if fragment_block_margins.collapsed_through {
|
if fragment_block_margins.collapsed_through {
|
||||||
// `fragment_block_size` is typically zero when collapsing through,
|
// `fragment_block_size` is typically zero when collapsing through,
|
||||||
// but we still need to consider it in case there is clearance.
|
// but we still need to consider it in case there is clearance.
|
||||||
self.current_block_direction_position += fragment_block_size.into();
|
self.current_block_direction_position += fragment_block_size;
|
||||||
self.current_margin
|
self.current_margin
|
||||||
.adjoin_assign(&fragment_block_margins.end);
|
.adjoin_assign(&fragment_block_margins.end);
|
||||||
} else {
|
} else {
|
||||||
self.current_block_direction_position +=
|
self.current_block_direction_position +=
|
||||||
Length::from(self.current_margin.solve()) + fragment_block_size.into();
|
self.current_margin.solve() + fragment_block_size;
|
||||||
self.current_margin = fragment_block_margins.end;
|
self.current_margin = fragment_block_margins.end;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Fragment::AbsoluteOrFixedPositioned(fragment) => {
|
Fragment::AbsoluteOrFixedPositioned(fragment) => {
|
||||||
let offset = LogicalVec2 {
|
let offset = LogicalVec2 {
|
||||||
block: Length::from(self.current_margin.solve()) +
|
block: (self.current_margin.solve() + self.current_block_direction_position)
|
||||||
self.current_block_direction_position,
|
.into(),
|
||||||
inline: Length::new(0.),
|
inline: Length::new(0.),
|
||||||
};
|
};
|
||||||
fragment.borrow_mut().adjust_offsets(offset);
|
fragment.borrow_mut().adjust_offsets(offset);
|
||||||
|
@ -1646,11 +1645,11 @@ impl PlacementState {
|
||||||
let sequential_layout_state = sequential_layout_state
|
let sequential_layout_state = sequential_layout_state
|
||||||
.expect("Found float fragment without SequentialLayoutState");
|
.expect("Found float fragment without SequentialLayoutState");
|
||||||
let block_offset_from_containing_block_top =
|
let block_offset_from_containing_block_top =
|
||||||
self.current_block_direction_position + self.current_margin.solve().into();
|
self.current_block_direction_position + self.current_margin.solve();
|
||||||
sequential_layout_state.place_float_fragment(
|
sequential_layout_state.place_float_fragment(
|
||||||
box_fragment,
|
box_fragment,
|
||||||
self.start_margin,
|
self.start_margin,
|
||||||
block_offset_from_containing_block_top.into(),
|
block_offset_from_containing_block_top,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
Fragment::Positioning(_) => {},
|
Fragment::Positioning(_) => {},
|
||||||
|
@ -1660,11 +1659,11 @@ impl PlacementState {
|
||||||
|
|
||||||
fn finish(mut self) -> (Length, CollapsedBlockMargins, Baselines) {
|
fn finish(mut self) -> (Length, CollapsedBlockMargins, Baselines) {
|
||||||
if !self.last_in_flow_margin_collapses_with_parent_end_margin {
|
if !self.last_in_flow_margin_collapses_with_parent_end_margin {
|
||||||
self.current_block_direction_position += self.current_margin.solve().into();
|
self.current_block_direction_position += self.current_margin.solve();
|
||||||
self.current_margin = CollapsedMargin::zero();
|
self.current_margin = CollapsedMargin::zero();
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
self.current_block_direction_position,
|
self.current_block_direction_position.into(),
|
||||||
CollapsedBlockMargins {
|
CollapsedBlockMargins {
|
||||||
collapsed_through: self.next_in_flow_margin_collapses_with_parent_start_margin,
|
collapsed_through: self.next_in_flow_margin_collapses_with_parent_start_margin,
|
||||||
start: self.start_margin,
|
start: self.start_margin,
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
[flexbox-align-self-baseline-horiz-004.xhtml]
|
||||||
|
expected: FAIL
|
Loading…
Add table
Add a link
Reference in a new issue