mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:28:12 +00:00
Everywhere: Use to_number<T> instead of to_{int,uint,float,double}
In a bunch of cases, this actually ends up simplifying the code as to_number will handle something such as: ``` Optional<I> opt; if constexpr (IsSigned<I>) opt = view.to_int<I>(); else opt = view.to_uint<I>(); ``` For us. The main goal here however is to have a single generic number conversion API between all of the String classes.
This commit is contained in:
parent
a4ecc65398
commit
e2e7c4d574
155 changed files with 397 additions and 412 deletions
|
@ -72,7 +72,7 @@ void TableFormattingContext::compute_constrainedness()
|
|||
m_columns[column_index].is_constrained = true;
|
||||
}
|
||||
auto const& col_node = static_cast<HTML::HTMLTableColElement const&>(*column_box.dom_node());
|
||||
unsigned span = col_node.deprecated_attribute(HTML::AttributeNames::span).to_uint().value_or(1);
|
||||
unsigned span = col_node.deprecated_attribute(HTML::AttributeNames::span).to_number<unsigned>().value_or(1);
|
||||
column_index += span;
|
||||
});
|
||||
});
|
||||
|
@ -189,7 +189,7 @@ void TableFormattingContext::compute_outer_content_sizes()
|
|||
// The outer max-content width of a table-column or table-column-group is max(min-width, min(max-width, width)).
|
||||
m_columns[column_index].max_size = max(min_width, min(max_width, width));
|
||||
auto const& col_node = static_cast<HTML::HTMLTableColElement const&>(*column_box.dom_node());
|
||||
unsigned span = col_node.deprecated_attribute(HTML::AttributeNames::span).to_uint().value_or(1);
|
||||
unsigned span = col_node.deprecated_attribute(HTML::AttributeNames::span).to_number<unsigned>().value_or(1);
|
||||
column_index += span;
|
||||
});
|
||||
});
|
||||
|
@ -1380,7 +1380,7 @@ void TableFormattingContext::BorderConflictFinder::collect_conflicting_col_eleme
|
|||
for (auto* child_of_column_group = child->first_child(); child_of_column_group; child_of_column_group = child_of_column_group->next_sibling()) {
|
||||
VERIFY(child_of_column_group->display().is_table_column());
|
||||
auto const& col_node = static_cast<HTML::HTMLTableColElement const&>(*child_of_column_group->dom_node());
|
||||
unsigned span = col_node.deprecated_attribute(HTML::AttributeNames::span).to_uint().value_or(1);
|
||||
unsigned span = col_node.deprecated_attribute(HTML::AttributeNames::span).to_number<unsigned>().value_or(1);
|
||||
for (size_t i = column_index; i < column_index + span; ++i) {
|
||||
m_col_elements_by_index[i] = child_of_column_group;
|
||||
}
|
||||
|
@ -1744,7 +1744,7 @@ void TableFormattingContext::initialize_intrinsic_percentages_from_rows_or_colum
|
|||
m_columns[column_index].has_intrinsic_percentage = computed_values.max_width().is_percentage() || computed_values.width().is_percentage();
|
||||
m_columns[column_index].intrinsic_percentage = min(width_percentage, max_width_percentage);
|
||||
auto const& col_node = static_cast<HTML::HTMLTableColElement const&>(*column_box.dom_node());
|
||||
unsigned span = col_node.deprecated_attribute(HTML::AttributeNames::span).to_uint().value_or(1);
|
||||
unsigned span = col_node.deprecated_attribute(HTML::AttributeNames::span).to_number<unsigned>().value_or(1);
|
||||
column_index += span;
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue