#include "ui/views/layout/box_layout.h"
#include <algorithm>
#include <numeric>
#include <string>
#include <vector>
#include "base/containers/adapters.h"
#include "base/ranges/algorithm.h"
#include "base/strings/strcat.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/views/layout/normalized_geometry.h"
#include "ui/views/view_class_properties.h"
namespace views {
namespace {
struct BoxChildData { … };
}
struct BoxLayout::BoxLayoutData { … };
BoxLayoutFlexSpecification::BoxLayoutFlexSpecification() = default;
BoxLayoutFlexSpecification BoxLayoutFlexSpecification::WithWeight(
int weight) const { … }
BoxLayoutFlexSpecification BoxLayoutFlexSpecification::UseMinSize(
bool use_min_size) const { … }
BoxLayoutFlexSpecification::~BoxLayoutFlexSpecification() = default;
BoxLayout::BoxLayout(BoxLayout::Orientation orientation,
const gfx::Insets& inside_border_insets,
int between_child_spacing,
bool collapse_margins_spacing)
: … { … }
BoxLayout::~BoxLayout() = default;
void BoxLayout::SetOrientation(Orientation orientation) { … }
BoxLayout::Orientation BoxLayout::GetOrientation() const { … }
void BoxLayout::set_main_axis_alignment(MainAxisAlignment main_axis_alignment) { … }
void BoxLayout::set_cross_axis_alignment(
CrossAxisAlignment cross_axis_alignment) { … }
void BoxLayout::set_inside_border_insets(const gfx::Insets& insets) { … }
void BoxLayout::SetCollapseMarginsSpacing(bool collapse_margins_spacing) { … }
bool BoxLayout::GetCollapseMarginsSpacing() const { … }
void BoxLayout::SetFlexForView(const View* view,
int flex_weight,
bool use_min_size) { … }
void BoxLayout::ClearFlexForView(const View* view) { … }
void BoxLayout::SetDefaultFlex(int default_flex) { … }
int BoxLayout::GetDefaultFlex() const { … }
ProposedLayout BoxLayout::CalculateProposedLayout(
const SizeBounds& size_bounds) const { … }
int BoxLayout::GetFlexForView(const View* view) const { … }
int BoxLayout::GetMinimumSizeForView(const View* view) const { … }
gfx::Size BoxLayout::GetPreferredSizeForView(
const View* view,
const NormalizedSizeBounds& size_bounds) const { … }
void BoxLayout::EnsureCrossSize(BoxLayoutData& data) const { … }
void BoxLayout::InitializeChildData(BoxLayoutData& data) const { … }
SizeBound BoxLayout::CalculateMaxChildWidth(BoxLayoutData& data) const { … }
void BoxLayout::CalculatePreferredSize(const SizeBounds& bounds,
BoxLayoutData& data) const { … }
void BoxLayout::UpdateChildMarginsIfCollapseMarginsSpacing(
BoxLayoutData& data) const { … }
void BoxLayout::CalculatePreferredTotalSize(BoxLayoutData& data) const { … }
void BoxLayout::UpdateFlexLayout(const NormalizedSizeBounds& bounds,
BoxLayoutData& data) const { … }
int BoxLayout::GetActualMainSizeAndUpdateChildPreferredSizeIfNeeded(
const NormalizedSizeBounds& bounds,
BoxLayoutData& data,
size_t index,
int current_padding,
SizeBound cross_axis_size) const { … }
void BoxLayout::CalculateChildBounds(const SizeBounds& size_bounds,
BoxLayoutData& data) const { … }
}