1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 09:47:35 +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

@ -41,11 +41,11 @@ Angle Angle::percentage_of(Percentage const& percentage) const
return Angle { percentage.as_fraction() * m_value, m_type };
}
String Angle::to_string() const
DeprecatedString Angle::to_string() const
{
if (is_calculated())
return m_calculated_style->to_string();
return String::formatted("{}{}", m_value, unit_name());
return DeprecatedString::formatted("{}{}", m_value, unit_name());
}
float Angle::to_degrees() const

View file

@ -6,8 +6,8 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/RefPtr.h>
#include <AK/String.h>
#include <LibWeb/Forward.h>
namespace Web::CSS {
@ -33,7 +33,7 @@ public:
bool is_calculated() const { return m_type == Type::Calculated; }
NonnullRefPtr<CalculatedStyleValue> calculated_style_value() const;
String to_string() const;
DeprecatedString to_string() const;
float to_degrees() const;
bool operator==(Angle const& other) const

View file

@ -18,8 +18,8 @@ class CSSConditionRule : public CSSGroupingRule {
public:
virtual ~CSSConditionRule() = default;
virtual String condition_text() const = 0;
virtual void set_condition_text(String) = 0;
virtual DeprecatedString condition_text() const = 0;
virtual void set_condition_text(DeprecatedString) = 0;
virtual bool condition_matches() const = 0;
virtual void for_each_effective_style_rule(Function<void(CSSStyleRule const&)> const& callback) const override;

View file

@ -31,7 +31,7 @@ CSSStyleDeclaration* CSSFontFaceRule::style()
}
// https://www.w3.org/TR/cssom/#ref-for-cssfontfacerule
String CSSFontFaceRule::serialized() const
DeprecatedString CSSFontFaceRule::serialized() const
{
StringBuilder builder;
// The result of concatenating the following:

View file

@ -28,7 +28,7 @@ public:
private:
CSSFontFaceRule(JS::Realm&, FontFace&&);
virtual String serialized() const override;
virtual DeprecatedString serialized() const override;
FontFace m_font_face;
};

View file

@ -49,7 +49,7 @@ void CSSImportRule::visit_edges(Cell::Visitor& visitor)
}
// https://www.w3.org/TR/cssom/#serialize-a-css-rule
String CSSImportRule::serialized() const
DeprecatedString CSSImportRule::serialized() const
{
StringBuilder builder;
// The result of concatenating the following:

View file

@ -27,7 +27,7 @@ public:
AK::URL const& url() const { return m_url; }
// FIXME: This should return only the specified part of the url. eg, "stuff/foo.css", not "https://example.com/stuff/foo.css".
String href() const { return m_url.to_string(); }
DeprecatedString href() const { return m_url.to_string(); }
bool has_import_result() const { return !m_style_sheet; }
CSSStyleSheet* loaded_style_sheet() { return m_style_sheet; }
@ -42,7 +42,7 @@ private:
virtual void visit_edges(Cell::Visitor&) override;
virtual String serialized() const override;
virtual DeprecatedString serialized() const override;
// ^ResourceClient
virtual void resource_did_fail() override;

View file

@ -30,18 +30,18 @@ void CSSMediaRule::visit_edges(Cell::Visitor& visitor)
visitor.visit(&m_media);
}
String CSSMediaRule::condition_text() const
DeprecatedString CSSMediaRule::condition_text() const
{
return m_media.media_text();
}
void CSSMediaRule::set_condition_text(String text)
void CSSMediaRule::set_condition_text(DeprecatedString text)
{
m_media.set_media_text(text);
}
// https://www.w3.org/TR/cssom-1/#serialize-a-css-rule
String CSSMediaRule::serialized() const
DeprecatedString CSSMediaRule::serialized() const
{
// The result of concatenating the following:
StringBuilder builder;

View file

@ -24,8 +24,8 @@ public:
virtual Type type() const override { return Type::Media; };
virtual String condition_text() const override;
virtual void set_condition_text(String) override;
virtual DeprecatedString condition_text() const override;
virtual void set_condition_text(DeprecatedString) override;
virtual bool condition_matches() const override { return m_media.matches(); }
MediaList* media() const { return &m_media; }
@ -36,7 +36,7 @@ private:
CSSMediaRule(JS::Realm&, MediaList&, CSSRuleList&);
virtual void visit_edges(Cell::Visitor&) override;
virtual String serialized() const override;
virtual DeprecatedString serialized() const override;
MediaList& m_media;
};

View file

@ -24,7 +24,7 @@ void CSSRule::visit_edges(Cell::Visitor& visitor)
}
// https://www.w3.org/TR/cssom/#dom-cssrule-csstext
String CSSRule::css_text() const
DeprecatedString CSSRule::css_text() const
{
// The cssText attribute must return a serialization of the CSS rule.
return serialized();

View file

@ -7,7 +7,7 @@
#pragma once
#include <AK/String.h>
#include <AK/DeprecatedString.h>
#include <LibJS/Heap/GCPtr.h>
#include <LibWeb/Bindings/PlatformObject.h>
#include <LibWeb/CSS/CSSStyleDeclaration.h>
@ -32,7 +32,7 @@ public:
virtual Type type() const = 0;
String css_text() const;
DeprecatedString css_text() const;
void set_css_text(StringView);
CSSRule* parent_rule() { return m_parent_rule.ptr(); }
@ -47,7 +47,7 @@ public:
protected:
explicit CSSRule(JS::Realm&);
virtual String serialized() const = 0;
virtual DeprecatedString serialized() const = 0;
virtual void visit_edges(Cell::Visitor&) override;

View file

@ -19,32 +19,32 @@ CSSStyleDeclaration::CSSStyleDeclaration(JS::Realm& realm)
{
}
PropertyOwningCSSStyleDeclaration* PropertyOwningCSSStyleDeclaration::create(JS::Realm& realm, Vector<StyleProperty> properties, HashMap<String, StyleProperty> custom_properties)
PropertyOwningCSSStyleDeclaration* PropertyOwningCSSStyleDeclaration::create(JS::Realm& realm, Vector<StyleProperty> properties, HashMap<DeprecatedString, StyleProperty> custom_properties)
{
return realm.heap().allocate<PropertyOwningCSSStyleDeclaration>(realm, realm, move(properties), move(custom_properties));
}
PropertyOwningCSSStyleDeclaration::PropertyOwningCSSStyleDeclaration(JS::Realm& realm, Vector<StyleProperty> properties, HashMap<String, StyleProperty> custom_properties)
PropertyOwningCSSStyleDeclaration::PropertyOwningCSSStyleDeclaration(JS::Realm& realm, Vector<StyleProperty> properties, HashMap<DeprecatedString, StyleProperty> custom_properties)
: CSSStyleDeclaration(realm)
, m_properties(move(properties))
, m_custom_properties(move(custom_properties))
{
}
String PropertyOwningCSSStyleDeclaration::item(size_t index) const
DeprecatedString PropertyOwningCSSStyleDeclaration::item(size_t index) const
{
if (index >= m_properties.size())
return {};
return CSS::string_from_property_id(m_properties[index].property_id);
}
ElementInlineCSSStyleDeclaration* ElementInlineCSSStyleDeclaration::create(DOM::Element& element, Vector<StyleProperty> properties, HashMap<String, StyleProperty> custom_properties)
ElementInlineCSSStyleDeclaration* ElementInlineCSSStyleDeclaration::create(DOM::Element& element, Vector<StyleProperty> properties, HashMap<DeprecatedString, StyleProperty> custom_properties)
{
auto& realm = element.realm();
return realm.heap().allocate<ElementInlineCSSStyleDeclaration>(realm, element, move(properties), move(custom_properties));
}
ElementInlineCSSStyleDeclaration::ElementInlineCSSStyleDeclaration(DOM::Element& element, Vector<StyleProperty> properties, HashMap<String, StyleProperty> custom_properties)
ElementInlineCSSStyleDeclaration::ElementInlineCSSStyleDeclaration(DOM::Element& element, Vector<StyleProperty> properties, HashMap<DeprecatedString, StyleProperty> custom_properties)
: PropertyOwningCSSStyleDeclaration(element.realm(), move(properties), move(custom_properties))
, m_element(element.make_weak_ptr<DOM::Element>())
{
@ -119,7 +119,7 @@ WebIDL::ExceptionOr<void> PropertyOwningCSSStyleDeclaration::set_property(Proper
}
// https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-removeproperty
WebIDL::ExceptionOr<String> PropertyOwningCSSStyleDeclaration::remove_property(PropertyID property_id)
WebIDL::ExceptionOr<DeprecatedString> PropertyOwningCSSStyleDeclaration::remove_property(PropertyID property_id)
{
// 1. If the computed flag is set, then throw a NoModificationAllowedError exception.
// NOTE: This is handled by the virtual override in ResolvedCSSStyleDeclaration.
@ -193,7 +193,7 @@ bool PropertyOwningCSSStyleDeclaration::set_a_css_declaration(PropertyID propert
return true;
}
String CSSStyleDeclaration::get_property_value(StringView property_name) const
DeprecatedString CSSStyleDeclaration::get_property_value(StringView property_name) const
{
auto property_id = property_id_from_string(property_name);
if (property_id == CSS::PropertyID::Invalid)
@ -205,7 +205,7 @@ String CSSStyleDeclaration::get_property_value(StringView property_name) const
}
// https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-getpropertypriority
String CSSStyleDeclaration::get_property_priority(StringView property_name) const
DeprecatedString CSSStyleDeclaration::get_property_priority(StringView property_name) const
{
auto property_id = property_id_from_string(property_name);
if (property_id == CSS::PropertyID::Invalid)
@ -224,16 +224,16 @@ WebIDL::ExceptionOr<void> CSSStyleDeclaration::set_property(StringView property_
return set_property(property_id, css_text, priority);
}
WebIDL::ExceptionOr<String> CSSStyleDeclaration::remove_property(StringView property_name)
WebIDL::ExceptionOr<DeprecatedString> CSSStyleDeclaration::remove_property(StringView property_name)
{
auto property_id = property_id_from_string(property_name);
if (property_id == CSS::PropertyID::Invalid)
return String::empty();
return DeprecatedString::empty();
return remove_property(property_id);
}
// https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-csstext
String CSSStyleDeclaration::css_text() const
DeprecatedString CSSStyleDeclaration::css_text() const
{
// 1. If the computed flag is set, then return the empty string.
// NOTE: See ResolvedCSSStyleDeclaration::serialized()
@ -243,7 +243,7 @@ String CSSStyleDeclaration::css_text() const
}
// https://www.w3.org/TR/cssom/#serialize-a-css-declaration
static String serialize_a_css_declaration(CSS::PropertyID property, String value, Important important)
static DeprecatedString serialize_a_css_declaration(CSS::PropertyID property, DeprecatedString value, Important important)
{
StringBuilder builder;
@ -269,10 +269,10 @@ static String serialize_a_css_declaration(CSS::PropertyID property, String value
}
// https://www.w3.org/TR/cssom/#serialize-a-css-declaration-block
String PropertyOwningCSSStyleDeclaration::serialized() const
DeprecatedString PropertyOwningCSSStyleDeclaration::serialized() const
{
// 1. Let list be an empty array.
Vector<String> list;
Vector<DeprecatedString> list;
// 2. Let already serialized be an empty array.
HashTable<PropertyID> already_serialized;
@ -341,7 +341,7 @@ JS::ThrowCompletionOr<JS::Value> CSSStyleDeclaration::internal_get(JS::PropertyK
return Base::internal_get(name, receiver);
if (auto maybe_property = property(property_id); maybe_property.has_value())
return { js_string(vm(), maybe_property->value->to_string()) };
return { js_string(vm(), String::empty()) };
return { js_string(vm(), DeprecatedString::empty()) };
}
JS::ThrowCompletionOr<bool> CSSStyleDeclaration::internal_set(JS::PropertyKey const& name, JS::Value value, JS::Value receiver)
@ -371,7 +371,7 @@ void PropertyOwningCSSStyleDeclaration::empty_the_declarations()
m_custom_properties.clear();
}
void PropertyOwningCSSStyleDeclaration::set_the_declarations(Vector<StyleProperty> properties, HashMap<String, StyleProperty> custom_properties)
void PropertyOwningCSSStyleDeclaration::set_the_declarations(Vector<StyleProperty> properties, HashMap<DeprecatedString, StyleProperty> custom_properties)
{
m_properties = move(properties);
m_custom_properties = move(custom_properties);

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/String.h>
#include <AK/DeprecatedString.h>
#include <AK/Vector.h>
#include <LibWeb/Bindings/PlatformObject.h>
#include <LibWeb/CSS/StyleValue.h>
@ -22,7 +22,7 @@ struct StyleProperty {
Important important { Important::No };
CSS::PropertyID property_id;
NonnullRefPtr<StyleValue> value;
String custom_name {};
DeprecatedString custom_name {};
};
class CSSStyleDeclaration : public Bindings::PlatformObject {
@ -32,23 +32,23 @@ public:
virtual ~CSSStyleDeclaration() = default;
virtual size_t length() const = 0;
virtual String item(size_t index) const = 0;
virtual DeprecatedString item(size_t index) const = 0;
virtual Optional<StyleProperty> property(PropertyID) const = 0;
virtual WebIDL::ExceptionOr<void> set_property(PropertyID, StringView css_text, StringView priority = ""sv) = 0;
virtual WebIDL::ExceptionOr<String> remove_property(PropertyID) = 0;
virtual WebIDL::ExceptionOr<DeprecatedString> remove_property(PropertyID) = 0;
WebIDL::ExceptionOr<void> set_property(StringView property_name, StringView css_text, StringView priority);
WebIDL::ExceptionOr<String> remove_property(StringView property_name);
WebIDL::ExceptionOr<DeprecatedString> remove_property(StringView property_name);
String get_property_value(StringView property) const;
String get_property_priority(StringView property) const;
DeprecatedString get_property_value(StringView property) const;
DeprecatedString get_property_priority(StringView property) const;
String css_text() const;
DeprecatedString css_text() const;
virtual WebIDL::ExceptionOr<void> set_css_text(StringView) = 0;
virtual String serialized() const = 0;
virtual DeprecatedString serialized() const = 0;
virtual JS::ThrowCompletionOr<bool> internal_has_property(JS::PropertyKey const& name) const override;
virtual JS::ThrowCompletionOr<JS::Value> internal_get(JS::PropertyKey const&, JS::Value receiver) const override;
@ -63,46 +63,46 @@ class PropertyOwningCSSStyleDeclaration : public CSSStyleDeclaration {
friend class ElementInlineCSSStyleDeclaration;
public:
static PropertyOwningCSSStyleDeclaration* create(JS::Realm&, Vector<StyleProperty>, HashMap<String, StyleProperty> custom_properties);
static PropertyOwningCSSStyleDeclaration* create(JS::Realm&, Vector<StyleProperty>, HashMap<DeprecatedString, StyleProperty> custom_properties);
virtual ~PropertyOwningCSSStyleDeclaration() override = default;
virtual size_t length() const override;
virtual String item(size_t index) const override;
virtual DeprecatedString item(size_t index) const override;
virtual Optional<StyleProperty> property(PropertyID) const override;
virtual WebIDL::ExceptionOr<void> set_property(PropertyID, StringView css_text, StringView priority) override;
virtual WebIDL::ExceptionOr<String> remove_property(PropertyID) override;
virtual WebIDL::ExceptionOr<DeprecatedString> remove_property(PropertyID) override;
Vector<StyleProperty> const& properties() const { return m_properties; }
HashMap<String, StyleProperty> const& custom_properties() const { return m_custom_properties; }
Optional<StyleProperty> custom_property(String const& custom_property_name) const { return m_custom_properties.get(custom_property_name); }
HashMap<DeprecatedString, StyleProperty> const& custom_properties() const { return m_custom_properties; }
Optional<StyleProperty> custom_property(DeprecatedString const& custom_property_name) const { return m_custom_properties.get(custom_property_name); }
size_t custom_property_count() const { return m_custom_properties.size(); }
virtual String serialized() const final override;
virtual DeprecatedString serialized() const final override;
virtual WebIDL::ExceptionOr<void> set_css_text(StringView) override;
protected:
PropertyOwningCSSStyleDeclaration(JS::Realm&, Vector<StyleProperty>, HashMap<String, StyleProperty>);
PropertyOwningCSSStyleDeclaration(JS::Realm&, Vector<StyleProperty>, HashMap<DeprecatedString, StyleProperty>);
virtual void update_style_attribute() { }
void empty_the_declarations();
void set_the_declarations(Vector<StyleProperty> properties, HashMap<String, StyleProperty> custom_properties);
void set_the_declarations(Vector<StyleProperty> properties, HashMap<DeprecatedString, StyleProperty> custom_properties);
private:
bool set_a_css_declaration(PropertyID, NonnullRefPtr<StyleValue>, Important);
Vector<StyleProperty> m_properties;
HashMap<String, StyleProperty> m_custom_properties;
HashMap<DeprecatedString, StyleProperty> m_custom_properties;
};
class ElementInlineCSSStyleDeclaration final : public PropertyOwningCSSStyleDeclaration {
WEB_PLATFORM_OBJECT(ElementInlineCSSStyleDeclaration, PropertyOwningCSSStyleDeclaration);
public:
static ElementInlineCSSStyleDeclaration* create(DOM::Element&, Vector<StyleProperty> properties, HashMap<String, StyleProperty> custom_properties);
static ElementInlineCSSStyleDeclaration* create(DOM::Element&, Vector<StyleProperty> properties, HashMap<DeprecatedString, StyleProperty> custom_properties);
virtual ~ElementInlineCSSStyleDeclaration() override = default;
@ -114,7 +114,7 @@ public:
virtual WebIDL::ExceptionOr<void> set_css_text(StringView) override;
private:
ElementInlineCSSStyleDeclaration(DOM::Element&, Vector<StyleProperty> properties, HashMap<String, StyleProperty> custom_properties);
ElementInlineCSSStyleDeclaration(DOM::Element&, Vector<StyleProperty> properties, HashMap<DeprecatedString, StyleProperty> custom_properties);
virtual void visit_edges(Cell::Visitor&) override;

View file

@ -37,7 +37,7 @@ CSSStyleDeclaration* CSSStyleRule::style()
}
// https://www.w3.org/TR/cssom/#serialize-a-css-rule
String CSSStyleRule::serialized() const
DeprecatedString CSSStyleRule::serialized() const
{
StringBuilder builder;
@ -50,7 +50,7 @@ String CSSStyleRule::serialized() const
auto decls = declaration().serialized();
// FIXME: 3. Let rules be the result of performing serialize a CSS rule on each rule in the rules cssRules list, or null if there are no such rules.
String rules;
DeprecatedString rules;
// 4. If decls and rules are both null, append " }" to s (i.e. a single SPACE (U+0020) followed by RIGHT CURLY BRACKET (U+007D)) and return s.
if (decls.is_null() && rules.is_null()) {
@ -81,7 +81,7 @@ String CSSStyleRule::serialized() const
}
// https://www.w3.org/TR/cssom/#dom-cssstylerule-selectortext
String CSSStyleRule::selector_text() const
DeprecatedString CSSStyleRule::selector_text() const
{
// The selectorText attribute, on getting, must return the result of serializing the associated group of selectors.
return serialize_a_group_of_selectors(selectors());

View file

@ -28,7 +28,7 @@ public:
virtual Type type() const override { return Type::Style; };
String selector_text() const;
DeprecatedString selector_text() const;
void set_selector_text(StringView);
CSSStyleDeclaration* style();
@ -37,7 +37,7 @@ private:
CSSStyleRule(JS::Realm&, NonnullRefPtrVector<Selector>&&, CSSStyleDeclaration&);
virtual void visit_edges(Cell::Visitor&) override;
virtual String serialized() const override;
virtual DeprecatedString serialized() const override;
NonnullRefPtrVector<Selector> m_selectors;
CSSStyleDeclaration& m_declaration;

View file

@ -30,7 +30,7 @@ public:
void set_owner_css_rule(CSSRule* rule) { m_owner_css_rule = rule; }
virtual String type() const override { return "text/css"; }
virtual DeprecatedString type() const override { return "text/css"; }
CSSRuleList const& rules() const { return *m_rules; }
CSSRuleList& rules() { return *m_rules; }

View file

@ -23,19 +23,19 @@ CSSSupportsRule::CSSSupportsRule(JS::Realm& realm, NonnullRefPtr<Supports>&& sup
set_prototype(&Bindings::ensure_web_prototype<Bindings::CSSSupportsRulePrototype>(realm, "CSSSupportsRule"));
}
String CSSSupportsRule::condition_text() const
DeprecatedString CSSSupportsRule::condition_text() const
{
return m_supports->to_string();
}
void CSSSupportsRule::set_condition_text(String text)
void CSSSupportsRule::set_condition_text(DeprecatedString text)
{
if (auto new_supports = parse_css_supports({}, text))
m_supports = new_supports.release_nonnull();
}
// https://www.w3.org/TR/cssom-1/#serialize-a-css-rule
String CSSSupportsRule::serialized() const
DeprecatedString CSSSupportsRule::serialized() const
{
// Note: The spec doesn't cover this yet, so I'm roughly following the spec for the @media rule.
// It should be pretty close!

View file

@ -26,14 +26,14 @@ public:
virtual Type type() const override { return Type::Supports; };
String condition_text() const override;
void set_condition_text(String) override;
DeprecatedString condition_text() const override;
void set_condition_text(DeprecatedString) override;
virtual bool condition_matches() const override { return m_supports->matches(); }
private:
CSSSupportsRule(JS::Realm&, NonnullRefPtr<Supports>&&, CSSRuleList&);
virtual String serialized() const override;
virtual DeprecatedString serialized() const override;
NonnullRefPtr<Supports> m_supports;
};

View file

@ -131,8 +131,8 @@ struct ContentData {
} type { Type::Normal };
// FIXME: Data is a list of identifiers, strings and image values.
String data {};
String alt_text {};
DeprecatedString data {};
DeprecatedString alt_text {};
};
struct BorderRadiusData {

View file

@ -8,7 +8,7 @@
namespace Web::CSS {
String Display::to_string() const
DeprecatedString Display::to_string() const
{
StringBuilder builder;
switch (m_type) {

View file

@ -7,7 +7,7 @@
#pragma once
#include <AK/Assertions.h>
#include <AK/String.h>
#include <AK/DeprecatedString.h>
namespace Web::CSS {
@ -16,7 +16,7 @@ public:
Display() = default;
~Display() = default;
String to_string() const;
DeprecatedString to_string() const;
bool operator==(Display const& other) const
{

View file

@ -40,11 +40,11 @@ Frequency Frequency::percentage_of(Percentage const& percentage) const
return Frequency { percentage.as_fraction() * m_value, m_type };
}
String Frequency::to_string() const
DeprecatedString Frequency::to_string() const
{
if (is_calculated())
return m_calculated_style->to_string();
return String::formatted("{}{}", m_value, unit_name());
return DeprecatedString::formatted("{}{}", m_value, unit_name());
}
float Frequency::to_hertz() const

View file

@ -6,8 +6,8 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/RefPtr.h>
#include <AK/String.h>
#include <LibWeb/Forward.h>
namespace Web::CSS {
@ -30,7 +30,7 @@ public:
bool is_calculated() const { return m_type == Type::Calculated; }
NonnullRefPtr<CalculatedStyleValue> calculated_style_value() const;
String to_string() const;
DeprecatedString to_string() const;
float to_hertz() const;
bool operator==(Frequency const& other) const

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/String.h>
#include <AK/DeprecatedString.h>
namespace Web::CSS {
@ -71,7 +71,7 @@ inline MatchResult evaluate_or(Collection& collection, Evaluate evaluate)
// https://www.w3.org/TR/mediaqueries-4/#typedef-general-enclosed
class GeneralEnclosed {
public:
GeneralEnclosed(String serialized_contents)
GeneralEnclosed(DeprecatedString serialized_contents)
: m_serialized_contents(move(serialized_contents))
{
}
@ -80,6 +80,6 @@ public:
StringView to_string() const { return m_serialized_contents.view(); }
private:
String m_serialized_contents;
DeprecatedString m_serialized_contents;
};
}

View file

@ -5,7 +5,7 @@
*/
#include "GridTrackPlacement.h"
#include <AK/String.h>
#include <AK/DeprecatedString.h>
namespace Web::CSS {
@ -15,14 +15,14 @@ GridTrackPlacement::GridTrackPlacement(int span_count_or_position, bool has_span
{
}
GridTrackPlacement::GridTrackPlacement(String line_name, int span_count_or_position, bool has_span)
GridTrackPlacement::GridTrackPlacement(DeprecatedString line_name, int span_count_or_position, bool has_span)
: m_type(has_span ? Type::Span : Type::Position)
, m_span_count_or_position(span_count_or_position)
, m_line_name(line_name)
{
}
GridTrackPlacement::GridTrackPlacement(String line_name, bool has_span)
GridTrackPlacement::GridTrackPlacement(DeprecatedString line_name, bool has_span)
: m_type(has_span ? Type::Span : Type::Position)
, m_line_name(line_name)
{
@ -33,7 +33,7 @@ GridTrackPlacement::GridTrackPlacement()
{
}
String GridTrackPlacement::to_string() const
DeprecatedString GridTrackPlacement::to_string() const
{
StringBuilder builder;
if (is_auto()) {
@ -45,7 +45,7 @@ String GridTrackPlacement::to_string() const
builder.append(" "sv);
}
if (m_span_count_or_position != 0) {
builder.append(String::number(m_span_count_or_position));
builder.append(DeprecatedString::number(m_span_count_or_position));
builder.append(" "sv);
}
if (has_line_name()) {

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/String.h>
#include <AK/DeprecatedString.h>
namespace Web::CSS {
@ -18,9 +18,9 @@ public:
Auto
};
GridTrackPlacement(String line_name, int span_count_or_position, bool has_span = false);
GridTrackPlacement(DeprecatedString line_name, int span_count_or_position, bool has_span = false);
GridTrackPlacement(int span_count_or_position, bool has_span = false);
GridTrackPlacement(String line_name, bool has_span = false);
GridTrackPlacement(DeprecatedString line_name, bool has_span = false);
GridTrackPlacement();
static GridTrackPlacement make_auto() { return GridTrackPlacement(); };
@ -34,9 +34,9 @@ public:
int raw_value() const { return m_span_count_or_position; }
Type type() const { return m_type; }
String line_name() const { return m_line_name; }
DeprecatedString line_name() const { return m_line_name; }
String to_string() const;
DeprecatedString to_string() const;
bool operator==(GridTrackPlacement const& other) const
{
return m_type == other.type() && m_span_count_or_position == other.raw_value();
@ -45,7 +45,7 @@ public:
private:
Type m_type;
int m_span_count_or_position { 0 };
String m_line_name;
DeprecatedString m_line_name;
};
}

View file

@ -5,7 +5,7 @@
*/
#include "GridTrackSize.h"
#include <AK/String.h>
#include <AK/DeprecatedString.h>
#include <LibWeb/CSS/Length.h>
#include <LibWeb/CSS/Percentage.h>
#include <LibWeb/CSS/StyleValue.h>
@ -44,7 +44,7 @@ GridSize GridSize::make_auto()
return GridSize(CSS::Length::make_auto());
}
String GridSize::to_string() const
DeprecatedString GridSize::to_string() const
{
switch (m_type) {
case Type::Length:
@ -52,7 +52,7 @@ String GridSize::to_string() const
case Type::Percentage:
return m_percentage.to_string();
case Type::FlexibleLength:
return String::formatted("{}fr", m_flexible_length);
return DeprecatedString::formatted("{}fr", m_flexible_length);
}
VERIFY_NOT_REACHED();
}
@ -68,7 +68,7 @@ GridMinMax::GridMinMax(GridSize min_grid_size, GridSize max_grid_size)
{
}
String GridMinMax::to_string() const
DeprecatedString GridMinMax::to_string() const
{
StringBuilder builder;
builder.append("minmax("sv);
@ -96,7 +96,7 @@ GridRepeat::GridRepeat()
{
}
String GridRepeat::to_string() const
DeprecatedString GridRepeat::to_string() const
{
StringBuilder builder;
builder.append("repeat("sv);
@ -137,7 +137,7 @@ ExplicitGridTrack::ExplicitGridTrack(CSS::GridSize grid_size)
{
}
String ExplicitGridTrack::to_string() const
DeprecatedString ExplicitGridTrack::to_string() const
{
switch (m_type) {
case Type::MinMax:
@ -151,7 +151,7 @@ String ExplicitGridTrack::to_string() const
}
}
GridTrackSizeList::GridTrackSizeList(Vector<CSS::ExplicitGridTrack> track_list, Vector<Vector<String>> line_names)
GridTrackSizeList::GridTrackSizeList(Vector<CSS::ExplicitGridTrack> track_list, Vector<Vector<DeprecatedString>> line_names)
: m_track_list(track_list)
, m_line_names(line_names)
{
@ -168,7 +168,7 @@ GridTrackSizeList GridTrackSizeList::make_auto()
return GridTrackSizeList();
}
String GridTrackSizeList::to_string() const
DeprecatedString GridTrackSizeList::to_string() const
{
StringBuilder builder;
auto print_line_names = [&](size_t index) -> void {

View file

@ -52,7 +52,7 @@ public:
return (m_type == Type::Length && !m_length.is_auto()) || is_percentage();
}
String to_string() const;
DeprecatedString to_string() const;
bool operator==(GridSize const& other) const
{
return m_type == other.type()
@ -78,7 +78,7 @@ public:
GridSize min_grid_size() const& { return m_min_grid_size; }
GridSize max_grid_size() const& { return m_max_grid_size; }
String to_string() const;
DeprecatedString to_string() const;
bool operator==(GridMinMax const& other) const
{
return m_min_grid_size == other.min_grid_size()
@ -92,15 +92,15 @@ private:
class GridTrackSizeList {
public:
GridTrackSizeList(Vector<CSS::ExplicitGridTrack> track_list, Vector<Vector<String>> line_names);
GridTrackSizeList(Vector<CSS::ExplicitGridTrack> track_list, Vector<Vector<DeprecatedString>> line_names);
GridTrackSizeList();
static GridTrackSizeList make_auto();
Vector<CSS::ExplicitGridTrack> track_list() const { return m_track_list; }
Vector<Vector<String>> line_names() const { return m_line_names; }
Vector<Vector<DeprecatedString>> line_names() const { return m_line_names; }
String to_string() const;
DeprecatedString to_string() const;
bool operator==(GridTrackSizeList const& other) const
{
return m_line_names == other.line_names() && m_track_list == other.track_list();
@ -108,7 +108,7 @@ public:
private:
Vector<CSS::ExplicitGridTrack> m_track_list;
Vector<Vector<String>> m_line_names;
Vector<Vector<DeprecatedString>> m_line_names;
};
class GridRepeat {
@ -133,7 +133,7 @@ public:
GridTrackSizeList grid_track_size_list() const& { return m_grid_track_size_list; }
Type type() const& { return m_type; }
String to_string() const;
DeprecatedString to_string() const;
bool operator==(GridRepeat const& other) const
{
if (m_type != other.type())
@ -183,7 +183,7 @@ public:
Type type() const { return m_type; }
String to_string() const;
DeprecatedString to_string() const;
bool operator==(ExplicitGridTrack const& other) const
{
if (is_repeat() && other.is_repeat())

View file

@ -112,13 +112,13 @@ float Length::to_px(Layout::Node const& layout_node) const
return to_px(viewport_rect, layout_node.font().pixel_metrics(), layout_node.computed_values().font_size(), root_element->layout_node()->computed_values().font_size());
}
String Length::to_string() const
DeprecatedString Length::to_string() const
{
if (is_calculated())
return m_calculated_style->to_string();
if (is_auto())
return "auto";
return String::formatted("{}{}", m_value, unit_name());
return DeprecatedString::formatted("{}{}", m_value, unit_name());
}
char const* Length::unit_name() const

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/String.h>
#include <AK/DeprecatedString.h>
#include <LibGfx/Forward.h>
#include <LibWeb/Forward.h>
@ -116,7 +116,7 @@ public:
}
}
String to_string() const;
DeprecatedString to_string() const;
// We have a RefPtr<CalculatedStyleValue> member, but can't include the header StyleValue.h as it includes
// this file already. To break the cyclic dependency, we must move all method definitions out.

View file

@ -24,13 +24,13 @@ MediaList::MediaList(JS::Realm& realm, NonnullRefPtrVector<MediaQuery>&& media)
}
// https://www.w3.org/TR/cssom-1/#dom-medialist-mediatext
String MediaList::media_text() const
DeprecatedString MediaList::media_text() const
{
return serialize_a_media_query_list(m_media);
}
// https://www.w3.org/TR/cssom-1/#dom-medialist-mediatext
void MediaList::set_media_text(String const& text)
void MediaList::set_media_text(DeprecatedString const& text)
{
m_media.clear();
if (text.is_empty())
@ -44,7 +44,7 @@ bool MediaList::is_supported_property_index(u32 index) const
}
// https://www.w3.org/TR/cssom-1/#dom-medialist-item
String MediaList::item(u32 index) const
DeprecatedString MediaList::item(u32 index) const
{
if (!is_supported_property_index(index))
return {};
@ -53,7 +53,7 @@ String MediaList::item(u32 index) const
}
// https://www.w3.org/TR/cssom-1/#dom-medialist-appendmedium
void MediaList::append_medium(String medium)
void MediaList::append_medium(DeprecatedString medium)
{
auto m = parse_media_query({}, medium);
if (!m)
@ -64,7 +64,7 @@ void MediaList::append_medium(String medium)
}
// https://www.w3.org/TR/cssom-1/#dom-medialist-deletemedium
void MediaList::delete_medium(String medium)
void MediaList::delete_medium(DeprecatedString medium)
{
auto m = parse_media_query({}, medium);
if (!m)

View file

@ -23,12 +23,12 @@ public:
static MediaList* create(JS::Realm&, NonnullRefPtrVector<MediaQuery>&& media);
~MediaList() = default;
String media_text() const;
void set_media_text(String const&);
DeprecatedString media_text() const;
void set_media_text(DeprecatedString const&);
size_t length() const { return m_media.size(); }
String item(u32 index) const;
void append_medium(String);
void delete_medium(String);
DeprecatedString item(u32 index) const;
void append_medium(DeprecatedString);
void delete_medium(DeprecatedString);
virtual bool is_supported_property_index(u32 index) const override;
virtual JS::Value item_value(size_t index) const override;

View file

@ -20,14 +20,14 @@ NonnullRefPtr<MediaQuery> MediaQuery::create_not_all()
return adopt_ref(*media_query);
}
String MediaFeatureValue::to_string() const
DeprecatedString MediaFeatureValue::to_string() const
{
return m_value.visit(
[](ValueID const& ident) { return String { string_from_value_id(ident) }; },
[](ValueID const& ident) { return DeprecatedString { string_from_value_id(ident) }; },
[](Length const& length) { return length.to_string(); },
[](Ratio const& ratio) { return ratio.to_string(); },
[](Resolution const& resolution) { return resolution.to_string(); },
[](float number) { return String::number(number); });
[](float number) { return DeprecatedString::number(number); });
}
bool MediaFeatureValue::is_same_type(MediaFeatureValue const& other) const
@ -40,7 +40,7 @@ bool MediaFeatureValue::is_same_type(MediaFeatureValue const& other) const
[&](float) { return other.is_number(); });
}
String MediaFeature::to_string() const
DeprecatedString MediaFeature::to_string() const
{
auto comparison_string = [](Comparison comparison) -> StringView {
switch (comparison) {
@ -62,16 +62,16 @@ String MediaFeature::to_string() const
case Type::IsTrue:
return string_from_media_feature_id(m_id);
case Type::ExactValue:
return String::formatted("{}:{}", string_from_media_feature_id(m_id), m_value->to_string());
return DeprecatedString::formatted("{}:{}", string_from_media_feature_id(m_id), m_value->to_string());
case Type::MinValue:
return String::formatted("min-{}:{}", string_from_media_feature_id(m_id), m_value->to_string());
return DeprecatedString::formatted("min-{}:{}", string_from_media_feature_id(m_id), m_value->to_string());
case Type::MaxValue:
return String::formatted("max-{}:{}", string_from_media_feature_id(m_id), m_value->to_string());
return DeprecatedString::formatted("max-{}:{}", string_from_media_feature_id(m_id), m_value->to_string());
case Type::Range:
if (!m_range->right_comparison.has_value())
return String::formatted("{} {} {}", m_range->left_value.to_string(), comparison_string(m_range->left_comparison), string_from_media_feature_id(m_id));
return DeprecatedString::formatted("{} {} {}", m_range->left_value.to_string(), comparison_string(m_range->left_comparison), string_from_media_feature_id(m_id));
return String::formatted("{} {} {} {} {}", m_range->left_value.to_string(), comparison_string(m_range->left_comparison), string_from_media_feature_id(m_id), comparison_string(*m_range->right_comparison), m_range->right_value->to_string());
return DeprecatedString::formatted("{} {} {} {} {}", m_range->left_value.to_string(), comparison_string(m_range->left_comparison), string_from_media_feature_id(m_id), comparison_string(*m_range->right_comparison), m_range->right_value->to_string());
}
VERIFY_NOT_REACHED();
@ -275,7 +275,7 @@ NonnullOwnPtr<MediaCondition> MediaCondition::from_or_list(NonnullOwnPtrVector<M
return adopt_own(*result);
}
String MediaCondition::to_string() const
DeprecatedString MediaCondition::to_string() const
{
StringBuilder builder;
builder.append('(');
@ -318,7 +318,7 @@ MatchResult MediaCondition::evaluate(HTML::Window const& window) const
VERIFY_NOT_REACHED();
}
String MediaQuery::to_string() const
DeprecatedString MediaQuery::to_string() const
{
StringBuilder builder;
@ -379,7 +379,7 @@ bool MediaQuery::evaluate(HTML::Window const& window)
}
// https://www.w3.org/TR/cssom-1/#serialize-a-media-query-list
String serialize_a_media_query_list(NonnullRefPtrVector<MediaQuery> const& media_queries)
DeprecatedString serialize_a_media_query_list(NonnullRefPtrVector<MediaQuery> const& media_queries)
{
// 1. If the media query list is empty, then return the empty string.
if (media_queries.is_empty())

View file

@ -47,7 +47,7 @@ public:
{
}
String to_string() const;
DeprecatedString to_string() const;
bool is_ident() const { return m_value.has<ValueID>(); }
bool is_length() const { return m_value.has<Length>(); }
@ -146,7 +146,7 @@ public:
}
bool evaluate(HTML::Window const&) const;
String to_string() const;
DeprecatedString to_string() const;
private:
enum class Type {
@ -202,7 +202,7 @@ struct MediaCondition {
static NonnullOwnPtr<MediaCondition> from_or_list(NonnullOwnPtrVector<MediaCondition>&&);
MatchResult evaluate(HTML::Window const&) const;
String to_string() const;
DeprecatedString to_string() const;
private:
MediaCondition() = default;
@ -241,7 +241,7 @@ public:
bool matches() const { return m_matches; }
bool evaluate(HTML::Window const&);
String to_string() const;
DeprecatedString to_string() const;
private:
MediaQuery() = default;
@ -255,7 +255,7 @@ private:
bool m_matches { false };
};
String serialize_a_media_query_list(NonnullRefPtrVector<MediaQuery> const&);
DeprecatedString serialize_a_media_query_list(NonnullRefPtrVector<MediaQuery> const&);
bool is_media_feature_name(StringView name);

View file

@ -36,7 +36,7 @@ void MediaQueryList::visit_edges(Cell::Visitor& visitor)
}
// https://drafts.csswg.org/cssom-view/#dom-mediaquerylist-media
String MediaQueryList::media() const
DeprecatedString MediaQueryList::media() const
{
return serialize_a_media_query_list(m_media);
}

View file

@ -21,7 +21,7 @@ public:
virtual ~MediaQueryList() override = default;
String media() const;
DeprecatedString media() const;
bool matches() const;
bool evaluate();

View file

@ -11,7 +11,7 @@
namespace Web::CSS {
struct MediaQueryListEventInit : public DOM::EventInit {
String media { "" };
DeprecatedString media { "" };
bool matches { false };
};
@ -23,13 +23,13 @@ public:
virtual ~MediaQueryListEvent() override;
String const& media() const { return m_media; }
DeprecatedString const& media() const { return m_media; }
bool matches() const { return m_matches; }
private:
MediaQueryListEvent(JS::Realm&, FlyString const& event_name, MediaQueryListEventInit const& event_init);
String m_media;
DeprecatedString m_media;
bool m_matches;
};
}

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/String.h>
#include <AK/DeprecatedString.h>
#include <AK/Types.h>
#include <math.h>
@ -69,11 +69,11 @@ public:
return { Type::Number, m_value / other.m_value };
}
String to_string() const
DeprecatedString to_string() const
{
if (m_type == Type::IntegerWithExplicitSign)
return String::formatted("{:+}", m_value);
return String::number(m_value);
return DeprecatedString::formatted("{:+}", m_value);
return DeprecatedString::number(m_value);
}
bool operator==(Number const& other) const

View file

@ -17,7 +17,7 @@ Block::Block(Token token, Vector<ComponentValue>&& values)
Block::~Block() = default;
String Block::to_string() const
DeprecatedString Block::to_string() const
{
StringBuilder builder;

View file

@ -32,7 +32,7 @@ public:
Vector<ComponentValue> const& values() const { return m_values; }
String to_string() const;
DeprecatedString to_string() const;
private:
Block(Token, Vector<ComponentValue>&&);

View file

@ -26,7 +26,7 @@ ComponentValue::ComponentValue(NonnullRefPtr<Block> block)
ComponentValue::~ComponentValue() = default;
String ComponentValue::to_string() const
DeprecatedString ComponentValue::to_string() const
{
return m_value.visit(
[](Token const& token) { return token.to_string(); },
@ -34,17 +34,17 @@ String ComponentValue::to_string() const
[](NonnullRefPtr<Function> const& function) { return function->to_string(); });
}
String ComponentValue::to_debug_string() const
DeprecatedString ComponentValue::to_debug_string() const
{
return m_value.visit(
[](Token const& token) {
return String::formatted("Token: {}", token.to_debug_string());
return DeprecatedString::formatted("Token: {}", token.to_debug_string());
},
[](NonnullRefPtr<Block> const& block) {
return String::formatted("Block: {}", block->to_string());
return DeprecatedString::formatted("Block: {}", block->to_string());
},
[](NonnullRefPtr<Function> const& function) {
return String::formatted("Function: {}", function->to_string());
return DeprecatedString::formatted("Function: {}", function->to_string());
});
}

View file

@ -33,8 +33,8 @@ public:
Token const& token() const { return m_value.get<Token>(); }
operator Token() const { return m_value.get<Token>(); }
String to_string() const;
String to_debug_string() const;
DeprecatedString to_string() const;
DeprecatedString to_debug_string() const;
private:
Variant<Token, NonnullRefPtr<Function>, NonnullRefPtr<Block>> m_value;

View file

@ -19,7 +19,7 @@ Declaration::Declaration(FlyString name, Vector<ComponentValue> values, Importan
Declaration::~Declaration() = default;
String Declaration::to_string() const
DeprecatedString Declaration::to_string() const
{
StringBuilder builder;

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/String.h>
#include <AK/DeprecatedString.h>
#include <AK/Vector.h>
#include <LibWeb/CSS/CSSStyleDeclaration.h>
#include <LibWeb/CSS/Parser/ComponentValue.h>
@ -22,7 +22,7 @@ public:
Vector<ComponentValue> const& values() const { return m_values; }
Important importance() const { return m_important; }
String to_string() const;
DeprecatedString to_string() const;
private:
FlyString m_name;

View file

@ -24,7 +24,7 @@ DeclarationOrAtRule::DeclarationOrAtRule(Declaration declaration)
DeclarationOrAtRule::~DeclarationOrAtRule() = default;
String DeclarationOrAtRule::to_string() const
DeprecatedString DeclarationOrAtRule::to_string() const
{
StringBuilder builder;
switch (m_type) {

View file

@ -37,7 +37,7 @@ public:
return *m_declaration;
}
String to_string() const;
DeprecatedString to_string() const;
private:
DeclarationType m_type;

View file

@ -18,7 +18,7 @@ Function::Function(FlyString name, Vector<ComponentValue>&& values)
Function::~Function() = default;
String Function::to_string() const
DeprecatedString Function::to_string() const
{
StringBuilder builder;

View file

@ -7,9 +7,9 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/FlyString.h>
#include <AK/RefCounted.h>
#include <AK/String.h>
#include <AK/Vector.h>
#include <LibWeb/CSS/Parser/ComponentValue.h>
#include <LibWeb/Forward.h>
@ -28,7 +28,7 @@ public:
StringView name() const { return m_name; }
Vector<ComponentValue> const& values() const { return m_values; }
String to_string() const;
DeprecatedString to_string() const;
private:
Function(FlyString name, Vector<ComponentValue>&& values);

View file

@ -77,12 +77,12 @@ bool ParsingContext::in_quirks_mode() const
}
// https://www.w3.org/TR/css-values-4/#relative-urls
AK::URL ParsingContext::complete_url(String const& addr) const
AK::URL ParsingContext::complete_url(DeprecatedString const& addr) const
{
return m_url.complete_url(addr);
}
Parser::Parser(ParsingContext const& context, StringView input, String const& encoding)
Parser::Parser(ParsingContext const& context, StringView input, DeprecatedString const& encoding)
: m_context(context)
, m_tokenizer(input, encoding)
, m_tokens(m_tokenizer.parse())
@ -3382,7 +3382,7 @@ Optional<UnicodeRange> Parser::parse_unicode_range(TokenStream<ComponentValue>&
// Integers like `+34` get serialized as `34`, so manually include the `+` sign.
if (component_value.is(Token::Type::Number) && component_value.token().number().is_integer_with_explicit_sign()) {
auto int_value = component_value.token().number().integer_value();
return String::formatted("{:+}", int_value);
return DeprecatedString::formatted("{:+}", int_value);
}
return component_value.to_string();
@ -3879,7 +3879,7 @@ Optional<Color> Parser::parse_color(ComponentValue const& component_value)
return color;
} else if (component_value.is(Token::Type::Hash)) {
auto color = Color::from_string(String::formatted("#{}", component_value.token().hash_value()));
auto color = Color::from_string(DeprecatedString::formatted("#{}", component_value.token().hash_value()));
if (color.has_value())
return color;
return {};
@ -3898,7 +3898,7 @@ Optional<Color> Parser::parse_color(ComponentValue const& component_value)
// 1. Let cv be the component value.
auto const& cv = component_value;
String serialization;
DeprecatedString serialization;
// 2. If cv is a <number-token> or a <dimension-token>, follow these substeps:
if (cv.is(Token::Type::Number) || cv.is(Token::Type::Dimension)) {
// 1. If cvs type flag is not "integer", return an error.
@ -3947,7 +3947,7 @@ Optional<Color> Parser::parse_color(ComponentValue const& component_value)
}
// 6. Return the concatenation of "#" (U+0023) and serialization.
String concatenation = String::formatted("#{}", serialization);
DeprecatedString concatenation = DeprecatedString::formatted("#{}", serialization);
return Color::from_string(concatenation);
}
@ -5228,7 +5228,7 @@ RefPtr<StyleValue> Parser::parse_font_family_value(Vector<ComponentValue> const&
// font-family: my cool font\!, serif;
// font-family: "my cool font!", serif;
NonnullRefPtrVector<StyleValue> font_families;
Vector<String> current_name_parts;
Vector<DeprecatedString> current_name_parts;
for (size_t i = start_index; i < component_values.size(); ++i) {
auto const& part = component_values[i];
@ -5266,7 +5266,7 @@ RefPtr<StyleValue> Parser::parse_font_family_value(Vector<ComponentValue> const&
if (part.is(Token::Type::Comma)) {
if (current_name_parts.is_empty())
return nullptr;
font_families.append(StringStyleValue::create(String::join(' ', current_name_parts)));
font_families.append(StringStyleValue::create(DeprecatedString::join(' ', current_name_parts)));
current_name_parts.clear();
// Can't have a trailing comma
if (i + 1 == component_values.size())
@ -5276,7 +5276,7 @@ RefPtr<StyleValue> Parser::parse_font_family_value(Vector<ComponentValue> const&
}
if (!current_name_parts.is_empty()) {
font_families.append(StringStyleValue::create(String::join(' ', current_name_parts)));
font_families.append(StringStyleValue::create(DeprecatedString::join(' ', current_name_parts)));
current_name_parts.clear();
}
@ -5303,7 +5303,7 @@ CSSRule* Parser::parse_font_face_rule(TokenStream<ComponentValue>& tokens)
if (declaration.name().equals_ignoring_case("font-family"sv)) {
// FIXME: This is very similar to, but different from, the logic in parse_font_family_value().
// Ideally they could share code.
Vector<String> font_family_parts;
Vector<DeprecatedString> font_family_parts;
bool had_syntax_error = false;
for (size_t i = 0; i < declaration.values().size(); ++i) {
auto const& part = declaration.values()[i];
@ -5341,7 +5341,7 @@ CSSRule* Parser::parse_font_face_rule(TokenStream<ComponentValue>& tokens)
if (had_syntax_error || font_family_parts.is_empty())
continue;
font_family = String::join(' ', font_family_parts);
font_family = DeprecatedString::join(' ', font_family_parts);
continue;
}
if (declaration.name().equals_ignoring_case("src"sv)) {
@ -6014,11 +6014,11 @@ Optional<CSS::GridRepeat> Parser::parse_repeat(Vector<ComponentValue> const& com
return {};
Vector<CSS::ExplicitGridTrack> repeat_params;
Vector<Vector<String>> line_names_list;
Vector<Vector<DeprecatedString>> line_names_list;
auto last_object_was_line_names = false;
while (part_two_tokens.has_next_token()) {
auto token = part_two_tokens.next_token();
Vector<String> line_names;
Vector<DeprecatedString> line_names;
if (token.is_block()) {
if (last_object_was_line_names)
return {};
@ -6112,7 +6112,7 @@ Optional<CSS::ExplicitGridTrack> Parser::parse_track_sizing_function(ComponentVa
RefPtr<StyleValue> Parser::parse_grid_track_sizes(Vector<ComponentValue> const& component_values)
{
Vector<CSS::ExplicitGridTrack> track_list;
Vector<Vector<String>> line_names_list;
Vector<Vector<DeprecatedString>> line_names_list;
auto last_object_was_line_names = false;
TokenStream tokens { component_values };
while (tokens.has_next_token()) {
@ -6121,7 +6121,7 @@ RefPtr<StyleValue> Parser::parse_grid_track_sizes(Vector<ComponentValue> const&
if (last_object_was_line_names)
return GridTrackSizeStyleValue::make_auto();
last_object_was_line_names = true;
Vector<String> line_names;
Vector<DeprecatedString> line_names;
if (!token.block().is_square())
return GridTrackSizeStyleValue::make_auto();
TokenStream block_tokens { token.block().values() };
@ -6196,7 +6196,7 @@ RefPtr<StyleValue> Parser::parse_grid_track_placement(Vector<ComponentValue> con
auto span_value = false;
auto span_or_position_value = 0;
String line_name_value;
DeprecatedString line_name_value;
while (true) {
if (is_auto(current_token))
return {};

View file

@ -43,7 +43,7 @@ public:
bool in_quirks_mode() const;
DOM::Document const* document() const { return m_document; }
AK::URL complete_url(String const&) const;
AK::URL complete_url(DeprecatedString const&) const;
PropertyID current_property_id() const { return m_current_property_id; }
void set_current_property_id(PropertyID property_id) { m_current_property_id = property_id; }
@ -59,7 +59,7 @@ private:
class Parser {
public:
Parser(ParsingContext const&, StringView input, String const& encoding = "utf-8");
Parser(ParsingContext const&, StringView input, DeprecatedString const& encoding = "utf-8");
~Parser() = default;
CSSStyleSheet* parse_as_css_stylesheet(Optional<AK::URL> location);
@ -353,7 +353,7 @@ private:
struct PropertiesAndCustomProperties {
Vector<StyleProperty> properties;
HashMap<String, StyleProperty> custom_properties;
HashMap<DeprecatedString, StyleProperty> custom_properties;
};
PropertiesAndCustomProperties extract_properties(Vector<DeclarationOrAtRule> const&);

View file

@ -20,7 +20,7 @@ Rule::Rule(Rule::Type type, FlyString name, Vector<ComponentValue> prelude, RefP
Rule::~Rule() = default;
String Rule::to_string() const
DeprecatedString Rule::to_string() const
{
StringBuilder builder;

View file

@ -41,7 +41,7 @@ public:
RefPtr<Block const> block() const { return m_block; }
StringView at_rule_name() const { return m_at_rule_name; }
String to_string() const;
DeprecatedString to_string() const;
private:
Rule(Type, FlyString name, Vector<ComponentValue> prelude, RefPtr<Block>);

View file

@ -5,13 +5,13 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/String.h>
#include <AK/DeprecatedString.h>
#include <LibWeb/CSS/Parser/Token.h>
#include <LibWeb/CSS/Serialize.h>
namespace Web::CSS::Parser {
String Token::to_string() const
DeprecatedString Token::to_string() const
{
StringBuilder builder;
@ -21,15 +21,15 @@ String Token::to_string() const
case Type::Ident:
return serialize_an_identifier(ident());
case Type::Function:
return String::formatted("{}(", serialize_an_identifier(function()));
return DeprecatedString::formatted("{}(", serialize_an_identifier(function()));
case Type::AtKeyword:
return String::formatted("@{}", serialize_an_identifier(at_keyword()));
return DeprecatedString::formatted("@{}", serialize_an_identifier(at_keyword()));
case Type::Hash: {
switch (m_hash_type) {
case HashType::Id:
return String::formatted("#{}", serialize_an_identifier(hash_value()));
return DeprecatedString::formatted("#{}", serialize_an_identifier(hash_value()));
case HashType::Unrestricted:
return String::formatted("#{}", hash_value());
return DeprecatedString::formatted("#{}", hash_value());
}
VERIFY_NOT_REACHED();
}
@ -44,11 +44,11 @@ String Token::to_string() const
case Type::Delim:
return m_value;
case Type::Number:
return String::number(m_number_value.value());
return DeprecatedString::number(m_number_value.value());
case Type::Percentage:
return String::formatted("{}%", m_number_value.value());
return DeprecatedString::formatted("{}%", m_number_value.value());
case Type::Dimension:
return String::formatted("{}{}", m_number_value.value(), dimension_unit());
return DeprecatedString::formatted("{}{}", m_number_value.value(), dimension_unit());
case Type::Whitespace:
return " ";
case Type::CDO:
@ -79,7 +79,7 @@ String Token::to_string() const
}
}
String Token::to_debug_string() const
DeprecatedString Token::to_debug_string() const
{
switch (m_type) {
case Type::Invalid:
@ -88,29 +88,29 @@ String Token::to_debug_string() const
case Type::EndOfFile:
return "__EOF__";
case Type::Ident:
return String::formatted("Ident: {}", ident());
return DeprecatedString::formatted("Ident: {}", ident());
case Type::Function:
return String::formatted("Function: {}", function());
return DeprecatedString::formatted("Function: {}", function());
case Type::AtKeyword:
return String::formatted("AtKeyword: {}", at_keyword());
return DeprecatedString::formatted("AtKeyword: {}", at_keyword());
case Type::Hash:
return String::formatted("Hash: {} (hash_type: {})", hash_value(), m_hash_type == HashType::Unrestricted ? "Unrestricted" : "Id");
return DeprecatedString::formatted("Hash: {} (hash_type: {})", hash_value(), m_hash_type == HashType::Unrestricted ? "Unrestricted" : "Id");
case Type::String:
return String::formatted("String: {}", string());
return DeprecatedString::formatted("String: {}", string());
case Type::BadString:
return "BadString";
case Type::Url:
return String::formatted("Url: {}", url());
return DeprecatedString::formatted("Url: {}", url());
case Type::BadUrl:
return "BadUrl";
case Type::Delim:
return String::formatted("Delim: {}", m_value);
return DeprecatedString::formatted("Delim: {}", m_value);
case Type::Number:
return String::formatted("Number: {}{} (number_type: {})", m_number_value.value() > 0 && m_number_value.is_integer_with_explicit_sign() ? "+" : "", m_number_value.value(), m_number_value.is_integer() ? "Integer" : "Number");
return DeprecatedString::formatted("Number: {}{} (number_type: {})", m_number_value.value() > 0 && m_number_value.is_integer_with_explicit_sign() ? "+" : "", m_number_value.value(), m_number_value.is_integer() ? "Integer" : "Number");
case Type::Percentage:
return String::formatted("Percentage: {}% (number_type: {})", percentage(), m_number_value.is_integer() ? "Integer" : "Number");
return DeprecatedString::formatted("Percentage: {}% (number_type: {})", percentage(), m_number_value.is_integer() ? "Integer" : "Number");
case Type::Dimension:
return String::formatted("Dimension: {}{} (number_type: {})", dimension_value(), dimension_unit(), m_number_value.is_integer() ? "Integer" : "Number");
return DeprecatedString::formatted("Dimension: {}{} (number_type: {})", dimension_value(), dimension_unit(), m_number_value.is_integer() ? "Integer" : "Number");
case Type::Whitespace:
return "Whitespace";
case Type::CDO:
@ -156,7 +156,7 @@ Token::Type Token::mirror_variant() const
return Type::Invalid;
}
String Token::bracket_string() const
DeprecatedString Token::bracket_string() const
{
if (is(Token::Type::OpenCurly)) {
return "{";
@ -185,7 +185,7 @@ String Token::bracket_string() const
return "";
}
String Token::bracket_mirror_string() const
DeprecatedString Token::bracket_mirror_string() const
{
if (is(Token::Type::OpenCurly)) {
return "}";

View file

@ -7,8 +7,8 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/FlyString.h>
#include <AK/String.h>
#include <AK/Utf8View.h>
#include <LibWeb/CSS/Number.h>
@ -142,11 +142,11 @@ public:
}
Type mirror_variant() const;
String bracket_string() const;
String bracket_mirror_string() const;
DeprecatedString bracket_string() const;
DeprecatedString bracket_mirror_string() const;
String to_string() const;
String to_debug_string() const;
DeprecatedString to_string() const;
DeprecatedString to_debug_string() const;
Position const& start_position() const { return m_start_position; }
Position const& end_position() const { return m_end_position; }

View file

@ -195,10 +195,10 @@ static inline bool is_E(u32 code_point)
return code_point == 0x45;
}
Tokenizer::Tokenizer(StringView input, String const& encoding)
Tokenizer::Tokenizer(StringView input, DeprecatedString const& encoding)
{
// https://www.w3.org/TR/css-syntax-3/#css-filter-code-points
auto filter_code_points = [](StringView input, auto const& encoding) -> String {
auto filter_code_points = [](StringView input, auto const& encoding) -> DeprecatedString {
auto* decoder = TextCodec::decoder_for(encoding);
VERIFY(decoder);
@ -352,7 +352,7 @@ Token Tokenizer::create_eof_token()
return create_new_token(Token::Type::EndOfFile);
}
Token Tokenizer::create_value_token(Token::Type type, String value)
Token Tokenizer::create_value_token(Token::Type type, DeprecatedString value)
{
Token token;
token.m_type = type;
@ -576,7 +576,7 @@ float Tokenizer::convert_a_string_to_a_number(StringView string)
}
// https://www.w3.org/TR/css-syntax-3/#consume-name
String Tokenizer::consume_an_ident_sequence()
DeprecatedString Tokenizer::consume_an_ident_sequence()
{
// This section describes how to consume an ident sequence from a stream of code points.
// It returns a string containing the largest name that can be formed from adjacent

View file

@ -6,8 +6,8 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/Optional.h>
#include <AK/String.h>
#include <AK/StringView.h>
#include <AK/Types.h>
#include <AK/Utf8View.h>
@ -60,7 +60,7 @@ public:
class Tokenizer {
public:
explicit Tokenizer(StringView input, String const& encoding);
explicit Tokenizer(StringView input, DeprecatedString const& encoding);
[[nodiscard]] Vector<Token> parse();
@ -76,7 +76,7 @@ private:
[[nodiscard]] U32Triplet start_of_input_stream_triplet();
[[nodiscard]] static Token create_new_token(Token::Type);
[[nodiscard]] static Token create_value_token(Token::Type, String value);
[[nodiscard]] static Token create_value_token(Token::Type, DeprecatedString value);
[[nodiscard]] static Token create_value_token(Token::Type, u32 value);
[[nodiscard]] Token consume_a_token();
[[nodiscard]] Token consume_string_token(u32 ending_code_point);
@ -84,7 +84,7 @@ private:
[[nodiscard]] Token consume_an_ident_like_token();
[[nodiscard]] Number consume_a_number();
[[nodiscard]] float convert_a_string_to_a_number(StringView);
[[nodiscard]] String consume_an_ident_sequence();
[[nodiscard]] DeprecatedString consume_an_ident_sequence();
[[nodiscard]] u32 consume_escaped_code_point();
[[nodiscard]] Token consume_a_url_token();
void consume_the_remnants_of_a_bad_url();
@ -95,7 +95,7 @@ private:
[[nodiscard]] static bool would_start_an_ident_sequence(U32Triplet);
[[nodiscard]] static bool would_start_a_number(U32Triplet);
String m_decoded_input;
DeprecatedString m_decoded_input;
Utf8View m_utf8_view;
AK::Utf8CodePointIterator m_utf8_iterator;
AK::Utf8CodePointIterator m_prev_utf8_iterator;

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/String.h>
#include <AK/DeprecatedString.h>
#include <AK/Variant.h>
#include <LibWeb/CSS/Angle.h>
#include <LibWeb/CSS/Frequency.h>
@ -31,9 +31,9 @@ public:
float value() const { return m_value; }
float as_fraction() const { return m_value * 0.01f; }
String to_string() const
DeprecatedString to_string() const
{
return String::formatted("{}%", m_value);
return DeprecatedString::formatted("{}%", m_value);
}
bool operator==(Percentage const& other) const { return m_value == other.m_value; }
@ -128,7 +128,7 @@ public:
});
}
String to_string() const
DeprecatedString to_string() const
{
if (is_percentage())
return m_value.template get<Percentage>().to_string();

View file

@ -8,7 +8,7 @@
namespace Web::CSS {
PreferredColorScheme preferred_color_scheme_from_string(String const& value)
PreferredColorScheme preferred_color_scheme_from_string(DeprecatedString const& value)
{
if (value.equals_ignoring_case("light"sv))
return PreferredColorScheme::Light;

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/String.h>
#include <AK/DeprecatedString.h>
#include <AK/StringView.h>
namespace Web::CSS {
@ -17,7 +17,7 @@ enum class PreferredColorScheme {
Light,
};
PreferredColorScheme preferred_color_scheme_from_string(String const&);
PreferredColorScheme preferred_color_scheme_from_string(DeprecatedString const&);
StringView preferred_color_scheme_to_string(PreferredColorScheme);
}

View file

@ -22,9 +22,9 @@ bool Ratio::is_degenerate() const
|| !isfinite(m_second_value) || m_second_value == 0;
}
String Ratio::to_string() const
DeprecatedString Ratio::to_string() const
{
return String::formatted("{} / {}", m_first_value, m_second_value);
return DeprecatedString::formatted("{} / {}", m_first_value, m_second_value);
}
}

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/String.h>
#include <AK/DeprecatedString.h>
namespace Web::CSS {
@ -17,7 +17,7 @@ public:
float value() const { return m_first_value / m_second_value; }
bool is_degenerate() const;
String to_string() const;
DeprecatedString to_string() const;
private:
float m_first_value { 0 };

View file

@ -21,9 +21,9 @@ Resolution::Resolution(float value, Type type)
{
}
String Resolution::to_string() const
DeprecatedString Resolution::to_string() const
{
return String::formatted("{}{}", m_value, unit_name());
return DeprecatedString::formatted("{}{}", m_value, unit_name());
}
float Resolution::to_dots_per_pixel() const

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/String.h>
#include <AK/DeprecatedString.h>
#include <LibWeb/Forward.h>
namespace Web::CSS {
@ -24,7 +24,7 @@ public:
Resolution(int value, Type type);
Resolution(float value, Type type);
String to_string() const;
DeprecatedString to_string() const;
float to_dots_per_pixel() const;
bool operator==(Resolution const& other) const

View file

@ -41,7 +41,7 @@ size_t ResolvedCSSStyleDeclaration::length() const
return 0;
}
String ResolvedCSSStyleDeclaration::item(size_t index) const
DeprecatedString ResolvedCSSStyleDeclaration::item(size_t index) const
{
(void)index;
return {};
@ -562,20 +562,20 @@ WebIDL::ExceptionOr<void> ResolvedCSSStyleDeclaration::set_property(PropertyID,
}
// https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-removeproperty
WebIDL::ExceptionOr<String> ResolvedCSSStyleDeclaration::remove_property(PropertyID)
WebIDL::ExceptionOr<DeprecatedString> ResolvedCSSStyleDeclaration::remove_property(PropertyID)
{
// 1. If the computed flag is set, then throw a NoModificationAllowedError exception.
return WebIDL::NoModificationAllowedError::create(realm(), "Cannot remove properties from result of getComputedStyle()");
}
String ResolvedCSSStyleDeclaration::serialized() const
DeprecatedString ResolvedCSSStyleDeclaration::serialized() const
{
// https://www.w3.org/TR/cssom/#dom-cssstyledeclaration-csstext
// If the computed flag is set, then return the empty string.
// NOTE: ResolvedCSSStyleDeclaration is something you would only get from window.getComputedStyle(),
// which returns what the spec calls "resolved style". The "computed flag" is always set here.
return String::empty();
return DeprecatedString::empty();
}
// https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-csstext

View file

@ -19,12 +19,12 @@ public:
virtual ~ResolvedCSSStyleDeclaration() override = default;
virtual size_t length() const override;
virtual String item(size_t index) const override;
virtual DeprecatedString item(size_t index) const override;
virtual Optional<StyleProperty> property(PropertyID) const override;
virtual WebIDL::ExceptionOr<void> set_property(PropertyID, StringView css_text, StringView priority) override;
virtual WebIDL::ExceptionOr<String> remove_property(PropertyID) override;
virtual WebIDL::ExceptionOr<DeprecatedString> remove_property(PropertyID) override;
virtual String serialized() const override;
virtual DeprecatedString serialized() const override;
virtual WebIDL::ExceptionOr<void> set_css_text(StringView) override;
private:

View file

@ -119,7 +119,7 @@ u32 Selector::specificity() const
}
// https://www.w3.org/TR/cssom/#serialize-a-simple-selector
String Selector::SimpleSelector::serialize() const
DeprecatedString Selector::SimpleSelector::serialize() const
{
StringBuilder s;
switch (type) {
@ -279,7 +279,7 @@ String Selector::SimpleSelector::serialize() const
}
// https://www.w3.org/TR/cssom/#serialize-a-selector
String Selector::serialize() const
DeprecatedString Selector::serialize() const
{
StringBuilder s;
@ -337,7 +337,7 @@ String Selector::serialize() const
}
// https://www.w3.org/TR/cssom/#serialize-a-group-of-selectors
String serialize_a_group_of_selectors(NonnullRefPtrVector<Selector> const& selectors)
DeprecatedString serialize_a_group_of_selectors(NonnullRefPtrVector<Selector> const& selectors)
{
// To serialize a group of selectors serialize each selector in the group of selectors and then serialize a comma-separated list of these serializations.
StringBuilder builder;

View file

@ -7,10 +7,10 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/FlyString.h>
#include <AK/NonnullRefPtrVector.h>
#include <AK/RefCounted.h>
#include <AK/String.h>
#include <AK/Vector.h>
namespace Web::CSS {
@ -50,11 +50,11 @@ public:
int offset = { 0 }; // "B"
// https://www.w3.org/TR/css-syntax-3/#serializing-anb
String serialize() const
DeprecatedString serialize() const
{
// 1. If A is zero, return the serialization of B.
if (step_size == 0) {
return String::formatted("{}", offset);
return DeprecatedString::formatted("{}", offset);
}
// 2. Otherwise, let result initially be an empty string.
@ -141,7 +141,7 @@ public:
};
MatchType match_type;
FlyString name {};
String value {};
DeprecatedString value {};
CaseType case_type;
};
@ -171,7 +171,7 @@ public:
FlyString const& lowercase_name() const { return value.get<Name>().lowercase_name; }
FlyString& lowercase_name() { return value.get<Name>().lowercase_name; }
String serialize() const;
DeprecatedString serialize() const;
};
enum class Combinator {
@ -200,7 +200,7 @@ public:
Vector<CompoundSelector> const& compound_selectors() const { return m_compound_selectors; }
Optional<PseudoElement> pseudo_element() const { return m_pseudo_element; }
u32 specificity() const;
String serialize() const;
DeprecatedString serialize() const;
private:
explicit Selector(Vector<CompoundSelector>&&);
@ -294,7 +294,7 @@ constexpr StringView pseudo_class_name(Selector::SimpleSelector::PseudoClass::Ty
VERIFY_NOT_REACHED();
}
String serialize_a_group_of_selectors(NonnullRefPtrVector<Selector> const& selectors);
DeprecatedString serialize_a_group_of_selectors(NonnullRefPtrVector<Selector> const& selectors);
}

View file

@ -147,42 +147,42 @@ void serialize_a_srgb_value(StringBuilder& builder, Color color)
builder.appendff("rgba({}, {}, {}, {})"sv, color.red(), color.green(), color.blue(), (float)(color.alpha()) / 255.0f);
}
String escape_a_character(u32 character)
DeprecatedString escape_a_character(u32 character)
{
StringBuilder builder;
escape_a_character(builder, character);
return builder.to_string();
}
String escape_a_character_as_code_point(u32 character)
DeprecatedString escape_a_character_as_code_point(u32 character)
{
StringBuilder builder;
escape_a_character_as_code_point(builder, character);
return builder.to_string();
}
String serialize_an_identifier(StringView ident)
DeprecatedString serialize_an_identifier(StringView ident)
{
StringBuilder builder;
serialize_an_identifier(builder, ident);
return builder.to_string();
}
String serialize_a_string(StringView string)
DeprecatedString serialize_a_string(StringView string)
{
StringBuilder builder;
serialize_a_string(builder, string);
return builder.to_string();
}
String serialize_a_url(StringView url)
DeprecatedString serialize_a_url(StringView url)
{
StringBuilder builder;
serialize_a_url(builder, url);
return builder.to_string();
}
String serialize_a_srgb_value(Color color)
DeprecatedString serialize_a_srgb_value(Color color)
{
StringBuilder builder;
serialize_a_srgb_value(builder, color);

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/String.h>
#include <AK/DeprecatedString.h>
#include <AK/StringBuilder.h>
#include <AK/StringView.h>
#include <AK/Vector.h>
@ -24,12 +24,12 @@ void serialize_a_local(StringBuilder&, StringView path);
void serialize_unicode_ranges(StringBuilder&, Vector<UnicodeRange> const& unicode_ranges);
void serialize_a_srgb_value(StringBuilder&, Color color);
String escape_a_character(u32 character);
String escape_a_character_as_code_point(u32 character);
String serialize_an_identifier(StringView ident);
String serialize_a_string(StringView string);
String serialize_a_url(StringView url);
String serialize_a_srgb_value(Color color);
DeprecatedString escape_a_character(u32 character);
DeprecatedString escape_a_character_as_code_point(u32 character);
DeprecatedString serialize_an_identifier(StringView ident);
DeprecatedString serialize_a_string(StringView string);
DeprecatedString serialize_a_url(StringView url);
DeprecatedString serialize_a_srgb_value(Color color);
template<typename T, typename SerializeItem>
void serialize_a_comma_separated_list(StringBuilder& builder, Vector<T> const& items, SerializeItem serialize_item)

View file

@ -74,7 +74,7 @@ bool Size::contains_percentage() const
}
}
String Size::to_string() const
DeprecatedString Size::to_string() const
{
switch (m_type) {
case Type::Auto:
@ -87,7 +87,7 @@ String Size::to_string() const
case Type::MaxContent:
return "max-content";
case Type::FitContent:
return String::formatted("fit-content({})", m_length_percentage.to_string());
return DeprecatedString::formatted("fit-content({})", m_length_percentage.to_string());
case Type::None:
return "none";
}

View file

@ -63,7 +63,7 @@ public:
return m_length_percentage.length();
}
String to_string() const;
DeprecatedString to_string() const;
private:
Size(Type type, LengthPercentage);

View file

@ -115,7 +115,7 @@ static CSSStyleSheet& default_stylesheet()
static JS::Handle<CSSStyleSheet> sheet;
if (!sheet.cell()) {
extern char const default_stylesheet_source[];
String css = default_stylesheet_source;
DeprecatedString css = default_stylesheet_source;
sheet = JS::make_handle(parse_css_stylesheet(CSS::Parser::ParsingContext(), css));
}
return *sheet;
@ -126,7 +126,7 @@ static CSSStyleSheet& quirks_mode_stylesheet()
static JS::Handle<CSSStyleSheet> sheet;
if (!sheet.cell()) {
extern char const quirks_mode_stylesheet_source[];
String css = quirks_mode_stylesheet_source;
DeprecatedString css = quirks_mode_stylesheet_source;
sheet = JS::make_handle(parse_css_stylesheet(CSS::Parser::ParsingContext(), css));
}
return *sheet;
@ -1105,7 +1105,7 @@ void StyleComputer::compute_font(StyleProperties& style, DOM::Element const* ele
FontSelector font_selector;
bool monospace = false;
auto find_font = [&](String const& family) -> RefPtr<Gfx::Font> {
auto find_font = [&](DeprecatedString const& family) -> RefPtr<Gfx::Font> {
float font_size_in_pt = font_size_in_px * 0.75f;
font_selector = { family, font_size_in_pt, weight, slope };
@ -1316,7 +1316,7 @@ NonnullRefPtr<StyleProperties> StyleComputer::compute_style(DOM::Element& elemen
return style;
}
PropertyDependencyNode::PropertyDependencyNode(String name)
PropertyDependencyNode::PropertyDependencyNode(DeprecatedString name)
: m_name(move(name))
{
}

View file

@ -31,7 +31,7 @@ struct MatchingRule {
class PropertyDependencyNode : public RefCounted<PropertyDependencyNode> {
public:
static NonnullRefPtr<PropertyDependencyNode> create(String name)
static NonnullRefPtr<PropertyDependencyNode> create(DeprecatedString name)
{
return adopt_ref(*new PropertyDependencyNode(move(name)));
}
@ -40,9 +40,9 @@ public:
bool has_cycles();
private:
explicit PropertyDependencyNode(String name);
explicit PropertyDependencyNode(DeprecatedString name);
String m_name;
DeprecatedString m_name;
NonnullRefPtrVector<PropertyDependencyNode> m_children;
bool m_marked { false };
};
@ -118,7 +118,7 @@ private:
OwnPtr<RuleCache> m_rule_cache;
class FontLoader;
HashMap<String, NonnullOwnPtr<FontLoader>> m_loaded_fonts;
HashMap<DeprecatedString, NonnullOwnPtr<FontLoader>> m_loaded_fonts;
};
}

View file

@ -19,27 +19,27 @@ class StyleSheet : public Bindings::PlatformObject {
public:
virtual ~StyleSheet() = default;
virtual String type() const = 0;
virtual DeprecatedString type() const = 0;
DOM::Element* owner_node() { return m_owner_node; }
void set_owner_node(DOM::Element*);
String href() const { return m_location; }
DeprecatedString href() const { return m_location; }
String location() const { return m_location; }
void set_location(String location) { m_location = move(location); }
DeprecatedString location() const { return m_location; }
void set_location(DeprecatedString location) { m_location = move(location); }
String title() const { return m_title; }
void set_title(String title) { m_title = move(title); }
DeprecatedString title() const { return m_title; }
void set_title(DeprecatedString title) { m_title = move(title); }
void set_type(String type) { m_type_string = move(type); }
void set_type(DeprecatedString type) { m_type_string = move(type); }
MediaList* media() const
{
return &m_media;
}
void set_media(String media)
void set_media(DeprecatedString media)
{
m_media.set_media_text(media);
}
@ -65,9 +65,9 @@ private:
JS::GCPtr<DOM::Element> m_owner_node;
JS::GCPtr<CSSStyleSheet> m_parent_style_sheet;
String m_location;
String m_title;
String m_type_string;
DeprecatedString m_location;
DeprecatedString m_title;
DeprecatedString m_type_string;
bool m_disabled { false };
bool m_alternate { false };

View file

@ -313,10 +313,10 @@ BackgroundStyleValue::BackgroundStyleValue(
VERIFY(!m_color->is_value_list());
}
String BackgroundStyleValue::to_string() const
DeprecatedString BackgroundStyleValue::to_string() const
{
if (m_layer_count == 1) {
return String::formatted("{} {} {} {} {} {} {} {}", m_color->to_string(), m_image->to_string(), m_position->to_string(), m_size->to_string(), m_repeat->to_string(), m_attachment->to_string(), m_origin->to_string(), m_clip->to_string());
return DeprecatedString::formatted("{} {} {} {} {} {} {} {}", m_color->to_string(), m_image->to_string(), m_position->to_string(), m_size->to_string(), m_repeat->to_string(), m_attachment->to_string(), m_origin->to_string(), m_clip->to_string());
}
auto get_layer_value_string = [](NonnullRefPtr<StyleValue> const& style_value, size_t index) {
@ -352,9 +352,9 @@ bool BackgroundStyleValue::equals(StyleValue const& other) const
&& m_clip->equals(typed_other.m_clip);
}
String BackgroundRepeatStyleValue::to_string() const
DeprecatedString BackgroundRepeatStyleValue::to_string() const
{
return String::formatted("{} {}", CSS::to_string(m_repeat_x), CSS::to_string(m_repeat_y));
return DeprecatedString::formatted("{} {}", CSS::to_string(m_repeat_x), CSS::to_string(m_repeat_y));
}
bool BackgroundRepeatStyleValue::equals(StyleValue const& other) const
@ -365,9 +365,9 @@ bool BackgroundRepeatStyleValue::equals(StyleValue const& other) const
return m_repeat_x == typed_other.m_repeat_x && m_repeat_y == typed_other.m_repeat_y;
}
String BackgroundSizeStyleValue::to_string() const
DeprecatedString BackgroundSizeStyleValue::to_string() const
{
return String::formatted("{} {}", m_size_x.to_string(), m_size_y.to_string());
return DeprecatedString::formatted("{} {}", m_size_x.to_string(), m_size_y.to_string());
}
bool BackgroundSizeStyleValue::equals(StyleValue const& other) const
@ -378,9 +378,9 @@ bool BackgroundSizeStyleValue::equals(StyleValue const& other) const
return m_size_x == typed_other.m_size_x && m_size_y == typed_other.m_size_y;
}
String BorderStyleValue::to_string() const
DeprecatedString BorderStyleValue::to_string() const
{
return String::formatted("{} {} {}", m_border_width->to_string(), m_border_style->to_string(), m_border_color->to_string());
return DeprecatedString::formatted("{} {} {}", m_border_width->to_string(), m_border_style->to_string(), m_border_color->to_string());
}
bool BorderStyleValue::equals(StyleValue const& other) const
@ -393,11 +393,11 @@ bool BorderStyleValue::equals(StyleValue const& other) const
&& m_border_color->equals(typed_other.m_border_color);
}
String BorderRadiusStyleValue::to_string() const
DeprecatedString BorderRadiusStyleValue::to_string() const
{
if (m_horizontal_radius == m_vertical_radius)
return m_horizontal_radius.to_string();
return String::formatted("{} / {}", m_horizontal_radius.to_string(), m_vertical_radius.to_string());
return DeprecatedString::formatted("{} / {}", m_horizontal_radius.to_string(), m_vertical_radius.to_string());
}
bool BorderRadiusStyleValue::equals(StyleValue const& other) const
@ -410,9 +410,9 @@ bool BorderRadiusStyleValue::equals(StyleValue const& other) const
&& m_vertical_radius == typed_other.m_vertical_radius;
}
String BorderRadiusShorthandStyleValue::to_string() const
DeprecatedString BorderRadiusShorthandStyleValue::to_string() const
{
return String::formatted("{} {} {} {} / {} {} {} {}", m_top_left->horizontal_radius().to_string(), m_top_right->horizontal_radius().to_string(), m_bottom_right->horizontal_radius().to_string(), m_bottom_left->horizontal_radius().to_string(), m_top_left->vertical_radius().to_string(), m_top_right->vertical_radius().to_string(), m_bottom_right->vertical_radius().to_string(), m_bottom_left->vertical_radius().to_string());
return DeprecatedString::formatted("{} {} {} {} / {} {} {} {}", m_top_left->horizontal_radius().to_string(), m_top_right->horizontal_radius().to_string(), m_bottom_right->horizontal_radius().to_string(), m_bottom_left->horizontal_radius().to_string(), m_top_left->vertical_radius().to_string(), m_top_right->vertical_radius().to_string(), m_bottom_right->vertical_radius().to_string(), m_bottom_left->vertical_radius().to_string());
}
bool BorderRadiusShorthandStyleValue::equals(StyleValue const& other) const
@ -615,9 +615,9 @@ void CalculatedStyleValue::CalculationResult::divide_by(CalculationResult const&
});
}
String CalculatedStyleValue::to_string() const
DeprecatedString CalculatedStyleValue::to_string() const
{
return String::formatted("calc({})", m_expression->to_string());
return DeprecatedString::formatted("calc({})", m_expression->to_string());
}
bool CalculatedStyleValue::equals(StyleValue const& other) const
@ -628,22 +628,22 @@ bool CalculatedStyleValue::equals(StyleValue const& other) const
return to_string() == other.to_string();
}
String CalculatedStyleValue::CalcNumberValue::to_string() const
DeprecatedString CalculatedStyleValue::CalcNumberValue::to_string() const
{
return value.visit(
[](Number const& number) { return String::number(number.value()); },
[](NonnullOwnPtr<CalcNumberSum> const& sum) { return String::formatted("({})", sum->to_string()); });
[](Number const& number) { return DeprecatedString::number(number.value()); },
[](NonnullOwnPtr<CalcNumberSum> const& sum) { return DeprecatedString::formatted("({})", sum->to_string()); });
}
String CalculatedStyleValue::CalcValue::to_string() const
DeprecatedString CalculatedStyleValue::CalcValue::to_string() const
{
return value.visit(
[](Number const& number) { return String::number(number.value()); },
[](NonnullOwnPtr<CalcSum> const& sum) { return String::formatted("({})", sum->to_string()); },
[](Number const& number) { return DeprecatedString::number(number.value()); },
[](NonnullOwnPtr<CalcSum> const& sum) { return DeprecatedString::formatted("({})", sum->to_string()); },
[](auto const& v) { return v.to_string(); });
}
String CalculatedStyleValue::CalcSum::to_string() const
DeprecatedString CalculatedStyleValue::CalcSum::to_string() const
{
StringBuilder builder;
builder.append(first_calc_product->to_string());
@ -652,7 +652,7 @@ String CalculatedStyleValue::CalcSum::to_string() const
return builder.to_string();
}
String CalculatedStyleValue::CalcNumberSum::to_string() const
DeprecatedString CalculatedStyleValue::CalcNumberSum::to_string() const
{
StringBuilder builder;
builder.append(first_calc_number_product->to_string());
@ -661,7 +661,7 @@ String CalculatedStyleValue::CalcNumberSum::to_string() const
return builder.to_string();
}
String CalculatedStyleValue::CalcProduct::to_string() const
DeprecatedString CalculatedStyleValue::CalcProduct::to_string() const
{
StringBuilder builder;
builder.append(first_calc_value.to_string());
@ -670,20 +670,20 @@ String CalculatedStyleValue::CalcProduct::to_string() const
return builder.to_string();
}
String CalculatedStyleValue::CalcSumPartWithOperator::to_string() const
DeprecatedString CalculatedStyleValue::CalcSumPartWithOperator::to_string() const
{
return String::formatted(" {} {}", op == SumOperation::Add ? "+"sv : "-"sv, value->to_string());
return DeprecatedString::formatted(" {} {}", op == SumOperation::Add ? "+"sv : "-"sv, value->to_string());
}
String CalculatedStyleValue::CalcProductPartWithOperator::to_string() const
DeprecatedString CalculatedStyleValue::CalcProductPartWithOperator::to_string() const
{
auto value_string = value.visit(
[](CalcValue const& v) { return v.to_string(); },
[](CalcNumberValue const& v) { return v.to_string(); });
return String::formatted(" {} {}", op == ProductOperation::Multiply ? "*"sv : "/"sv, value_string);
return DeprecatedString::formatted(" {} {}", op == ProductOperation::Multiply ? "*"sv : "/"sv, value_string);
}
String CalculatedStyleValue::CalcNumberProduct::to_string() const
DeprecatedString CalculatedStyleValue::CalcNumberProduct::to_string() const
{
StringBuilder builder;
builder.append(first_calc_number_value.to_string());
@ -692,14 +692,14 @@ String CalculatedStyleValue::CalcNumberProduct::to_string() const
return builder.to_string();
}
String CalculatedStyleValue::CalcNumberProductPartWithOperator::to_string() const
DeprecatedString CalculatedStyleValue::CalcNumberProductPartWithOperator::to_string() const
{
return String::formatted(" {} {}", op == ProductOperation::Multiply ? "*"sv : "/"sv, value.to_string());
return DeprecatedString::formatted(" {} {}", op == ProductOperation::Multiply ? "*"sv : "/"sv, value.to_string());
}
String CalculatedStyleValue::CalcNumberSumPartWithOperator::to_string() const
DeprecatedString CalculatedStyleValue::CalcNumberSumPartWithOperator::to_string() const
{
return String::formatted(" {} {}", op == SumOperation::Add ? "+"sv : "-"sv, value->to_string());
return DeprecatedString::formatted(" {} {}", op == SumOperation::Add ? "+"sv : "-"sv, value->to_string());
}
Optional<Angle> CalculatedStyleValue::resolve_angle() const
@ -1149,7 +1149,7 @@ CalculatedStyleValue::CalculationResult CalculatedStyleValue::CalcNumberSumPartW
return value->resolve(layout_node, percentage_basis);
}
String ColorStyleValue::to_string() const
DeprecatedString ColorStyleValue::to_string() const
{
return serialize_a_srgb_value(m_color);
}
@ -1161,10 +1161,10 @@ bool ColorStyleValue::equals(StyleValue const& other) const
return m_color == other.as_color().m_color;
}
String ContentStyleValue::to_string() const
DeprecatedString ContentStyleValue::to_string() const
{
if (has_alt_text())
return String::formatted("{} / {}", m_content->to_string(), m_alt_text->to_string());
return DeprecatedString::formatted("{} / {}", m_content->to_string(), m_alt_text->to_string());
return m_content->to_string();
}
@ -1223,7 +1223,7 @@ float Filter::Color::resolved_amount() const
return 1.0f;
}
String FilterValueListStyleValue::to_string() const
DeprecatedString FilterValueListStyleValue::to_string() const
{
StringBuilder builder {};
bool first = true;
@ -1347,9 +1347,9 @@ bool FilterValueListStyleValue::equals(StyleValue const& other) const
return true;
}
String FlexStyleValue::to_string() const
DeprecatedString FlexStyleValue::to_string() const
{
return String::formatted("{} {} {}", m_grow->to_string(), m_shrink->to_string(), m_basis->to_string());
return DeprecatedString::formatted("{} {} {}", m_grow->to_string(), m_shrink->to_string(), m_basis->to_string());
}
bool FlexStyleValue::equals(StyleValue const& other) const
@ -1362,9 +1362,9 @@ bool FlexStyleValue::equals(StyleValue const& other) const
&& m_basis->equals(typed_other.m_basis);
}
String FlexFlowStyleValue::to_string() const
DeprecatedString FlexFlowStyleValue::to_string() const
{
return String::formatted("{} {}", m_flex_direction->to_string(), m_flex_wrap->to_string());
return DeprecatedString::formatted("{} {}", m_flex_direction->to_string(), m_flex_wrap->to_string());
}
bool FlexFlowStyleValue::equals(StyleValue const& other) const
@ -1376,9 +1376,9 @@ bool FlexFlowStyleValue::equals(StyleValue const& other) const
&& m_flex_wrap->equals(typed_other.m_flex_wrap);
}
String FontStyleValue::to_string() const
DeprecatedString FontStyleValue::to_string() const
{
return String::formatted("{} {} {} / {} {}", m_font_style->to_string(), m_font_weight->to_string(), m_font_size->to_string(), m_line_height->to_string(), m_font_families->to_string());
return DeprecatedString::formatted("{} {} {} / {} {}", m_font_style->to_string(), m_font_weight->to_string(), m_font_size->to_string(), m_line_height->to_string(), m_font_families->to_string());
}
bool FontStyleValue::equals(StyleValue const& other) const
@ -1400,11 +1400,11 @@ bool FrequencyStyleValue::equals(StyleValue const& other) const
return m_frequency == other.as_frequency().m_frequency;
}
String GridTrackPlacementShorthandStyleValue::to_string() const
DeprecatedString GridTrackPlacementShorthandStyleValue::to_string() const
{
if (m_end->grid_track_placement().is_auto())
return String::formatted("{}", m_start->grid_track_placement().to_string());
return String::formatted("{} / {}", m_start->grid_track_placement().to_string(), m_end->grid_track_placement().to_string());
return DeprecatedString::formatted("{}", m_start->grid_track_placement().to_string());
return DeprecatedString::formatted("{} / {}", m_start->grid_track_placement().to_string(), m_end->grid_track_placement().to_string());
}
bool GridTrackPlacementShorthandStyleValue::equals(StyleValue const& other) const
@ -1416,7 +1416,7 @@ bool GridTrackPlacementShorthandStyleValue::equals(StyleValue const& other) cons
&& m_end->equals(typed_other.m_end);
}
String GridTrackPlacementStyleValue::to_string() const
DeprecatedString GridTrackPlacementStyleValue::to_string() const
{
return m_grid_track_placement.to_string();
}
@ -1429,7 +1429,7 @@ bool GridTrackPlacementStyleValue::equals(StyleValue const& other) const
return m_grid_track_placement == typed_other.grid_track_placement();
}
String GridTrackSizeStyleValue::to_string() const
DeprecatedString GridTrackSizeStyleValue::to_string() const
{
return m_grid_track_size_list.to_string();
}
@ -1442,7 +1442,7 @@ bool GridTrackSizeStyleValue::equals(StyleValue const& other) const
return m_grid_track_size_list == typed_other.grid_track_size_list();
}
String IdentifierStyleValue::to_string() const
DeprecatedString IdentifierStyleValue::to_string() const
{
return CSS::string_from_value_id(m_id);
}
@ -1706,7 +1706,7 @@ Gfx::Bitmap const* ImageStyleValue::bitmap(size_t frame_index) const
return resource()->bitmap(frame_index);
}
String ImageStyleValue::to_string() const
DeprecatedString ImageStyleValue::to_string() const
{
return serialize_a_url(m_url.to_string());
}
@ -1758,7 +1758,7 @@ static void serialize_color_stop_list(StringBuilder& builder, auto const& color_
}
}
String LinearGradientStyleValue::to_string() const
DeprecatedString LinearGradientStyleValue::to_string() const
{
StringBuilder builder;
auto side_or_corner_to_string = [](SideOrCorner value) {
@ -1981,7 +1981,7 @@ bool PositionValue::operator==(PositionValue const& other) const
&& variant_equals(vertical_position, other.vertical_position));
}
String RadialGradientStyleValue::to_string() const
DeprecatedString RadialGradientStyleValue::to_string() const
{
StringBuilder builder;
if (is_repeating())
@ -2181,7 +2181,7 @@ void RadialGradientStyleValue::paint(PaintContext& context, Gfx::IntRect const&
Painting::paint_radial_gradient(context, dest_rect, m_resolved->data, m_resolved->center.to_rounded<int>(), m_resolved->gradient_size);
}
String ConicGradientStyleValue::to_string() const
DeprecatedString ConicGradientStyleValue::to_string() const
{
StringBuilder builder;
if (is_repeating())
@ -2250,9 +2250,9 @@ bool LengthStyleValue::equals(StyleValue const& other) const
return m_length == other.as_length().m_length;
}
String ListStyleStyleValue::to_string() const
DeprecatedString ListStyleStyleValue::to_string() const
{
return String::formatted("{} {} {}", m_position->to_string(), m_image->to_string(), m_style_type->to_string());
return DeprecatedString::formatted("{} {} {}", m_position->to_string(), m_image->to_string(), m_style_type->to_string());
}
bool ListStyleStyleValue::equals(StyleValue const& other) const
@ -2265,14 +2265,14 @@ bool ListStyleStyleValue::equals(StyleValue const& other) const
&& m_style_type->equals(typed_other.m_style_type);
}
String NumericStyleValue::to_string() const
DeprecatedString NumericStyleValue::to_string() const
{
return m_value.visit(
[](float value) {
return String::formatted("{}", value);
return DeprecatedString::formatted("{}", value);
},
[](i64 value) {
return String::formatted("{}", value);
return DeprecatedString::formatted("{}", value);
});
}
@ -2287,9 +2287,9 @@ bool NumericStyleValue::equals(StyleValue const& other) const
return m_value.get<float>() == other.as_numeric().m_value.get<float>();
}
String OverflowStyleValue::to_string() const
DeprecatedString OverflowStyleValue::to_string() const
{
return String::formatted("{} {}", m_overflow_x->to_string(), m_overflow_y->to_string());
return DeprecatedString::formatted("{} {}", m_overflow_x->to_string(), m_overflow_y->to_string());
}
bool OverflowStyleValue::equals(StyleValue const& other) const
@ -2301,7 +2301,7 @@ bool OverflowStyleValue::equals(StyleValue const& other) const
&& m_overflow_y->equals(typed_other.m_overflow_y);
}
String PercentageStyleValue::to_string() const
DeprecatedString PercentageStyleValue::to_string() const
{
return m_percentage.to_string();
}
@ -2313,7 +2313,7 @@ bool PercentageStyleValue::equals(StyleValue const& other) const
return m_percentage == other.as_percentage().m_percentage;
}
String PositionStyleValue::to_string() const
DeprecatedString PositionStyleValue::to_string() const
{
auto to_string = [](PositionEdge edge) {
switch (edge) {
@ -2329,7 +2329,7 @@ String PositionStyleValue::to_string() const
VERIFY_NOT_REACHED();
};
return String::formatted("{} {} {} {}", to_string(m_edge_x), m_offset_x.to_string(), to_string(m_edge_y), m_offset_y.to_string());
return DeprecatedString::formatted("{} {} {} {}", to_string(m_edge_x), m_offset_x.to_string(), to_string(m_edge_y), m_offset_y.to_string());
}
bool PositionStyleValue::equals(StyleValue const& other) const
@ -2343,9 +2343,9 @@ bool PositionStyleValue::equals(StyleValue const& other) const
&& m_offset_y == typed_other.m_offset_y;
}
String RectStyleValue::to_string() const
DeprecatedString RectStyleValue::to_string() const
{
return String::formatted("rect({} {} {} {})", m_rect.top_edge, m_rect.right_edge, m_rect.bottom_edge, m_rect.left_edge);
return DeprecatedString::formatted("rect({} {} {} {})", m_rect.top_edge, m_rect.right_edge, m_rect.bottom_edge, m_rect.left_edge);
}
bool RectStyleValue::equals(StyleValue const& other) const
@ -2363,7 +2363,7 @@ bool ResolutionStyleValue::equals(StyleValue const& other) const
return m_resolution == other.as_resolution().m_resolution;
}
String ShadowStyleValue::to_string() const
DeprecatedString ShadowStyleValue::to_string() const
{
StringBuilder builder;
builder.appendff("{} {} {} {} {}", m_color.to_string(), m_offset_x.to_string(), m_offset_y.to_string(), m_blur_radius.to_string(), m_spread_distance.to_string());
@ -2392,9 +2392,9 @@ bool StringStyleValue::equals(StyleValue const& other) const
return m_string == other.as_string().m_string;
}
String TextDecorationStyleValue::to_string() const
DeprecatedString TextDecorationStyleValue::to_string() const
{
return String::formatted("{} {} {} {}", m_line->to_string(), m_thickness->to_string(), m_style->to_string(), m_color->to_string());
return DeprecatedString::formatted("{} {} {} {}", m_line->to_string(), m_thickness->to_string(), m_style->to_string(), m_color->to_string());
}
bool TextDecorationStyleValue::equals(StyleValue const& other) const
@ -2415,7 +2415,7 @@ bool TimeStyleValue::equals(StyleValue const& other) const
return m_time == other.as_time().m_time;
}
String TransformationStyleValue::to_string() const
DeprecatedString TransformationStyleValue::to_string() const
{
StringBuilder builder;
builder.append(CSS::to_string(m_transform_function));
@ -2442,7 +2442,7 @@ bool TransformationStyleValue::equals(StyleValue const& other) const
return true;
}
String UnresolvedStyleValue::to_string() const
DeprecatedString UnresolvedStyleValue::to_string() const
{
StringBuilder builder;
for (auto& value : m_values)
@ -2463,9 +2463,9 @@ bool UnsetStyleValue::equals(StyleValue const& other) const
return type() == other.type();
}
String StyleValueList::to_string() const
DeprecatedString StyleValueList::to_string() const
{
String separator = "";
DeprecatedString separator = "";
switch (m_separator) {
case Separator::Space:
separator = " ";
@ -2477,7 +2477,7 @@ String StyleValueList::to_string() const
VERIFY_NOT_REACHED();
}
return String::join(separator, m_values);
return DeprecatedString::join(separator, m_values);
}
bool StyleValueList::equals(StyleValue const& other) const

View file

@ -8,6 +8,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/Function.h>
#include <AK/GenericShorthands.h>
#include <AK/NonnullOwnPtr.h>
@ -15,7 +16,6 @@
#include <AK/NonnullRefPtrVector.h>
#include <AK/RefCounted.h>
#include <AK/RefPtr.h>
#include <AK/String.h>
#include <AK/StringView.h>
#include <AK/URL.h>
#include <AK/Variant.h>
@ -403,7 +403,7 @@ public:
virtual Length to_length() const { VERIFY_NOT_REACHED(); }
virtual float to_number() const { return 0; }
virtual float to_integer() const { return 0; }
virtual String to_string() const = 0;
virtual DeprecatedString to_string() const = 0;
bool operator==(StyleValue const& other) const { return equals(other); }
@ -426,7 +426,7 @@ public:
Angle const& angle() const { return m_angle; }
virtual String to_string() const override { return m_angle.to_string(); }
virtual DeprecatedString to_string() const override { return m_angle.to_string(); }
virtual bool equals(StyleValue const& other) const override
{
@ -472,7 +472,7 @@ public:
NonnullRefPtr<StyleValue> repeat() const { return m_repeat; }
NonnullRefPtr<StyleValue> size() const { return m_size; }
virtual String to_string() const override;
virtual DeprecatedString to_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -509,7 +509,7 @@ public:
Repeat repeat_x() const { return m_repeat_x; }
Repeat repeat_y() const { return m_repeat_y; }
virtual String to_string() const override;
virtual DeprecatedString to_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -536,7 +536,7 @@ public:
LengthPercentage size_x() const { return m_size_x; }
LengthPercentage size_y() const { return m_size_y; }
virtual String to_string() const override;
virtual DeprecatedString to_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -566,7 +566,7 @@ public:
NonnullRefPtr<StyleValue> border_style() const { return m_border_style; }
NonnullRefPtr<StyleValue> border_color() const { return m_border_color; }
virtual String to_string() const override;
virtual DeprecatedString to_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -598,7 +598,7 @@ public:
LengthPercentage const& vertical_radius() const { return m_vertical_radius; }
bool is_elliptical() const { return m_is_elliptical; }
virtual String to_string() const override;
virtual DeprecatedString to_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -630,7 +630,7 @@ public:
NonnullRefPtr<BorderRadiusStyleValue> bottom_right() const { return m_bottom_right; }
NonnullRefPtr<BorderRadiusStyleValue> bottom_left() const { return m_bottom_left; }
virtual String to_string() const override;
virtual DeprecatedString to_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -702,14 +702,14 @@ public:
struct CalcNumberValue {
Variant<Number, NonnullOwnPtr<CalcNumberSum>> value;
String to_string() const;
DeprecatedString to_string() const;
Optional<ResolvedType> resolved_type() const;
CalculationResult resolve(Layout::Node const*, PercentageBasis const& percentage_basis) const;
};
struct CalcValue {
Variant<Number, Angle, Frequency, Length, Percentage, Time, NonnullOwnPtr<CalcSum>> value;
String to_string() const;
DeprecatedString to_string() const;
Optional<ResolvedType> resolved_type() const;
CalculationResult resolve(Layout::Node const*, PercentageBasis const& percentage_basis) const;
bool contains_percentage() const;
@ -724,7 +724,7 @@ public:
NonnullOwnPtr<CalcProduct> first_calc_product;
NonnullOwnPtrVector<CalcSumPartWithOperator> zero_or_more_additional_calc_products;
String to_string() const;
DeprecatedString to_string() const;
Optional<ResolvedType> resolved_type() const;
CalculationResult resolve(Layout::Node const*, PercentageBasis const& percentage_basis) const;
@ -739,7 +739,7 @@ public:
NonnullOwnPtr<CalcNumberProduct> first_calc_number_product;
NonnullOwnPtrVector<CalcNumberSumPartWithOperator> zero_or_more_additional_calc_number_products;
String to_string() const;
DeprecatedString to_string() const;
Optional<ResolvedType> resolved_type() const;
CalculationResult resolve(Layout::Node const*, PercentageBasis const& percentage_basis) const;
};
@ -748,7 +748,7 @@ public:
CalcValue first_calc_value;
NonnullOwnPtrVector<CalcProductPartWithOperator> zero_or_more_additional_calc_values;
String to_string() const;
DeprecatedString to_string() const;
Optional<ResolvedType> resolved_type() const;
CalculationResult resolve(Layout::Node const*, PercentageBasis const& percentage_basis) const;
bool contains_percentage() const;
@ -762,7 +762,7 @@ public:
SumOperation op;
NonnullOwnPtr<CalcProduct> value;
String to_string() const;
DeprecatedString to_string() const;
Optional<ResolvedType> resolved_type() const;
CalculationResult resolve(Layout::Node const*, PercentageBasis const& percentage_basis) const;
bool contains_percentage() const;
@ -772,7 +772,7 @@ public:
ProductOperation op;
Variant<CalcValue, CalcNumberValue> value;
String to_string() const;
DeprecatedString to_string() const;
Optional<ResolvedType> resolved_type() const;
CalculationResult resolve(Layout::Node const*, PercentageBasis const& percentage_basis) const;
@ -783,7 +783,7 @@ public:
CalcNumberValue first_calc_number_value;
NonnullOwnPtrVector<CalcNumberProductPartWithOperator> zero_or_more_additional_calc_number_values;
String to_string() const;
DeprecatedString to_string() const;
Optional<ResolvedType> resolved_type() const;
CalculationResult resolve(Layout::Node const*, PercentageBasis const& percentage_basis) const;
};
@ -792,7 +792,7 @@ public:
ProductOperation op;
CalcNumberValue value;
String to_string() const;
DeprecatedString to_string() const;
Optional<ResolvedType> resolved_type() const;
CalculationResult resolve(Layout::Node const*, PercentageBasis const& percentage_basis) const;
};
@ -805,7 +805,7 @@ public:
SumOperation op;
NonnullOwnPtr<CalcNumberProduct> value;
String to_string() const;
DeprecatedString to_string() const;
Optional<ResolvedType> resolved_type() const;
CalculationResult resolve(Layout::Node const*, PercentageBasis const& percentage_basis) const;
};
@ -815,7 +815,7 @@ public:
return adopt_ref(*new CalculatedStyleValue(move(calc_sum), resolved_type));
}
String to_string() const override;
DeprecatedString to_string() const override;
virtual bool equals(StyleValue const& other) const override;
ResolvedType resolved_type() const { return m_resolved_type; }
NonnullOwnPtr<CalcSum> const& expression() const { return m_expression; }
@ -864,7 +864,7 @@ public:
virtual ~ColorStyleValue() override = default;
Color color() const { return m_color; }
virtual String to_string() const override;
virtual DeprecatedString to_string() const override;
virtual bool has_color() const override { return true; }
virtual Color to_color(Layout::NodeWithStyle const&) const override { return m_color; }
@ -891,7 +891,7 @@ public:
bool has_alt_text() const { return !m_alt_text.is_null(); }
StyleValueList const* alt_text() const { return m_alt_text; }
virtual String to_string() const override;
virtual DeprecatedString to_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -917,7 +917,7 @@ public:
Vector<FilterFunction> const& filter_value_list() const { return m_filter_value_list; }
virtual String to_string() const override;
virtual DeprecatedString to_string() const override;
virtual bool equals(StyleValue const& other) const override;
virtual ~FilterValueListStyleValue() override = default;
@ -948,7 +948,7 @@ public:
NonnullRefPtr<StyleValue> shrink() const { return m_shrink; }
NonnullRefPtr<StyleValue> basis() const { return m_basis; }
virtual String to_string() const override;
virtual DeprecatedString to_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -979,7 +979,7 @@ public:
NonnullRefPtr<StyleValue> flex_direction() const { return m_flex_direction; }
NonnullRefPtr<StyleValue> flex_wrap() const { return m_flex_wrap; }
virtual String to_string() const override;
virtual DeprecatedString to_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -1005,7 +1005,7 @@ public:
NonnullRefPtr<StyleValue> line_height() const { return m_line_height; }
NonnullRefPtr<StyleValue> font_families() const { return m_font_families; }
virtual String to_string() const override;
virtual DeprecatedString to_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -1037,7 +1037,7 @@ public:
Frequency const& frequency() const { return m_frequency; }
virtual String to_string() const override { return m_frequency.to_string(); }
virtual DeprecatedString to_string() const override { return m_frequency.to_string(); }
virtual bool equals(StyleValue const& other) const override;
private:
@ -1056,7 +1056,7 @@ public:
virtual ~GridTrackPlacementStyleValue() override = default;
CSS::GridTrackPlacement const& grid_track_placement() const { return m_grid_track_placement; }
virtual String to_string() const override;
virtual DeprecatedString to_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -1084,7 +1084,7 @@ public:
NonnullRefPtr<GridTrackPlacementStyleValue> start() const { return m_start; }
NonnullRefPtr<GridTrackPlacementStyleValue> end() const { return m_end; }
virtual String to_string() const override;
virtual DeprecatedString to_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -1108,7 +1108,7 @@ public:
CSS::GridTrackSizeList grid_track_size_list() const { return m_grid_track_size_list; }
virtual String to_string() const override;
virtual DeprecatedString to_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -1136,7 +1136,7 @@ public:
virtual CSS::ValueID to_identifier() const override { return m_id; }
virtual bool has_color() const override;
virtual Color to_color(Layout::NodeWithStyle const& node) const override;
virtual String to_string() const override;
virtual DeprecatedString to_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -1170,7 +1170,7 @@ public:
static NonnullRefPtr<ImageStyleValue> create(AK::URL const& url) { return adopt_ref(*new ImageStyleValue(url)); }
virtual ~ImageStyleValue() override = default;
virtual String to_string() const override;
virtual DeprecatedString to_string() const override;
virtual bool equals(StyleValue const& other) const override;
virtual void load_any_resources(DOM::Document&) override;
@ -1238,7 +1238,7 @@ public:
return adopt_ref(*new RadialGradientStyleValue(ending_shape, size, position, move(color_stop_list), repeating));
}
virtual String to_string() const override;
virtual DeprecatedString to_string() const override;
void paint(PaintContext&, Gfx::IntRect const& dest_rect, CSS::ImageRendering) const override;
@ -1293,7 +1293,7 @@ public:
return adopt_ref(*new ConicGradientStyleValue(from_angle, position, move(color_stop_list), repeating));
}
virtual String to_string() const override;
virtual DeprecatedString to_string() const override;
void paint(PaintContext&, Gfx::IntRect const& dest_rect, CSS::ImageRendering) const override;
@ -1355,7 +1355,7 @@ public:
return adopt_ref(*new LinearGradientStyleValue(direction, move(color_stop_list), type, repeating));
}
virtual String to_string() const override;
virtual DeprecatedString to_string() const override;
virtual ~LinearGradientStyleValue() override = default;
virtual bool equals(StyleValue const& other) const override;
@ -1405,7 +1405,7 @@ public:
}
virtual ~InheritStyleValue() override = default;
String to_string() const override { return "inherit"; }
DeprecatedString to_string() const override { return "inherit"; }
virtual bool equals(StyleValue const& other) const override;
private:
@ -1424,7 +1424,7 @@ public:
}
virtual ~InitialStyleValue() override = default;
String to_string() const override { return "initial"; }
DeprecatedString to_string() const override { return "initial"; }
virtual bool equals(StyleValue const& other) const override;
private:
@ -1444,7 +1444,7 @@ public:
virtual bool has_auto() const override { return m_length.is_auto(); }
virtual bool has_length() const override { return true; }
virtual bool has_identifier() const override { return has_auto(); }
virtual String to_string() const override { return m_length.to_string(); }
virtual DeprecatedString to_string() const override { return m_length.to_string(); }
virtual Length to_length() const override { return m_length; }
virtual ValueID to_identifier() const override { return has_auto() ? ValueID::Auto : ValueID::Invalid; }
virtual NonnullRefPtr<StyleValue> absolutized(Gfx::IntRect const& viewport_rect, Gfx::FontPixelMetrics const& font_metrics, float font_size, float root_font_size) const override;
@ -1475,7 +1475,7 @@ public:
NonnullRefPtr<StyleValue> image() const { return m_image; }
NonnullRefPtr<StyleValue> style_type() const { return m_style_type; }
virtual String to_string() const override;
virtual DeprecatedString to_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -1521,7 +1521,7 @@ public:
virtual bool has_integer() const override { return m_value.has<i64>(); }
virtual float to_integer() const override { return m_value.get<i64>(); }
virtual String to_string() const override;
virtual DeprecatedString to_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -1545,7 +1545,7 @@ public:
NonnullRefPtr<StyleValue> overflow_x() const { return m_overflow_x; }
NonnullRefPtr<StyleValue> overflow_y() const { return m_overflow_y; }
virtual String to_string() const override;
virtual DeprecatedString to_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -1571,7 +1571,7 @@ public:
Percentage const& percentage() const { return m_percentage; }
Percentage& percentage() { return m_percentage; }
virtual String to_string() const override;
virtual DeprecatedString to_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -1597,7 +1597,7 @@ public:
PositionEdge edge_y() const { return m_edge_y; }
LengthPercentage const& offset_y() const { return m_offset_y; }
virtual String to_string() const override;
virtual DeprecatedString to_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -1626,7 +1626,7 @@ public:
Resolution const& resolution() const { return m_resolution; }
virtual String to_string() const override { return m_resolution.to_string(); }
virtual DeprecatedString to_string() const override { return m_resolution.to_string(); }
virtual bool equals(StyleValue const& other) const override;
private:
@ -1655,7 +1655,7 @@ public:
Length const& spread_distance() const { return m_spread_distance; }
ShadowPlacement placement() const { return m_placement; }
virtual String to_string() const override;
virtual DeprecatedString to_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -1682,23 +1682,23 @@ private:
class StringStyleValue : public StyleValue {
public:
static NonnullRefPtr<StringStyleValue> create(String const& string)
static NonnullRefPtr<StringStyleValue> create(DeprecatedString const& string)
{
return adopt_ref(*new StringStyleValue(string));
}
virtual ~StringStyleValue() override = default;
String to_string() const override { return m_string; }
DeprecatedString to_string() const override { return m_string; }
virtual bool equals(StyleValue const& other) const override;
private:
explicit StringStyleValue(String const& string)
explicit StringStyleValue(DeprecatedString const& string)
: StyleValue(Type::String)
, m_string(string)
{
}
String m_string;
DeprecatedString m_string;
};
class TextDecorationStyleValue final : public StyleValue {
@ -1718,7 +1718,7 @@ public:
NonnullRefPtr<StyleValue> style() const { return m_style; }
NonnullRefPtr<StyleValue> color() const { return m_color; }
virtual String to_string() const override;
virtual DeprecatedString to_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -1751,7 +1751,7 @@ public:
Time const& time() const { return m_time; }
virtual String to_string() const override { return m_time.to_string(); }
virtual DeprecatedString to_string() const override { return m_time.to_string(); }
virtual bool equals(StyleValue const& other) const override;
private:
@ -1775,7 +1775,7 @@ public:
CSS::TransformFunction transform_function() const { return m_transform_function; }
NonnullRefPtrVector<StyleValue> values() const { return m_values; }
virtual String to_string() const override;
virtual DeprecatedString to_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -1798,7 +1798,7 @@ public:
}
virtual ~UnresolvedStyleValue() override = default;
virtual String to_string() const override;
virtual DeprecatedString to_string() const override;
virtual bool equals(StyleValue const& other) const override;
Vector<Parser::ComponentValue> const& values() const { return m_values; }
@ -1825,7 +1825,7 @@ public:
}
virtual ~UnsetStyleValue() override = default;
String to_string() const override { return "unset"; }
DeprecatedString to_string() const override { return "unset"; }
virtual bool equals(StyleValue const& other) const override;
private:
@ -1852,7 +1852,7 @@ public:
return m_values[i];
}
virtual String to_string() const override;
virtual DeprecatedString to_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -1873,7 +1873,7 @@ public:
virtual ~RectStyleValue() override = default;
EdgeRect rect() const { return m_rect; }
virtual String to_string() const override;
virtual DeprecatedString to_string() const override;
virtual bool has_rect() const override { return true; }
virtual EdgeRect to_rect() const override { return m_rect; }
virtual bool equals(StyleValue const& other) const override;

View file

@ -73,42 +73,42 @@ bool Supports::Feature::evaluate() const
});
}
String Supports::Declaration::to_string() const
DeprecatedString Supports::Declaration::to_string() const
{
return String::formatted("({})", declaration);
return DeprecatedString::formatted("({})", declaration);
}
String Supports::Selector::to_string() const
DeprecatedString Supports::Selector::to_string() const
{
return String::formatted("selector({})", selector);
return DeprecatedString::formatted("selector({})", selector);
}
String Supports::Feature::to_string() const
DeprecatedString Supports::Feature::to_string() const
{
return value.visit([](auto& it) { return it.to_string(); });
}
String Supports::InParens::to_string() const
DeprecatedString Supports::InParens::to_string() const
{
return value.visit(
[](NonnullOwnPtr<Condition> const& condition) -> String { return String::formatted("({})", condition->to_string()); },
[](auto& it) -> String { return it.to_string(); });
[](NonnullOwnPtr<Condition> const& condition) -> DeprecatedString { return DeprecatedString::formatted("({})", condition->to_string()); },
[](auto& it) -> DeprecatedString { return it.to_string(); });
}
String Supports::Condition::to_string() const
DeprecatedString Supports::Condition::to_string() const
{
switch (type) {
case Type::Not:
return String::formatted("not {}", children.first().to_string());
return DeprecatedString::formatted("not {}", children.first().to_string());
case Type::And:
return String::join(" and "sv, children);
return DeprecatedString::join(" and "sv, children);
case Type::Or:
return String::join(" or "sv, children);
return DeprecatedString::join(" or "sv, children);
}
VERIFY_NOT_REACHED();
}
String Supports::to_string() const
DeprecatedString Supports::to_string() const
{
return m_condition->to_string();
}

View file

@ -6,9 +6,9 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/NonnullOwnPtr.h>
#include <AK/RefCounted.h>
#include <AK/String.h>
#include <AK/Variant.h>
#include <AK/Vector.h>
#include <LibWeb/CSS/GeneralEnclosed.h>
@ -22,21 +22,21 @@ class Supports final : public RefCounted<Supports> {
public:
struct Declaration {
String declaration;
DeprecatedString declaration;
bool evaluate() const;
String to_string() const;
DeprecatedString to_string() const;
};
struct Selector {
String selector;
DeprecatedString selector;
bool evaluate() const;
String to_string() const;
DeprecatedString to_string() const;
};
struct Feature {
Variant<Declaration, Selector> value;
bool evaluate() const;
String to_string() const;
DeprecatedString to_string() const;
};
struct Condition;
@ -44,7 +44,7 @@ public:
Variant<NonnullOwnPtr<Condition>, Feature, GeneralEnclosed> value;
bool evaluate() const;
String to_string() const;
DeprecatedString to_string() const;
};
struct Condition {
@ -57,7 +57,7 @@ public:
Vector<InParens> children;
bool evaluate() const;
String to_string() const;
DeprecatedString to_string() const;
};
static NonnullRefPtr<Supports> create(NonnullOwnPtr<Condition>&& condition)
@ -66,7 +66,7 @@ public:
}
bool matches() const { return m_matches; }
String to_string() const;
DeprecatedString to_string() const;
private:
Supports(NonnullOwnPtr<Condition>&&);

View file

@ -40,11 +40,11 @@ Time Time::percentage_of(Percentage const& percentage) const
return Time { percentage.as_fraction() * m_value, m_type };
}
String Time::to_string() const
DeprecatedString Time::to_string() const
{
if (is_calculated())
return m_calculated_style->to_string();
return String::formatted("{}{}", m_value, unit_name());
return DeprecatedString::formatted("{}{}", m_value, unit_name());
}
float Time::to_seconds() const

View file

@ -6,8 +6,8 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/RefPtr.h>
#include <AK/String.h>
#include <LibWeb/Forward.h>
namespace Web::CSS {
@ -31,7 +31,7 @@ public:
bool is_calculated() const { return m_type == Type::Calculated; }
NonnullRefPtr<CalculatedStyleValue> calculated_style_value() const;
String to_string() const;
DeprecatedString to_string() const;
float to_seconds() const;
bool operator==(Time const& other) const

View file

@ -7,7 +7,7 @@
#pragma once
#include <AK/Assertions.h>
#include <AK/String.h>
#include <AK/DeprecatedString.h>
namespace Web::CSS {
@ -29,11 +29,11 @@ public:
return m_min_code_point <= code_point && code_point <= m_max_code_point;
}
String to_string() const
DeprecatedString to_string() const
{
if (m_min_code_point == m_max_code_point)
return String::formatted("U+{:x}", m_min_code_point);
return String::formatted("U+{:x}-{:x}", m_min_code_point, m_max_code_point);
return DeprecatedString::formatted("U+{:x}", m_min_code_point);
return DeprecatedString::formatted("U+{:x}-{:x}", m_min_code_point, m_max_code_point);
}
private: