#include "ui/views/layout/table_layout.h"
#include <algorithm>
#include <functional>
#include <memory>
#include <numeric>
#include <optional>
#include <utility>
#include "base/check_op.h"
#include "base/containers/span.h"
#include "base/memory/raw_ptr.h"
#include "base/notreached.h"
#include "base/numerics/safe_conversions.h"
#include "base/ranges/algorithm.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/views/layout/layout_types.h"
#include "ui/views/view.h"
#include "ui/views/view_class_properties.h"
namespace views {
namespace {
class LayoutElement { … };
template <class T>
void ResetSizes(std::vector<T>& elements) { … }
template <class T>
void DistributeDelta(int delta, std::vector<T>& elements) { … }
template <class T>
int TotalSize(size_t start, size_t length, const std::vector<T>& elements) { … }
template <class T>
void SkipPadding(size_t& index, const std::vector<T>& elements) { … }
void CalculateLocationAndSize(int pref_size,
LayoutAlignment alignment,
int* location,
int* size) { … }
}
constexpr float TableLayout::kFixedSize;
class TableLayout::Column : public LayoutElement { … };
class TableLayout::Row : public LayoutElement { … };
struct TableLayout::ViewState { … };
TableLayout::TableLayout() = default;
TableLayout::~TableLayout() = default;
TableLayout& TableLayout::AddColumn(LayoutAlignment h_align,
LayoutAlignment v_align,
float horizontal_resize,
ColumnSize size_type,
int fixed_width,
int min_width) { … }
TableLayout& TableLayout::AddPaddingColumn(float horizontal_resize, int width) { … }
TableLayout& TableLayout::AddRows(size_t n, float vertical_resize, int height) { … }
TableLayout& TableLayout::AddPaddingRow(float vertical_resize, int height) { … }
TableLayout& TableLayout::LinkColumnSizes(std::vector<size_t> columns) { … }
TableLayout& TableLayout::SetLinkedColumnSizeLimit(int size_limit) { … }
TableLayout& TableLayout::SetMinimumSize(const gfx::Size& size) { … }
ProposedLayout TableLayout::CalculateProposedLayout(
const SizeBounds& size_bounds) const { … }
void TableLayout::SetViewStates() const { … }
gfx::Size TableLayout::SizeRowsAndColumns(const SizeBounds& bounds) const { … }
void TableLayout::DistributeRemainingHeight(ViewState& view_state) const { … }
void TableLayout::UnifyLinkedColumnSizes() const { … }
void TableLayout::DistributeRemainingWidth(ViewState& view_state) const { … }
int TableLayout::LayoutWidth() const { … }
void TableLayout::CalculateSize(
SizeCalculationType type,
const std::vector<raw_ptr<ViewState, VectorExperimental>>& view_states)
const { … }
void TableLayout::Resize(int delta) const { … }
void TableLayout::ResizeUsingMin(int total_delta) const { … }
bool TableLayout::CanUseMinimum(const ViewState& view_state) const { … }
}