mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:57:44 +00:00
LibWeb: Use Optional instead of undefined-lengths for widths/heights
This commit is contained in:
parent
699b48ccc8
commit
5b2482a939
10 changed files with 126 additions and 92 deletions
|
@ -52,7 +52,7 @@ void TableFormattingContext::run(Box& box, LayoutMode)
|
|||
content_height += row.content_height();
|
||||
});
|
||||
|
||||
if (row_group_box.computed_values().width().is_length() && row_group_box.computed_values().width().length().is_auto())
|
||||
if (row_group_box.computed_values().width().has_value() && row_group_box.computed_values().width()->is_length() && row_group_box.computed_values().width()->length().is_auto())
|
||||
row_group_box.set_content_width(content_width);
|
||||
row_group_box.set_content_height(content_height);
|
||||
|
||||
|
@ -61,7 +61,7 @@ void TableFormattingContext::run(Box& box, LayoutMode)
|
|||
total_content_width = max(total_content_width, row_group_box.content_width());
|
||||
});
|
||||
|
||||
if (box.computed_values().width().is_length() && box.computed_values().width().length().is_auto())
|
||||
if (box.computed_values().width().has_value() && box.computed_values().width()->is_length() && box.computed_values().width()->length().is_auto())
|
||||
box.set_content_width(total_content_width);
|
||||
|
||||
// FIXME: This is a total hack, we should respect the 'height' property.
|
||||
|
@ -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().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_undefined_or_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().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_undefined_or_auto()));
|
||||
|
||||
row.for_each_child_of_type<TableCellBox>([&](auto& cell) {
|
||||
cell.set_offset(row.effective_offset().translated(content_width, 0));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue