LibWeb: Rename IntrinsicSizeDetermination to IntrinsicSizing

This matches the exact terminology used in CSS-SIZING-3:
https://drafts.csswg.org/css-sizing-3/#intrinsic-sizing
This commit is contained in:
Andreas Kling 2022-07-20 18:12:12 +02:00
parent 97f53de8a2
commit 3ede8dbffb
5 changed files with 16 additions and 15 deletions

View file

@ -368,7 +368,7 @@ void BlockFormattingContext::layout_inline_children(BlockContainer const& block_
auto& block_container_state = m_state.get_mutable(block_container);
if (layout_mode == LayoutMode::IntrinsicSizeDetermination) {
if (layout_mode == LayoutMode::IntrinsicSizing) {
if (block_container.computed_values().width().is_auto() || block_container_state.width_constraint != SizeConstraint::None)
block_container_state.set_content_width(containing_block_width_for(block_container));
if (block_container.computed_values().height().is_auto() || block_container_state.height_constraint != SizeConstraint::None)
@ -386,7 +386,7 @@ void BlockFormattingContext::layout_inline_children(BlockContainer const& block_
content_height += line_box.height();
}
if (layout_mode == LayoutMode::IntrinsicSizeDetermination) {
if (layout_mode == LayoutMode::IntrinsicSizing) {
if (block_container.computed_values().width().is_auto() || block_container_state.width_constraint != SizeConstraint::None)
block_container_state.set_content_width(max_line_width);
}
@ -452,7 +452,7 @@ void BlockFormattingContext::layout_block_level_box(Box const& box, BlockContain
independent_formatting_context->parent_context_did_dimension_child_root_box();
}
void BlockFormattingContext::run_intrinsic_size_determination(Box const& box)
void BlockFormattingContext::run_intrinsic_sizing(Box const& box)
{
auto& box_state = m_state.get_mutable(box);
@ -462,7 +462,7 @@ void BlockFormattingContext::run_intrinsic_size_determination(Box const& box)
if (box_state.has_definite_height())
box_state.set_content_height(box.computed_values().height().resolved(box, CSS::Length::make_px(containing_block_height_for(box))).to_px(box));
run(box, LayoutMode::IntrinsicSizeDetermination);
run(box, LayoutMode::IntrinsicSizing);
}
void BlockFormattingContext::layout_block_level_children(BlockContainer const& block_container, LayoutMode layout_mode)
@ -471,7 +471,7 @@ void BlockFormattingContext::layout_block_level_children(BlockContainer const& b
float content_height = 0;
if (layout_mode == LayoutMode::IntrinsicSizeDetermination) {
if (layout_mode == LayoutMode::IntrinsicSizing) {
auto& block_container_state = m_state.get_mutable(block_container);
if (block_container.computed_values().width().is_auto() || block_container_state.width_constraint != SizeConstraint::None)
block_container_state.set_content_width(containing_block_width_for(block_container));
@ -484,7 +484,7 @@ void BlockFormattingContext::layout_block_level_children(BlockContainer const& b
return IterationDecision::Continue;
});
if (layout_mode == LayoutMode::IntrinsicSizeDetermination) {
if (layout_mode == LayoutMode::IntrinsicSizing) {
auto& block_container_state = m_state.get_mutable(block_container);
if (block_container.computed_values().width().is_auto() || block_container_state.width_constraint != SizeConstraint::None)
block_container_state.set_content_width(greatest_child_width(block_container));

View file

@ -22,7 +22,7 @@ public:
~BlockFormattingContext();
virtual void run(Box const&, LayoutMode) override;
virtual void run_intrinsic_size_determination(Box const&) override;
virtual void run_intrinsic_sizing(Box const&) override;
bool is_initial() const;

View file

@ -28,7 +28,7 @@ FormattingContext::FormattingContext(Type type, LayoutState& state, Box const& c
FormattingContext::~FormattingContext() = default;
void FormattingContext::run_intrinsic_size_determination(Box const& box)
void FormattingContext::run_intrinsic_sizing(Box const& box)
{
auto& box_state = m_state.get_mutable(box);
@ -38,7 +38,7 @@ void FormattingContext::run_intrinsic_size_determination(Box const& box)
if (box_state.has_definite_height())
box_state.set_content_height(box.computed_values().height().resolved(box, CSS::Length::make_px(containing_block_height_for(box))).to_px(box));
run(box, LayoutMode::IntrinsicSizeDetermination);
run(box, LayoutMode::IntrinsicSizing);
}
bool FormattingContext::creates_block_formatting_context(Box const& box)
@ -903,7 +903,7 @@ float FormattingContext::calculate_min_content_width(Layout::Box const& box) con
auto context = const_cast<FormattingContext*>(this)->create_independent_formatting_context_if_needed(throwaway_state, box);
VERIFY(context);
context->run_intrinsic_size_determination(box);
context->run_intrinsic_sizing(box);
if (context->type() == FormattingContext::Type::Flex) {
cache.min_content_width = box_state.content_width();
} else {
@ -945,7 +945,7 @@ float FormattingContext::calculate_max_content_width(Layout::Box const& box) con
auto context = const_cast<FormattingContext*>(this)->create_independent_formatting_context_if_needed(throwaway_state, box);
VERIFY(context);
context->run_intrinsic_size_determination(box);
context->run_intrinsic_sizing(box);
if (context->type() == FormattingContext::Type::Flex) {
cache.max_content_width = box_state.content_width();
} else {
@ -987,7 +987,7 @@ float FormattingContext::calculate_min_content_height(Layout::Box const& box) co
auto context = const_cast<FormattingContext*>(this)->create_independent_formatting_context_if_needed(throwaway_state, box);
VERIFY(context);
context->run_intrinsic_size_determination(box);
context->run_intrinsic_sizing(box);
if (context->type() == FormattingContext::Type::Flex) {
cache.min_content_height = box_state.content_height();
} else {
@ -1029,7 +1029,7 @@ float FormattingContext::calculate_max_content_height(Layout::Box const& box) co
auto context = const_cast<FormattingContext*>(this)->create_independent_formatting_context_if_needed(throwaway_state, box);
VERIFY(context);
context->run_intrinsic_size_determination(box);
context->run_intrinsic_sizing(box);
if (context->type() == FormattingContext::Type::Flex) {
cache.max_content_height = box_state.content_height();
} else {

View file

@ -61,7 +61,7 @@ public:
static float containing_block_width_for(Box const&, LayoutState const&);
static float containing_block_height_for(Box const&, LayoutState const&);
virtual void run_intrinsic_size_determination(Box const&);
virtual void run_intrinsic_sizing(Box const&);
protected:
FormattingContext(Type, LayoutState&, Box const&, FormattingContext* parent = nullptr);

View file

@ -27,7 +27,8 @@ enum class LayoutMode {
// Intrinsic size determination.
// Boxes honor min-content and max-content constraints (set via LayoutState::UsedValues::{width,height}_constraint)
// by considering their containing block to be 0-sized or infinitely large in the relevant axis.
IntrinsicSizeDetermination,
// https://drafts.csswg.org/css-sizing-3/#intrinsic-sizing
IntrinsicSizing,
};
class Node : public TreeNode<Node> {