1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:17:34 +00:00

AK+Everywhere: Rename String to DeprecatedString

We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
This commit is contained in:
Linus Groh 2022-12-04 18:02:33 +00:00 committed by Andreas Kling
parent f74251606d
commit 6e19ab2bbc
2006 changed files with 11635 additions and 11636 deletions

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/String.h>
#include <AK/DeprecatedString.h>
#include <LibWeb/HTML/HTMLCanvasElement.h>
#include <LibWeb/HTML/HTMLImageElement.h>
#include <LibWeb/WebIDL/ExceptionOr.h>

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/String.h>
#include <AK/DeprecatedString.h>
#include <LibWeb/HTML/Path2D.h>
namespace Web::HTML {
@ -18,8 +18,8 @@ public:
virtual void begin_path() = 0;
virtual void fill(String const& fill_rule) = 0;
virtual void fill(Path2D& path, String const& fill_rule) = 0;
virtual void fill(DeprecatedString const& fill_rule) = 0;
virtual void fill(Path2D& path, DeprecatedString const& fill_rule) = 0;
virtual void stroke() = 0;
virtual void stroke(Path2D const& path) = 0;

View file

@ -8,7 +8,7 @@
#pragma once
#include <AK/String.h>
#include <AK/DeprecatedString.h>
#include <LibWeb/HTML/Canvas/CanvasState.h>
#include <LibWeb/HTML/CanvasGradient.h>
@ -20,24 +20,24 @@ class CanvasFillStrokeStyles {
public:
~CanvasFillStrokeStyles() = default;
void set_fill_style(String style)
void set_fill_style(DeprecatedString style)
{
// FIXME: 2. If the given value is a CanvasPattern object that is marked as not origin-clean, then set this's origin-clean flag to false.
my_drawing_state().fill_style = Gfx::Color::from_string(style).value_or(Color::Black);
}
String fill_style() const
DeprecatedString fill_style() const
{
return my_drawing_state().fill_style.to_string();
}
void set_stroke_style(String style)
void set_stroke_style(DeprecatedString style)
{
// FIXME: 2. If the given value is a CanvasPattern object that is marked as not origin-clean, then set this's origin-clean flag to false.
my_drawing_state().stroke_style = Gfx::Color::from_string(style).value_or(Color::Black);
}
String stroke_style() const
DeprecatedString stroke_style() const
{
return my_drawing_state().stroke_style.to_string();
}

View file

@ -38,17 +38,17 @@ void CanvasPath::bezier_curve_to(double cp1x, double cp1y, double cp2x, double c
WebIDL::ExceptionOr<void> CanvasPath::arc(float x, float y, float radius, float start_angle, float end_angle, bool counter_clockwise)
{
if (radius < 0)
return WebIDL::IndexSizeError::create(m_self.realm(), String::formatted("The radius provided ({}) is negative.", radius));
return WebIDL::IndexSizeError::create(m_self.realm(), DeprecatedString::formatted("The radius provided ({}) is negative.", radius));
return ellipse(x, y, radius, radius, 0, start_angle, end_angle, counter_clockwise);
}
WebIDL::ExceptionOr<void> CanvasPath::ellipse(float x, float y, float radius_x, float radius_y, float rotation, float start_angle, float end_angle, bool counter_clockwise)
{
if (radius_x < 0)
return WebIDL::IndexSizeError::create(m_self.realm(), String::formatted("The major-axis radius provided ({}) is negative.", radius_x));
return WebIDL::IndexSizeError::create(m_self.realm(), DeprecatedString::formatted("The major-axis radius provided ({}) is negative.", radius_x));
if (radius_y < 0)
return WebIDL::IndexSizeError::create(m_self.realm(), String::formatted("The minor-axis radius provided ({}) is negative.", radius_y));
return WebIDL::IndexSizeError::create(m_self.realm(), DeprecatedString::formatted("The minor-axis radius provided ({}) is negative.", radius_y));
if (constexpr float tau = M_TAU; (!counter_clockwise && (end_angle - start_angle) >= tau)
|| (counter_clockwise && (start_angle - end_angle) >= tau)) {

View file

@ -6,8 +6,8 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/Optional.h>
#include <AK/String.h>
#include <LibWeb/HTML/TextMetrics.h>
namespace Web::HTML {
@ -17,9 +17,9 @@ class CanvasText {
public:
virtual ~CanvasText() = default;
virtual void fill_text(String const&, float x, float y, Optional<double> max_width) = 0;
virtual void stroke_text(String const&, float x, float y, Optional<double> max_width) = 0;
virtual JS::NonnullGCPtr<TextMetrics> measure_text(String const& text) = 0;
virtual void fill_text(DeprecatedString const&, float x, float y, Optional<double> max_width) = 0;
virtual void stroke_text(DeprecatedString const&, float x, float y, Optional<double> max_width) = 0;
virtual JS::NonnullGCPtr<TextMetrics> measure_text(DeprecatedString const& text) = 0;
protected:
CanvasText() = default;