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

@ -392,7 +392,7 @@ void BrowsingContext::scroll_to(Gfx::IntPoint const& position)
m_page->client().page_did_request_scroll_to(position);
}
void BrowsingContext::scroll_to_anchor(String const& fragment)
void BrowsingContext::scroll_to_anchor(DeprecatedString const& fragment)
{
JS::GCPtr<DOM::Document> document = active_document();
if (!document)
@ -468,7 +468,7 @@ void BrowsingContext::set_cursor_position(DOM::Position position)
reset_cursor_blink_cycle();
}
String BrowsingContext::selected_text() const
DeprecatedString BrowsingContext::selected_text() const
{
StringBuilder builder;
if (!active_document())
@ -901,8 +901,8 @@ WebIDL::ExceptionOr<void> BrowsingContext::navigate(
bool exceptions_enabled,
HistoryHandlingBehavior history_handling,
Optional<PolicyContainer> history_policy_container,
String navigation_type,
Optional<String> navigation_id,
DeprecatedString navigation_type,
Optional<DeprecatedString> navigation_id,
Function<void(JS::NonnullGCPtr<Fetch::Infrastructure::Response>)> process_response_end_of_body)
{
// 1. If resource is a URL, then set resource to a new request whose URL is resource.
@ -1019,7 +1019,7 @@ WebIDL::ExceptionOr<void> BrowsingContext::navigate(
}
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate-fragid
WebIDL::ExceptionOr<void> BrowsingContext::navigate_to_a_fragment(AK::URL const& url, HistoryHandlingBehavior history_handling, String navigation_id)
WebIDL::ExceptionOr<void> BrowsingContext::navigate_to_a_fragment(AK::URL const& url, HistoryHandlingBehavior history_handling, DeprecatedString navigation_id)
{
// 1. If historyHandling is not "replace",
if (history_handling != HistoryHandlingBehavior::Replace) {

View file

@ -151,7 +151,7 @@ public:
Web::EventHandler const& event_handler() const { return m_event_handler; }
void scroll_to(Gfx::IntPoint const&);
void scroll_to_anchor(String const&);
void scroll_to_anchor(DeprecatedString const&);
BrowsingContext& top_level_browsing_context()
{
@ -193,7 +193,7 @@ public:
bool cursor_blink_state() const { return m_cursor_blink_state; }
String selected_text() const;
DeprecatedString selected_text() const;
void select_all();
void did_edit(Badge<EditEventHandler>);
@ -211,8 +211,8 @@ public:
JS::GCPtr<DOM::Node> currently_focused_area();
String const& name() const { return m_name; }
void set_name(String const& name) { m_name = name; }
DeprecatedString const& name() const { return m_name; }
void set_name(DeprecatedString const& name) { m_name = name; }
Vector<SessionHistoryEntry>& session_history() { return m_session_history; }
Vector<SessionHistoryEntry> const& session_history() const { return m_session_history; }
@ -237,12 +237,12 @@ public:
bool exceptions_enabled = false,
HistoryHandlingBehavior history_handling = HistoryHandlingBehavior::Default,
Optional<PolicyContainer> history_policy_container = {},
String navigation_type = "other",
Optional<String> navigation_id = {},
DeprecatedString navigation_type = "other",
Optional<DeprecatedString> navigation_id = {},
Function<void(JS::NonnullGCPtr<Fetch::Infrastructure::Response>)> process_response_end_of_body = {});
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate-fragid
WebIDL::ExceptionOr<void> navigate_to_a_fragment(AK::URL const&, HistoryHandlingBehavior, String navigation_id);
WebIDL::ExceptionOr<void> navigate_to_a_fragment(AK::URL const&, HistoryHandlingBehavior, DeprecatedString navigation_id);
// https://html.spec.whatwg.org/multipage/origin.html#one-permitted-sandboxed-navigator
BrowsingContext const* the_one_permitted_sandboxed_navigator() const;
@ -313,7 +313,7 @@ private:
HashTable<ViewportClient*> m_viewport_clients;
HashMap<AK::URL, size_t> m_frame_nesting_levels;
String m_name;
DeprecatedString m_name;
// https://html.spec.whatwg.org/multipage/browsers.html#tlbc-group
JS::GCPtr<BrowsingContextGroup> m_group;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -49,7 +49,7 @@ CanvasGradient::CanvasGradient(JS::Realm& realm, Type type)
CanvasGradient::~CanvasGradient() = default;
// https://html.spec.whatwg.org/multipage/canvas.html#dom-canvasgradient-addcolorstop
WebIDL::ExceptionOr<void> CanvasGradient::add_color_stop(double offset, String const& color)
WebIDL::ExceptionOr<void> CanvasGradient::add_color_stop(double offset, DeprecatedString const& color)
{
// 1. If the offset is less than 0 or greater than 1, then throw an "IndexSizeError" DOMException.
if (offset < 0 || offset > 1)

View file

@ -25,7 +25,7 @@ public:
static JS::NonnullGCPtr<CanvasGradient> create_linear(JS::Realm&, double x0, double y0, double x1, double y1);
static JS::NonnullGCPtr<CanvasGradient> create_conic(JS::Realm&, double start_angle, double x, double y);
WebIDL::ExceptionOr<void> add_color_stop(double offset, String const& color);
WebIDL::ExceptionOr<void> add_color_stop(double offset, DeprecatedString const& color);
~CanvasGradient();

View file

@ -194,7 +194,7 @@ Optional<Gfx::AntiAliasingPainter> CanvasRenderingContext2D::antialiased_painter
return {};
}
void CanvasRenderingContext2D::fill_text(String const& text, float x, float y, Optional<double> max_width)
void CanvasRenderingContext2D::fill_text(DeprecatedString const& text, float x, float y, Optional<double> max_width)
{
if (max_width.has_value() && max_width.value() <= 0)
return;
@ -212,7 +212,7 @@ void CanvasRenderingContext2D::fill_text(String const& text, float x, float y, O
did_draw(transformed_rect.to_type<float>());
}
void CanvasRenderingContext2D::stroke_text(String const& text, float x, float y, Optional<double> max_width)
void CanvasRenderingContext2D::stroke_text(DeprecatedString const& text, float x, float y, Optional<double> max_width)
{
// FIXME: Stroke the text instead of filling it.
fill_text(text, x, y, max_width);
@ -247,7 +247,7 @@ void CanvasRenderingContext2D::stroke(Path2D const& path)
stroke_internal(transformed_path);
}
void CanvasRenderingContext2D::fill_internal(Gfx::Path& path, String const& fill_rule)
void CanvasRenderingContext2D::fill_internal(Gfx::Path& path, DeprecatedString const& fill_rule)
{
auto painter = this->antialiased_painter();
if (!painter.has_value())
@ -267,12 +267,12 @@ void CanvasRenderingContext2D::fill_internal(Gfx::Path& path, String const& fill
did_draw(path.bounding_box());
}
void CanvasRenderingContext2D::fill(String const& fill_rule)
void CanvasRenderingContext2D::fill(DeprecatedString const& fill_rule)
{
return fill_internal(path(), fill_rule);
}
void CanvasRenderingContext2D::fill(Path2D& path, String const& fill_rule)
void CanvasRenderingContext2D::fill(Path2D& path, DeprecatedString const& fill_rule)
{
auto transformed_path = path.path().copy_transformed(drawing_state().transform);
return fill_internal(transformed_path, fill_rule);
@ -357,7 +357,7 @@ void CanvasRenderingContext2D::reset_to_default_state()
}
// https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-measuretext
JS::NonnullGCPtr<TextMetrics> CanvasRenderingContext2D::measure_text(String const& text)
JS::NonnullGCPtr<TextMetrics> CanvasRenderingContext2D::measure_text(DeprecatedString const& text)
{
// The measureText(text) method steps are to run the text preparation
// algorithm, passing it text and the object implementing the CanvasText
@ -398,7 +398,7 @@ JS::NonnullGCPtr<TextMetrics> CanvasRenderingContext2D::measure_text(String cons
}
// https://html.spec.whatwg.org/multipage/canvas.html#text-preparation-algorithm
CanvasRenderingContext2D::PreparedText CanvasRenderingContext2D::prepare_text(String const& text, float max_width)
CanvasRenderingContext2D::PreparedText CanvasRenderingContext2D::prepare_text(DeprecatedString const& text, float max_width)
{
// 1. If maxWidth was provided but is less than or equal to zero or equal to NaN, then return an empty array.
if (max_width <= 0 || max_width != max_width) {
@ -410,7 +410,7 @@ CanvasRenderingContext2D::PreparedText CanvasRenderingContext2D::prepare_text(St
for (auto c : text) {
builder.append(Infra::is_ascii_whitespace(c) ? ' ' : c);
}
String replaced_text = builder.build();
DeprecatedString replaced_text = builder.build();
// 3. Let font be the current font of target, as given by that object's font attribute.
// FIXME: Once we have CanvasTextDrawingStyles, implement font selection.

View file

@ -65,11 +65,11 @@ public:
virtual void stroke() override;
virtual void stroke(Path2D const& path) override;
virtual void fill_text(String const&, float x, float y, Optional<double> max_width) override;
virtual void stroke_text(String const&, float x, float y, Optional<double> max_width) override;
virtual void fill_text(DeprecatedString const&, float x, float y, Optional<double> max_width) override;
virtual void stroke_text(DeprecatedString const&, float x, float y, Optional<double> max_width) override;
virtual void fill(String const& fill_rule) override;
virtual void fill(Path2D& path, String const& fill_rule) override;
virtual void fill(DeprecatedString const& fill_rule) override;
virtual void fill(Path2D& path, DeprecatedString const& fill_rule) override;
virtual JS::GCPtr<ImageData> create_image_data(int width, int height) const override;
virtual WebIDL::ExceptionOr<JS::GCPtr<ImageData>> get_image_data(int x, int y, int width, int height) const override;
@ -79,7 +79,7 @@ public:
JS::NonnullGCPtr<HTMLCanvasElement> canvas_for_binding() const;
virtual JS::NonnullGCPtr<TextMetrics> measure_text(String const& text) override;
virtual JS::NonnullGCPtr<TextMetrics> measure_text(DeprecatedString const& text) override;
virtual void clip() override;
@ -100,7 +100,7 @@ private:
};
void did_draw(Gfx::FloatRect const&);
PreparedText prepare_text(String const& text, float max_width = INFINITY);
PreparedText prepare_text(DeprecatedString const& text, float max_width = INFINITY);
Gfx::Painter* painter();
Optional<Gfx::AntiAliasingPainter> antialiased_painter();
@ -109,7 +109,7 @@ private:
HTMLCanvasElement const& canvas_element() const;
void stroke_internal(Gfx::Path const&);
void fill_internal(Gfx::Path&, String const& fill_rule);
void fill_internal(Gfx::Path&, DeprecatedString const& fill_rule);
JS::NonnullGCPtr<HTMLCanvasElement> m_element;
OwnPtr<Gfx::Painter> m_painter;

View file

@ -14,7 +14,7 @@ namespace Web::HTML {
struct CloseEventInit : public DOM::EventInit {
bool was_clean { false };
u16 code { 0 };
String reason { "" };
DeprecatedString reason { "" };
};
class CloseEvent : public DOM::Event {
@ -28,14 +28,14 @@ public:
bool was_clean() const { return m_was_clean; }
u16 code() const { return m_code; }
String reason() const { return m_reason; }
DeprecatedString reason() const { return m_reason; }
private:
CloseEvent(JS::Realm&, FlyString const& event_name, CloseEventInit const& event_init);
bool m_was_clean { false };
u16 m_code { 0 };
String m_reason;
DeprecatedString m_reason;
};
}

View file

@ -78,7 +78,7 @@ JS::ThrowCompletionOr<JS::PropertyDescriptor> cross_origin_property_fallback(JS:
return JS::PropertyDescriptor { .value = JS::js_undefined(), .writable = false, .enumerable = false, .configurable = true };
// 2. Throw a "SecurityError" DOMException.
return throw_completion(WebIDL::SecurityError::create(*vm.current_realm(), String::formatted("Can't access property '{}' on cross-origin object", property_key)));
return throw_completion(WebIDL::SecurityError::create(*vm.current_realm(), DeprecatedString::formatted("Can't access property '{}' on cross-origin object", property_key)));
}
// 7.2.3.3 IsPlatformObjectSameOrigin ( O ), https://html.spec.whatwg.org/multipage/browsers.html#isplatformobjectsameorigin-(-o-)
@ -196,7 +196,7 @@ JS::ThrowCompletionOr<JS::Value> cross_origin_get(JS::VM& vm, JS::Object const&
// 6. If getter is undefined, then throw a "SecurityError" DOMException.
if (!getter.has_value())
return throw_completion(WebIDL::SecurityError::create(*vm.current_realm(), String::formatted("Can't get property '{}' on cross-origin object", property_key)));
return throw_completion(WebIDL::SecurityError::create(*vm.current_realm(), DeprecatedString::formatted("Can't get property '{}' on cross-origin object", property_key)));
// 7. Return ? Call(getter, Receiver).
return JS::call(vm, *getter, receiver);
@ -222,7 +222,7 @@ JS::ThrowCompletionOr<bool> cross_origin_set(JS::VM& vm, JS::Object& object, JS:
}
// 4. Throw a "SecurityError" DOMException.
return throw_completion(WebIDL::SecurityError::create(*vm.current_realm(), String::formatted("Can't set property '{}' on cross-origin object", property_key)));
return throw_completion(WebIDL::SecurityError::create(*vm.current_realm(), DeprecatedString::formatted("Can't set property '{}' on cross-origin object", property_key)));
}
// 7.2.3.7 CrossOriginOwnPropertyKeys ( O ), https://html.spec.whatwg.org/multipage/browsers.html#crossoriginownpropertykeys-(-o-)

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/String.h>
#include <AK/DeprecatedString.h>
namespace Web::HTML {
@ -24,13 +24,13 @@ struct CrossOriginOpenerPolicy {
CrossOriginOpenerPolicyValue value { CrossOriginOpenerPolicyValue::UnsafeNone };
// A reporting endpoint, which is string or null, initially null.
Optional<String> reporting_endpoint;
Optional<DeprecatedString> reporting_endpoint;
// A report-only value, which is a cross-origin opener policy value, initially "unsafe-none".
CrossOriginOpenerPolicyValue report_only_value { CrossOriginOpenerPolicyValue::UnsafeNone };
// A report-only reporting endpoint, which is a string or null, initially null.
Optional<String> report_only_reporting_endpoint;
Optional<DeprecatedString> report_only_reporting_endpoint;
};
}

View file

@ -13,7 +13,7 @@
namespace Web::HTML {
struct CrossOriginProperty {
String property;
DeprecatedString property;
Optional<bool> needs_get {};
Optional<bool> needs_set {};
};

View file

@ -27,7 +27,7 @@ DOMParser::DOMParser(JS::Realm& realm)
DOMParser::~DOMParser() = default;
// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring
JS::NonnullGCPtr<DOM::Document> DOMParser::parse_from_string(String const& string, Bindings::DOMParserSupportedType type)
JS::NonnullGCPtr<DOM::Document> DOMParser::parse_from_string(DeprecatedString const& string, Bindings::DOMParserSupportedType type)
{
// 1. Let document be a new Document, whose content type is type and url is this's relevant global object's associated Document's URL.
auto document = DOM::Document::create(realm(), verify_cast<HTML::Window>(relevant_global_object(*this)).associated_document().url());

View file

@ -23,7 +23,7 @@ public:
virtual ~DOMParser() override;
JS::NonnullGCPtr<DOM::Document> parse_from_string(String const&, Bindings::DOMParserSupportedType type);
JS::NonnullGCPtr<DOM::Document> parse_from_string(DeprecatedString const&, Bindings::DOMParserSupportedType type);
private:
explicit DOMParser(JS::Realm&);

View file

@ -83,10 +83,10 @@ Vector<DOMStringMap::NameValuePair> DOMStringMap::get_name_value_pairs() const
// https://html.spec.whatwg.org/multipage/dom.html#concept-domstringmap-pairs
// NOTE: There isn't a direct link to this, so the link is to one of the algorithms above it.
Vector<String> DOMStringMap::supported_property_names() const
Vector<DeprecatedString> DOMStringMap::supported_property_names() const
{
// The supported property names on a DOMStringMap object at any instant are the names of each pair returned from getting the DOMStringMap's name-value pairs at that instant, in the order returned.
Vector<String> names;
Vector<DeprecatedString> names;
auto name_value_pairs = get_name_value_pairs();
for (auto& name_value_pair : name_value_pairs) {
names.append(name_value_pair.name);
@ -95,7 +95,7 @@ Vector<String> DOMStringMap::supported_property_names() const
}
// https://html.spec.whatwg.org/multipage/dom.html#dom-domstringmap-nameditem
String DOMStringMap::determine_value_of_named_property(String const& name) const
DeprecatedString DOMStringMap::determine_value_of_named_property(DeprecatedString const& name) const
{
// To determine the value of a named property name for a DOMStringMap, return the value component of the name-value pair whose name component is name in the list returned from getting the
// DOMStringMap's name-value pairs.
@ -111,7 +111,7 @@ String DOMStringMap::determine_value_of_named_property(String const& name) const
}
// https://html.spec.whatwg.org/multipage/dom.html#dom-domstringmap-setitem
WebIDL::ExceptionOr<void> DOMStringMap::set_value_of_new_named_property(String const& name, String const& value)
WebIDL::ExceptionOr<void> DOMStringMap::set_value_of_new_named_property(DeprecatedString const& name, DeprecatedString const& value)
{
AK::StringBuilder builder;
@ -150,13 +150,13 @@ WebIDL::ExceptionOr<void> DOMStringMap::set_value_of_new_named_property(String c
}
// https://html.spec.whatwg.org/multipage/dom.html#dom-domstringmap-setitem
WebIDL::ExceptionOr<void> DOMStringMap::set_value_of_existing_named_property(String const& name, String const& value)
WebIDL::ExceptionOr<void> DOMStringMap::set_value_of_existing_named_property(DeprecatedString const& name, DeprecatedString const& value)
{
return set_value_of_new_named_property(name, value);
}
// https://html.spec.whatwg.org/multipage/dom.html#dom-domstringmap-removeitem
bool DOMStringMap::delete_existing_named_property(String const& name)
bool DOMStringMap::delete_existing_named_property(DeprecatedString const& name)
{
AK::StringBuilder builder;

View file

@ -21,12 +21,12 @@ public:
virtual ~DOMStringMap() override;
String determine_value_of_named_property(String const&) const;
DeprecatedString determine_value_of_named_property(DeprecatedString const&) const;
WebIDL::ExceptionOr<void> set_value_of_new_named_property(String const&, String const&);
WebIDL::ExceptionOr<void> set_value_of_existing_named_property(String const&, String const&);
WebIDL::ExceptionOr<void> set_value_of_new_named_property(DeprecatedString const&, DeprecatedString const&);
WebIDL::ExceptionOr<void> set_value_of_existing_named_property(DeprecatedString const&, DeprecatedString const&);
bool delete_existing_named_property(String const&);
bool delete_existing_named_property(DeprecatedString const&);
private:
explicit DOMStringMap(DOM::Element&);
@ -35,11 +35,11 @@ private:
// ^LegacyPlatformObject
virtual JS::Value named_item_value(FlyString const&) const override;
virtual Vector<String> supported_property_names() const override;
virtual Vector<DeprecatedString> supported_property_names() const override;
struct NameValuePair {
String name;
String value;
DeprecatedString name;
DeprecatedString value;
};
Vector<NameValuePair> get_name_value_pairs() const;

View file

@ -12,8 +12,8 @@ namespace Web::HTML {
// https://html.spec.whatwg.org/multipage/webappapis.html#erroreventinit
struct ErrorEventInit : public DOM::EventInit {
String message { "" };
String filename { "" }; // FIXME: This should be a USVString.
DeprecatedString message { "" };
DeprecatedString filename { "" }; // FIXME: This should be a USVString.
u32 lineno { 0 };
u32 colno { 0 };
JS::Value error { JS::js_null() };
@ -30,10 +30,10 @@ public:
virtual ~ErrorEvent() override;
// https://html.spec.whatwg.org/multipage/webappapis.html#dom-errorevent-message
String const& message() const { return m_message; }
DeprecatedString const& message() const { return m_message; }
// https://html.spec.whatwg.org/multipage/webappapis.html#dom-errorevent-filename
String const& filename() const { return m_filename; }
DeprecatedString const& filename() const { return m_filename; }
// https://html.spec.whatwg.org/multipage/webappapis.html#dom-errorevent-lineno
u32 lineno() const { return m_lineno; }
@ -49,8 +49,8 @@ private:
virtual void visit_edges(Cell::Visitor&) override;
String m_message { "" };
String m_filename { "" }; // FIXME: This should be a USVString.
DeprecatedString m_message { "" };
DeprecatedString m_filename { "" }; // FIXME: This should be a USVString.
u32 m_lineno { 0 };
u32 m_colno { 0 };
JS::Value m_error;

View file

@ -9,7 +9,7 @@
namespace Web::HTML {
EventHandler::EventHandler(String s)
EventHandler::EventHandler(DeprecatedString s)
: value(move(s))
{
}

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/String.h>
#include <AK/DeprecatedString.h>
#include <AK/Variant.h>
#include <LibJS/Heap/Cell.h>
#include <LibWeb/WebIDL/CallbackType.h>
@ -15,7 +15,7 @@ namespace Web::HTML {
class EventHandler final : public JS::Cell {
public:
explicit EventHandler(String);
explicit EventHandler(DeprecatedString);
explicit EventHandler(WebIDL::CallbackType&);
// Either uncompiled source code or a callback.
@ -23,7 +23,7 @@ public:
// NOTE: This does not contain Empty as part of the optimization of not allocating all event handler attributes up front.
// FIXME: The string should actually be an "internal raw uncompiled handler" struct. This struct is just the uncompiled source code plus a source location for reporting parse errors.
// https://html.spec.whatwg.org/multipage/webappapis.html#internal-raw-uncompiled-handler
Variant<String, WebIDL::CallbackType*> value;
Variant<DeprecatedString, WebIDL::CallbackType*> value;
// https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-listener
DOM::DOMEventListener* listener { nullptr };

View file

@ -158,7 +158,7 @@ static Vector<JS::Handle<DOM::Node>> focus_chain(DOM::Node* subject)
// https://html.spec.whatwg.org/multipage/interaction.html#focusing-steps
// FIXME: This should accept more types.
void run_focusing_steps(DOM::Node* new_focus_target, DOM::Node* fallback_target, [[maybe_unused]] Optional<String> focus_trigger)
void run_focusing_steps(DOM::Node* new_focus_target, DOM::Node* fallback_target, [[maybe_unused]] Optional<DeprecatedString> focus_trigger)
{
// FIXME: 1. If new focus target is not a focusable area, then set new focus target
// to the result of getting the focusable area for new focus target,

View file

@ -6,13 +6,13 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/Optional.h>
#include <AK/String.h>
#include <LibWeb/Forward.h>
namespace Web::HTML {
void run_focusing_steps(DOM::Node* new_focus_target, DOM::Node* fallback_target = nullptr, Optional<String> focus_trigger = {});
void run_focusing_steps(DOM::Node* new_focus_target, DOM::Node* fallback_target = nullptr, Optional<DeprecatedString> focus_trigger = {});
void run_unfocusing_steps(DOM::Node* old_focus_target);
}

View file

@ -21,7 +21,7 @@ HTMLAnchorElement::HTMLAnchorElement(DOM::Document& document, DOM::QualifiedName
HTMLAnchorElement::~HTMLAnchorElement() = default;
void HTMLAnchorElement::parse_attribute(FlyString const& name, String const& value)
void HTMLAnchorElement::parse_attribute(FlyString const& name, DeprecatedString const& value)
{
HTMLElement::parse_attribute(name, value);
if (name == HTML::AttributeNames::href) {
@ -29,12 +29,12 @@ void HTMLAnchorElement::parse_attribute(FlyString const& name, String const& val
}
}
String HTMLAnchorElement::hyperlink_element_utils_href() const
DeprecatedString HTMLAnchorElement::hyperlink_element_utils_href() const
{
return attribute(HTML::AttributeNames::href);
}
void HTMLAnchorElement::set_hyperlink_element_utils_href(String href)
void HTMLAnchorElement::set_hyperlink_element_utils_href(DeprecatedString href)
{
MUST(set_attribute(HTML::AttributeNames::href, move(href)));
}
@ -48,7 +48,7 @@ void HTMLAnchorElement::run_activation_behavior(Web::DOM::Event const&)
return;
// 2. Let hyperlinkSuffix be null.
Optional<String> hyperlink_suffix {};
Optional<DeprecatedString> hyperlink_suffix {};
// FIXME: 3. If event's target is an img with an ismap attribute
// specified, then:

View file

@ -19,8 +19,8 @@ class HTMLAnchorElement final
public:
virtual ~HTMLAnchorElement() override;
String target() const { return attribute(HTML::AttributeNames::target); }
String download() const { return attribute(HTML::AttributeNames::download); }
DeprecatedString target() const { return attribute(HTML::AttributeNames::target); }
DeprecatedString download() const { return attribute(HTML::AttributeNames::download); }
// ^EventTarget
// https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute:the-a-element
@ -34,16 +34,16 @@ private:
void run_activation_behavior(Web::DOM::Event const&);
// ^DOM::Element
virtual void parse_attribute(FlyString const& name, String const& value) override;
virtual void parse_attribute(FlyString const& name, DeprecatedString const& value) override;
virtual i32 default_tab_index_value() const override;
// ^HTML::HTMLHyperlinkElementUtils
virtual DOM::Document& hyperlink_element_utils_document() override { return document(); }
virtual String hyperlink_element_utils_href() const override;
virtual void set_hyperlink_element_utils_href(String) override;
virtual DeprecatedString hyperlink_element_utils_href() const override;
virtual void set_hyperlink_element_utils_href(DeprecatedString) override;
virtual bool hyperlink_element_utils_is_html_anchor_element() const final { return true; }
virtual bool hyperlink_element_utils_is_connected() const final { return is_connected(); }
virtual String hyperlink_element_utils_target() const final { return target(); }
virtual DeprecatedString hyperlink_element_utils_target() const final { return target(); }
virtual void hyperlink_element_utils_queue_an_element_task(HTML::Task::Source source, Function<void()> steps) override
{
queue_an_element_task(source, move(steps));

View file

@ -17,7 +17,7 @@ HTMLAreaElement::HTMLAreaElement(DOM::Document& document, DOM::QualifiedName qua
HTMLAreaElement::~HTMLAreaElement() = default;
void HTMLAreaElement::parse_attribute(FlyString const& name, String const& value)
void HTMLAreaElement::parse_attribute(FlyString const& name, DeprecatedString const& value)
{
HTMLElement::parse_attribute(name, value);
if (name == HTML::AttributeNames::href) {
@ -25,12 +25,12 @@ void HTMLAreaElement::parse_attribute(FlyString const& name, String const& value
}
}
String HTMLAreaElement::hyperlink_element_utils_href() const
DeprecatedString HTMLAreaElement::hyperlink_element_utils_href() const
{
return attribute(HTML::AttributeNames::href);
}
void HTMLAreaElement::set_hyperlink_element_utils_href(String href)
void HTMLAreaElement::set_hyperlink_element_utils_href(DeprecatedString href)
{
MUST(set_attribute(HTML::AttributeNames::href, move(href)));
}

View file

@ -24,16 +24,16 @@ private:
HTMLAreaElement(DOM::Document&, DOM::QualifiedName);
// ^DOM::Element
virtual void parse_attribute(FlyString const& name, String const& value) override;
virtual void parse_attribute(FlyString const& name, DeprecatedString const& value) override;
virtual i32 default_tab_index_value() const override;
// ^HTML::HTMLHyperlinkElementUtils
virtual DOM::Document& hyperlink_element_utils_document() override { return document(); }
virtual String hyperlink_element_utils_href() const override;
virtual void set_hyperlink_element_utils_href(String) override;
virtual DeprecatedString hyperlink_element_utils_href() const override;
virtual void set_hyperlink_element_utils_href(DeprecatedString) override;
virtual bool hyperlink_element_utils_is_html_anchor_element() const override { return false; }
virtual bool hyperlink_element_utils_is_connected() const override { return is_connected(); }
virtual String hyperlink_element_utils_target() const override { return ""; }
virtual DeprecatedString hyperlink_element_utils_target() const override { return ""; }
virtual void hyperlink_element_utils_queue_an_element_task(HTML::Task::Source source, Function<void()> steps) override
{
queue_an_element_task(source, move(steps));

View file

@ -38,7 +38,7 @@ void HTMLBaseElement::removed_from(Node* parent)
document().update_base_element({});
}
void HTMLBaseElement::parse_attribute(FlyString const& name, String const& value)
void HTMLBaseElement::parse_attribute(FlyString const& name, DeprecatedString const& value)
{
HTMLElement::parse_attribute(name, value);
@ -75,13 +75,13 @@ void HTMLBaseElement::set_the_frozen_base_url()
}
// https://html.spec.whatwg.org/multipage/semantics.html#dom-base-href
String HTMLBaseElement::href() const
DeprecatedString HTMLBaseElement::href() const
{
// 1. Let document be element's node document.
auto& document = this->document();
// 2. Let url be the value of the href attribute of this element, if it has one, and the empty string otherwise.
auto url = String::empty();
auto url = DeprecatedString::empty();
if (has_attribute(AttributeNames::href))
url = attribute(AttributeNames::href);
@ -98,7 +98,7 @@ String HTMLBaseElement::href() const
}
// https://html.spec.whatwg.org/multipage/semantics.html#dom-base-href
void HTMLBaseElement::set_href(String const& href)
void HTMLBaseElement::set_href(DeprecatedString const& href)
{
// The href IDL attribute, on setting, must set the href content attribute to the given new value.
MUST(set_attribute(AttributeNames::href, href));

View file

@ -16,14 +16,14 @@ class HTMLBaseElement final : public HTMLElement {
public:
virtual ~HTMLBaseElement() override;
String href() const;
void set_href(String const& href);
DeprecatedString href() const;
void set_href(DeprecatedString const& href);
AK::URL const& frozen_base_url() const { return m_frozen_base_url; }
virtual void inserted() override;
virtual void removed_from(Node*) override;
virtual void parse_attribute(FlyString const& name, String const& value) override;
virtual void parse_attribute(FlyString const& name, DeprecatedString const& value) override;
private:
HTMLBaseElement(DOM::Document&, DOM::QualifiedName);

View file

@ -38,7 +38,7 @@ void HTMLBodyElement::apply_presentational_hints(CSS::StyleProperties& style) co
});
}
void HTMLBodyElement::parse_attribute(FlyString const& name, String const& value)
void HTMLBodyElement::parse_attribute(FlyString const& name, DeprecatedString const& value)
{
HTMLElement::parse_attribute(name, value);
if (name.equals_ignoring_case("link"sv)) {

View file

@ -19,7 +19,7 @@ class HTMLBodyElement final
public:
virtual ~HTMLBodyElement() override;
virtual void parse_attribute(FlyString const&, String const&) override;
virtual void parse_attribute(FlyString const&, DeprecatedString const&) override;
virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
private:

View file

@ -53,7 +53,7 @@ HTMLButtonElement::HTMLButtonElement(DOM::Document& document, DOM::QualifiedName
HTMLButtonElement::~HTMLButtonElement() = default;
String HTMLButtonElement::type() const
DeprecatedString HTMLButtonElement::type() const
{
auto value = attribute(HTML::AttributeNames::type);
@ -81,7 +81,7 @@ HTMLButtonElement::TypeAttributeState HTMLButtonElement::type_state() const
return HTMLButtonElement::TypeAttributeState::Submit;
}
void HTMLButtonElement::set_type(String const& type)
void HTMLButtonElement::set_type(DeprecatedString const& type)
{
MUST(set_attribute(HTML::AttributeNames::type, type));
}

View file

@ -31,9 +31,9 @@ public:
#undef __ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTE
};
String type() const;
DeprecatedString type() const;
TypeAttributeState type_state() const;
void set_type(String const&);
void set_type(DeprecatedString const&);
// ^EventTarget
// https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute:the-button-element

View file

@ -66,14 +66,14 @@ void HTMLCanvasElement::reset_context_to_default_state()
void HTMLCanvasElement::set_width(unsigned value)
{
MUST(set_attribute(HTML::AttributeNames::width, String::number(value)));
MUST(set_attribute(HTML::AttributeNames::width, DeprecatedString::number(value)));
m_bitmap = nullptr;
reset_context_to_default_state();
}
void HTMLCanvasElement::set_height(unsigned value)
{
MUST(set_attribute(HTML::AttributeNames::height, String::number(value)));
MUST(set_attribute(HTML::AttributeNames::height, DeprecatedString::number(value)));
m_bitmap = nullptr;
reset_context_to_default_state();
}
@ -106,7 +106,7 @@ JS::ThrowCompletionOr<HTMLCanvasElement::HasOrCreatedContext> HTMLCanvasElement:
}
// https://html.spec.whatwg.org/multipage/canvas.html#dom-canvas-getcontext
JS::ThrowCompletionOr<HTMLCanvasElement::RenderingContext> HTMLCanvasElement::get_context(String const& type, JS::Value options)
JS::ThrowCompletionOr<HTMLCanvasElement::RenderingContext> HTMLCanvasElement::get_context(DeprecatedString const& type, JS::Value options)
{
// 1. If options is not an object, then set options to null.
if (!options.is_object())
@ -170,7 +170,7 @@ bool HTMLCanvasElement::create_bitmap(size_t minimum_width, size_t minimum_heigh
return m_bitmap;
}
String HTMLCanvasElement::to_data_url(String const& type, [[maybe_unused]] Optional<double> quality) const
DeprecatedString HTMLCanvasElement::to_data_url(DeprecatedString const& type, [[maybe_unused]] Optional<double> quality) const
{
if (!m_bitmap)
return {};

View file

@ -25,7 +25,7 @@ public:
Gfx::Bitmap* bitmap() { return m_bitmap; }
bool create_bitmap(size_t minimum_width = 0, size_t minimum_height = 0);
JS::ThrowCompletionOr<RenderingContext> get_context(String const& type, JS::Value options);
JS::ThrowCompletionOr<RenderingContext> get_context(DeprecatedString const& type, JS::Value options);
unsigned width() const;
unsigned height() const;
@ -33,7 +33,7 @@ public:
void set_width(unsigned);
void set_height(unsigned);
String to_data_url(String const& type, Optional<double> quality) const;
DeprecatedString to_data_url(DeprecatedString const& type, Optional<double> quality) const;
void present();

View file

@ -53,7 +53,7 @@ void HTMLElement::visit_edges(Cell::Visitor& visitor)
}
// https://html.spec.whatwg.org/multipage/dom.html#dom-dir
String HTMLElement::dir() const
DeprecatedString HTMLElement::dir() const
{
auto dir = attribute(HTML::AttributeNames::dir);
#define __ENUMERATE_HTML_ELEMENT_DIR_ATTRIBUTE(keyword) \
@ -65,7 +65,7 @@ String HTMLElement::dir() const
return {};
}
void HTMLElement::set_dir(String const& dir)
void HTMLElement::set_dir(DeprecatedString const& dir)
{
MUST(set_attribute(HTML::AttributeNames::dir, dir));
}
@ -97,7 +97,7 @@ bool HTMLElement::is_editable() const
}
}
String HTMLElement::content_editable() const
DeprecatedString HTMLElement::content_editable() const
{
switch (content_editable_state()) {
case ContentEditableState::True:
@ -112,7 +112,7 @@ String HTMLElement::content_editable() const
}
// https://html.spec.whatwg.org/multipage/interaction.html#contenteditable
WebIDL::ExceptionOr<void> HTMLElement::set_content_editable(String const& content_editable)
WebIDL::ExceptionOr<void> HTMLElement::set_content_editable(DeprecatedString const& content_editable)
{
if (content_editable.equals_ignoring_case("inherit"sv)) {
remove_attribute(HTML::AttributeNames::contenteditable);
@ -137,7 +137,7 @@ void HTMLElement::set_inner_text(StringView text)
set_needs_style_update(true);
}
String HTMLElement::inner_text()
DeprecatedString HTMLElement::inner_text()
{
StringBuilder builder;
@ -231,7 +231,7 @@ bool HTMLElement::cannot_navigate() const
return !is<HTML::HTMLAnchorElement>(this) && !is_connected();
}
void HTMLElement::parse_attribute(FlyString const& name, String const& value)
void HTMLElement::parse_attribute(FlyString const& name, DeprecatedString const& value)
{
Element::parse_attribute(name, value);

View file

@ -26,16 +26,16 @@ class HTMLElement
public:
virtual ~HTMLElement() override;
String title() const { return attribute(HTML::AttributeNames::title); }
DeprecatedString title() const { return attribute(HTML::AttributeNames::title); }
String dir() const;
void set_dir(String const&);
DeprecatedString dir() const;
void set_dir(DeprecatedString const&);
virtual bool is_editable() const final;
String content_editable() const;
WebIDL::ExceptionOr<void> set_content_editable(String const&);
DeprecatedString content_editable() const;
WebIDL::ExceptionOr<void> set_content_editable(DeprecatedString const&);
String inner_text();
DeprecatedString inner_text();
void set_inner_text(StringView);
int offset_top() const;
@ -64,7 +64,7 @@ protected:
virtual void initialize(JS::Realm&) override;
virtual void parse_attribute(FlyString const& name, String const& value) override;
virtual void parse_attribute(FlyString const& name, DeprecatedString const& value) override;
virtual void visit_edges(Cell::Visitor&) override;

View file

@ -20,9 +20,9 @@ class HTMLFieldSetElement final
public:
virtual ~HTMLFieldSetElement() override;
String const& type() const
DeprecatedString const& type() const
{
static String fieldset = "fieldset";
static DeprecatedString fieldset = "fieldset";
return fieldset;
}

View file

@ -152,7 +152,7 @@ void HTMLFormElement::remove_associated_element(Badge<FormAssociatedElement>, HT
}
// https://html.spec.whatwg.org/#dom-fs-action
String HTMLFormElement::action() const
DeprecatedString HTMLFormElement::action() const
{
auto value = attribute(HTML::AttributeNames::action);

View file

@ -17,8 +17,8 @@ class HTMLFormElement final : public HTMLElement {
public:
virtual ~HTMLFormElement() override;
String action() const;
String method() const { return attribute(HTML::AttributeNames::method); }
DeprecatedString action() const;
DeprecatedString method() const { return attribute(HTML::AttributeNames::method); }
void submit_form(JS::GCPtr<HTMLElement> submitter, bool from_submit_binding = false);

View file

@ -18,7 +18,7 @@ HTMLFrameSetElement::HTMLFrameSetElement(DOM::Document& document, DOM::Qualified
HTMLFrameSetElement::~HTMLFrameSetElement() = default;
void HTMLFrameSetElement::parse_attribute(FlyString const& name, String const& value)
void HTMLFrameSetElement::parse_attribute(FlyString const& name, DeprecatedString const& value)
{
HTMLElement::parse_attribute(name, value);

View file

@ -23,7 +23,7 @@ public:
private:
HTMLFrameSetElement(DOM::Document&, DOM::QualifiedName);
virtual void parse_attribute(FlyString const&, String const&) override;
virtual void parse_attribute(FlyString const&, DeprecatedString const&) override;
private:
// ^HTML::GlobalEventHandlers

View file

@ -40,21 +40,21 @@ void HTMLHyperlinkElementUtils::set_the_url()
}
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-origin
String HTMLHyperlinkElementUtils::origin() const
DeprecatedString HTMLHyperlinkElementUtils::origin() const
{
// 1. Reinitialize url.
reinitialize_url();
// 2. If this element's url is null, return the empty string.
if (!m_url.has_value())
return String::empty();
return DeprecatedString::empty();
// 3. Return the serialization of this element's url's origin.
return m_url->serialize_origin();
}
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-protocol
String HTMLHyperlinkElementUtils::protocol() const
DeprecatedString HTMLHyperlinkElementUtils::protocol() const
{
// 1. Reinitialize url.
reinitialize_url();
@ -64,11 +64,11 @@ String HTMLHyperlinkElementUtils::protocol() const
return ":"sv;
// 3. Return this element's url's scheme, followed by ":".
return String::formatted("{}:", m_url->scheme());
return DeprecatedString::formatted("{}:", m_url->scheme());
}
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-protocol
void HTMLHyperlinkElementUtils::set_protocol(String protocol)
void HTMLHyperlinkElementUtils::set_protocol(DeprecatedString protocol)
{
// 1. Reinitialize url.
reinitialize_url();
@ -78,7 +78,7 @@ void HTMLHyperlinkElementUtils::set_protocol(String protocol)
return;
// 3. Basic URL parse the given value, followed by ":", with this element's url as url and scheme start state as state override.
auto result_url = URLParser::parse(String::formatted("{}:", protocol), nullptr, m_url, URLParser::State::SchemeStart);
auto result_url = URLParser::parse(DeprecatedString::formatted("{}:", protocol), nullptr, m_url, URLParser::State::SchemeStart);
if (result_url.is_valid())
m_url = move(result_url);
@ -87,21 +87,21 @@ void HTMLHyperlinkElementUtils::set_protocol(String protocol)
}
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-username
String HTMLHyperlinkElementUtils::username() const
DeprecatedString HTMLHyperlinkElementUtils::username() const
{
// 1. Reinitialize url.
reinitialize_url();
// 2. If this element's url is null, return the empty string.
if (!m_url.has_value())
return String::empty();
return DeprecatedString::empty();
// 3. Return this element's url's username.
return m_url->username();
}
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-username
void HTMLHyperlinkElementUtils::set_username(String username)
void HTMLHyperlinkElementUtils::set_username(DeprecatedString username)
{
// 1. Reinitialize url.
reinitialize_url();
@ -121,7 +121,7 @@ void HTMLHyperlinkElementUtils::set_username(String username)
}
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-password
String HTMLHyperlinkElementUtils::password() const
DeprecatedString HTMLHyperlinkElementUtils::password() const
{
// 1. Reinitialize url.
reinitialize_url();
@ -131,14 +131,14 @@ String HTMLHyperlinkElementUtils::password() const
// 3. If url is null, then return the empty string.
if (!url.has_value())
return String::empty();
return DeprecatedString::empty();
// 4. Return url's password.
return url->password();
}
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-password
void HTMLHyperlinkElementUtils::set_password(String password)
void HTMLHyperlinkElementUtils::set_password(DeprecatedString password)
{
// 1. Reinitialize url.
reinitialize_url();
@ -158,7 +158,7 @@ void HTMLHyperlinkElementUtils::set_password(String password)
}
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-host
String HTMLHyperlinkElementUtils::host() const
DeprecatedString HTMLHyperlinkElementUtils::host() const
{
// 1. Reinitialize url.
reinitialize_url();
@ -168,18 +168,18 @@ String HTMLHyperlinkElementUtils::host() const
// 3. If url or url's host is null, return the empty string.
if (!url.has_value() || url->host().is_null())
return String::empty();
return DeprecatedString::empty();
// 4. If url's port is null, return url's host, serialized.
if (!url->port().has_value())
return url->host();
// 5. Return url's host, serialized, followed by ":" and url's port, serialized.
return String::formatted("{}:{}", url->host(), url->port().value());
return DeprecatedString::formatted("{}:{}", url->host(), url->port().value());
}
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-host
void HTMLHyperlinkElementUtils::set_host(String host)
void HTMLHyperlinkElementUtils::set_host(DeprecatedString host)
{
// 1. Reinitialize url.
reinitialize_url();
@ -200,7 +200,7 @@ void HTMLHyperlinkElementUtils::set_host(String host)
update_href();
}
String HTMLHyperlinkElementUtils::hostname() const
DeprecatedString HTMLHyperlinkElementUtils::hostname() const
{
// 1. Reinitialize url.
//
@ -212,7 +212,7 @@ String HTMLHyperlinkElementUtils::hostname() const
return AK::URL(href()).host();
}
void HTMLHyperlinkElementUtils::set_hostname(String hostname)
void HTMLHyperlinkElementUtils::set_hostname(DeprecatedString hostname)
{
// 1. Reinitialize url.
reinitialize_url();
@ -234,7 +234,7 @@ void HTMLHyperlinkElementUtils::set_hostname(String hostname)
}
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-port
String HTMLHyperlinkElementUtils::port() const
DeprecatedString HTMLHyperlinkElementUtils::port() const
{
// 1. Reinitialize url.
reinitialize_url();
@ -244,14 +244,14 @@ String HTMLHyperlinkElementUtils::port() const
// 3. If url or url's port is null, return the empty string.
if (!url.has_value() || !url->port().has_value())
return String::empty();
return DeprecatedString::empty();
// 4. Return url's port, serialized.
return String::number(url->port().value());
return DeprecatedString::number(url->port().value());
}
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-port
void HTMLHyperlinkElementUtils::set_port(String port)
void HTMLHyperlinkElementUtils::set_port(DeprecatedString port)
{
// 1. Reinitialize url.
reinitialize_url();
@ -277,7 +277,7 @@ void HTMLHyperlinkElementUtils::set_port(String port)
}
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-pathname
String HTMLHyperlinkElementUtils::pathname() const
DeprecatedString HTMLHyperlinkElementUtils::pathname() const
{
// 1. Reinitialize url.
reinitialize_url();
@ -286,7 +286,7 @@ String HTMLHyperlinkElementUtils::pathname() const
// 3. If url is null, return the empty string.
if (!m_url.has_value())
return String::empty();
return DeprecatedString::empty();
// 4. If url's cannot-be-a-base-URL is true, then return url's path[0].
// 5. If url's path is empty, then return the empty string.
@ -295,7 +295,7 @@ String HTMLHyperlinkElementUtils::pathname() const
}
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-pathname
void HTMLHyperlinkElementUtils::set_pathname(String pathname)
void HTMLHyperlinkElementUtils::set_pathname(DeprecatedString pathname)
{
// 1. Reinitialize url.
reinitialize_url();
@ -319,7 +319,7 @@ void HTMLHyperlinkElementUtils::set_pathname(String pathname)
update_href();
}
String HTMLHyperlinkElementUtils::search() const
DeprecatedString HTMLHyperlinkElementUtils::search() const
{
// 1. Reinitialize url.
reinitialize_url();
@ -328,13 +328,13 @@ String HTMLHyperlinkElementUtils::search() const
// 3. If url is null, or url's query is either null or the empty string, return the empty string.
if (!m_url.has_value() || m_url->query().is_null() || m_url->query().is_empty())
return String::empty();
return DeprecatedString::empty();
// 4. Return "?", followed by url's query.
return String::formatted("?{}", m_url->query());
return DeprecatedString::formatted("?{}", m_url->query());
}
void HTMLHyperlinkElementUtils::set_search(String search)
void HTMLHyperlinkElementUtils::set_search(DeprecatedString search)
{
// 1. Reinitialize url.
reinitialize_url();
@ -355,7 +355,7 @@ void HTMLHyperlinkElementUtils::set_search(String search)
// 2. Set url's query to the empty string.
auto url_copy = m_url; // We copy the URL here to follow other browser's behaviour of reverting the search change if the parse failed.
url_copy->set_query(String::empty());
url_copy->set_query(DeprecatedString::empty());
// 3. Basic URL parse input, with null, this element's node document's document's character encoding, url as url, and query state as state override.
auto result_url = URLParser::parse(input, nullptr, move(url_copy), URLParser::State::Query);
@ -367,7 +367,7 @@ void HTMLHyperlinkElementUtils::set_search(String search)
update_href();
}
String HTMLHyperlinkElementUtils::hash() const
DeprecatedString HTMLHyperlinkElementUtils::hash() const
{
// 1. Reinitialize url.
reinitialize_url();
@ -376,13 +376,13 @@ String HTMLHyperlinkElementUtils::hash() const
// 3. If url is null, or url's fragment is either null or the empty string, return the empty string.
if (!m_url.has_value() || m_url->fragment().is_null() || m_url->fragment().is_empty())
return String::empty();
return DeprecatedString::empty();
// 4. Return "#", followed by url's fragment.
return String::formatted("#{}", m_url->fragment());
return DeprecatedString::formatted("#{}", m_url->fragment());
}
void HTMLHyperlinkElementUtils::set_hash(String hash)
void HTMLHyperlinkElementUtils::set_hash(DeprecatedString hash)
{
// 1. Reinitialize url.
reinitialize_url();
@ -403,7 +403,7 @@ void HTMLHyperlinkElementUtils::set_hash(String hash)
// 2. Set url's fragment to the empty string.
auto url_copy = m_url; // We copy the URL here to follow other browser's behaviour of reverting the hash change if the parse failed.
url_copy->set_fragment(String::empty());
url_copy->set_fragment(DeprecatedString::empty());
// 3. Basic URL parse input, with url as url and fragment state as state override.
auto result_url = URLParser::parse(input, nullptr, move(url_copy), URLParser::State::Fragment);
@ -416,7 +416,7 @@ void HTMLHyperlinkElementUtils::set_hash(String hash)
}
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-href
String HTMLHyperlinkElementUtils::href() const
DeprecatedString HTMLHyperlinkElementUtils::href() const
{
// 1. Reinitialize url.
reinitialize_url();
@ -427,7 +427,7 @@ String HTMLHyperlinkElementUtils::href() const
// 3. If url is null and this element has no href content attribute, return the empty string.
auto href_content_attribute = hyperlink_element_utils_href();
if (!url.has_value() && href_content_attribute.is_null())
return String::empty();
return DeprecatedString::empty();
// 4. Otherwise, if url is null, return this element's href content attribute's value.
if (!url->is_valid())
@ -438,7 +438,7 @@ String HTMLHyperlinkElementUtils::href() const
}
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-href
void HTMLHyperlinkElementUtils::set_href(String href)
void HTMLHyperlinkElementUtils::set_href(DeprecatedString href)
{
// The href attribute's setter must set this element's href content attribute's value to the given value.
set_hyperlink_element_utils_href(move(href));
@ -467,7 +467,7 @@ bool HTMLHyperlinkElementUtils::cannot_navigate() const
}
// https://html.spec.whatwg.org/multipage/links.html#following-hyperlinks-2
void HTMLHyperlinkElementUtils::follow_the_hyperlink(Optional<String> hyperlink_suffix)
void HTMLHyperlinkElementUtils::follow_the_hyperlink(Optional<DeprecatedString> hyperlink_suffix)
{
// To follow the hyperlink created by an element subject, given an optional hyperlinkSuffix (default null):
@ -485,7 +485,7 @@ void HTMLHyperlinkElementUtils::follow_the_hyperlink(Optional<String> hyperlink_
// 4. Let targetAttributeValue be the empty string.
// 5. If subject is an a or area element, then set targetAttributeValue to
// the result of getting an element's target given subject.
String target_attribute_value = get_an_elements_target();
DeprecatedString target_attribute_value = get_an_elements_target();
// 6. Let noopener be the result of getting an element's noopener with subject and targetAttributeValue.
bool noopener = get_an_elements_noopener(target_attribute_value);
@ -539,7 +539,7 @@ void HTMLHyperlinkElementUtils::follow_the_hyperlink(Optional<String> hyperlink_
});
}
String HTMLHyperlinkElementUtils::get_an_elements_target() const
DeprecatedString HTMLHyperlinkElementUtils::get_an_elements_target() const
{
// To get an element's target, given an a, area, or form element element, run these steps:

View file

@ -16,55 +16,55 @@ class HTMLHyperlinkElementUtils {
public:
virtual ~HTMLHyperlinkElementUtils();
String origin() const;
DeprecatedString origin() const;
String href() const;
void set_href(String);
DeprecatedString href() const;
void set_href(DeprecatedString);
String protocol() const;
void set_protocol(String);
DeprecatedString protocol() const;
void set_protocol(DeprecatedString);
String username() const;
void set_username(String);
DeprecatedString username() const;
void set_username(DeprecatedString);
String password() const;
void set_password(String);
DeprecatedString password() const;
void set_password(DeprecatedString);
String host() const;
void set_host(String);
DeprecatedString host() const;
void set_host(DeprecatedString);
String hostname() const;
void set_hostname(String);
DeprecatedString hostname() const;
void set_hostname(DeprecatedString);
String port() const;
void set_port(String);
DeprecatedString port() const;
void set_port(DeprecatedString);
String pathname() const;
void set_pathname(String);
DeprecatedString pathname() const;
void set_pathname(DeprecatedString);
String search() const;
void set_search(String);
DeprecatedString search() const;
void set_search(DeprecatedString);
String hash() const;
void set_hash(String);
DeprecatedString hash() const;
void set_hash(DeprecatedString);
protected:
virtual DOM::Document& hyperlink_element_utils_document() = 0;
virtual String hyperlink_element_utils_href() const = 0;
virtual void set_hyperlink_element_utils_href(String) = 0;
virtual DeprecatedString hyperlink_element_utils_href() const = 0;
virtual void set_hyperlink_element_utils_href(DeprecatedString) = 0;
virtual bool hyperlink_element_utils_is_html_anchor_element() const = 0;
virtual bool hyperlink_element_utils_is_connected() const = 0;
virtual String hyperlink_element_utils_target() const = 0;
virtual DeprecatedString hyperlink_element_utils_target() const = 0;
virtual void hyperlink_element_utils_queue_an_element_task(HTML::Task::Source source, Function<void()> steps) = 0;
void set_the_url();
void follow_the_hyperlink(Optional<String> hyperlink_suffix);
void follow_the_hyperlink(Optional<DeprecatedString> hyperlink_suffix);
private:
void reinitialize_url() const;
void update_href();
bool cannot_navigate() const;
String get_an_elements_target() const;
DeprecatedString get_an_elements_target() const;
bool get_an_elements_noopener(StringView target) const;
Optional<AK::URL> m_url;

View file

@ -27,7 +27,7 @@ JS::GCPtr<Layout::Node> HTMLIFrameElement::create_layout_node(NonnullRefPtr<CSS:
return heap().allocate_without_realm<Layout::FrameBox>(document(), *this, move(style));
}
void HTMLIFrameElement::parse_attribute(FlyString const& name, String const& value)
void HTMLIFrameElement::parse_attribute(FlyString const& name, DeprecatedString const& value)
{
HTMLElement::parse_attribute(name, value);
if (name == HTML::AttributeNames::src)
@ -104,7 +104,7 @@ void HTMLIFrameElement::removed_from(DOM::Node* node)
}
}
void HTMLIFrameElement::load_src(String const& value)
void HTMLIFrameElement::load_src(DeprecatedString const& value)
{
if (!m_nested_browsing_context)
return;

View file

@ -31,13 +31,13 @@ private:
// ^DOM::Element
virtual void inserted() override;
virtual void removed_from(Node*) override;
virtual void parse_attribute(FlyString const& name, String const& value) override;
virtual void parse_attribute(FlyString const& name, DeprecatedString const& value) override;
virtual i32 default_tab_index_value() const override;
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#process-the-iframe-attributes
void process_the_iframe_attributes(bool initial_insertion = false);
void load_src(String const&);
void load_src(DeprecatedString const&);
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#current-navigation-was-lazy-loaded
bool m_current_navigation_was_lazy_loaded { false };

View file

@ -72,7 +72,7 @@ void HTMLImageElement::apply_presentational_hints(CSS::StyleProperties& style) c
});
}
void HTMLImageElement::parse_attribute(FlyString const& name, String const& value)
void HTMLImageElement::parse_attribute(FlyString const& name, DeprecatedString const& value)
{
HTMLElement::parse_attribute(name, value);
@ -120,7 +120,7 @@ unsigned HTMLImageElement::width() const
void HTMLImageElement::set_width(unsigned width)
{
MUST(set_attribute(HTML::AttributeNames::width, String::number(width)));
MUST(set_attribute(HTML::AttributeNames::width, DeprecatedString::number(width)));
}
// https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-height
@ -148,7 +148,7 @@ unsigned HTMLImageElement::height() const
void HTMLImageElement::set_height(unsigned height)
{
MUST(set_attribute(HTML::AttributeNames::height, String::number(height)));
MUST(set_attribute(HTML::AttributeNames::height, DeprecatedString::number(height)));
}
// https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-naturalwidth

View file

@ -24,10 +24,10 @@ class HTMLImageElement final
public:
virtual ~HTMLImageElement() override;
virtual void parse_attribute(FlyString const& name, String const& value) override;
virtual void parse_attribute(FlyString const& name, DeprecatedString const& value) override;
String alt() const { return attribute(HTML::AttributeNames::alt); }
String src() const { return attribute(HTML::AttributeNames::src); }
DeprecatedString alt() const { return attribute(HTML::AttributeNames::alt); }
DeprecatedString src() const { return attribute(HTML::AttributeNames::src); }
Gfx::Bitmap const* bitmap() const;

View file

@ -27,7 +27,7 @@ namespace Web::HTML {
HTMLInputElement::HTMLInputElement(DOM::Document& document, DOM::QualifiedName qualified_name)
: HTMLElement(document, move(qualified_name))
, m_value(String::empty())
, m_value(DeprecatedString::empty())
{
set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLInputElement"));
@ -268,14 +268,14 @@ void HTMLInputElement::did_edit_text_node(Badge<BrowsingContext>)
});
}
String HTMLInputElement::value() const
DeprecatedString HTMLInputElement::value() const
{
// https://html.spec.whatwg.org/multipage/input.html#dom-input-value-filename
if (type_state() == TypeAttributeState::FileUpload) {
// NOTE: This "fakepath" requirement is a sad accident of history. See the example in the File Upload state section for more information.
// NOTE: Since path components are not permitted in filenames in the list of selected files, the "\fakepath\" cannot be mistaken for a path component.
if (m_selected_files && m_selected_files->item(0))
return String::formatted("C:\\fakepath\\{}", m_selected_files->item(0)->name());
return DeprecatedString::formatted("C:\\fakepath\\{}", m_selected_files->item(0)->name());
return "C:\\fakepath\\"sv;
}
@ -284,12 +284,12 @@ String HTMLInputElement::value() const
return m_value;
}
WebIDL::ExceptionOr<void> HTMLInputElement::set_value(String value)
WebIDL::ExceptionOr<void> HTMLInputElement::set_value(DeprecatedString value)
{
// https://html.spec.whatwg.org/multipage/input.html#dom-input-value-filename
if (type_state() == TypeAttributeState::FileUpload) {
// On setting, if the new value is the empty string, empty the list of selected files; otherwise, throw an "InvalidStateError" DOMException.
if (value != String::empty())
if (value != DeprecatedString::empty())
return WebIDL::InvalidStateError::create(realm(), "Setting value of input type file to non-empty string"sv);
m_selected_files = nullptr;
return {};
@ -335,7 +335,7 @@ static bool is_allowed_to_have_placeholder(HTML::HTMLInputElement::TypeAttribute
}
// https://html.spec.whatwg.org/multipage/input.html#attr-input-placeholder
Optional<String> HTMLInputElement::placeholder_value() const
Optional<DeprecatedString> HTMLInputElement::placeholder_value() const
{
if (!m_text_node || !m_text_node->data().is_empty())
return {};
@ -379,7 +379,7 @@ void HTMLInputElement::create_shadow_tree_if_needed()
auto* shadow_root = heap().allocate<DOM::ShadowRoot>(realm(), document(), *this);
auto initial_value = m_value;
if (initial_value.is_null())
initial_value = String::empty();
initial_value = DeprecatedString::empty();
auto element = document().create_element(HTML::TagNames::div).release_value();
MUST(element->set_attribute(HTML::AttributeNames::style, "white-space: pre; padding-top: 1px; padding-bottom: 1px; padding-left: 2px; padding-right: 2px"));
m_text_node = heap().allocate<DOM::Text>(realm(), document(), initial_value);
@ -404,7 +404,7 @@ void HTMLInputElement::did_receive_focus()
browsing_context->set_cursor_position(DOM::Position { *m_text_node, 0 });
}
void HTMLInputElement::parse_attribute(FlyString const& name, String const& value)
void HTMLInputElement::parse_attribute(FlyString const& name, DeprecatedString const& value)
{
HTMLElement::parse_attribute(name, value);
if (name == HTML::AttributeNames::checked) {
@ -444,11 +444,11 @@ void HTMLInputElement::did_remove_attribute(FlyString const& name)
set_checked(false, ChangeSource::Programmatic);
} else if (name == HTML::AttributeNames::value) {
if (!m_dirty_value)
m_value = String::empty();
m_value = DeprecatedString::empty();
}
}
String HTMLInputElement::type() const
DeprecatedString HTMLInputElement::type() const
{
switch (m_type) {
#define __ENUMERATE_HTML_INPUT_TYPE_ATTRIBUTE(keyword, state) \
@ -461,13 +461,13 @@ String HTMLInputElement::type() const
VERIFY_NOT_REACHED();
}
void HTMLInputElement::set_type(String const& type)
void HTMLInputElement::set_type(DeprecatedString const& type)
{
MUST(set_attribute(HTML::AttributeNames::type, type));
}
// https://html.spec.whatwg.org/multipage/input.html#value-sanitization-algorithm
String HTMLInputElement::value_sanitization_algorithm(String value) const
DeprecatedString HTMLInputElement::value_sanitization_algorithm(DeprecatedString value) const
{
if (type_state() == HTMLInputElement::TypeAttributeState::Text || type_state() == HTMLInputElement::TypeAttributeState::Search || type_state() == HTMLInputElement::TypeAttributeState::Telephone || type_state() == HTMLInputElement::TypeAttributeState::Password) {
// Strip newlines from the value.
@ -513,7 +513,7 @@ void HTMLInputElement::set_checked_within_group()
return;
set_checked(true, ChangeSource::User);
String name = this->name();
DeprecatedString name = this->name();
document().for_each_in_inclusive_subtree_of_type<HTML::HTMLInputElement>([&](auto& element) {
if (element.checked() && &element != this && element.name() == name)
@ -541,7 +541,7 @@ void HTMLInputElement::legacy_pre_activation_behavior()
// has its checkedness set to true, if any, and then set this element's
// checkedness to true.
if (type_state() == TypeAttributeState::RadioButton) {
String name = this->name();
DeprecatedString name = this->name();
document().for_each_in_inclusive_subtree_of_type<HTML::HTMLInputElement>([&](auto& element) {
if (element.checked() && element.name() == name) {
@ -574,7 +574,7 @@ void HTMLInputElement::legacy_cancelled_activation_behavior()
// group, or if this element no longer has a radio button group, setting
// this element's checkedness to false.
if (type_state() == TypeAttributeState::RadioButton) {
String name = this->name();
DeprecatedString name = this->name();
bool did_reselect_previous_element = false;
if (m_legacy_pre_activation_behavior_checked_element_in_group) {
auto& element_in_group = *m_legacy_pre_activation_behavior_checked_element_in_group;

View file

@ -56,17 +56,17 @@ public:
#undef __ENUMERATE_HTML_INPUT_TYPE_ATTRIBUTE
};
String type() const;
DeprecatedString type() const;
TypeAttributeState type_state() const { return m_type; }
void set_type(String const&);
void set_type(DeprecatedString const&);
String default_value() const { return attribute(HTML::AttributeNames::value); }
String name() const { return attribute(HTML::AttributeNames::name); }
DeprecatedString default_value() const { return attribute(HTML::AttributeNames::value); }
DeprecatedString name() const { return attribute(HTML::AttributeNames::name); }
String value() const;
WebIDL::ExceptionOr<void> set_value(String);
DeprecatedString value() const;
WebIDL::ExceptionOr<void> set_value(DeprecatedString);
Optional<String> placeholder_value() const;
Optional<DeprecatedString> placeholder_value() const;
bool checked() const { return m_checked; }
enum class ChangeSource {
@ -94,7 +94,7 @@ public:
virtual bool is_focusable() const override { return m_type != TypeAttributeState::Hidden; }
// ^HTMLElement
virtual void parse_attribute(FlyString const&, String const&) override;
virtual void parse_attribute(FlyString const&, DeprecatedString const&) override;
virtual void did_remove_attribute(FlyString const&) override;
// ^FormAssociatedElement
@ -136,7 +136,7 @@ private:
void set_checked_within_group();
// https://html.spec.whatwg.org/multipage/input.html#value-sanitization-algorithm
String value_sanitization_algorithm(String) const;
DeprecatedString value_sanitization_algorithm(DeprecatedString) const;
JS::GCPtr<DOM::Text> m_text_node;
bool m_checked { false };
@ -155,7 +155,7 @@ private:
JS::GCPtr<FileAPI::FileList> m_selected_files;
TypeAttributeState m_type { TypeAttributeState::Text };
String m_value;
DeprecatedString m_value;
};
}

View file

@ -18,7 +18,7 @@ public:
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
String for_() const { return attribute(HTML::AttributeNames::for_); }
DeprecatedString for_() const { return attribute(HTML::AttributeNames::for_); }
private:
HTMLLabelElement(DOM::Document&, DOM::QualifiedName);

View file

@ -69,7 +69,7 @@ bool HTMLLinkElement::has_loaded_icon() const
return m_relationship & Relationship::Icon && resource() && resource()->is_loaded() && resource()->has_encoded_data();
}
void HTMLLinkElement::parse_attribute(FlyString const& name, String const& value)
void HTMLLinkElement::parse_attribute(FlyString const& name, DeprecatedString const& value)
{
// 4.6.7 Link types - https://html.spec.whatwg.org/multipage/links.html#linkTypes
if (name == HTML::AttributeNames::rel) {

View file

@ -23,9 +23,9 @@ public:
virtual void inserted() override;
String rel() const { return attribute(HTML::AttributeNames::rel); }
String type() const { return attribute(HTML::AttributeNames::type); }
String href() const { return attribute(HTML::AttributeNames::href); }
DeprecatedString rel() const { return attribute(HTML::AttributeNames::rel); }
DeprecatedString type() const { return attribute(HTML::AttributeNames::type); }
DeprecatedString href() const { return attribute(HTML::AttributeNames::href); }
bool has_loaded_icon() const;
bool load_favicon_and_use_if_window_is_active();
@ -33,7 +33,7 @@ public:
private:
HTMLLinkElement(DOM::Document&, DOM::QualifiedName);
void parse_attribute(FlyString const&, String const&) override;
void parse_attribute(FlyString const&, DeprecatedString const&) override;
// ^ResourceClient
virtual void resource_did_fail() override;

View file

@ -19,7 +19,7 @@ HTMLMediaElement::HTMLMediaElement(DOM::Document& document, DOM::QualifiedName q
HTMLMediaElement::~HTMLMediaElement() = default;
// https://html.spec.whatwg.org/multipage/media.html#dom-navigator-canplaytype
Bindings::CanPlayTypeResult HTMLMediaElement::can_play_type(String const& type) const
Bindings::CanPlayTypeResult HTMLMediaElement::can_play_type(DeprecatedString const& type) const
{
// The canPlayType(type) method must:
// - return the empty string if type is a type that the user agent knows it cannot render or is the type "application/octet-stream"

View file

@ -16,7 +16,7 @@ class HTMLMediaElement : public HTMLElement {
public:
virtual ~HTMLMediaElement() override;
Bindings::CanPlayTypeResult can_play_type(String const& type) const;
Bindings::CanPlayTypeResult can_play_type(DeprecatedString const& type) const;
void load() const;

View file

@ -24,7 +24,7 @@ HTMLObjectElement::HTMLObjectElement(DOM::Document& document, DOM::QualifiedName
HTMLObjectElement::~HTMLObjectElement() = default;
void HTMLObjectElement::parse_attribute(FlyString const& name, String const& value)
void HTMLObjectElement::parse_attribute(FlyString const& name, DeprecatedString const& value)
{
BrowsingContextContainer::parse_attribute(name, value);
@ -33,7 +33,7 @@ void HTMLObjectElement::parse_attribute(FlyString const& name, String const& val
}
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#attr-object-data
String HTMLObjectElement::data() const
DeprecatedString HTMLObjectElement::data() const
{
auto data = attribute(HTML::AttributeNames::data);
return document().parse_url(data).to_string();
@ -134,7 +134,7 @@ void HTMLObjectElement::resource_did_load()
// 4.8. Determine the resource type, as follows:
// 1. Let the resource type be unknown.
Optional<String> resource_type;
Optional<DeprecatedString> resource_type;
// FIXME: 2. If the user agent is configured to strictly obey Content-Type headers for this resource, and the resource has associated Content-Type metadata, then let the resource type be the type specified in the resource's Content-Type metadata, and jump to the step below labeled handler.
// FIXME: 3. If there is a type attribute present on the object element, and that attribute's value is not a type that the user agent supports, but it is a type that a plugin supports, then let the resource type be the type specified in that type attribute, and jump to the step below labeled handler.
@ -167,7 +167,7 @@ void HTMLObjectElement::resource_did_load()
}
// * Otherwise, if the resource does not have associated Content-Type metadata
else {
Optional<String> tentative_type;
Optional<DeprecatedString> tentative_type;
// 1. If there is a type attribute present on the object element, then let the tentative type be the type specified in that type attribute.
// Otherwise, let tentative type be the computed type of the resource.
@ -203,7 +203,7 @@ static bool is_xml_mime_type(StringView resource_type)
}
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-object-element:plugin-11
void HTMLObjectElement::run_object_representation_handler_steps(Optional<String> resource_type)
void HTMLObjectElement::run_object_representation_handler_steps(Optional<DeprecatedString> resource_type)
{
// 4.9. Handler: Handle the content as given by the first of the following cases that matches:

View file

@ -32,12 +32,12 @@ class HTMLObjectElement final
public:
virtual ~HTMLObjectElement() override;
virtual void parse_attribute(FlyString const& name, String const& value) override;
virtual void parse_attribute(FlyString const& name, DeprecatedString const& value) override;
String data() const;
void set_data(String const& data) { MUST(set_attribute(HTML::AttributeNames::data, data)); }
DeprecatedString data() const;
void set_data(DeprecatedString const& data) { MUST(set_attribute(HTML::AttributeNames::data, data)); }
String type() const { return attribute(HTML::AttributeNames::type); }
DeprecatedString type() const { return attribute(HTML::AttributeNames::type); }
// ^FormAssociatedElement
// https://html.spec.whatwg.org/multipage/forms.html#category-listed
@ -51,7 +51,7 @@ private:
bool has_ancestor_media_element_or_object_element_not_showing_fallback_content() const;
void queue_element_task_to_run_object_representation_steps();
void run_object_representation_handler_steps(Optional<String> resource_type);
void run_object_representation_handler_steps(Optional<DeprecatedString> resource_type);
void run_object_representation_completed_steps(Representation);
void run_object_representation_fallback_steps();

View file

@ -25,7 +25,7 @@ HTMLOptionElement::HTMLOptionElement(DOM::Document& document, DOM::QualifiedName
HTMLOptionElement::~HTMLOptionElement() = default;
void HTMLOptionElement::parse_attribute(FlyString const& name, String const& value)
void HTMLOptionElement::parse_attribute(FlyString const& name, DeprecatedString const& value)
{
HTMLElement::parse_attribute(name, value);
@ -59,7 +59,7 @@ void HTMLOptionElement::set_selected(bool selected)
}
// https://html.spec.whatwg.org/multipage/form-elements.html#dom-option-value
String HTMLOptionElement::value() const
DeprecatedString HTMLOptionElement::value() const
{
// The value of an option element is the value of the value content attribute, if there is one.
if (auto value_attr = get_attribute(HTML::AttributeNames::value); !value_attr.is_null())
@ -70,7 +70,7 @@ String HTMLOptionElement::value() const
}
// https://html.spec.whatwg.org/multipage/form-elements.html#dom-option-value
void HTMLOptionElement::set_value(String value)
void HTMLOptionElement::set_value(DeprecatedString value)
{
MUST(set_attribute(HTML::AttributeNames::value, value));
}
@ -88,7 +88,7 @@ static void concatenate_descendants_text_content(DOM::Node const* node, StringBu
}
// https://html.spec.whatwg.org/multipage/form-elements.html#dom-option-text
String HTMLOptionElement::text() const
DeprecatedString HTMLOptionElement::text() const
{
StringBuilder builder;
@ -104,7 +104,7 @@ String HTMLOptionElement::text() const
}
// https://html.spec.whatwg.org/multipage/form-elements.html#dom-option-text
void HTMLOptionElement::set_text(String text)
void HTMLOptionElement::set_text(DeprecatedString text)
{
string_replace_all(text);
}

View file

@ -20,11 +20,11 @@ public:
bool selected() const { return m_selected; }
void set_selected(bool);
String value() const;
void set_value(String);
DeprecatedString value() const;
void set_value(DeprecatedString);
String text() const;
void set_text(String);
DeprecatedString text() const;
void set_text(DeprecatedString);
int index() const;
@ -36,7 +36,7 @@ private:
HTMLOptionElement(DOM::Document&, DOM::QualifiedName);
void parse_attribute(FlyString const& name, String const& value) override;
void parse_attribute(FlyString const& name, DeprecatedString const& value) override;
void did_remove_attribute(FlyString const& name) override;
void ask_for_a_reset();

View file

@ -21,9 +21,9 @@ class HTMLOutputElement final
public:
virtual ~HTMLOutputElement() override;
String const& type() const
DeprecatedString const& type() const
{
static String output = "output";
static DeprecatedString output = "output";
return output;
}

View file

@ -67,7 +67,7 @@ void HTMLProgressElement::set_value(double value)
if (value < 0)
return;
MUST(set_attribute(HTML::AttributeNames::value, String::number(value)));
MUST(set_attribute(HTML::AttributeNames::value, DeprecatedString::number(value)));
progress_position_updated();
}
@ -93,7 +93,7 @@ void HTMLProgressElement::set_max(double value)
if (value <= 0)
return;
MUST(set_attribute(HTML::AttributeNames::max, String::number(value)));
MUST(set_attribute(HTML::AttributeNames::max, DeprecatedString::number(value)));
progress_position_updated();
}

View file

@ -156,7 +156,7 @@ void HTMLScriptElement::prepare_script()
// - el has a type attribute whose value is the empty string;
// - el has no type attribute but it has a language attribute and that attribute's value is the empty string; or
// - el has neither a type attribute nor a language attribute
String script_block_type;
DeprecatedString script_block_type;
bool has_type_attribute = has_attribute(HTML::AttributeNames::type);
bool has_language_attribute = has_attribute(HTML::AttributeNames::language);
if ((has_type_attribute && attribute(HTML::AttributeNames::type).is_empty())
@ -173,7 +173,7 @@ void HTMLScriptElement::prepare_script()
// Otherwise, el has a non-empty language attribute;
else if (!attribute(HTML::AttributeNames::language).is_empty()) {
// let the script block's type string be the concatenation of "text/" and the value of el's language attribute.
script_block_type = String::formatted("text/{}", attribute(HTML::AttributeNames::language));
script_block_type = DeprecatedString::formatted("text/{}", attribute(HTML::AttributeNames::language));
}
// 9. If the script block's type string is a JavaScript MIME type essence match,

View file

@ -44,7 +44,7 @@ public:
virtual void inserted() override;
// https://html.spec.whatwg.org/multipage/scripting.html#dom-script-supports
static bool supports(JS::VM&, String const& type)
static bool supports(JS::VM&, DeprecatedString const& type)
{
return type.is_one_of("classic", "module");
}

View file

@ -130,11 +130,11 @@ i32 HTMLSelectElement::default_tab_index_value() const
}
// https://html.spec.whatwg.org/multipage/form-elements.html#dom-select-type
String const& HTMLSelectElement::type() const
DeprecatedString const& HTMLSelectElement::type() const
{
// The type IDL attribute, on getting, must return the string "select-one" if the multiple attribute is absent, and the string "select-multiple" if the multiple attribute is present.
static String select_one = "select-one"sv;
static String select_multiple = "select-multiple"sv;
static DeprecatedString select_one = "select-one"sv;
static DeprecatedString select_multiple = "select-multiple"sv;
if (!has_attribute(AttributeNames::multiple))
return select_one;

View file

@ -56,7 +56,7 @@ public:
// https://html.spec.whatwg.org/multipage/forms.html#category-label
virtual bool is_labelable() const override { return true; }
String const& type() const;
DeprecatedString const& type() const;
private:
HTMLSelectElement(DOM::Document&, DOM::QualifiedName);

View file

@ -77,7 +77,7 @@ static void add_a_css_style_sheet(DOM::Document& document, CSS::CSSStyleSheet& s
}
// https://www.w3.org/TR/cssom/#create-a-css-style-sheet
static void create_a_css_style_sheet(DOM::Document& document, String type, DOM::Element* owner_node, String media, String title, bool alternate, bool origin_clean, String location, CSS::CSSStyleSheet* parent_style_sheet, CSS::CSSRule* owner_rule, CSS::CSSStyleSheet& sheet)
static void create_a_css_style_sheet(DOM::Document& document, DeprecatedString type, DOM::Element* owner_node, DeprecatedString media, DeprecatedString title, bool alternate, bool origin_clean, DeprecatedString location, CSS::CSSStyleSheet* parent_style_sheet, CSS::CSSRule* owner_rule, CSS::CSSStyleSheet& sheet)
{
// 1. Create a new CSS style sheet object and set its properties as specified.
// FIXME: We receive `sheet` from the caller already. This is weird.
@ -144,7 +144,7 @@ void HTMLStyleElement::update_a_style_block()
"text/css"sv,
this,
attribute(HTML::AttributeNames::media),
in_a_document_tree() ? attribute(HTML::AttributeNames::title) : String::empty(),
in_a_document_tree() ? attribute(HTML::AttributeNames::title) : DeprecatedString::empty(),
false,
true,
{},

View file

@ -56,7 +56,7 @@ unsigned int HTMLTableCellElement::col_span() const
void HTMLTableCellElement::set_col_span(unsigned int value)
{
MUST(set_attribute(HTML::AttributeNames::colspan, String::number(value)));
MUST(set_attribute(HTML::AttributeNames::colspan, DeprecatedString::number(value)));
}
unsigned int HTMLTableCellElement::row_span() const
@ -66,7 +66,7 @@ unsigned int HTMLTableCellElement::row_span() const
void HTMLTableCellElement::set_row_span(unsigned int value)
{
MUST(set_attribute(HTML::AttributeNames::rowspan, String::number(value)));
MUST(set_attribute(HTML::AttributeNames::rowspan, DeprecatedString::number(value)));
}
}

View file

@ -21,9 +21,9 @@ class HTMLTextAreaElement final
public:
virtual ~HTMLTextAreaElement() override;
String const& type() const
DeprecatedString const& type() const
{
static String textarea = "textarea";
static DeprecatedString textarea = "textarea";
return textarea;
}

View file

@ -31,14 +31,14 @@ void History::visit_edges(Cell::Visitor& visitor)
}
// https://html.spec.whatwg.org/multipage/history.html#dom-history-pushstate
WebIDL::ExceptionOr<void> History::push_state(JS::Value data, String const&, String const& url)
WebIDL::ExceptionOr<void> History::push_state(JS::Value data, DeprecatedString const&, DeprecatedString const& url)
{
// NOTE: The second parameter of this function is intentionally unused.
return shared_history_push_replace_state(data, url, IsPush::Yes);
}
// https://html.spec.whatwg.org/multipage/history.html#dom-history-replacestate
WebIDL::ExceptionOr<void> History::replace_state(JS::Value data, String const&, String const& url)
WebIDL::ExceptionOr<void> History::replace_state(JS::Value data, DeprecatedString const&, DeprecatedString const& url)
{
// NOTE: The second parameter of this function is intentionally unused.
return shared_history_push_replace_state(data, url, IsPush::No);
@ -105,7 +105,7 @@ WebIDL::ExceptionOr<void> History::forward()
}
// https://html.spec.whatwg.org/multipage/history.html#shared-history-push/replace-state-steps
WebIDL::ExceptionOr<void> History::shared_history_push_replace_state(JS::Value, String const&, IsPush)
WebIDL::ExceptionOr<void> History::shared_history_push_replace_state(JS::Value, DeprecatedString const&, IsPush)
{
// 1. Let document be history's associated Document. (NOTE: Not necessary)

View file

@ -20,8 +20,8 @@ public:
virtual ~History() override;
WebIDL::ExceptionOr<void> push_state(JS::Value data, String const& unused, String const& url);
WebIDL::ExceptionOr<void> replace_state(JS::Value data, String const& unused, String const& url);
WebIDL::ExceptionOr<void> push_state(JS::Value data, DeprecatedString const& unused, DeprecatedString const& url);
WebIDL::ExceptionOr<void> replace_state(JS::Value data, DeprecatedString const& unused, DeprecatedString const& url);
WebIDL::ExceptionOr<void> go(long delta);
WebIDL::ExceptionOr<void> back();
WebIDL::ExceptionOr<void> forward();
@ -36,7 +36,7 @@ private:
No,
Yes,
};
WebIDL::ExceptionOr<void> shared_history_push_replace_state(JS::Value data, String const& url, IsPush is_push);
WebIDL::ExceptionOr<void> shared_history_push_replace_state(JS::Value data, DeprecatedString const& url, IsPush is_push);
JS::NonnullGCPtr<DOM::Document> m_associated_document;
};

View file

@ -13,8 +13,8 @@ namespace Web::HTML {
struct MessageEventInit : public DOM::EventInit {
JS::Value data { JS::js_null() };
String origin { "" };
String last_event_id { "" };
DeprecatedString origin { "" };
DeprecatedString last_event_id { "" };
};
class MessageEvent : public DOM::Event {
@ -28,15 +28,15 @@ public:
virtual ~MessageEvent() override;
JS::Value data() const { return m_data; }
String const& origin() const { return m_origin; }
String const& last_event_id() const { return m_last_event_id; }
DeprecatedString const& origin() const { return m_origin; }
DeprecatedString const& last_event_id() const { return m_last_event_id; }
private:
virtual void visit_edges(Cell::Visitor&) override;
JS::Value m_data;
String m_origin;
String m_last_event_id;
DeprecatedString m_origin;
DeprecatedString m_last_event_id;
};
}

View file

@ -20,7 +20,7 @@ namespace Web::HTML {
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigation-params
struct NavigationParams {
// a navigation id
String id;
DeprecatedString id;
// null or a request that started the navigation
JS::GCPtr<Fetch::Infrastructure::Request> request;

View file

@ -4,14 +4,14 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/String.h>
#include <AK/DeprecatedString.h>
#include <LibWeb/HTML/NavigatorID.h>
#include <LibWeb/Loader/ResourceLoader.h>
namespace Web::HTML {
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-appversion
String NavigatorIDMixin::app_version() const
DeprecatedString NavigatorIDMixin::app_version() const
{
// Must return the appropriate string that starts with "5.0 (", as follows:
@ -33,7 +33,7 @@ String NavigatorIDMixin::app_version() const
}
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-platform
String NavigatorIDMixin::platform() const
DeprecatedString NavigatorIDMixin::platform() const
{
// Must return a string representing the platform on which the browser is executing (e.g. "MacIntel", "Win32",
// "Linux x86_64", "Linux armv81") or, for privacy and compatibility, a string that is commonly returned on another
@ -44,7 +44,7 @@ String NavigatorIDMixin::platform() const
}
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-useragent
String NavigatorIDMixin::user_agent() const
DeprecatedString NavigatorIDMixin::user_agent() const
{
// Must return the default `User-Agent` value.
return ResourceLoader::the().user_agent();

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/String.h>
#include <AK/DeprecatedString.h>
namespace Web::HTML {
@ -17,35 +17,35 @@ public:
// implementers are strongly urged to include as little information in this API as possible.
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-appcodename
String app_code_name() const { return "Mozilla"sv; }
DeprecatedString app_code_name() const { return "Mozilla"sv; }
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-appcodename
String app_name() const { return "Netscape"sv; }
DeprecatedString app_name() const { return "Netscape"sv; }
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-appversion
String app_version() const;
DeprecatedString app_version() const;
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-platform
String platform() const;
DeprecatedString platform() const;
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-product
String product() const { return "Gecko"sv; }
DeprecatedString product() const { return "Gecko"sv; }
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-productsub
String product_sub() const { return "20030107"sv; } // Compatibility mode "Chrome"
DeprecatedString product_sub() const { return "20030107"sv; } // Compatibility mode "Chrome"
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-useragent
String user_agent() const;
DeprecatedString user_agent() const;
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-vendor
String vendor() const { return "Google Inc."sv; } // Compatibility mode "Chrome"
DeprecatedString vendor() const { return "Google Inc."sv; } // Compatibility mode "Chrome"
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-vendorsub
String vendor_sub() const { return ""sv; }
DeprecatedString vendor_sub() const { return ""sv; }
// NOTE: If the navigator compatibility mode is Gecko, then the user agent must also support the following partial interface:
// bool taint_enabled()
// String oscpu()
// DeprecatedString oscpu()
};
}

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/String.h>
#include <AK/DeprecatedString.h>
#include <AK/Vector.h>
namespace Web::HTML {
@ -14,15 +14,15 @@ namespace Web::HTML {
class NavigatorLanguageMixin {
public:
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-language
String language() const { return m_current_preferred_languages[0]; }
DeprecatedString language() const { return m_current_preferred_languages[0]; }
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-languages
// FIXME: The same object must be returned until the user agent needs to return different values, or values in a
// different order.
Vector<String> languages() const { return m_current_preferred_languages; }
Vector<DeprecatedString> languages() const { return m_current_preferred_languages; }
protected:
Vector<String> m_current_preferred_languages = { "en-US" };
Vector<DeprecatedString> m_current_preferred_languages = { "en-US" };
};
}

View file

@ -7,14 +7,14 @@
#pragma once
#include <AK/String.h>
#include <AK/DeprecatedString.h>
namespace Web::HTML {
class Origin {
public:
Origin() = default;
Origin(String const& scheme, String const& host, u16 port)
Origin(DeprecatedString const& scheme, DeprecatedString const& host, u16 port)
: m_scheme(scheme)
, m_host(host)
, m_port(port)
@ -24,8 +24,8 @@ public:
// https://html.spec.whatwg.org/multipage/origin.html#concept-origin-opaque
bool is_opaque() const { return m_scheme.is_null() && m_host.is_null() && m_port == 0; }
String const& scheme() const { return m_scheme; }
String const& host() const { return m_host; }
DeprecatedString const& scheme() const { return m_scheme; }
DeprecatedString const& host() const { return m_host; }
u16 port() const { return m_port; }
// https://html.spec.whatwg.org/multipage/origin.html#same-origin
@ -67,7 +67,7 @@ public:
}
// https://html.spec.whatwg.org/multipage/origin.html#ascii-serialisation-of-an-origin
String serialize() const
DeprecatedString serialize() const
{
// 1. If origin is an opaque origin, then return "null"
if (is_opaque())
@ -86,18 +86,18 @@ public:
// 5. If origin's port is non-null, append a U+003A COLON character (:), and origin's port, serialized, to result.
if (port() != 0) {
result.append(':');
result.append(String::number(port()));
result.append(DeprecatedString::number(port()));
}
// 6. Return result
return result.to_string();
}
// https://html.spec.whatwg.org/multipage/origin.html#concept-origin-effective-domain
Optional<String> effective_domain() const
Optional<DeprecatedString> effective_domain() const
{
// 1. If origin is an opaque origin, then return null.
if (is_opaque())
return Optional<String> {};
return Optional<DeprecatedString> {};
// FIXME: 2. If origin's domain is non-null, then return origin's domain.
@ -108,8 +108,8 @@ public:
bool operator==(Origin const& other) const { return is_same_origin(other); }
private:
String m_scheme;
String m_host;
DeprecatedString m_scheme;
DeprecatedString m_host;
u16 m_port { 0 };
};

View file

@ -35,7 +35,7 @@ bool prescan_skip_whitespace_and_slashes(ByteBuffer const& input, size_t& positi
}
// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#algorithm-for-extracting-a-character-encoding-from-a-meta-element
Optional<StringView> extract_character_encoding_from_meta_element(String const& string)
Optional<StringView> extract_character_encoding_from_meta_element(DeprecatedString const& string)
{
// Checking for "charset" is case insensitive, as is getting an encoding.
// Therefore, stick to lowercase from the start for simplicity.
@ -158,7 +158,7 @@ value:
}
// https://html.spec.whatwg.org/multipage/parsing.html#prescan-a-byte-stream-to-determine-its-encoding
Optional<String> run_prescan_byte_stream_algorithm(DOM::Document& document, ByteBuffer const& input)
Optional<DeprecatedString> run_prescan_byte_stream_algorithm(DOM::Document& document, ByteBuffer const& input)
{
// https://html.spec.whatwg.org/multipage/parsing.html#prescan-a-byte-stream-to-determine-its-encoding
@ -188,10 +188,10 @@ Optional<String> run_prescan_byte_stream_algorithm(DOM::Document& document, Byte
&& (input[position + 4] == 'A' || input[position + 4] == 'a')
&& prescan_is_whitespace_or_slash(input[position + 5])) {
position += 6;
Vector<String> attribute_list {};
Vector<DeprecatedString> attribute_list {};
bool got_pragma = false;
Optional<bool> need_pragma {};
Optional<String> charset {};
Optional<DeprecatedString> charset {};
while (true) {
auto attribute = prescan_get_attribute(document, input, position);
@ -213,7 +213,7 @@ Optional<String> run_prescan_byte_stream_algorithm(DOM::Document& document, Byte
} else if (attribute_name == "charset") {
auto maybe_charset = TextCodec::get_standardized_encoding(attribute->value());
if (maybe_charset.has_value()) {
charset = Optional<String> { maybe_charset };
charset = Optional<DeprecatedString> { maybe_charset };
need_pragma = { false };
}
}
@ -247,7 +247,7 @@ Optional<String> run_prescan_byte_stream_algorithm(DOM::Document& document, Byte
}
// https://html.spec.whatwg.org/multipage/parsing.html#determining-the-character-encoding
String run_encoding_sniffing_algorithm(DOM::Document& document, ByteBuffer const& input)
DeprecatedString run_encoding_sniffing_algorithm(DOM::Document& document, ByteBuffer const& input)
{
if (input.size() >= 2) {
if (input[0] == 0xFE && input[1] == 0xFF) {

View file

@ -6,8 +6,8 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/Optional.h>
#include <AK/String.h>
#include <LibJS/Heap/GCPtr.h>
#include <LibWeb/Forward.h>
@ -16,9 +16,9 @@ namespace Web::HTML {
bool prescan_should_abort(ByteBuffer const& input, size_t const& position);
bool prescan_is_whitespace_or_slash(u8 const& byte);
bool prescan_skip_whitespace_and_slashes(ByteBuffer const& input, size_t& position);
Optional<StringView> extract_character_encoding_from_meta_element(String const&);
Optional<StringView> extract_character_encoding_from_meta_element(DeprecatedString const&);
JS::GCPtr<DOM::Attr> prescan_get_attribute(DOM::Document&, ByteBuffer const& input, size_t& position);
Optional<String> run_prescan_byte_stream_algorithm(DOM::Document&, ByteBuffer const& input);
String run_encoding_sniffing_algorithm(DOM::Document&, ByteBuffer const& input);
Optional<DeprecatedString> run_prescan_byte_stream_algorithm(DOM::Document&, ByteBuffer const& input);
DeprecatedString run_encoding_sniffing_algorithm(DOM::Document&, ByteBuffer const& input);
}

View file

@ -121,7 +121,7 @@ static bool is_html_integration_point(DOM::Element const& element)
return false;
}
HTMLParser::HTMLParser(DOM::Document& document, StringView input, String const& encoding)
HTMLParser::HTMLParser(DOM::Document& document, StringView input, DeprecatedString const& encoding)
: m_tokenizer(input, encoding)
, m_scripting_enabled(document.is_scripting_enabled())
, m_document(JS::make_handle(document))
@ -3552,13 +3552,13 @@ JS::NonnullGCPtr<HTMLParser> HTMLParser::create_with_uncertain_encoding(DOM::Doc
return *document.heap().allocate_without_realm<HTMLParser>(document, input, encoding);
}
JS::NonnullGCPtr<HTMLParser> HTMLParser::create(DOM::Document& document, StringView input, String const& encoding)
JS::NonnullGCPtr<HTMLParser> HTMLParser::create(DOM::Document& document, StringView input, DeprecatedString const& encoding)
{
return *document.heap().allocate_without_realm<HTMLParser>(document, input, encoding);
}
// https://html.spec.whatwg.org/multipage/parsing.html#html-fragment-serialisation-algorithm
String HTMLParser::serialize_html_fragment(DOM::Node const& node)
DeprecatedString HTMLParser::serialize_html_fragment(DOM::Node const& node)
{
// The algorithm takes as input a DOM Element, Document, or DocumentFragment referred to as the node.
VERIFY(node.is_element() || node.is_document() || node.is_document_fragment());
@ -3570,7 +3570,7 @@ String HTMLParser::serialize_html_fragment(DOM::Node const& node)
// 1. If the node serializes as void, then return the empty string.
// (NOTE: serializes as void is defined only on elements in the spec)
if (element.serializes_as_void())
return String::empty();
return DeprecatedString::empty();
// 3. If the node is a template element, then let the node instead be the template element's template contents (a DocumentFragment node).
// (NOTE: This is out of order of the spec to avoid another dynamic cast. The second step just creates a string builder, so it shouldn't matter)
@ -3583,7 +3583,7 @@ String HTMLParser::serialize_html_fragment(DOM::Node const& node)
Yes,
};
auto escape_string = [](StringView string, AttributeMode attribute_mode) -> String {
auto escape_string = [](StringView string, AttributeMode attribute_mode) -> DeprecatedString {
// https://html.spec.whatwg.org/multipage/parsing.html#escapingString
StringBuilder builder;
for (auto& ch : string) {
@ -3622,7 +3622,7 @@ String HTMLParser::serialize_html_fragment(DOM::Node const& node)
// 1. If current node is an element in the HTML namespace, the MathML namespace, or the SVG namespace, then let tagname be current node's local name.
// Otherwise, let tagname be current node's qualified name.
String tag_name;
DeprecatedString tag_name;
if (element.namespace_().is_one_of(Namespace::HTML, Namespace::MathML, Namespace::SVG))
tag_name = element.local_name();

View file

@ -49,7 +49,7 @@ public:
static JS::NonnullGCPtr<HTMLParser> create_for_scripting(DOM::Document&);
static JS::NonnullGCPtr<HTMLParser> create_with_uncertain_encoding(DOM::Document&, ByteBuffer const& input);
static JS::NonnullGCPtr<HTMLParser> create(DOM::Document&, StringView input, String const& encoding);
static JS::NonnullGCPtr<HTMLParser> create(DOM::Document&, StringView input, DeprecatedString const& encoding);
void run();
void run(const AK::URL&);
@ -57,7 +57,7 @@ public:
DOM::Document& document();
static Vector<JS::Handle<DOM::Node>> parse_html_fragment(DOM::Element& context_element, StringView);
static String serialize_html_fragment(DOM::Node const& node);
static DeprecatedString serialize_html_fragment(DOM::Node const& node);
enum class InsertionMode {
#define __ENUMERATE_INSERTION_MODE(mode) mode,
@ -80,7 +80,7 @@ public:
size_t script_nesting_level() const { return m_script_nesting_level; }
private:
HTMLParser(DOM::Document&, StringView input, String const& encoding);
HTMLParser(DOM::Document&, StringView input, DeprecatedString const& encoding);
HTMLParser(DOM::Document&);
virtual void visit_edges(Cell::Visitor&) override;

View file

@ -8,7 +8,7 @@
namespace Web::HTML {
String HTMLToken::to_string() const
DeprecatedString HTMLToken::to_string() const
{
StringBuilder builder;

View file

@ -7,10 +7,10 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/FlyString.h>
#include <AK/Function.h>
#include <AK/OwnPtr.h>
#include <AK/String.h>
#include <AK/Types.h>
#include <AK/Variant.h>
#include <AK/Vector.h>
@ -39,10 +39,10 @@ public:
};
struct Attribute {
String prefix;
String local_name { "" };
String namespace_;
String value { "" };
DeprecatedString prefix;
DeprecatedString local_name { "" };
DeprecatedString namespace_;
DeprecatedString value { "" };
Position name_start_position;
Position value_start_position;
Position name_end_position;
@ -51,9 +51,9 @@ public:
struct DoctypeData {
// NOTE: "Missing" is a distinct state from the empty string.
String name;
String public_identifier;
String system_identifier;
DeprecatedString name;
DeprecatedString public_identifier;
DeprecatedString system_identifier;
bool missing_name { true };
bool missing_public_identifier { true };
bool missing_system_identifier { true };
@ -140,7 +140,7 @@ public:
return m_string_data;
}
void set_comment(String comment)
void set_comment(DeprecatedString comment)
{
VERIFY(is_comment());
m_string_data = move(comment);
@ -152,7 +152,7 @@ public:
return m_string_data;
}
void set_tag_name(String name)
void set_tag_name(DeprecatedString name)
{
VERIFY(is_start_tag() || is_end_tag());
m_string_data = move(name);
@ -315,7 +315,7 @@ public:
Type type() const { return m_type; }
String to_string() const;
DeprecatedString to_string() const;
Position const& start_position() const { return m_start_position; }
Position const& end_position() const { return m_end_position; }

View file

@ -2796,7 +2796,7 @@ HTMLTokenizer::HTMLTokenizer()
m_source_positions.empend(0u, 0u);
}
HTMLTokenizer::HTMLTokenizer(StringView input, String const& encoding)
HTMLTokenizer::HTMLTokenizer(StringView input, DeprecatedString const& encoding)
{
auto* decoder = TextCodec::decoder_for(encoding);
VERIFY(decoder);
@ -2807,7 +2807,7 @@ HTMLTokenizer::HTMLTokenizer(StringView input, String const& encoding)
m_source_positions.empend(0u, 0u);
}
void HTMLTokenizer::insert_input_at_insertion_point(String const& input)
void HTMLTokenizer::insert_input_at_insertion_point(DeprecatedString const& input)
{
auto utf8_iterator_byte_offset = m_utf8_view.byte_offset_of(m_utf8_iterator);
@ -2885,7 +2885,7 @@ void HTMLTokenizer::restore_to(Utf8CodePointIterator const& new_iterator)
m_utf8_iterator = new_iterator;
}
String HTMLTokenizer::consume_current_builder()
DeprecatedString HTMLTokenizer::consume_current_builder()
{
auto string = m_current_builder.to_string();
m_current_builder.clear();

View file

@ -102,7 +102,7 @@ namespace Web::HTML {
class HTMLTokenizer {
public:
explicit HTMLTokenizer();
explicit HTMLTokenizer(StringView input, String const& encoding);
explicit HTMLTokenizer(StringView input, DeprecatedString const& encoding);
enum class State {
#define __ENUMERATE_TOKENIZER_STATE(state) state,
@ -123,9 +123,9 @@ public:
void set_blocked(bool b) { m_blocked = b; }
bool is_blocked() const { return m_blocked; }
String source() const { return m_decoded_input; }
DeprecatedString source() const { return m_decoded_input; }
void insert_input_at_insertion_point(String const& input);
void insert_input_at_insertion_point(DeprecatedString const& input);
void insert_eof();
bool is_eof_inserted();
@ -153,7 +153,7 @@ private:
bool consume_next_if_match(StringView, CaseSensitivity = CaseSensitivity::CaseSensitive);
void create_new_token(HTMLToken::Type);
bool current_end_tag_token_is_appropriate() const;
String consume_current_builder();
DeprecatedString consume_current_builder();
static char const* state_name(State state)
{
@ -183,7 +183,7 @@ private:
Vector<u32> m_temporary_buffer;
String m_decoded_input;
DeprecatedString m_decoded_input;
struct InsertionPoint {
size_t position { 0 };
@ -199,7 +199,7 @@ private:
HTMLToken m_current_token;
StringBuilder m_current_builder;
Optional<String> m_last_emitted_start_tag_name;
Optional<DeprecatedString> m_last_emitted_start_tag_name;
bool m_explicit_eof_inserted { false };
bool m_has_emitted_eof { false };

View file

@ -12,13 +12,13 @@
namespace Web::HTML {
JS::NonnullGCPtr<Path2D> Path2D::construct_impl(JS::Realm& realm, Optional<Variant<JS::Handle<Path2D>, String>> const& path)
JS::NonnullGCPtr<Path2D> Path2D::construct_impl(JS::Realm& realm, Optional<Variant<JS::Handle<Path2D>, DeprecatedString>> const& path)
{
return *realm.heap().allocate<Path2D>(realm, realm, path);
}
// https://html.spec.whatwg.org/multipage/canvas.html#dom-path2d
Path2D::Path2D(JS::Realm& realm, Optional<Variant<JS::Handle<Path2D>, String>> const& path)
Path2D::Path2D(JS::Realm& realm, Optional<Variant<JS::Handle<Path2D>, DeprecatedString>> const& path)
: PlatformObject(realm)
, CanvasPath(static_cast<Bindings::PlatformObject&>(*this))
{
@ -37,7 +37,7 @@ Path2D::Path2D(JS::Realm& realm, Optional<Variant<JS::Handle<Path2D>, String>> c
}
// 4. Let svgPath be the result of parsing and interpreting path according to SVG 2's rules for path data. [SVG]
auto path_instructions = SVG::AttributeParser::parse_path_data(path->get<String>());
auto path_instructions = SVG::AttributeParser::parse_path_data(path->get<DeprecatedString>());
auto svg_path = SVG::path_from_path_instructions(path_instructions);
if (!svg_path.segments().is_empty()) {

View file

@ -21,12 +21,12 @@ class Path2D final
WEB_PLATFORM_OBJECT(Path2D, Bindings::PlatformObject);
public:
static JS::NonnullGCPtr<Path2D> construct_impl(JS::Realm&, Optional<Variant<JS::Handle<Path2D>, String>> const& path);
static JS::NonnullGCPtr<Path2D> construct_impl(JS::Realm&, Optional<Variant<JS::Handle<Path2D>, DeprecatedString>> const& path);
virtual ~Path2D() override;
private:
Path2D(JS::Realm&, Optional<Variant<JS::Handle<Path2D>, String>> const&);
Path2D(JS::Realm&, Optional<Variant<JS::Handle<Path2D>, DeprecatedString>> const&);
};
}

View file

@ -16,7 +16,7 @@
namespace Web::HTML {
// https://html.spec.whatwg.org/multipage/webappapis.html#creating-a-classic-script
JS::NonnullGCPtr<ClassicScript> ClassicScript::create(String filename, StringView source, EnvironmentSettingsObject& environment_settings_object, AK::URL base_url, size_t source_line_number, MutedErrors muted_errors)
JS::NonnullGCPtr<ClassicScript> ClassicScript::create(DeprecatedString filename, StringView source, EnvironmentSettingsObject& environment_settings_object, AK::URL base_url, size_t source_line_number, MutedErrors muted_errors)
{
auto& vm = environment_settings_object.realm().vm();
@ -148,7 +148,7 @@ JS::Completion ClassicScript::run(RethrowErrors rethrow_errors)
// Return Completion { [[Type]]: throw, [[Value]]: a new "QuotaExceededError" DOMException, [[Target]]: empty }.
}
ClassicScript::ClassicScript(AK::URL base_url, String filename, EnvironmentSettingsObject& environment_settings_object)
ClassicScript::ClassicScript(AK::URL base_url, DeprecatedString filename, EnvironmentSettingsObject& environment_settings_object)
: Script(move(base_url), move(filename), environment_settings_object)
{
}

View file

@ -23,7 +23,7 @@ public:
No,
Yes,
};
static JS::NonnullGCPtr<ClassicScript> create(String filename, StringView source, EnvironmentSettingsObject&, AK::URL base_url, size_t source_line_number = 1, MutedErrors = MutedErrors::No);
static JS::NonnullGCPtr<ClassicScript> create(DeprecatedString filename, StringView source, EnvironmentSettingsObject&, AK::URL base_url, size_t source_line_number = 1, MutedErrors = MutedErrors::No);
JS::Script* script_record() { return m_script_record; }
JS::Script const* script_record() const { return m_script_record; }
@ -37,7 +37,7 @@ public:
MutedErrors muted_errors() const { return m_muted_errors; }
private:
ClassicScript(AK::URL base_url, String filename, EnvironmentSettingsObject& environment_settings_object);
ClassicScript(AK::URL base_url, DeprecatedString filename, EnvironmentSettingsObject& environment_settings_object);
virtual void visit_edges(Cell::Visitor&) override;

View file

@ -301,7 +301,7 @@ bool EnvironmentSettingsObject::is_scripting_disabled() const
}
// https://html.spec.whatwg.org/multipage/webappapis.html#module-type-allowed
bool EnvironmentSettingsObject::module_type_allowed(AK::String const& module_type) const
bool EnvironmentSettingsObject::module_type_allowed(AK::DeprecatedString const& module_type) const
{
// 1. If moduleType is not "javascript", "css", or "json", then return false.
if (module_type != "javascript"sv && module_type != "css"sv && module_type != "json"sv)

View file

@ -23,7 +23,7 @@ struct Environment {
virtual ~Environment() = default;
// An id https://html.spec.whatwg.org/multipage/webappapis.html#concept-environment-id
String id;
DeprecatedString id;
// https://html.spec.whatwg.org/multipage/webappapis.html#concept-environment-creation-url
AK::URL creation_url;
@ -71,7 +71,7 @@ struct EnvironmentSettingsObject
virtual JS::GCPtr<DOM::Document> responsible_document() = 0;
// https://html.spec.whatwg.org/multipage/webappapis.html#api-url-character-encoding
virtual String api_url_character_encoding() = 0;
virtual DeprecatedString api_url_character_encoding() = 0;
// https://html.spec.whatwg.org/multipage/webappapis.html#api-base-url
virtual AK::URL api_base_url() = 0;
@ -113,7 +113,7 @@ struct EnvironmentSettingsObject
bool is_scripting_enabled() const;
bool is_scripting_disabled() const;
bool module_type_allowed(String const& module_type) const;
bool module_type_allowed(DeprecatedString const& module_type) const;
void disallow_further_import_maps();

View file

@ -18,10 +18,10 @@
namespace Web::HTML {
// https://html.spec.whatwg.org/multipage/webappapis.html#module-type-from-module-request
String module_type_from_module_request(JS::ModuleRequest const& module_request)
DeprecatedString module_type_from_module_request(JS::ModuleRequest const& module_request)
{
// 1. Let moduleType be "javascript".
String module_type = "javascript"sv;
DeprecatedString module_type = "javascript"sv;
// 2. If moduleRequest.[[Assertions]] has a Record entry such that entry.[[Key]] is "type", then:
for (auto const& entry : module_request.assertions) {
@ -41,7 +41,7 @@ String module_type_from_module_request(JS::ModuleRequest const& module_request)
}
// https://html.spec.whatwg.org/multipage/webappapis.html#resolve-a-module-specifier
WebIDL::ExceptionOr<AK::URL> resolve_module_specifier(Optional<Script&> referring_script, String const& specifier)
WebIDL::ExceptionOr<AK::URL> resolve_module_specifier(Optional<Script&> referring_script, DeprecatedString const& specifier)
{
// 1. Let settingsObject and baseURL be null.
Optional<EnvironmentSettingsObject&> settings_object;
@ -113,11 +113,11 @@ WebIDL::ExceptionOr<AK::URL> resolve_module_specifier(Optional<Script&> referrin
return as_url.release_value();
// 13. Throw a TypeError indicating that specifier was a bare specifier, but was not remapped to anything by importMap.
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, String::formatted("Failed to resolve non relative module specifier '{}' from an import map.", specifier) };
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, DeprecatedString::formatted("Failed to resolve non relative module specifier '{}' from an import map.", specifier) };
}
// https://html.spec.whatwg.org/multipage/webappapis.html#resolving-an-imports-match
WebIDL::ExceptionOr<Optional<AK::URL>> resolve_imports_match(String const& normalized_specifier, Optional<AK::URL> as_url, ModuleSpecifierMap const& specifier_map)
WebIDL::ExceptionOr<Optional<AK::URL>> resolve_imports_match(DeprecatedString const& normalized_specifier, Optional<AK::URL> as_url, ModuleSpecifierMap const& specifier_map)
{
// 1. For each specifierKey → resolutionResult of specifierMap:
for (auto const& [specifier_key, resolution_result] : specifier_map) {
@ -125,7 +125,7 @@ WebIDL::ExceptionOr<Optional<AK::URL>> resolve_imports_match(String const& norma
if (specifier_key == normalized_specifier) {
// 1. If resolutionResult is null, then throw a TypeError indicating that resolution of specifierKey was blocked by a null entry.
if (!resolution_result.has_value())
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, String::formatted("Import resolution of '{}' was blocked by a null entry.", specifier_key) };
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, DeprecatedString::formatted("Import resolution of '{}' was blocked by a null entry.", specifier_key) };
// 2. Assert: resolutionResult is a URL.
VERIFY(resolution_result->is_valid());
@ -146,7 +146,7 @@ WebIDL::ExceptionOr<Optional<AK::URL>> resolve_imports_match(String const& norma
) {
// 1. If resolutionResult is null, then throw a TypeError indicating that the resolution of specifierKey was blocked by a null entry.
if (!resolution_result.has_value())
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, String::formatted("Import resolution of '{}' was blocked by a null entry.", specifier_key) };
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, DeprecatedString::formatted("Import resolution of '{}' was blocked by a null entry.", specifier_key) };
// 2. Assert: resolutionResult is a URL.
VERIFY(resolution_result->is_valid());
@ -164,7 +164,7 @@ WebIDL::ExceptionOr<Optional<AK::URL>> resolve_imports_match(String const& norma
// 6. If url is failure, then throw a TypeError indicating that resolution of normalizedSpecifier was blocked since the afterPrefix portion
// could not be URL-parsed relative to the resolutionResult mapped to by the specifierKey prefix.
if (!url.is_valid())
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, String::formatted("Could not resolve '{}' as the after prefix portion could not be URL-parsed.", normalized_specifier) };
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, DeprecatedString::formatted("Could not resolve '{}' as the after prefix portion could not be URL-parsed.", normalized_specifier) };
// 7. Assert: url is a URL.
VERIFY(url.is_valid());
@ -172,7 +172,7 @@ WebIDL::ExceptionOr<Optional<AK::URL>> resolve_imports_match(String const& norma
// 8. If the serialization of resolutionResult is not a code unit prefix of the serialization of url, then throw a TypeError indicating
// that the resolution of normalizedSpecifier was blocked due to it backtracking above its prefix specifierKey.
if (!Infra::is_code_unit_prefix(resolution_result->serialize(), url.serialize()))
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, String::formatted("Could not resolve '{}' as it backtracks above its prefix specifierKey.", normalized_specifier) };
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, DeprecatedString::formatted("Could not resolve '{}' as it backtracks above its prefix specifierKey.", normalized_specifier) };
// 9. Return url.
return url;
@ -184,7 +184,7 @@ WebIDL::ExceptionOr<Optional<AK::URL>> resolve_imports_match(String const& norma
}
// https://html.spec.whatwg.org/multipage/webappapis.html#resolving-a-url-like-module-specifier
Optional<AK::URL> resolve_url_like_module_specifier(String const& specifier, AK::URL const& base_url)
Optional<AK::URL> resolve_url_like_module_specifier(DeprecatedString const& specifier, AK::URL const& base_url)
{
// 1. If specifier starts with "/", "./", or "../", then:
if (specifier.starts_with("/"sv) || specifier.starts_with("./"sv) || specifier.starts_with("../"sv)) {
@ -339,7 +339,7 @@ void fetch_descendants_of_a_module_script(JavaScriptModuleScript& module_script,
void fetch_single_module_script(AK::URL const& url, EnvironmentSettingsObject&, StringView, EnvironmentSettingsObject& module_map_settings_object, AK::URL const&, Optional<JS::ModuleRequest> const& module_request, TopLevelModule, ModuleCallback on_complete)
{
// 1. Let moduleType be "javascript".
String module_type = "javascript"sv;
DeprecatedString module_type = "javascript"sv;
// 2. If moduleRequest was given, then set moduleType to the result of running the module type from module request steps given moduleRequest.
if (module_request.has_value())
@ -442,7 +442,7 @@ void fetch_external_module_script_graph(AK::URL const& url, EnvironmentSettingsO
}
// https://html.spec.whatwg.org/multipage/webappapis.html#fetch-an-inline-module-script-graph
void fetch_inline_module_script_graph(String const& filename, String const& source_text, AK::URL const& base_url, EnvironmentSettingsObject& settings_object, ModuleCallback on_complete)
void fetch_inline_module_script_graph(DeprecatedString const& filename, DeprecatedString const& source_text, AK::URL const& base_url, EnvironmentSettingsObject& settings_object, ModuleCallback on_complete)
{
// 1. Disallow further import maps given settings object.
settings_object.disallow_further_import_maps();

View file

@ -38,14 +38,14 @@ private:
ModuleCallback m_on_complete;
};
String module_type_from_module_request(JS::ModuleRequest const&);
WebIDL::ExceptionOr<AK::URL> resolve_module_specifier(Optional<Script&> referring_script, String const& specifier);
WebIDL::ExceptionOr<Optional<AK::URL>> resolve_imports_match(String const& normalized_specifier, Optional<AK::URL> as_url, ModuleSpecifierMap const&);
Optional<AK::URL> resolve_url_like_module_specifier(String const& specifier, AK::URL const& base_url);
DeprecatedString module_type_from_module_request(JS::ModuleRequest const&);
WebIDL::ExceptionOr<AK::URL> resolve_module_specifier(Optional<Script&> referring_script, DeprecatedString const& specifier);
WebIDL::ExceptionOr<Optional<AK::URL>> resolve_imports_match(DeprecatedString const& normalized_specifier, Optional<AK::URL> as_url, ModuleSpecifierMap const&);
Optional<AK::URL> resolve_url_like_module_specifier(DeprecatedString const& specifier, AK::URL const& base_url);
void fetch_internal_module_script_graph(JS::ModuleRequest const& module_request, EnvironmentSettingsObject& fetch_client_settings_object, StringView destination, Script& referring_script, HashTable<ModuleLocationTuple> const& visited_set, ModuleCallback on_complete);
void fetch_external_module_script_graph(AK::URL const&, EnvironmentSettingsObject& settings_object, ModuleCallback on_complete);
void fetch_inline_module_script_graph(String const& filename, String const& source_text, AK::URL const& base_url, EnvironmentSettingsObject& settings_object, ModuleCallback on_complete);
void fetch_inline_module_script_graph(DeprecatedString const& filename, DeprecatedString const& source_text, AK::URL const& base_url, EnvironmentSettingsObject& settings_object, ModuleCallback on_complete);
void fetch_descendants_of_a_module_script(JavaScriptModuleScript& module_script, EnvironmentSettingsObject& fetch_client_settings_object, StringView destination, HashTable<ModuleLocationTuple> visited_set, ModuleCallback callback);
void fetch_descendants_of_and_link_a_module_script(JavaScriptModuleScript& module_script, EnvironmentSettingsObject& fetch_client_settings_object, StringView destination, HashTable<ModuleLocationTuple> const& visited_set, ModuleCallback on_complete);

View file

@ -10,7 +10,7 @@
namespace Web::HTML {
using ModuleSpecifierMap = HashMap<String, Optional<AK::URL>>;
using ModuleSpecifierMap = HashMap<DeprecatedString, Optional<AK::URL>>;
// https://html.spec.whatwg.org/multipage/webappapis.html#import-map
class ImportMap {

View file

@ -8,17 +8,17 @@
namespace Web::HTML {
bool ModuleMap::is_fetching(AK::URL const& url, String const& type) const
bool ModuleMap::is_fetching(AK::URL const& url, DeprecatedString const& type) const
{
return is(url, type, EntryType::Fetching);
}
bool ModuleMap::is_failed(AK::URL const& url, String const& type) const
bool ModuleMap::is_failed(AK::URL const& url, DeprecatedString const& type) const
{
return is(url, type, EntryType::Failed);
}
bool ModuleMap::is(AK::URL const& url, String const& type, EntryType entry_type) const
bool ModuleMap::is(AK::URL const& url, DeprecatedString const& type, EntryType entry_type) const
{
auto value = m_values.get({ url, type });
if (!value.has_value())
@ -27,12 +27,12 @@ bool ModuleMap::is(AK::URL const& url, String const& type, EntryType entry_type)
return value->type == entry_type;
}
Optional<ModuleMap::Entry> ModuleMap::get(AK::URL const& url, String const& type) const
Optional<ModuleMap::Entry> ModuleMap::get(AK::URL const& url, DeprecatedString const& type) const
{
return m_values.get({ url, type });
}
AK::HashSetResult ModuleMap::set(AK::URL const& url, String const& type, Entry entry)
AK::HashSetResult ModuleMap::set(AK::URL const& url, DeprecatedString const& type, Entry entry)
{
auto callbacks = m_callbacks.get({ url, type });
if (callbacks.has_value())
@ -42,7 +42,7 @@ AK::HashSetResult ModuleMap::set(AK::URL const& url, String const& type, Entry e
return m_values.set({ url, type }, entry);
}
void ModuleMap::wait_for_change(AK::URL const& url, String const& type, Function<void(Entry)> callback)
void ModuleMap::wait_for_change(AK::URL const& url, DeprecatedString const& type, Function<void(Entry)> callback)
{
m_callbacks.ensure({ url, type }).append(move(callback));
}

View file

@ -12,14 +12,14 @@ namespace Web::HTML {
class ModuleLocationTuple {
public:
ModuleLocationTuple(AK::URL url, String type)
ModuleLocationTuple(AK::URL url, DeprecatedString type)
: m_url(move(url))
, m_type(move(type))
{
}
AK::URL const& url() const { return m_url; };
String const& type() const { return m_type; }
DeprecatedString const& type() const { return m_type; }
bool operator==(ModuleLocationTuple const& other) const
{
@ -28,7 +28,7 @@ public:
private:
AK::URL m_url;
String m_type;
DeprecatedString m_type;
};
// https://html.spec.whatwg.org/multipage/webappapis.html#module-map
@ -50,16 +50,16 @@ public:
JavaScriptModuleScript* module_script;
};
bool is_fetching(AK::URL const& url, String const& type) const;
bool is_failed(AK::URL const& url, String const& type) const;
bool is_fetching(AK::URL const& url, DeprecatedString const& type) const;
bool is_failed(AK::URL const& url, DeprecatedString const& type) const;
bool is(AK::URL const& url, String const& type, EntryType) const;
bool is(AK::URL const& url, DeprecatedString const& type, EntryType) const;
Optional<Entry> get(AK::URL const& url, String const& type) const;
Optional<Entry> get(AK::URL const& url, DeprecatedString const& type) const;
AK::HashSetResult set(AK::URL const& url, String const& type, Entry);
AK::HashSetResult set(AK::URL const& url, DeprecatedString const& type, Entry);
void wait_for_change(AK::URL const& url, String const& type, Function<void(Entry)> callback);
void wait_for_change(AK::URL const& url, DeprecatedString const& type, Function<void(Entry)> callback);
private:
HashMap<ModuleLocationTuple, Entry> m_values;

View file

@ -16,20 +16,20 @@ namespace Web::HTML {
ModuleScript::~ModuleScript() = default;
ModuleScript::ModuleScript(AK::URL base_url, String filename, EnvironmentSettingsObject& environment_settings_object)
ModuleScript::ModuleScript(AK::URL base_url, DeprecatedString filename, EnvironmentSettingsObject& environment_settings_object)
: Script(move(base_url), move(filename), environment_settings_object)
{
}
JavaScriptModuleScript::~JavaScriptModuleScript() = default;
JavaScriptModuleScript::JavaScriptModuleScript(AK::URL base_url, String filename, EnvironmentSettingsObject& environment_settings_object)
JavaScriptModuleScript::JavaScriptModuleScript(AK::URL base_url, DeprecatedString filename, EnvironmentSettingsObject& environment_settings_object)
: ModuleScript(move(base_url), move(filename), environment_settings_object)
{
}
// https://html.spec.whatwg.org/multipage/webappapis.html#creating-a-javascript-module-script
JS::GCPtr<JavaScriptModuleScript> JavaScriptModuleScript::create(String const& filename, StringView source, EnvironmentSettingsObject& settings_object, AK::URL base_url)
JS::GCPtr<JavaScriptModuleScript> JavaScriptModuleScript::create(DeprecatedString const& filename, StringView source, EnvironmentSettingsObject& settings_object, AK::URL base_url)
{
// 1. If scripting is disabled for settings, then set source to the empty string.
if (settings_object.is_scripting_disabled())

View file

@ -20,7 +20,7 @@ public:
virtual ~ModuleScript() override;
protected:
ModuleScript(AK::URL base_url, String filename, EnvironmentSettingsObject& environment_settings_object);
ModuleScript(AK::URL base_url, DeprecatedString filename, EnvironmentSettingsObject& environment_settings_object);
};
class JavaScriptModuleScript final : public ModuleScript {
@ -29,7 +29,7 @@ class JavaScriptModuleScript final : public ModuleScript {
public:
virtual ~JavaScriptModuleScript() override;
static JS::GCPtr<JavaScriptModuleScript> create(String const& filename, StringView source, EnvironmentSettingsObject&, AK::URL base_url);
static JS::GCPtr<JavaScriptModuleScript> create(DeprecatedString const& filename, StringView source, EnvironmentSettingsObject&, AK::URL base_url);
enum class PreventErrorReporting {
Yes,
@ -42,7 +42,7 @@ public:
JS::SourceTextModule* record() { return m_record.ptr(); };
protected:
JavaScriptModuleScript(AK::URL base_url, String filename, EnvironmentSettingsObject& environment_settings_object);
JavaScriptModuleScript(AK::URL base_url, DeprecatedString filename, EnvironmentSettingsObject& environment_settings_object);
private:
virtual void visit_edges(JS::Cell::Visitor&) override;

View file

@ -8,7 +8,7 @@
namespace Web::HTML {
Script::Script(AK::URL base_url, String filename, EnvironmentSettingsObject& environment_settings_object)
Script::Script(AK::URL base_url, DeprecatedString filename, EnvironmentSettingsObject& environment_settings_object)
: m_base_url(move(base_url))
, m_filename(move(filename))
, m_settings_object(environment_settings_object)

View file

@ -23,18 +23,18 @@ public:
virtual ~Script() override;
AK::URL const& base_url() const { return m_base_url; }
String const& filename() const { return m_filename; }
DeprecatedString const& filename() const { return m_filename; }
EnvironmentSettingsObject& settings_object() { return m_settings_object; }
protected:
Script(AK::URL base_url, String filename, EnvironmentSettingsObject& environment_settings_object);
Script(AK::URL base_url, DeprecatedString filename, EnvironmentSettingsObject& environment_settings_object);
private:
virtual void visit_host_defined_self(JS::Cell::Visitor&) override;
AK::URL m_base_url;
String m_filename;
DeprecatedString m_filename;
EnvironmentSettingsObject& m_settings_object;
};

Some files were not shown because too many files have changed in this diff Show more