Trait layout_2013::block::ISizeAndMarginsComputer

source ·
pub trait ISizeAndMarginsComputer {
    // Required method
    fn solve_inline_size_constraints(
        &self,
        block: &mut BlockFlow,
        input: &ISizeConstraintInput,
    ) -> ISizeConstraintSolution;

    // Provided methods
    fn compute_border_and_padding(
        &self,
        block: &mut BlockFlow,
        containing_block_inline_size: Au,
    ) { ... }
    fn compute_inline_size_constraint_inputs(
        &self,
        block: &mut BlockFlow,
        parent_flow_inline_size: Au,
        shared_context: &SharedStyleContext<'_>,
    ) -> ISizeConstraintInput { ... }
    fn set_inline_size_constraint_solutions(
        &self,
        block: &mut BlockFlow,
        solution: ISizeConstraintSolution,
    ) { ... }
    fn set_inline_position_of_flow_if_necessary(
        &self,
        _: &mut BlockFlow,
        _: ISizeConstraintSolution,
    ) { ... }
    fn initial_computed_inline_size(
        &self,
        block: &mut BlockFlow,
        parent_flow_inline_size: Au,
        shared_context: &SharedStyleContext<'_>,
    ) -> MaybeAuto { ... }
    fn containing_block_inline_size(
        &self,
        _: &mut BlockFlow,
        parent_flow_inline_size: Au,
        _: &SharedStyleContext<'_>,
    ) -> Au { ... }
    fn compute_used_inline_size(
        &self,
        block: &mut BlockFlow,
        shared_context: &SharedStyleContext<'_>,
        parent_flow_inline_size: Au,
    ) { ... }
    fn solve_block_inline_size_constraints(
        &self,
        block: &mut BlockFlow,
        input: &ISizeConstraintInput,
    ) -> ISizeConstraintSolution { ... }
}

Required Methods§

source

fn solve_inline_size_constraints( &self, block: &mut BlockFlow, input: &ISizeConstraintInput, ) -> ISizeConstraintSolution

Solve the inline-size and margins constraints for this block flow.

Provided Methods§

source

fn compute_border_and_padding( &self, block: &mut BlockFlow, containing_block_inline_size: Au, )

Instructs the fragment to compute its border and padding.

source

fn compute_inline_size_constraint_inputs( &self, block: &mut BlockFlow, parent_flow_inline_size: Au, shared_context: &SharedStyleContext<'_>, ) -> ISizeConstraintInput

Compute the inputs for the ISize constraint equation.

This is called only once to compute the initial inputs. For calculations involving minimum and maximum inline-size, we don’t need to recompute these.

source

fn set_inline_size_constraint_solutions( &self, block: &mut BlockFlow, solution: ISizeConstraintSolution, )

Set the used values for inline-size and margins from the relevant constraint equation. This is called only once.

Set:

  • Used values for content inline-size, inline-start margin, and inline-end margin for this flow’s box;
  • Inline-start coordinate of this flow’s box;
  • Inline-start coordinate of the flow with respect to its containing block (if this is an absolute flow).
source

fn set_inline_position_of_flow_if_necessary( &self, _: &mut BlockFlow, _: ISizeConstraintSolution, )

Set the inline coordinate of the given flow if it is absolutely positioned.

source

fn initial_computed_inline_size( &self, block: &mut BlockFlow, parent_flow_inline_size: Au, shared_context: &SharedStyleContext<'_>, ) -> MaybeAuto

source

fn containing_block_inline_size( &self, _: &mut BlockFlow, parent_flow_inline_size: Au, _: &SharedStyleContext<'_>, ) -> Au

source

fn compute_used_inline_size( &self, block: &mut BlockFlow, shared_context: &SharedStyleContext<'_>, parent_flow_inline_size: Au, )

Compute the used value of inline-size, taking care of min-inline-size and max-inline-size.

CSS Section 10.4: Minimum and Maximum inline-sizes

source

fn solve_block_inline_size_constraints( &self, block: &mut BlockFlow, input: &ISizeConstraintInput, ) -> ISizeConstraintSolution

Computes inline-start and inline-end margins and inline-size.

This is used by both replaced and non-replaced Blocks.

CSS 2.1 Section 10.3.3. Constraint Equation: margin-inline-start + margin-inline-end + inline-size = available_inline-size where available_inline-size = CB inline-size - (horizontal border + padding)

Implementors§