#include "third_party/blink/renderer/core/layout/absolute_utils.h"
#include <algorithm>
#include "third_party/blink/renderer/core/layout/block_node.h"
#include "third_party/blink/renderer/core/layout/box_fragment_builder.h"
#include "third_party/blink/renderer/core/layout/constraint_space.h"
#include "third_party/blink/renderer/core/layout/constraint_space_builder.h"
#include "third_party/blink/renderer/core/layout/fragmentation_utils.h"
#include "third_party/blink/renderer/core/layout/geometry/static_position.h"
#include "third_party/blink/renderer/core/layout/length_utils.h"
#include "third_party/blink/renderer/core/style/computed_style.h"
#include "third_party/blink/renderer/platform/geometry/length_functions.h"
namespace blink {
namespace {
InsetBias;
inline InsetBias GetStaticPositionInsetBias(
LogicalStaticPosition::InlineEdge inline_edge) { … }
inline InsetBias GetStaticPositionInsetBias(
LogicalStaticPosition::BlockEdge block_edge) { … }
InsetBias GetAlignmentInsetBias(
const StyleSelfAlignmentData& alignment,
WritingDirectionMode container_writing_direction,
WritingDirectionMode self_writing_direction,
bool is_justify_axis,
std::optional<InsetBias>* out_safe_inset_bias) { … }
void ResizeIMCBInOneAxis(const InsetBias inset_bias,
const LayoutUnit amount,
LayoutUnit* inset_start,
LayoutUnit* inset_end) { … }
void ResizeIMCBForCenterOffset(const LayoutUnit available_size,
const LayoutUnit offset,
LayoutUnit* inset_start,
LayoutUnit* inset_end) { … }
void ComputeUnclampedIMCBInOneAxis(
const LayoutUnit available_size,
const std::optional<LayoutUnit>& inset_start,
const std::optional<LayoutUnit>& inset_end,
const LayoutUnit static_position_offset,
InsetBias static_position_inset_bias,
InsetBias alignment_inset_bias,
const std::optional<InsetBias>& safe_alignment_inset_bias,
LayoutUnit* imcb_start_out,
LayoutUnit* imcb_end_out,
InsetBias* imcb_inset_bias_out,
std::optional<InsetBias>* imcb_safe_inset_bias_out) { … }
InsetModifiedContainingBlock ComputeUnclampedIMCB(
const LogicalSize& available_size,
const LogicalAlignment& alignment,
const LogicalOofInsets& insets,
const LogicalStaticPosition& static_position,
const ComputedStyle& style,
WritingDirectionMode container_writing_direction,
WritingDirectionMode self_writing_direction) { … }
void ComputeMargins(LogicalSize margin_percentage_resolution_size,
const LayoutUnit imcb_size,
const Length& margin_start_length,
const Length& margin_end_length,
const LayoutUnit size,
bool has_auto_inset,
bool is_start_dominant,
bool is_block_direction,
LayoutUnit* margin_start_out,
LayoutUnit* margin_end_out) { … }
void ComputeInsets(const LayoutUnit available_size,
LayoutUnit imcb_start,
LayoutUnit imcb_end,
const InsetBias imcb_inset_bias,
const std::optional<InsetBias>& imcb_safe_inset_bias,
const LayoutUnit margin_start,
const LayoutUnit margin_end,
const LayoutUnit size,
LayoutUnit* inset_start_out,
LayoutUnit* inset_end_out) { … }
bool CanComputeBlockSizeWithoutLayout(
const BlockNode& node,
WritingDirectionMode container_writing_direction,
ItemPosition block_alignment_position,
bool has_auto_block_inset,
bool has_inline_size) { … }
}
LogicalOofInsets ComputeOutOfFlowInsets(
const ComputedStyle& style,
const LogicalSize& available_logical_size,
const LogicalAlignment& alignment,
WritingDirectionMode self_writing_direction) { … }
LogicalAlignment ComputeAlignment(
const ComputedStyle& style,
WritingDirectionMode container_writing_direction,
WritingDirectionMode self_writing_direction) { … }
LogicalAnchorCenterPosition ComputeAnchorCenterPosition(
const ComputedStyle& style,
const LogicalAlignment& alignment,
WritingDirectionMode writing_direction,
LogicalSize available_logical_size) { … }
InsetModifiedContainingBlock ComputeInsetModifiedContainingBlock(
const BlockNode& node,
const LogicalSize& available_size,
const LogicalAlignment& alignment,
const LogicalOofInsets& insets,
const LogicalStaticPosition& static_position,
const LogicalAnchorCenterPosition& anchor_center_position,
WritingDirectionMode container_writing_direction,
WritingDirectionMode self_writing_direction) { … }
InsetModifiedContainingBlock ComputeIMCBForPositionFallback(
const LogicalSize& available_size,
const LogicalAlignment& alignment,
const LogicalOofInsets& insets,
const LogicalStaticPosition& static_position,
const ComputedStyle& style,
WritingDirectionMode container_writing_direction,
WritingDirectionMode self_writing_direction) { … }
bool ComputeOofInlineDimensions(
const BlockNode& node,
const ComputedStyle& style,
const ConstraintSpace& space,
const InsetModifiedContainingBlock& imcb,
const LogicalAlignment& alignment,
const BoxStrut& border_padding,
const std::optional<LogicalSize>& replaced_size,
WritingDirectionMode container_writing_direction,
LogicalOofDimensions* dimensions) { … }
const LayoutResult* ComputeOofBlockDimensions(
const BlockNode& node,
const ComputedStyle& style,
const ConstraintSpace& space,
const InsetModifiedContainingBlock& imcb,
const LogicalAlignment& alignment,
const BoxStrut& border_padding,
const std::optional<LogicalSize>& replaced_size,
WritingDirectionMode container_writing_direction,
LogicalOofDimensions* dimensions) { … }
}