mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:27:43 +00:00
LibWeb+WebContent: Use new String class in CSS::StyleValue
Converts uses of DeprecatedString to String in StyleValue, and patches surrounding files that depend on these functions.
This commit is contained in:
parent
1c2e7b1e47
commit
ce0f41b9fb
37 changed files with 335 additions and 330 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include "GridTrackSize.h"
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibWeb/CSS/Length.h>
|
||||
#include <LibWeb/CSS/Percentage.h>
|
||||
#include <LibWeb/CSS/StyleValue.h>
|
||||
|
@ -44,15 +45,15 @@ GridSize GridSize::make_auto()
|
|||
return GridSize(CSS::Length::make_auto());
|
||||
}
|
||||
|
||||
DeprecatedString GridSize::to_deprecated_string() const
|
||||
ErrorOr<String> GridSize::to_string() const
|
||||
{
|
||||
switch (m_type) {
|
||||
case Type::Length:
|
||||
return m_length.to_deprecated_string();
|
||||
return m_length.to_string();
|
||||
case Type::Percentage:
|
||||
return m_percentage.to_deprecated_string();
|
||||
return m_percentage.to_string();
|
||||
case Type::FlexibleLength:
|
||||
return DeprecatedString::formatted("{}fr", m_flexible_length);
|
||||
return String::formatted("{}fr", m_flexible_length);
|
||||
}
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
@ -68,15 +69,15 @@ GridMinMax::GridMinMax(GridSize min_grid_size, GridSize max_grid_size)
|
|||
{
|
||||
}
|
||||
|
||||
DeprecatedString GridMinMax::to_deprecated_string() const
|
||||
ErrorOr<String> GridMinMax::to_string() const
|
||||
{
|
||||
StringBuilder builder;
|
||||
builder.append("minmax("sv);
|
||||
builder.appendff("{}", m_min_grid_size.to_deprecated_string());
|
||||
builder.appendff("{}", TRY(m_min_grid_size.to_string()));
|
||||
builder.append(", "sv);
|
||||
builder.appendff("{}", m_max_grid_size.to_deprecated_string());
|
||||
builder.appendff("{}", TRY(m_max_grid_size.to_string()));
|
||||
builder.append(")"sv);
|
||||
return builder.to_deprecated_string();
|
||||
return builder.to_string();
|
||||
}
|
||||
|
||||
GridRepeat::GridRepeat(GridTrackSizeList grid_track_size_list, int repeat_count)
|
||||
|
@ -96,7 +97,7 @@ GridRepeat::GridRepeat()
|
|||
{
|
||||
}
|
||||
|
||||
DeprecatedString GridRepeat::to_deprecated_string() const
|
||||
ErrorOr<String> GridRepeat::to_string() const
|
||||
{
|
||||
StringBuilder builder;
|
||||
builder.append("repeat("sv);
|
||||
|
@ -114,9 +115,9 @@ DeprecatedString GridRepeat::to_deprecated_string() const
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
builder.append(", "sv);
|
||||
builder.appendff("{}", m_grid_track_size_list.to_deprecated_string());
|
||||
builder.appendff("{}", TRY(m_grid_track_size_list.to_string()));
|
||||
builder.append(")"sv);
|
||||
return builder.to_deprecated_string();
|
||||
return builder.to_string();
|
||||
}
|
||||
|
||||
ExplicitGridTrack::ExplicitGridTrack(CSS::GridMinMax grid_minmax)
|
||||
|
@ -137,15 +138,15 @@ ExplicitGridTrack::ExplicitGridTrack(CSS::GridSize grid_size)
|
|||
{
|
||||
}
|
||||
|
||||
DeprecatedString ExplicitGridTrack::to_deprecated_string() const
|
||||
ErrorOr<String> ExplicitGridTrack::to_string() const
|
||||
{
|
||||
switch (m_type) {
|
||||
case Type::MinMax:
|
||||
return m_grid_minmax.to_deprecated_string();
|
||||
return m_grid_minmax.to_string();
|
||||
case Type::Repeat:
|
||||
return m_grid_repeat.to_deprecated_string();
|
||||
return m_grid_repeat.to_string();
|
||||
case Type::Default:
|
||||
return m_grid_size.to_deprecated_string();
|
||||
return m_grid_size.to_string();
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
@ -168,7 +169,7 @@ GridTrackSizeList GridTrackSizeList::make_auto()
|
|||
return GridTrackSizeList();
|
||||
}
|
||||
|
||||
DeprecatedString GridTrackSizeList::to_deprecated_string() const
|
||||
ErrorOr<String> GridTrackSizeList::to_string() const
|
||||
{
|
||||
StringBuilder builder;
|
||||
auto print_line_names = [&](size_t index) -> void {
|
||||
|
@ -186,7 +187,7 @@ DeprecatedString GridTrackSizeList::to_deprecated_string() const
|
|||
print_line_names(i);
|
||||
builder.append(" "sv);
|
||||
}
|
||||
builder.append(m_track_list[i].to_deprecated_string());
|
||||
builder.append(TRY(m_track_list[i].to_string()));
|
||||
if (i < m_track_list.size() - 1)
|
||||
builder.append(" "sv);
|
||||
}
|
||||
|
@ -194,7 +195,7 @@ DeprecatedString GridTrackSizeList::to_deprecated_string() const
|
|||
builder.append(" "sv);
|
||||
print_line_names(m_track_list.size());
|
||||
}
|
||||
return builder.to_deprecated_string();
|
||||
return builder.to_string();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue