1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:57:46 +00:00

LibWeb: Remove Length::Type::Undefined! :^)

This commit is contained in:
Sam Atkins 2022-02-18 16:50:17 +00:00 committed by Andreas Kling
parent b715943035
commit 356d8bcfe8
8 changed files with 13 additions and 20 deletions

View file

@ -295,7 +295,7 @@ float BlockFormattingContext::compute_theoretical_height(Box const& box)
height = compute_height_for_replaced_element(verify_cast<ReplacedBox>(box));
} else {
if (!box.computed_values().height().has_value()
|| (box.computed_values().height()->is_length() && box.computed_values().height()->length().is_undefined_or_auto())
|| (box.computed_values().height()->is_length() && box.computed_values().height()->length().is_auto())
|| (computed_values.height().has_value() && computed_values.height()->is_percentage() && !is_absolute(containing_block.computed_values().height()))) {
height = compute_auto_height_for_block_level_element(box, ConsiderFloats::No);
} else {
@ -441,7 +441,7 @@ void BlockFormattingContext::layout_block_level_children(BlockContainer& block_c
if (layout_mode != LayoutMode::Default) {
auto& width = block_container.computed_values().width();
if (!width.has_value() || (width->is_length() && width->length().is_undefined_or_auto()))
if (!width.has_value() || (width->is_length() && width->length().is_auto()))
block_container.set_content_width(content_width);
}
}

View file

@ -29,7 +29,7 @@ static bool is_undefined_or_auto(Optional<CSS::LengthPercentage> const& length_p
{
if (!length_percentage.has_value())
return true;
return length_percentage->is_length() && length_percentage->length().is_undefined_or_auto();
return length_percentage->is_length() && length_percentage->length().is_auto();
}
FlexFormattingContext::FlexFormattingContext(Box& flex_container, FormattingContext* parent)
@ -235,11 +235,12 @@ bool FlexFormattingContext::cross_size_is_absolute_or_resolved_nicely(NodeWithSt
if (!length_percentage.has_value())
return false;
// FIXME: Handle calc here.
if (length_percentage->is_length()) {
auto& length = length_percentage->length();
if (length.is_absolute() || length.is_relative())
return true;
if (length.is_undefined_or_auto())
if (length.is_auto())
return false;
}

View file

@ -126,7 +126,7 @@ void InlineFormattingContext::dimension_box_on_line(Box& box, LayoutMode layout_
auto& inline_block = const_cast<BlockContainer&>(verify_cast<BlockContainer>(box));
auto& width_value = inline_block.computed_values().width();
if (!width_value.has_value() || (width_value->is_length() && width_value->length().is_undefined_or_auto())) {
if (!width_value.has_value() || (width_value->is_length() && width_value->length().is_auto())) {
auto result = calculate_shrink_to_fit_widths(inline_block);
auto available_width = containing_block().content_width()
@ -146,7 +146,7 @@ void InlineFormattingContext::dimension_box_on_line(Box& box, LayoutMode layout_
auto independent_formatting_context = layout_inside(inline_block, layout_mode);
auto& height_value = inline_block.computed_values().height();
if (!height_value.has_value() || (height_value->is_length() && height_value->length().is_undefined_or_auto())) {
if (!height_value.has_value() || (height_value->is_length() && height_value->length().is_auto())) {
// FIXME: (10.6.6) If 'height' is 'auto', the height depends on the element's descendants per 10.6.7.
BlockFormattingContext::compute_height(inline_block);
} else {

View file

@ -72,7 +72,7 @@ void TableFormattingContext::calculate_column_widths(Box& row, Vector<float>& co
{
size_t column_index = 0;
auto* table = row.first_ancestor_of_type<TableBox>();
bool use_auto_layout = !table || (!table->computed_values().width().has_value() || (table->computed_values().width()->is_length() && table->computed_values().width()->length().is_undefined_or_auto()));
bool use_auto_layout = !table || (!table->computed_values().width().has_value() || (table->computed_values().width()->is_length() && table->computed_values().width()->length().is_auto()));
row.for_each_child_of_type<TableCellBox>([&](auto& cell) {
compute_width(cell);
if (use_auto_layout) {
@ -91,7 +91,7 @@ void TableFormattingContext::layout_row(Box& row, Vector<float>& column_widths)
float tallest_cell_height = 0;
float content_width = 0;
auto* table = row.first_ancestor_of_type<TableBox>();
bool use_auto_layout = !table || (!table->computed_values().width().has_value() || (table->computed_values().width()->is_length() && table->computed_values().width()->length().is_undefined_or_auto()));
bool use_auto_layout = !table || (!table->computed_values().width().has_value() || (table->computed_values().width()->is_length() && table->computed_values().width()->length().is_auto()));
row.for_each_child_of_type<TableCellBox>([&](auto& cell) {
cell.set_offset(row.effective_offset().translated(content_width, 0));