mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:38:11 +00:00
Everywhere: Rename {Deprecated => Byte}String
This commit un-deprecates DeprecatedString, and repurposes it as a byte string. As the null state has already been removed, there are no other particularly hairy blockers in repurposing this type as a byte string (what it _really_ is). This commit is auto-generated: $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \ Meta Ports Ladybird Tests Kernel) $ perl -pie 's/\bDeprecatedString\b/ByteString/g; s/deprecated_string/byte_string/g' $xs $ clang-format --style=file -i \ $(git diff --name-only | grep \.cpp\|\.h) $ gn format $(git ls-files '*.gn' '*.gni')
This commit is contained in:
parent
38d62563b3
commit
5e1499d104
1615 changed files with 10257 additions and 10257 deletions
|
@ -11,16 +11,16 @@
|
|||
#include <LibGfx/Font/FontStyleMapping.h>
|
||||
#include <LibGfx/Rect.h>
|
||||
|
||||
static DeprecatedString to_css_length(float design_value, Presentation const& presentation)
|
||||
static ByteString to_css_length(float design_value, Presentation const& presentation)
|
||||
{
|
||||
float length_in_vw = design_value / static_cast<float>(presentation.normative_size().width()) * 100.0f;
|
||||
return DeprecatedString::formatted("{}vw", length_in_vw);
|
||||
return ByteString::formatted("{}vw", length_in_vw);
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<SlideObject>> SlideObject::parse_slide_object(JsonObject const& slide_object_json, unsigned slide_index)
|
||||
{
|
||||
auto frame = slide_object_json.get_u32("frame"sv).value_or(0);
|
||||
auto maybe_type = slide_object_json.get_deprecated_string("type"sv);
|
||||
auto maybe_type = slide_object_json.get_byte_string("type"sv);
|
||||
if (!maybe_type.has_value())
|
||||
return Error::from_string_view("Slide object must have a type"sv);
|
||||
|
||||
|
@ -58,7 +58,7 @@ void SlideObject::set_property(StringView name, JsonValue value)
|
|||
void GraphicsObject::set_property(StringView name, JsonValue value)
|
||||
{
|
||||
if (name == "color"sv) {
|
||||
if (auto color = Gfx::Color::from_string(value.to_deprecated_string()); color.has_value()) {
|
||||
if (auto color = Gfx::Color::from_string(value.to_byte_string()); color.has_value()) {
|
||||
m_color = color.release_value();
|
||||
}
|
||||
}
|
||||
|
@ -68,15 +68,15 @@ void GraphicsObject::set_property(StringView name, JsonValue value)
|
|||
void Text::set_property(StringView name, JsonValue value)
|
||||
{
|
||||
if (name == "text"sv) {
|
||||
m_text = value.to_deprecated_string();
|
||||
m_text = value.to_byte_string();
|
||||
} else if (name == "font"sv) {
|
||||
m_font_family = value.to_deprecated_string();
|
||||
m_font_family = value.to_byte_string();
|
||||
} else if (name == "font-weight"sv) {
|
||||
m_font_weight = Gfx::name_to_weight(value.to_deprecated_string());
|
||||
m_font_weight = Gfx::name_to_weight(value.to_byte_string());
|
||||
} else if (name == "font-size"sv) {
|
||||
m_font_size_in_pt = value.to_float();
|
||||
} else if (name == "text-alignment"sv) {
|
||||
m_text_align = value.to_deprecated_string();
|
||||
m_text_align = value.to_byte_string();
|
||||
}
|
||||
GraphicsObject::set_property(name, move(value));
|
||||
}
|
||||
|
@ -84,11 +84,11 @@ void Text::set_property(StringView name, JsonValue value)
|
|||
void Image::set_property(StringView name, JsonValue value)
|
||||
{
|
||||
if (name == "path"sv) {
|
||||
m_src = value.to_deprecated_string();
|
||||
m_src = value.to_byte_string();
|
||||
} else if (name == "scaling-mode"sv) {
|
||||
if (value.to_deprecated_string() == "nearest-neighbor"sv)
|
||||
if (value.to_byte_string() == "nearest-neighbor"sv)
|
||||
m_image_rendering = "crisp-edges"sv;
|
||||
else if (value.to_deprecated_string() == "smooth-pixels"sv)
|
||||
else if (value.to_byte_string() == "smooth-pixels"sv)
|
||||
m_image_rendering = "pixelated"sv;
|
||||
}
|
||||
SlideObject::set_property(name, move(value));
|
||||
|
@ -98,11 +98,11 @@ ErrorOr<HTMLElement> Text::render(Presentation const& presentation) const
|
|||
{
|
||||
HTMLElement div;
|
||||
div.tag_name = "div"sv;
|
||||
TRY(div.attributes.try_set("class"sv, DeprecatedString::formatted("frame slide{}-frame{}", m_slide_index, m_frame_index)));
|
||||
div.style.set("color"sv, m_color.to_deprecated_string());
|
||||
div.style.set("font-family"sv, DeprecatedString::formatted("'{}'", m_font_family));
|
||||
TRY(div.attributes.try_set("class"sv, ByteString::formatted("frame slide{}-frame{}", m_slide_index, m_frame_index)));
|
||||
div.style.set("color"sv, m_color.to_byte_string());
|
||||
div.style.set("font-family"sv, ByteString::formatted("'{}'", m_font_family));
|
||||
div.style.set("font-size"sv, to_css_length(m_font_size_in_pt * 1.33333333f, presentation));
|
||||
div.style.set("font-weight"sv, DeprecatedString::number(m_font_weight));
|
||||
div.style.set("font-weight"sv, ByteString::number(m_font_weight));
|
||||
div.style.set("text-align"sv, m_text_align);
|
||||
div.style.set("white-space"sv, "pre-wrap"sv);
|
||||
div.style.set("width"sv, to_css_length(m_rect.width(), presentation));
|
||||
|
@ -118,7 +118,7 @@ ErrorOr<HTMLElement> Image::render(Presentation const& presentation) const
|
|||
{
|
||||
HTMLElement img;
|
||||
img.tag_name = "img"sv;
|
||||
img.attributes.set("src"sv, URL::create_with_file_scheme(m_src).to_deprecated_string());
|
||||
img.attributes.set("src"sv, URL::create_with_file_scheme(m_src).to_byte_string());
|
||||
img.style.set("image-rendering"sv, m_image_rendering);
|
||||
if (m_rect.width() > m_rect.height())
|
||||
img.style.set("height"sv, "100%"sv);
|
||||
|
@ -127,7 +127,7 @@ ErrorOr<HTMLElement> Image::render(Presentation const& presentation) const
|
|||
|
||||
HTMLElement image_wrapper;
|
||||
image_wrapper.tag_name = "div"sv;
|
||||
TRY(image_wrapper.attributes.try_set("class"sv, DeprecatedString::formatted("frame slide{}-frame{}", m_slide_index, m_frame_index)));
|
||||
TRY(image_wrapper.attributes.try_set("class"sv, ByteString::formatted("frame slide{}-frame{}", m_slide_index, m_frame_index)));
|
||||
image_wrapper.children.append(move(img));
|
||||
image_wrapper.style.set("position"sv, "absolute"sv);
|
||||
image_wrapper.style.set("left"sv, to_css_length(m_rect.left(), presentation));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue