mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:38:10 +00:00
LibWeb: Port AvailableSpace from DeprecatedString to String
This commit is contained in:
parent
6e48d9f2e6
commit
66ac0d88a3
2 changed files with 12 additions and 12 deletions
|
@ -30,24 +30,24 @@ AvailableSize AvailableSize::make_max_content()
|
||||||
return AvailableSize { Type::MaxContent, CSSPixels::max() };
|
return AvailableSize { Type::MaxContent, CSSPixels::max() };
|
||||||
}
|
}
|
||||||
|
|
||||||
DeprecatedString AvailableSize::to_deprecated_string() const
|
String AvailableSize::to_string() const
|
||||||
{
|
{
|
||||||
switch (m_type) {
|
switch (m_type) {
|
||||||
case Type::Definite:
|
case Type::Definite:
|
||||||
return DeprecatedString::formatted("definite({})", m_value);
|
return MUST(String::formatted("definite({})", m_value));
|
||||||
case Type::Indefinite:
|
case Type::Indefinite:
|
||||||
return "indefinite";
|
return "indefinite"_string;
|
||||||
case Type::MinContent:
|
case Type::MinContent:
|
||||||
return "min-content";
|
return "min-content"_string;
|
||||||
case Type::MaxContent:
|
case Type::MaxContent:
|
||||||
return "max-content";
|
return "max-content"_string;
|
||||||
}
|
}
|
||||||
VERIFY_NOT_REACHED();
|
VERIFY_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
DeprecatedString AvailableSpace::to_deprecated_string() const
|
String AvailableSpace::to_string() const
|
||||||
{
|
{
|
||||||
return DeprecatedString::formatted("{} x {}", width, height);
|
return MUST(String::formatted("{} x {}", width, height));
|
||||||
}
|
}
|
||||||
|
|
||||||
AvailableSize::AvailableSize(Type type, CSSPixels value)
|
AvailableSize::AvailableSize(Type type, CSSPixels value)
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <AK/DeprecatedString.h>
|
|
||||||
#include <AK/Format.h>
|
#include <AK/Format.h>
|
||||||
|
#include <AK/String.h>
|
||||||
#include <LibWeb/Forward.h>
|
#include <LibWeb/Forward.h>
|
||||||
#include <LibWeb/PixelUnits.h>
|
#include <LibWeb/PixelUnits.h>
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ public:
|
||||||
return m_value;
|
return m_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeprecatedString to_deprecated_string() const;
|
String to_string() const;
|
||||||
|
|
||||||
bool operator==(AvailableSize const& other) const = default;
|
bool operator==(AvailableSize const& other) const = default;
|
||||||
bool operator<(AvailableSize const& other) const { return m_value < other.m_value; }
|
bool operator<(AvailableSize const& other) const { return m_value < other.m_value; }
|
||||||
|
@ -92,7 +92,7 @@ public:
|
||||||
AvailableSize width;
|
AvailableSize width;
|
||||||
AvailableSize height;
|
AvailableSize height;
|
||||||
|
|
||||||
DeprecatedString to_deprecated_string() const;
|
String to_string() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ template<>
|
||||||
struct AK::Formatter<Web::Layout::AvailableSize> : Formatter<StringView> {
|
struct AK::Formatter<Web::Layout::AvailableSize> : Formatter<StringView> {
|
||||||
ErrorOr<void> format(FormatBuilder& builder, Web::Layout::AvailableSize const& available_size)
|
ErrorOr<void> format(FormatBuilder& builder, Web::Layout::AvailableSize const& available_size)
|
||||||
{
|
{
|
||||||
return Formatter<StringView>::format(builder, available_size.to_deprecated_string());
|
return Formatter<StringView>::format(builder, available_size.to_string());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -109,6 +109,6 @@ template<>
|
||||||
struct AK::Formatter<Web::Layout::AvailableSpace> : Formatter<StringView> {
|
struct AK::Formatter<Web::Layout::AvailableSpace> : Formatter<StringView> {
|
||||||
ErrorOr<void> format(FormatBuilder& builder, Web::Layout::AvailableSpace const& available_space)
|
ErrorOr<void> format(FormatBuilder& builder, Web::Layout::AvailableSpace const& available_space)
|
||||||
{
|
{
|
||||||
return Formatter<StringView>::format(builder, available_space.to_deprecated_string());
|
return Formatter<StringView>::format(builder, available_space.to_string());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue