#include "third_party/blink/renderer/core/layout/table/table_layout_algorithm.h"
#include "third_party/blink/renderer/core/layout/block_break_token.h"
#include "third_party/blink/renderer/core/layout/constraint_space_builder.h"
#include "third_party/blink/renderer/core/layout/disable_layout_side_effects_scope.h"
#include "third_party/blink/renderer/core/layout/fragmentation_utils.h"
#include "third_party/blink/renderer/core/layout/geometry/writing_mode_converter.h"
#include "third_party/blink/renderer/core/layout/layout_result.h"
#include "third_party/blink/renderer/core/layout/length_utils.h"
#include "third_party/blink/renderer/core/layout/logical_box_fragment.h"
#include "third_party/blink/renderer/core/layout/mathml/math_layout_utils.h"
#include "third_party/blink/renderer/core/layout/physical_box_fragment.h"
#include "third_party/blink/renderer/core/layout/space_utils.h"
#include "third_party/blink/renderer/core/layout/table/layout_table.h"
#include "third_party/blink/renderer/core/layout/table/layout_table_caption.h"
#include "third_party/blink/renderer/core/layout/table/layout_table_cell.h"
#include "third_party/blink/renderer/core/layout/table/layout_table_column.h"
#include "third_party/blink/renderer/core/layout/table/layout_table_column_visitor.h"
#include "third_party/blink/renderer/core/layout/table/layout_table_section.h"
#include "third_party/blink/renderer/core/layout/table/table_borders.h"
#include "third_party/blink/renderer/core/layout/table/table_break_token_data.h"
#include "third_party/blink/renderer/core/layout/table/table_child_iterator.h"
#include "third_party/blink/renderer/core/layout/table/table_constraint_space_data.h"
#include "third_party/blink/renderer/core/layout/table/table_fragment_data.h"
#include "third_party/blink/renderer/core/layout/table/table_layout_utils.h"
#include "third_party/blink/renderer/core/layout/table/table_node.h"
#include "third_party/blink/renderer/core/layout/text_autosizer.h"
#include "third_party/blink/renderer/core/mathml/mathml_element.h"
#include "third_party/blink/renderer/core/mathml_names.h"
namespace blink {
namespace {
TableTypes::Caption ComputeCaptionConstraint(
const ConstraintSpace& table_space,
const ComputedStyle& table_style,
const TableGroupedChildren& grouped_children) { … }
ConstraintSpace CreateCaptionConstraintSpace(
const ConstraintSpace& table_constraint_space,
const ComputedStyle& table_style,
const BlockNode& caption,
LogicalSize available_size,
std::optional<LayoutUnit> block_offset = std::nullopt) { … }
TableLayoutAlgorithm::CaptionResult LayoutCaption(
const ConstraintSpace& table_constraint_space,
const ComputedStyle& table_style,
LayoutUnit table_inline_size,
const ConstraintSpace& caption_constraint_space,
const BlockNode& caption,
BoxStrut margins,
const BlockBreakToken* break_token = nullptr,
const EarlyBreak* early_break = nullptr) { … }
BoxStrut ComputeCaptionMargins(
const ConstraintSpace& table_constraint_space,
const BlockNode& caption,
LayoutUnit table_border_box_inline_size,
const BlockBreakToken* caption_break_token = nullptr) { … }
void ComputeCaptionFragments(
const BoxFragmentBuilder& table_builder,
const ComputedStyle& table_style,
const TableGroupedChildren& grouped_children,
HeapVector<TableLayoutAlgorithm::CaptionResult>* captions,
LayoutUnit& captions_block_size) { … }
LayoutUnit ComputeUndistributableTableSpace(
const TableTypes::Columns& column_constraints,
LayoutUnit inline_table_border_padding,
LayoutUnit inline_border_spacing) { … }
LayoutUnit ComputeEmptyTableInlineSize(
const ConstraintSpace& space,
const ComputedStyle& table_style,
const LayoutUnit assignable_table_inline_size,
const LayoutUnit undistributable_space,
const TableTypes::Caption& caption_constraint,
const BoxStrut& table_border_padding,
const bool has_collapsed_borders) { … }
LayoutUnit ComputeAssignableTableInlineSize(
const TableNode& table,
const ConstraintSpace& space,
const TableTypes::Columns& column_constraints,
const TableTypes::Caption& caption_constraint,
const LayoutUnit undistributable_space,
const BoxStrut& table_border_padding,
const bool is_fixed_layout) { … }
void ComputeLocationsFromColumns(const TableTypes::Columns& column_constraints,
const Vector<LayoutUnit>& column_sizes,
LayoutUnit inline_border_spacing,
bool shrink_collapsed,
Vector<TableColumnLocation>* column_locations,
bool* has_collapsed_columns) { … }
scoped_refptr<const TableConstraintSpaceData> CreateConstraintSpaceData(
const ComputedStyle& style,
const Vector<TableColumnLocation>& column_locations,
const TableTypes::Sections& sections,
const TableTypes::Rows& rows,
const TableTypes::CellBlockConstraints& cell_block_constraints,
const LogicalSize& border_spacing) { … }
class ColumnGeometriesBuilder { … };
LayoutUnit ComputeTableSizeFromColumns(
const Vector<TableColumnLocation>& column_locations,
const BoxStrut& table_border_padding,
const LogicalSize& border_spacing) { … }
struct TableBoxExtent { … };
TableBoxExtent BeginTableBoxLayout(
LayoutUnit block_start_border_edge,
LayoutUnit table_border_padding_block_start) { … }
LayoutUnit EndTableBoxLayout(LayoutUnit table_border_padding_block_end,
LayoutUnit border_spacing_after_last_section,
LayoutUnit minimal_table_grid_block_size,
TableBoxExtent* extent,
LayoutUnit* grid_block_size_inflation) { … }
}
LayoutUnit TableLayoutAlgorithm::ComputeTableInlineSize(
const TableNode& table,
const ConstraintSpace& space,
const BoxStrut& table_border_padding) { … }
LayoutUnit TableLayoutAlgorithm::ComputeCaptionBlockSize() { … }
const LayoutResult* TableLayoutAlgorithm::Layout() { … }
MinMaxSizesResult TableLayoutAlgorithm::ComputeMinMaxSizes(
const MinMaxSizesFloatInput&) { … }
const LayoutResult* TableLayoutAlgorithm::RelayoutAsLastTableBox() { … }
void TableLayoutAlgorithm::ComputeRows(
const LayoutUnit table_grid_inline_size,
const TableGroupedChildren& grouped_children,
const Vector<TableColumnLocation>& column_locations,
const TableBorders& table_borders,
const LogicalSize& border_spacing,
const BoxStrut& table_border_padding,
const LayoutUnit captions_block_size,
TableTypes::Rows* rows,
TableTypes::CellBlockConstraints* cell_block_constraints,
TableTypes::Sections* sections,
LayoutUnit* minimal_table_grid_block_size) { … }
void TableLayoutAlgorithm::ComputeTableSpecificFragmentData(
const TableGroupedChildren& grouped_children,
const Vector<TableColumnLocation>& column_locations,
const TableTypes::Rows& rows,
const TableBorders& table_borders,
const LogicalRect& table_grid_rect,
const LayoutUnit table_grid_block_size) { … }
const LayoutResult* TableLayoutAlgorithm::GenerateFragment(
const LayoutUnit table_inline_size,
LayoutUnit minimal_table_grid_block_size,
const TableGroupedChildren& grouped_children,
const Vector<TableColumnLocation>& column_locations,
const TableTypes::Rows& rows,
const TableTypes::CellBlockConstraints& cell_block_constraints,
const TableTypes::Sections& sections,
const HeapVector<CaptionResult>& captions,
const TableBorders& table_borders,
const LogicalSize& border_spacing) { … }
}