mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Fix the unit test
These were broken for various issues.
This commit is contained in:
parent
25f6cc04a2
commit
5c5cc4b795
2 changed files with 63 additions and 47 deletions
|
@ -40,17 +40,17 @@ pub(crate) struct FloatBox {
|
|||
/// elements relative to their containing blocks. This data structure is used to
|
||||
/// help map between these two coordinate systems.
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub(crate) struct ContainingBlockPositionInfo {
|
||||
pub struct ContainingBlockPositionInfo {
|
||||
/// The distance from the block start of the independent block formatting
|
||||
/// context that contains the floats and the block start of the current
|
||||
/// containing block, excluding uncollapsed block start margins. Note that
|
||||
/// this does not include uncollapsed block start margins because we don't
|
||||
/// know the value of collapsed margins until we lay out children.
|
||||
pub block_start: Length,
|
||||
pub(crate) block_start: Length,
|
||||
/// Any uncollapsed block start margins that we have collected between the
|
||||
/// block start of the float containing independent block formatting context
|
||||
/// and this containing block, including for this containing block.
|
||||
pub block_start_margins_not_collapsed: CollapsedMargin,
|
||||
pub(crate) block_start_margins_not_collapsed: CollapsedMargin,
|
||||
/// The distance from the inline start position of the float containing
|
||||
/// independent formatting context and the inline start of this containing
|
||||
/// block.
|
||||
|
@ -61,9 +61,9 @@ pub(crate) struct ContainingBlockPositionInfo {
|
|||
pub inline_end: Length,
|
||||
}
|
||||
|
||||
impl ContainingBlockPositionInfo {
|
||||
fn new() -> ContainingBlockPositionInfo {
|
||||
ContainingBlockPositionInfo {
|
||||
impl Default for ContainingBlockPositionInfo {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
block_start: Length::zero(),
|
||||
block_start_margins_not_collapsed: CollapsedMargin::zero(),
|
||||
inline_start: Length::zero(),
|
||||
|
@ -72,12 +72,22 @@ impl ContainingBlockPositionInfo {
|
|||
}
|
||||
}
|
||||
|
||||
impl ContainingBlockPositionInfo {
|
||||
pub fn new_with_inline_offsets(inline_start: Length, inline_end: Length) -> Self {
|
||||
Self {
|
||||
inline_start,
|
||||
inline_end,
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Data kept during layout about the floats in a given block formatting context.
|
||||
///
|
||||
/// This is a persistent data structure. Each float has its own private copy of the float context,
|
||||
/// although such copies may share portions of the `bands` tree.
|
||||
#[derive(Clone, Debug)]
|
||||
pub(crate) struct FloatContext {
|
||||
pub struct FloatContext {
|
||||
/// A persistent AA tree of float bands.
|
||||
///
|
||||
/// This tree is immutable; modification operations return the new tree, which may share nodes
|
||||
|
@ -114,7 +124,7 @@ impl FloatContext {
|
|||
FloatContext {
|
||||
bands,
|
||||
ceiling: Length::zero(),
|
||||
containing_block_info: ContainingBlockPositionInfo::new(),
|
||||
containing_block_info: Default::default(),
|
||||
clear_left_position: Length::zero(),
|
||||
clear_right_position: Length::zero(),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue