mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:47:35 +00:00
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:
parent
97f53de8a2
commit
3ede8dbffb
5 changed files with 16 additions and 15 deletions
|
@ -368,7 +368,7 @@ void BlockFormattingContext::layout_inline_children(BlockContainer const& block_
|
||||||
|
|
||||||
auto& block_container_state = m_state.get_mutable(block_container);
|
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)
|
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));
|
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)
|
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();
|
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)
|
if (block_container.computed_values().width().is_auto() || block_container_state.width_constraint != SizeConstraint::None)
|
||||||
block_container_state.set_content_width(max_line_width);
|
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();
|
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);
|
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())
|
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));
|
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)
|
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;
|
float content_height = 0;
|
||||||
|
|
||||||
if (layout_mode == LayoutMode::IntrinsicSizeDetermination) {
|
if (layout_mode == LayoutMode::IntrinsicSizing) {
|
||||||
auto& block_container_state = m_state.get_mutable(block_container);
|
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)
|
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));
|
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;
|
return IterationDecision::Continue;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (layout_mode == LayoutMode::IntrinsicSizeDetermination) {
|
if (layout_mode == LayoutMode::IntrinsicSizing) {
|
||||||
auto& block_container_state = m_state.get_mutable(block_container);
|
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)
|
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));
|
block_container_state.set_content_width(greatest_child_width(block_container));
|
||||||
|
|
|
@ -22,7 +22,7 @@ public:
|
||||||
~BlockFormattingContext();
|
~BlockFormattingContext();
|
||||||
|
|
||||||
virtual void run(Box const&, LayoutMode) override;
|
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;
|
bool is_initial() const;
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ FormattingContext::FormattingContext(Type type, LayoutState& state, Box const& c
|
||||||
|
|
||||||
FormattingContext::~FormattingContext() = default;
|
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);
|
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())
|
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));
|
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)
|
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);
|
auto context = const_cast<FormattingContext*>(this)->create_independent_formatting_context_if_needed(throwaway_state, box);
|
||||||
VERIFY(context);
|
VERIFY(context);
|
||||||
context->run_intrinsic_size_determination(box);
|
context->run_intrinsic_sizing(box);
|
||||||
if (context->type() == FormattingContext::Type::Flex) {
|
if (context->type() == FormattingContext::Type::Flex) {
|
||||||
cache.min_content_width = box_state.content_width();
|
cache.min_content_width = box_state.content_width();
|
||||||
} else {
|
} 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);
|
auto context = const_cast<FormattingContext*>(this)->create_independent_formatting_context_if_needed(throwaway_state, box);
|
||||||
VERIFY(context);
|
VERIFY(context);
|
||||||
context->run_intrinsic_size_determination(box);
|
context->run_intrinsic_sizing(box);
|
||||||
if (context->type() == FormattingContext::Type::Flex) {
|
if (context->type() == FormattingContext::Type::Flex) {
|
||||||
cache.max_content_width = box_state.content_width();
|
cache.max_content_width = box_state.content_width();
|
||||||
} else {
|
} 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);
|
auto context = const_cast<FormattingContext*>(this)->create_independent_formatting_context_if_needed(throwaway_state, box);
|
||||||
VERIFY(context);
|
VERIFY(context);
|
||||||
context->run_intrinsic_size_determination(box);
|
context->run_intrinsic_sizing(box);
|
||||||
if (context->type() == FormattingContext::Type::Flex) {
|
if (context->type() == FormattingContext::Type::Flex) {
|
||||||
cache.min_content_height = box_state.content_height();
|
cache.min_content_height = box_state.content_height();
|
||||||
} else {
|
} 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);
|
auto context = const_cast<FormattingContext*>(this)->create_independent_formatting_context_if_needed(throwaway_state, box);
|
||||||
VERIFY(context);
|
VERIFY(context);
|
||||||
context->run_intrinsic_size_determination(box);
|
context->run_intrinsic_sizing(box);
|
||||||
if (context->type() == FormattingContext::Type::Flex) {
|
if (context->type() == FormattingContext::Type::Flex) {
|
||||||
cache.max_content_height = box_state.content_height();
|
cache.max_content_height = box_state.content_height();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -61,7 +61,7 @@ public:
|
||||||
static float containing_block_width_for(Box const&, LayoutState const&);
|
static float containing_block_width_for(Box const&, LayoutState const&);
|
||||||
static float containing_block_height_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:
|
protected:
|
||||||
FormattingContext(Type, LayoutState&, Box const&, FormattingContext* parent = nullptr);
|
FormattingContext(Type, LayoutState&, Box const&, FormattingContext* parent = nullptr);
|
||||||
|
|
|
@ -27,7 +27,8 @@ enum class LayoutMode {
|
||||||
// Intrinsic size determination.
|
// Intrinsic size determination.
|
||||||
// Boxes honor min-content and max-content constraints (set via LayoutState::UsedValues::{width,height}_constraint)
|
// 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.
|
// 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> {
|
class Node : public TreeNode<Node> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue