1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 10:07:44 +00:00

AK+Everywhere: Rename FlyString to DeprecatedFlyString

DeprecatedFlyString relies heavily on DeprecatedString's StringImpl, so
let's rename it to A) match the name of DeprecatedString, B) write a new
FlyString class that is tied to String.
This commit is contained in:
Timothy Flynn 2023-01-08 19:23:00 -05:00 committed by Linus Groh
parent 2eacc7aec1
commit f3db548a3d
316 changed files with 1177 additions and 1177 deletions

View file

@ -11,7 +11,7 @@
namespace Web::DOM {
// https://www.w3.org/TR/wai-aria-1.2/#introroles
FlyString ARIAMixin::role_or_default() const
DeprecatedFlyString ARIAMixin::role_or_default() const
{
// 1. Use the rules of the host language to detect that an element has a role attribute and to identify the attribute value string for it.
auto role_string = role();

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/FlyString.h>
#include <AK/DeprecatedFlyString.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
namespace Web::DOM {
@ -132,9 +132,9 @@ public:
virtual WebIDL::ExceptionOr<void> set_aria_value_text(DeprecatedString const&) = 0;
// https://www.w3.org/TR/html-aria/#docconformance
virtual FlyString default_role() const { return {}; };
virtual DeprecatedFlyString default_role() const { return {}; };
FlyString role_or_default() const;
DeprecatedFlyString role_or_default() const;
// https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion
virtual bool exclude_from_accessibility_tree() const = 0;

View file

@ -8,7 +8,7 @@
namespace Web::DOM::ARIARoleNames {
#define __ENUMERATE_ARIA_ROLE(name) FlyString name;
#define __ENUMERATE_ARIA_ROLE(name) DeprecatedFlyString name;
ENUMERATE_ARIA_ROLES
#undef __ENUMERATE_ARIA_ROLE
@ -28,7 +28,7 @@ ENUMERATE_ARIA_ROLES
}
// https://www.w3.org/TR/wai-aria-1.2/#abstract_roles
bool is_abstract_aria_role(FlyString const& role)
bool is_abstract_aria_role(DeprecatedFlyString const& role)
{
return role.is_one_of(
ARIARoleNames::command,
@ -46,7 +46,7 @@ bool is_abstract_aria_role(FlyString const& role)
}
// https://www.w3.org/TR/wai-aria-1.2/#widget_roles
bool is_widget_aria_role(FlyString const& role)
bool is_widget_aria_role(DeprecatedFlyString const& role)
{
return role.to_lowercase().is_one_of(
ARIARoleNames::button,
@ -80,7 +80,7 @@ bool is_widget_aria_role(FlyString const& role)
}
// https://www.w3.org/TR/wai-aria-1.2/#document_structure_roles
bool is_document_structure_aria_role(FlyString const& role)
bool is_document_structure_aria_role(DeprecatedFlyString const& role)
{
return role.to_lowercase().is_one_of(
ARIARoleNames::application,
@ -123,7 +123,7 @@ bool is_document_structure_aria_role(FlyString const& role)
}
// https://www.w3.org/TR/wai-aria-1.2/#landmark_roles
bool is_landmark_aria_role(FlyString const& role)
bool is_landmark_aria_role(DeprecatedFlyString const& role)
{
return role.to_lowercase().is_one_of(
ARIARoleNames::banner,
@ -137,7 +137,7 @@ bool is_landmark_aria_role(FlyString const& role)
}
// https://www.w3.org/TR/wai-aria-1.2/#live_region_roles
bool is_live_region_aria_role(FlyString const& role)
bool is_live_region_aria_role(DeprecatedFlyString const& role)
{
return role.to_lowercase().is_one_of(
ARIARoleNames::alert,
@ -148,14 +148,14 @@ bool is_live_region_aria_role(FlyString const& role)
}
// https://www.w3.org/TR/wai-aria-1.2/#window_roles
bool is_windows_aria_role(FlyString const& role)
bool is_windows_aria_role(DeprecatedFlyString const& role)
{
return role.to_lowercase().is_one_of(
ARIARoleNames::alertdialog,
ARIARoleNames::dialog);
}
bool is_non_abstract_aria_role(FlyString const& role)
bool is_non_abstract_aria_role(DeprecatedFlyString const& role)
{
return is_widget_aria_role(role)
|| is_document_structure_aria_role(role)

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/FlyString.h>
#include <AK/DeprecatedFlyString.h>
namespace Web::DOM::ARIARoleNames {
@ -106,17 +106,17 @@ namespace Web::DOM::ARIARoleNames {
__ENUMERATE_ARIA_ROLE(widget) \
__ENUMERATE_ARIA_ROLE(window)
#define __ENUMERATE_ARIA_ROLE(name) extern FlyString name;
#define __ENUMERATE_ARIA_ROLE(name) extern DeprecatedFlyString name;
ENUMERATE_ARIA_ROLES
#undef __ENUMERATE_ARIA_ROLE
bool is_abstract_aria_role(FlyString const&);
bool is_widget_aria_role(FlyString const&);
bool is_document_structure_aria_role(FlyString const&);
bool is_landmark_aria_role(FlyString const&);
bool is_live_region_aria_role(FlyString const&);
bool is_windows_aria_role(FlyString const&);
bool is_abstract_aria_role(DeprecatedFlyString const&);
bool is_widget_aria_role(DeprecatedFlyString const&);
bool is_document_structure_aria_role(DeprecatedFlyString const&);
bool is_landmark_aria_role(DeprecatedFlyString const&);
bool is_live_region_aria_role(DeprecatedFlyString const&);
bool is_windows_aria_role(DeprecatedFlyString const&);
bool is_non_abstract_aria_role(FlyString const&);
bool is_non_abstract_aria_role(DeprecatedFlyString const&);
}

View file

@ -13,7 +13,7 @@
namespace Web::DOM {
JS::NonnullGCPtr<Attr> Attr::create(Document& document, FlyString local_name, DeprecatedString value, Element const* owner_element)
JS::NonnullGCPtr<Attr> Attr::create(Document& document, DeprecatedFlyString local_name, DeprecatedString value, Element const* owner_element)
{
return document.heap().allocate<Attr>(document.realm(), document, QualifiedName(move(local_name), {}, {}), move(value), owner_element);
}

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/FlyString.h>
#include <AK/DeprecatedFlyString.h>
#include <AK/WeakPtr.h>
#include <LibWeb/DOM/Node.h>
#include <LibWeb/DOM/QualifiedName.h>
@ -18,16 +18,16 @@ class Attr final : public Node {
WEB_PLATFORM_OBJECT(Attr, Node);
public:
static JS::NonnullGCPtr<Attr> create(Document&, FlyString local_name, DeprecatedString value, Element const* = nullptr);
static JS::NonnullGCPtr<Attr> create(Document&, DeprecatedFlyString local_name, DeprecatedString value, Element const* = nullptr);
JS::NonnullGCPtr<Attr> clone(Document&);
virtual ~Attr() override = default;
virtual FlyString node_name() const override { return name(); }
virtual DeprecatedFlyString node_name() const override { return name(); }
FlyString const& namespace_uri() const { return m_qualified_name.namespace_(); }
FlyString const& prefix() const { return m_qualified_name.prefix(); }
FlyString const& local_name() const { return m_qualified_name.local_name(); }
DeprecatedFlyString const& namespace_uri() const { return m_qualified_name.namespace_(); }
DeprecatedFlyString const& prefix() const { return m_qualified_name.prefix(); }
DeprecatedFlyString const& local_name() const { return m_qualified_name.local_name(); }
DeprecatedString const& name() const { return m_qualified_name.as_string(); }
DeprecatedString const& value() const { return m_value; }

View file

@ -18,7 +18,7 @@ public:
virtual ~CDATASection() override;
// ^Node
virtual FlyString node_name() const override { return "#cdata-section"; }
virtual DeprecatedFlyString node_name() const override { return "#cdata-section"; }
private:
CDATASection(Document&, DeprecatedString const&);

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/FlyString.h>
#include <AK/DeprecatedFlyString.h>
#include <LibWeb/DOM/CharacterData.h>
namespace Web::DOM {
@ -18,7 +18,7 @@ public:
static JS::NonnullGCPtr<Comment> construct_impl(JS::Realm&, DeprecatedString const& data);
virtual ~Comment() override = default;
virtual FlyString node_name() const override { return "#comment"; }
virtual DeprecatedFlyString node_name() const override { return "#comment"; }
private:
Comment(Document&, DeprecatedString const&);

View file

@ -11,17 +11,17 @@
namespace Web::DOM {
CustomEvent* CustomEvent::create(JS::Realm& realm, FlyString const& event_name, CustomEventInit const& event_init)
CustomEvent* CustomEvent::create(JS::Realm& realm, DeprecatedFlyString const& event_name, CustomEventInit const& event_init)
{
return realm.heap().allocate<CustomEvent>(realm, realm, event_name, event_init);
}
CustomEvent* CustomEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, CustomEventInit const& event_init)
CustomEvent* CustomEvent::construct_impl(JS::Realm& realm, DeprecatedFlyString const& event_name, CustomEventInit const& event_init)
{
return create(realm, event_name, event_init);
}
CustomEvent::CustomEvent(JS::Realm& realm, FlyString const& event_name, CustomEventInit const& event_init)
CustomEvent::CustomEvent(JS::Realm& realm, DeprecatedFlyString const& event_name, CustomEventInit const& event_init)
: Event(realm, event_name, event_init)
, m_detail(event_init.detail)
{

View file

@ -20,8 +20,8 @@ class CustomEvent : public Event {
WEB_PLATFORM_OBJECT(CustomEvent, Event);
public:
static CustomEvent* create(JS::Realm&, FlyString const& event_name, CustomEventInit const& event_init = {});
static CustomEvent* construct_impl(JS::Realm&, FlyString const& event_name, CustomEventInit const& event_init);
static CustomEvent* create(JS::Realm&, DeprecatedFlyString const& event_name, CustomEventInit const& event_init = {});
static CustomEvent* construct_impl(JS::Realm&, DeprecatedFlyString const& event_name, CustomEventInit const& event_init);
virtual ~CustomEvent() override;
@ -33,7 +33,7 @@ public:
void init_custom_event(DeprecatedString const& type, bool bubbles, bool cancelable, JS::Value detail);
private:
CustomEvent(JS::Realm&, FlyString const& event_name, CustomEventInit const& event_init);
CustomEvent(JS::Realm&, DeprecatedFlyString const& event_name, CustomEventInit const& event_init);
// https://dom.spec.whatwg.org/#dom-customevent-initcustomevent-type-bubbles-cancelable-detail-detail
JS::Value m_detail { JS::js_null() };

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/FlyString.h>
#include <AK/DeprecatedFlyString.h>
#include <LibJS/Heap/GCPtr.h>
#include <LibJS/Runtime/Object.h>
#include <LibWeb/Forward.h>
@ -21,7 +21,7 @@ public:
~DOMEventListener();
// type (a string)
FlyString type;
DeprecatedFlyString type;
// callback (null or an EventListener object)
JS::GCPtr<IDLEventListener> callback;

View file

@ -52,14 +52,14 @@ inline void replace_in_ordered_set(Vector<DeprecatedString>& set, StringView ite
namespace Web::DOM {
DOMTokenList* DOMTokenList::create(Element const& associated_element, FlyString associated_attribute)
DOMTokenList* DOMTokenList::create(Element const& associated_element, DeprecatedFlyString associated_attribute)
{
auto& realm = associated_element.realm();
return realm.heap().allocate<DOMTokenList>(realm, associated_element, move(associated_attribute));
}
// https://dom.spec.whatwg.org/#ref-for-domtokenlist%E2%91%A0%E2%91%A2
DOMTokenList::DOMTokenList(Element const& associated_element, FlyString associated_attribute)
DOMTokenList::DOMTokenList(Element const& associated_element, DeprecatedFlyString associated_attribute)
: Bindings::LegacyPlatformObject(Bindings::cached_web_prototype(associated_element.realm(), "DOMTokenList"))
, m_associated_element(associated_element)
, m_associated_attribute(move(associated_attribute))

View file

@ -7,8 +7,8 @@
#pragma once
#include <AK/DeprecatedFlyString.h>
#include <AK/DeprecatedString.h>
#include <AK/FlyString.h>
#include <AK/Optional.h>
#include <AK/StringView.h>
#include <AK/Vector.h>
@ -23,7 +23,7 @@ class DOMTokenList final : public Bindings::LegacyPlatformObject {
WEB_PLATFORM_OBJECT(DOMTokenList, Bindings::LegacyPlatformObject);
public:
static DOMTokenList* create(Element const& associated_element, FlyString associated_attribute);
static DOMTokenList* create(Element const& associated_element, DeprecatedFlyString associated_attribute);
~DOMTokenList() = default;
void associated_attribute_changed(StringView value);
@ -43,7 +43,7 @@ public:
void set_value(DeprecatedString value);
private:
DOMTokenList(Element const& associated_element, FlyString associated_attribute);
DOMTokenList(Element const& associated_element, DeprecatedFlyString associated_attribute);
virtual void visit_edges(Cell::Visitor&) override;
@ -51,7 +51,7 @@ private:
void run_update_steps();
JS::NonnullGCPtr<Element> m_associated_element;
FlyString m_associated_attribute;
DeprecatedFlyString m_associated_attribute;
Vector<DeprecatedString> m_token_set;
};

View file

@ -1018,9 +1018,9 @@ JS::NonnullGCPtr<HTMLCollection> Document::get_elements_by_name(DeprecatedString
});
}
JS::NonnullGCPtr<HTMLCollection> Document::get_elements_by_class_name(FlyString const& class_names)
JS::NonnullGCPtr<HTMLCollection> Document::get_elements_by_class_name(DeprecatedFlyString const& class_names)
{
Vector<FlyString> list_of_class_names;
Vector<DeprecatedFlyString> list_of_class_names;
for (auto& name : class_names.view().split_view(' ')) {
list_of_class_names.append(name);
}
@ -1180,7 +1180,7 @@ JS::Value Document::run_javascript(StringView source, StringView filename)
}
// https://dom.spec.whatwg.org/#dom-document-createelement
WebIDL::ExceptionOr<JS::NonnullGCPtr<Element>> Document::create_element(FlyString const& a_local_name)
WebIDL::ExceptionOr<JS::NonnullGCPtr<Element>> Document::create_element(DeprecatedFlyString const& a_local_name)
{
auto local_name = a_local_name;
@ -1196,7 +1196,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Element>> Document::create_element(FlyStrin
// FIXME: 4. If options is a dictionary and options["is"] exists, then set is to it.
// 5. Let namespace be the HTML namespace, if this is an HTML document or thiss content type is "application/xhtml+xml"; otherwise null.
FlyString namespace_;
DeprecatedFlyString namespace_;
if (document_type() == Type::HTML || content_type() == "application/xhtml+xml"sv)
namespace_ = Namespace::HTML;

View file

@ -6,8 +6,8 @@
#pragma once
#include <AK/DeprecatedFlyString.h>
#include <AK/DeprecatedString.h>
#include <AK/FlyString.h>
#include <AK/Function.h>
#include <AK/HashMap.h>
#include <AK/NonnullRefPtrVector.h>
@ -127,7 +127,7 @@ public:
CSS::StyleSheetList* style_sheets_for_bindings() { return &style_sheets(); }
virtual FlyString node_name() const override { return "#document"; }
virtual DeprecatedFlyString node_name() const override { return "#document"; }
void set_hovered_node(Node*);
Node* hovered_node() { return m_hovered_node.ptr(); }
@ -203,7 +203,7 @@ public:
void schedule_layout_update();
JS::NonnullGCPtr<HTMLCollection> get_elements_by_name(DeprecatedString const&);
JS::NonnullGCPtr<HTMLCollection> get_elements_by_class_name(FlyString const&);
JS::NonnullGCPtr<HTMLCollection> get_elements_by_class_name(DeprecatedFlyString const&);
JS::NonnullGCPtr<HTMLCollection> applets();
JS::NonnullGCPtr<HTMLCollection> anchors();
@ -222,7 +222,7 @@ public:
JS::Value run_javascript(StringView source, StringView filename = "(unknown)"sv);
WebIDL::ExceptionOr<JS::NonnullGCPtr<Element>> create_element(FlyString const& local_name);
WebIDL::ExceptionOr<JS::NonnullGCPtr<Element>> create_element(DeprecatedFlyString const& local_name);
WebIDL::ExceptionOr<JS::NonnullGCPtr<Element>> create_element_ns(DeprecatedString const& namespace_, DeprecatedString const& qualified_name);
JS::NonnullGCPtr<DocumentFragment> create_document_fragment();
JS::NonnullGCPtr<Text> create_text_node(DeprecatedString const& data);
@ -371,8 +371,8 @@ public:
static bool is_valid_name(DeprecatedString const&);
struct PrefixAndTagName {
FlyString prefix;
FlyString tag_name;
DeprecatedFlyString prefix;
DeprecatedFlyString tag_name;
};
static WebIDL::ExceptionOr<PrefixAndTagName> validate_qualified_name(JS::Realm&, DeprecatedString const& qualified_name);
@ -456,7 +456,7 @@ private:
Document(JS::Realm&, AK::URL const&);
// ^HTML::GlobalEventHandlers
virtual EventTarget& global_event_handlers_to_event_target(FlyString const&) final { return *this; }
virtual EventTarget& global_event_handlers_to_event_target(DeprecatedFlyString const&) final { return *this; }
void tear_down_layout_tree();

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/FlyString.h>
#include <AK/DeprecatedFlyString.h>
#include <LibWeb/DOM/Element.h>
#include <LibWeb/DOM/NonElementParentNode.h>
#include <LibWeb/DOM/ParentNode.h>
@ -23,7 +23,7 @@ public:
virtual ~DocumentFragment() override = default;
virtual FlyString node_name() const override { return "#document-fragment"; }
virtual DeprecatedFlyString node_name() const override { return "#document-fragment"; }
Element* host() { return m_host.ptr(); }
Element const* host() const { return m_host.ptr(); }

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/FlyString.h>
#include <AK/DeprecatedFlyString.h>
#include <LibWeb/DOM/ChildNode.h>
#include <LibWeb/DOM/Node.h>
@ -22,7 +22,7 @@ public:
virtual ~DocumentType() override = default;
virtual FlyString node_name() const override { return "#doctype"; }
virtual DeprecatedFlyString node_name() const override { return "#doctype"; }
DeprecatedString const& name() const { return m_name; }
void set_name(DeprecatedString const& name) { m_name = name; }

View file

@ -80,7 +80,7 @@ void Element::visit_edges(Cell::Visitor& visitor)
}
// https://dom.spec.whatwg.org/#dom-element-getattribute
DeprecatedString Element::get_attribute(FlyString const& name) const
DeprecatedString Element::get_attribute(DeprecatedFlyString const& name) const
{
// 1. Let attr be the result of getting an attribute given qualifiedName and this.
auto const* attribute = m_attributes->get_attribute(name);
@ -94,14 +94,14 @@ DeprecatedString Element::get_attribute(FlyString const& name) const
}
// https://dom.spec.whatwg.org/#dom-element-getattributenode
JS::GCPtr<Attr> Element::get_attribute_node(FlyString const& name) const
JS::GCPtr<Attr> Element::get_attribute_node(DeprecatedFlyString const& name) const
{
// The getAttributeNode(qualifiedName) method steps are to return the result of getting an attribute given qualifiedName and this.
return m_attributes->get_attribute(name);
}
// https://dom.spec.whatwg.org/#dom-element-setattribute
WebIDL::ExceptionOr<void> Element::set_attribute(FlyString const& name, DeprecatedString const& value)
WebIDL::ExceptionOr<void> Element::set_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
{
// 1. If qualifiedName does not match the Name production in XML, then throw an "InvalidCharacterError" DOMException.
// FIXME: Proper name validation
@ -136,7 +136,7 @@ WebIDL::ExceptionOr<void> Element::set_attribute(FlyString const& name, Deprecat
}
// https://dom.spec.whatwg.org/#validate-and-extract
WebIDL::ExceptionOr<QualifiedName> validate_and_extract(JS::Realm& realm, FlyString namespace_, FlyString qualified_name)
WebIDL::ExceptionOr<QualifiedName> validate_and_extract(JS::Realm& realm, DeprecatedFlyString namespace_, DeprecatedFlyString qualified_name)
{
// 1. If namespace is the empty string, then set it to null.
if (namespace_.is_empty())
@ -146,7 +146,7 @@ WebIDL::ExceptionOr<QualifiedName> validate_and_extract(JS::Realm& realm, FlyStr
TRY(Document::validate_qualified_name(realm, qualified_name));
// 3. Let prefix be null.
FlyString prefix = {};
DeprecatedFlyString prefix = {};
// 4. Let localName be qualifiedName.
auto local_name = qualified_name;
@ -179,7 +179,7 @@ WebIDL::ExceptionOr<QualifiedName> validate_and_extract(JS::Realm& realm, FlyStr
}
// https://dom.spec.whatwg.org/#dom-element-setattributens
WebIDL::ExceptionOr<void> Element::set_attribute_ns(FlyString const& namespace_, FlyString const& qualified_name, DeprecatedString const& value)
WebIDL::ExceptionOr<void> Element::set_attribute_ns(DeprecatedFlyString const& namespace_, DeprecatedFlyString const& qualified_name, DeprecatedString const& value)
{
// 1. Let namespace, prefix, and localName be the result of passing namespace and qualifiedName to validate and extract.
auto extracted_qualified_name = TRY(validate_and_extract(realm(), namespace_, qualified_name));
@ -191,7 +191,7 @@ WebIDL::ExceptionOr<void> Element::set_attribute_ns(FlyString const& namespace_,
}
// https://dom.spec.whatwg.org/#dom-element-removeattribute
void Element::remove_attribute(FlyString const& name)
void Element::remove_attribute(DeprecatedFlyString const& name)
{
m_attributes->remove_attribute(name);
@ -201,13 +201,13 @@ void Element::remove_attribute(FlyString const& name)
}
// https://dom.spec.whatwg.org/#dom-element-hasattribute
bool Element::has_attribute(FlyString const& name) const
bool Element::has_attribute(DeprecatedFlyString const& name) const
{
return m_attributes->get_attribute(name) != nullptr;
}
// https://dom.spec.whatwg.org/#dom-element-toggleattribute
WebIDL::ExceptionOr<bool> Element::toggle_attribute(FlyString const& name, Optional<bool> force)
WebIDL::ExceptionOr<bool> Element::toggle_attribute(DeprecatedFlyString const& name, Optional<bool> force)
{
// 1. If qualifiedName does not match the Name production in XML, then throw an "InvalidCharacterError" DOMException.
// FIXME: Proper name validation
@ -264,7 +264,7 @@ Vector<DeprecatedString> Element::get_attribute_names() const
return names;
}
bool Element::has_class(FlyString const& class_name, CaseSensitivity case_sensitivity) const
bool Element::has_class(DeprecatedFlyString const& class_name, CaseSensitivity case_sensitivity) const
{
if (case_sensitivity == CaseSensitivity::CaseSensitive) {
return any_of(m_classes, [&](auto& it) {
@ -330,7 +330,7 @@ CSS::CSSStyleDeclaration const* Element::inline_style() const
return m_inline_style.ptr();
}
void Element::parse_attribute(FlyString const& name, DeprecatedString const& value)
void Element::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
{
if (name == HTML::AttributeNames::class_) {
auto new_classes = value.split_view(Infra::is_ascii_whitespace);
@ -350,7 +350,7 @@ void Element::parse_attribute(FlyString const& name, DeprecatedString const& val
}
}
void Element::did_remove_attribute(FlyString const& name)
void Element::did_remove_attribute(DeprecatedFlyString const& name)
{
if (name == HTML::AttributeNames::style) {
if (m_inline_style) {
@ -516,9 +516,9 @@ bool Element::is_active() const
return document().active_element() == this;
}
JS::NonnullGCPtr<HTMLCollection> Element::get_elements_by_class_name(FlyString const& class_names)
JS::NonnullGCPtr<HTMLCollection> Element::get_elements_by_class_name(DeprecatedFlyString const& class_names)
{
Vector<FlyString> list_of_class_names;
Vector<DeprecatedFlyString> list_of_class_names;
for (auto& name : class_names.view().split_view_if(Infra::is_ascii_whitespace)) {
list_of_class_names.append(name);
}
@ -1258,7 +1258,7 @@ ErrorOr<void> Element::scroll_into_view(Optional<Variant<bool, ScrollIntoViewOpt
// FIXME: 8. Optionally perform some other action that brings the element to the users attention.
}
void Element::invalidate_style_after_attribute_change(FlyString const& attribute_name)
void Element::invalidate_style_after_attribute_change(DeprecatedFlyString const& attribute_name)
{
// FIXME: Only invalidate if the attribute can actually affect style.
(void)attribute_name;

View file

@ -6,8 +6,8 @@
#pragma once
#include <AK/DeprecatedFlyString.h>
#include <AK/DeprecatedString.h>
#include <AK/FlyString.h>
#include <LibWeb/Bindings/ElementPrototype.h>
#include <LibWeb/CSS/CSSStyleDeclaration.h>
#include <LibWeb/CSS/StyleComputer.h>
@ -50,31 +50,31 @@ public:
DeprecatedString const& qualified_name() const { return m_qualified_name.as_string(); }
DeprecatedString const& html_uppercased_qualified_name() const { return m_html_uppercased_qualified_name; }
virtual FlyString node_name() const final { return html_uppercased_qualified_name(); }
FlyString const& local_name() const { return m_qualified_name.local_name(); }
virtual DeprecatedFlyString node_name() const final { return html_uppercased_qualified_name(); }
DeprecatedFlyString const& local_name() const { return m_qualified_name.local_name(); }
// NOTE: This is for the JS bindings
DeprecatedString const& tag_name() const { return html_uppercased_qualified_name(); }
FlyString const& prefix() const { return m_qualified_name.prefix(); }
FlyString const& namespace_() const { return m_qualified_name.namespace_(); }
DeprecatedFlyString const& prefix() const { return m_qualified_name.prefix(); }
DeprecatedFlyString const& namespace_() const { return m_qualified_name.namespace_(); }
// NOTE: This is for the JS bindings
FlyString const& namespace_uri() const { return namespace_(); }
DeprecatedFlyString const& namespace_uri() const { return namespace_(); }
bool has_attribute(FlyString const& name) const;
bool has_attribute(DeprecatedFlyString const& name) const;
bool has_attributes() const { return !m_attributes->is_empty(); }
DeprecatedString attribute(FlyString const& name) const { return get_attribute(name); }
DeprecatedString get_attribute(FlyString const& name) const;
WebIDL::ExceptionOr<void> set_attribute(FlyString const& name, DeprecatedString const& value);
WebIDL::ExceptionOr<void> set_attribute_ns(FlyString const& namespace_, FlyString const& qualified_name, DeprecatedString const& value);
void remove_attribute(FlyString const& name);
WebIDL::ExceptionOr<bool> toggle_attribute(FlyString const& name, Optional<bool> force);
DeprecatedString attribute(DeprecatedFlyString const& name) const { return get_attribute(name); }
DeprecatedString get_attribute(DeprecatedFlyString const& name) const;
WebIDL::ExceptionOr<void> set_attribute(DeprecatedFlyString const& name, DeprecatedString const& value);
WebIDL::ExceptionOr<void> set_attribute_ns(DeprecatedFlyString const& namespace_, DeprecatedFlyString const& qualified_name, DeprecatedString const& value);
void remove_attribute(DeprecatedFlyString const& name);
WebIDL::ExceptionOr<bool> toggle_attribute(DeprecatedFlyString const& name, Optional<bool> force);
size_t attribute_list_size() const { return m_attributes->length(); }
NamedNodeMap const* attributes() const { return m_attributes.ptr(); }
Vector<DeprecatedString> get_attribute_names() const;
JS::GCPtr<Attr> get_attribute_node(FlyString const& name) const;
JS::GCPtr<Attr> get_attribute_node(DeprecatedFlyString const& name) const;
DOMTokenList* class_list();
@ -95,12 +95,12 @@ public:
}
}
bool has_class(FlyString const&, CaseSensitivity = CaseSensitivity::CaseSensitive) const;
Vector<FlyString> const& class_names() const { return m_classes; }
bool has_class(DeprecatedFlyString const&, CaseSensitivity = CaseSensitivity::CaseSensitive) const;
Vector<DeprecatedFlyString> const& class_names() const { return m_classes; }
virtual void apply_presentational_hints(CSS::StyleProperties&) const { }
virtual void parse_attribute(FlyString const& name, DeprecatedString const& value);
virtual void did_remove_attribute(FlyString const&);
virtual void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value);
virtual void did_remove_attribute(DeprecatedFlyString const&);
enum class NeedsRelayout {
No = 0,
@ -129,14 +129,14 @@ public:
bool is_focused() const;
bool is_active() const;
JS::NonnullGCPtr<HTMLCollection> get_elements_by_class_name(FlyString const&);
JS::NonnullGCPtr<HTMLCollection> get_elements_by_class_name(DeprecatedFlyString const&);
ShadowRoot* shadow_root() { return m_shadow_root.ptr(); }
ShadowRoot const* shadow_root() const { return m_shadow_root.ptr(); }
void set_shadow_root(JS::GCPtr<ShadowRoot>);
void set_custom_properties(HashMap<FlyString, CSS::StyleProperty> custom_properties) { m_custom_properties = move(custom_properties); }
HashMap<FlyString, CSS::StyleProperty> const& custom_properties() const { return m_custom_properties; }
void set_custom_properties(HashMap<DeprecatedFlyString, CSS::StyleProperty> custom_properties) { m_custom_properties = move(custom_properties); }
HashMap<DeprecatedFlyString, CSS::StyleProperty> const& custom_properties() const { return m_custom_properties; }
void queue_an_element_task(HTML::Task::Source, JS::SafeFunction<void()>);
@ -261,7 +261,7 @@ protected:
private:
void make_html_uppercased_qualified_name();
void invalidate_style_after_attribute_change(FlyString const& attribute_name);
void invalidate_style_after_attribute_change(DeprecatedFlyString const& attribute_name);
WebIDL::ExceptionOr<JS::GCPtr<Node>> insert_adjacent(DeprecatedString const& where, JS::NonnullGCPtr<Node> node);
@ -274,9 +274,9 @@ private:
JS::GCPtr<ShadowRoot> m_shadow_root;
RefPtr<CSS::StyleProperties> m_computed_css_values;
HashMap<FlyString, CSS::StyleProperty> m_custom_properties;
HashMap<DeprecatedFlyString, CSS::StyleProperty> m_custom_properties;
Vector<FlyString> m_classes;
Vector<DeprecatedFlyString> m_classes;
Array<JS::GCPtr<Layout::Node>, to_underlying(CSS::Selector::PseudoElement::PseudoElementCount)> m_pseudo_element_nodes;
};
@ -284,6 +284,6 @@ private:
template<>
inline bool Node::fast_is<Element>() const { return is_element(); }
WebIDL::ExceptionOr<QualifiedName> validate_and_extract(JS::Realm&, FlyString namespace_, FlyString qualified_name);
WebIDL::ExceptionOr<QualifiedName> validate_and_extract(JS::Realm&, DeprecatedFlyString namespace_, DeprecatedFlyString qualified_name);
}

View file

@ -95,7 +95,7 @@
namespace Web::DOM {
// https://dom.spec.whatwg.org/#concept-create-element
JS::NonnullGCPtr<Element> create_element(Document& document, FlyString local_name, FlyString namespace_, FlyString prefix)
JS::NonnullGCPtr<Element> create_element(Document& document, DeprecatedFlyString local_name, DeprecatedFlyString namespace_, DeprecatedFlyString prefix)
{
// 1. If prefix was not given, let prefix be null.
// NOTE: This is already taken care of by `prefix` having a default value.

View file

@ -10,6 +10,6 @@
namespace Web::DOM {
JS::NonnullGCPtr<Element> create_element(Document&, FlyString local_name, FlyString namespace_, FlyString prefix = {});
JS::NonnullGCPtr<Element> create_element(Document&, DeprecatedFlyString local_name, DeprecatedFlyString namespace_, DeprecatedFlyString prefix = {});
}

View file

@ -14,24 +14,24 @@
namespace Web::DOM {
JS::NonnullGCPtr<Event> Event::create(JS::Realm& realm, FlyString const& event_name, EventInit const& event_init)
JS::NonnullGCPtr<Event> Event::create(JS::Realm& realm, DeprecatedFlyString const& event_name, EventInit const& event_init)
{
return realm.heap().allocate<Event>(realm, realm, event_name, event_init);
}
JS::NonnullGCPtr<Event> Event::construct_impl(JS::Realm& realm, FlyString const& event_name, EventInit const& event_init)
JS::NonnullGCPtr<Event> Event::construct_impl(JS::Realm& realm, DeprecatedFlyString const& event_name, EventInit const& event_init)
{
return create(realm, event_name, event_init);
}
Event::Event(JS::Realm& realm, FlyString const& type)
Event::Event(JS::Realm& realm, DeprecatedFlyString const& type)
: PlatformObject(Bindings::cached_web_prototype(realm, "Event"))
, m_type(type)
, m_initialized(true)
{
}
Event::Event(JS::Realm& realm, FlyString const& type, EventInit const& event_init)
Event::Event(JS::Realm& realm, DeprecatedFlyString const& type, EventInit const& event_init)
: PlatformObject(Bindings::cached_web_prototype(realm, "Event"))
, m_type(type)
, m_bubbles(event_init.bubbles)

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/FlyString.h>
#include <AK/DeprecatedFlyString.h>
#include <LibWeb/Bindings/PlatformObject.h>
#include <LibWeb/DOM/EventTarget.h>
@ -45,17 +45,17 @@ public:
using Path = Vector<PathEntry>;
static JS::NonnullGCPtr<Event> create(JS::Realm&, FlyString const& event_name, EventInit const& event_init = {});
static JS::NonnullGCPtr<Event> construct_impl(JS::Realm&, FlyString const& event_name, EventInit const& event_init);
static JS::NonnullGCPtr<Event> create(JS::Realm&, DeprecatedFlyString const& event_name, EventInit const& event_init = {});
static JS::NonnullGCPtr<Event> construct_impl(JS::Realm&, DeprecatedFlyString const& event_name, EventInit const& event_init);
Event(JS::Realm&, FlyString const& type);
Event(JS::Realm&, FlyString const& type, EventInit const& event_init);
Event(JS::Realm&, DeprecatedFlyString const& type);
Event(JS::Realm&, DeprecatedFlyString const& type, EventInit const& event_init);
virtual ~Event() = default;
double time_stamp() const;
FlyString const& type() const { return m_type; }
DeprecatedFlyString const& type() const { return m_type; }
void set_type(StringView type) { m_type = type; }
JS::GCPtr<EventTarget> target() const { return m_target; }
@ -148,7 +148,7 @@ protected:
virtual void visit_edges(Visitor&) override;
private:
FlyString m_type;
DeprecatedFlyString m_type;
JS::GCPtr<EventTarget> m_target;
JS::GCPtr<EventTarget> m_related_target;
JS::GCPtr<EventTarget> m_current_target;

View file

@ -120,7 +120,7 @@ static FlattenedAddEventListenerOptions flatten_add_event_listener_options(Varia
}
// https://dom.spec.whatwg.org/#dom-eventtarget-addeventlistener
void EventTarget::add_event_listener(FlyString const& type, IDLEventListener* callback, Variant<AddEventListenerOptions, bool> const& options)
void EventTarget::add_event_listener(DeprecatedFlyString const& type, IDLEventListener* callback, Variant<AddEventListenerOptions, bool> const& options)
{
// 1. Let capture, passive, once, and signal be the result of flattening more options.
auto flattened_options = flatten_add_event_listener_options(options);
@ -138,7 +138,7 @@ void EventTarget::add_event_listener(FlyString const& type, IDLEventListener* ca
add_an_event_listener(*event_listener);
}
void EventTarget::add_event_listener_without_options(FlyString const& type, IDLEventListener& callback)
void EventTarget::add_event_listener_without_options(DeprecatedFlyString const& type, IDLEventListener& callback)
{
add_event_listener(type, &callback, AddEventListenerOptions {});
}
@ -179,7 +179,7 @@ void EventTarget::add_an_event_listener(DOMEventListener& listener)
}
// https://dom.spec.whatwg.org/#dom-eventtarget-removeeventlistener
void EventTarget::remove_event_listener(FlyString const& type, IDLEventListener* callback, Variant<EventListenerOptions, bool> const& options)
void EventTarget::remove_event_listener(DeprecatedFlyString const& type, IDLEventListener* callback, Variant<EventListenerOptions, bool> const& options)
{
// 1. Let capture be the result of flattening options.
bool capture = flatten_event_listener_options(options);
@ -202,7 +202,7 @@ void EventTarget::remove_event_listener(FlyString const& type, IDLEventListener*
remove_an_event_listener(**it);
}
void EventTarget::remove_event_listener_without_options(FlyString const& type, IDLEventListener& callback)
void EventTarget::remove_event_listener_without_options(DeprecatedFlyString const& type, IDLEventListener& callback)
{
remove_event_listener(type, &callback, EventListenerOptions {});
}
@ -241,7 +241,7 @@ WebIDL::ExceptionOr<bool> EventTarget::dispatch_event_binding(Event& event)
}
// https://html.spec.whatwg.org/multipage/webappapis.html#window-reflecting-body-element-event-handler-set
bool is_window_reflecting_body_element_event_handler(FlyString const& name)
bool is_window_reflecting_body_element_event_handler(DeprecatedFlyString const& name)
{
return name.is_one_of(
HTML::EventNames::blur,
@ -253,7 +253,7 @@ bool is_window_reflecting_body_element_event_handler(FlyString const& name)
}
// https://html.spec.whatwg.org/multipage/webappapis.html#windoweventhandlers
static bool is_window_event_handler(FlyString const& name)
static bool is_window_event_handler(DeprecatedFlyString const& name)
{
return name.is_one_of(
HTML::EventNames::afterprint,
@ -275,7 +275,7 @@ static bool is_window_event_handler(FlyString const& name)
}
// https://html.spec.whatwg.org/multipage/webappapis.html#determining-the-target-of-an-event-handler
static EventTarget* determine_target_of_event_handler(EventTarget& event_target, FlyString const& name)
static EventTarget* determine_target_of_event_handler(EventTarget& event_target, DeprecatedFlyString const& name)
{
// To determine the target of an event handler, given an EventTarget object eventTarget on which the event handler is exposed,
// and an event handler name name, the following steps are taken:
@ -300,7 +300,7 @@ static EventTarget* determine_target_of_event_handler(EventTarget& event_target,
}
// https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-attributes:event-handler-idl-attributes-2
WebIDL::CallbackType* EventTarget::event_handler_attribute(FlyString const& name)
WebIDL::CallbackType* EventTarget::event_handler_attribute(DeprecatedFlyString const& name)
{
// 1. Let eventTarget be the result of determining the target of an event handler given this object and name.
auto target = determine_target_of_event_handler(*this, name);
@ -314,7 +314,7 @@ WebIDL::CallbackType* EventTarget::event_handler_attribute(FlyString const& name
}
// https://html.spec.whatwg.org/multipage/webappapis.html#getting-the-current-value-of-the-event-handler
WebIDL::CallbackType* EventTarget::get_current_value_of_event_handler(FlyString const& name)
WebIDL::CallbackType* EventTarget::get_current_value_of_event_handler(DeprecatedFlyString const& name)
{
// 1. Let handlerMap be eventTarget's event handler map. (NOTE: Not necessary)
@ -473,7 +473,7 @@ WebIDL::CallbackType* EventTarget::get_current_value_of_event_handler(FlyString
}
// https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-attributes:event-handler-idl-attributes-3
void EventTarget::set_event_handler_attribute(FlyString const& name, WebIDL::CallbackType* value)
void EventTarget::set_event_handler_attribute(DeprecatedFlyString const& name, WebIDL::CallbackType* value)
{
// 1. Let eventTarget be the result of determining the target of an event handler given this object and name.
auto event_target = determine_target_of_event_handler(*this, name);
@ -520,7 +520,7 @@ void EventTarget::set_event_handler_attribute(FlyString const& name, WebIDL::Cal
}
// https://html.spec.whatwg.org/multipage/webappapis.html#activate-an-event-handler
void EventTarget::activate_event_handler(FlyString const& name, HTML::EventHandler& event_handler)
void EventTarget::activate_event_handler(DeprecatedFlyString const& name, HTML::EventHandler& event_handler)
{
// 1. Let handlerMap be eventTarget's event handler map.
// 2. Let eventHandler be handlerMap[name].
@ -570,7 +570,7 @@ void EventTarget::activate_event_handler(FlyString const& name, HTML::EventHandl
event_handler.listener = listener;
}
void EventTarget::deactivate_event_handler(FlyString const& name)
void EventTarget::deactivate_event_handler(DeprecatedFlyString const& name)
{
// 1. Let handlerMap be eventTarget's event handler map. (NOTE: Not necessary)
@ -600,7 +600,7 @@ void EventTarget::deactivate_event_handler(FlyString const& name)
}
// https://html.spec.whatwg.org/multipage/webappapis.html#the-event-handler-processing-algorithm
JS::ThrowCompletionOr<void> EventTarget::process_event_handler_for_event(FlyString const& name, Event& event)
JS::ThrowCompletionOr<void> EventTarget::process_event_handler_for_event(DeprecatedFlyString const& name, Event& event)
{
// 1. Let callback be the result of getting the current value of the event handler given eventTarget and name.
auto* callback = get_current_value_of_event_handler(name);
@ -679,7 +679,7 @@ JS::ThrowCompletionOr<void> EventTarget::process_event_handler_for_event(FlyStri
}
// https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-attributes:concept-element-attributes-change-ext
void EventTarget::element_event_handler_attribute_changed(FlyString const& local_name, DeprecatedString const& value)
void EventTarget::element_event_handler_attribute_changed(DeprecatedFlyString const& local_name, DeprecatedString const& value)
{
// NOTE: Step 1 of this algorithm was handled in HTMLElement::parse_attribute.
@ -735,7 +735,7 @@ bool EventTarget::dispatch_event(Event& event)
return EventDispatcher::dispatch(*this, event);
}
bool EventTarget::has_event_listener(FlyString const& type) const
bool EventTarget::has_event_listener(DeprecatedFlyString const& type) const
{
for (auto& listener : m_event_listener_list) {
if (listener->type == type)

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/FlyString.h>
#include <AK/DeprecatedFlyString.h>
#include <AK/Noncopyable.h>
#include <AK/Vector.h>
#include <LibJS/Forward.h>
@ -26,12 +26,12 @@ public:
virtual bool is_focusable() const { return false; }
void add_event_listener(FlyString const& type, IDLEventListener* callback, Variant<AddEventListenerOptions, bool> const& options);
void remove_event_listener(FlyString const& type, IDLEventListener* callback, Variant<EventListenerOptions, bool> const& options);
void add_event_listener(DeprecatedFlyString const& type, IDLEventListener* callback, Variant<AddEventListenerOptions, bool> const& options);
void remove_event_listener(DeprecatedFlyString const& type, IDLEventListener* callback, Variant<EventListenerOptions, bool> const& options);
// NOTE: These are for internal use only. They operate as though addEventListener(type, callback) was called instead of addEventListener(type, callback, options).
void add_event_listener_without_options(FlyString const& type, IDLEventListener& callback);
void remove_event_listener_without_options(FlyString const& type, IDLEventListener& callback);
void add_event_listener_without_options(DeprecatedFlyString const& type, IDLEventListener& callback);
void remove_event_listener_without_options(DeprecatedFlyString const& type, IDLEventListener& callback);
virtual bool dispatch_event(Event&);
WebIDL::ExceptionOr<bool> dispatch_event_binding(Event&);
@ -51,15 +51,15 @@ public:
virtual void legacy_cancelled_activation_behavior() { }
virtual void legacy_cancelled_activation_behavior_was_not_called() { }
WebIDL::CallbackType* event_handler_attribute(FlyString const& name);
void set_event_handler_attribute(FlyString const& name, WebIDL::CallbackType*);
WebIDL::CallbackType* event_handler_attribute(DeprecatedFlyString const& name);
void set_event_handler_attribute(DeprecatedFlyString const& name, WebIDL::CallbackType*);
bool has_event_listener(FlyString const& type) const;
bool has_event_listener(DeprecatedFlyString const& type) const;
protected:
explicit EventTarget(JS::Realm&);
void element_event_handler_attribute_changed(FlyString const& local_name, DeprecatedString const& value);
void element_event_handler_attribute_changed(DeprecatedFlyString const& local_name, DeprecatedString const& value);
virtual void visit_edges(Cell::Visitor&) override;
@ -68,14 +68,14 @@ private:
// https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-map
// Spec Note: The order of the entries of event handler map could be arbitrary. It is not observable through any algorithms that operate on the map.
HashMap<FlyString, JS::GCPtr<HTML::EventHandler>> m_event_handler_map;
HashMap<DeprecatedFlyString, JS::GCPtr<HTML::EventHandler>> m_event_handler_map;
WebIDL::CallbackType* get_current_value_of_event_handler(FlyString const& name);
void activate_event_handler(FlyString const& name, HTML::EventHandler& event_handler);
void deactivate_event_handler(FlyString const& name);
JS::ThrowCompletionOr<void> process_event_handler_for_event(FlyString const& name, Event& event);
WebIDL::CallbackType* get_current_value_of_event_handler(DeprecatedFlyString const& name);
void activate_event_handler(DeprecatedFlyString const& name, HTML::EventHandler& event_handler);
void deactivate_event_handler(DeprecatedFlyString const& name);
JS::ThrowCompletionOr<void> process_event_handler_for_event(DeprecatedFlyString const& name, Event& event);
};
bool is_window_reflecting_body_element_event_handler(FlyString const& name);
bool is_window_reflecting_body_element_event_handler(DeprecatedFlyString const& name);
}

View file

@ -62,7 +62,7 @@ Element* HTMLCollection::item(size_t index) const
}
// https://dom.spec.whatwg.org/#dom-htmlcollection-nameditem-key
Element* HTMLCollection::named_item(FlyString const& name) const
Element* HTMLCollection::named_item(DeprecatedFlyString const& name) const
{
// 1. If key is the empty string, return null.
if (name.is_empty())
@ -130,7 +130,7 @@ JS::Value HTMLCollection::item_value(size_t index) const
return const_cast<Element*>(element);
}
JS::Value HTMLCollection::named_item_value(FlyString const& index) const
JS::Value HTMLCollection::named_item_value(DeprecatedFlyString const& index) const
{
auto* element = named_item(index);
if (!element)

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/FlyString.h>
#include <AK/DeprecatedFlyString.h>
#include <AK/Function.h>
#include <LibJS/Heap/GCPtr.h>
#include <LibWeb/Bindings/LegacyPlatformObject.h>
@ -35,12 +35,12 @@ public:
size_t length();
Element* item(size_t index) const;
Element* named_item(FlyString const& name) const;
Element* named_item(DeprecatedFlyString const& name) const;
JS::MarkedVector<Element*> collect_matching_elements() const;
virtual JS::Value item_value(size_t index) const override;
virtual JS::Value named_item_value(FlyString const& name) const override;
virtual JS::Value named_item_value(DeprecatedFlyString const& name) const override;
virtual Vector<DeprecatedString> supported_property_names() const override;
virtual bool is_supported_property_index(u32) const override;

View file

@ -12,12 +12,12 @@
namespace Web::DOM {
JS::NonnullGCPtr<MutationRecord> MutationRecord::create(JS::Realm& realm, FlyString const& type, Node& target, NodeList& added_nodes, NodeList& removed_nodes, Node* previous_sibling, Node* next_sibling, DeprecatedString const& attribute_name, DeprecatedString const& attribute_namespace, DeprecatedString const& old_value)
JS::NonnullGCPtr<MutationRecord> MutationRecord::create(JS::Realm& realm, DeprecatedFlyString const& type, Node& target, NodeList& added_nodes, NodeList& removed_nodes, Node* previous_sibling, Node* next_sibling, DeprecatedString const& attribute_name, DeprecatedString const& attribute_namespace, DeprecatedString const& old_value)
{
return realm.heap().allocate<MutationRecord>(realm, realm, type, target, added_nodes, removed_nodes, previous_sibling, next_sibling, attribute_name, attribute_namespace, old_value);
}
MutationRecord::MutationRecord(JS::Realm& realm, FlyString const& type, Node& target, NodeList& added_nodes, NodeList& removed_nodes, Node* previous_sibling, Node* next_sibling, DeprecatedString const& attribute_name, DeprecatedString const& attribute_namespace, DeprecatedString const& old_value)
MutationRecord::MutationRecord(JS::Realm& realm, DeprecatedFlyString const& type, Node& target, NodeList& added_nodes, NodeList& removed_nodes, Node* previous_sibling, Node* next_sibling, DeprecatedString const& attribute_name, DeprecatedString const& attribute_namespace, DeprecatedString const& old_value)
: PlatformObject(realm)
, m_type(type)
, m_target(JS::make_handle(target))

View file

@ -15,11 +15,11 @@ class MutationRecord : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(MutationRecord, Bindings::PlatformObject);
public:
static JS::NonnullGCPtr<MutationRecord> create(JS::Realm&, FlyString const& type, Node& target, NodeList& added_nodes, NodeList& removed_nodes, Node* previous_sibling, Node* next_sibling, DeprecatedString const& attribute_name, DeprecatedString const& attribute_namespace, DeprecatedString const& old_value);
static JS::NonnullGCPtr<MutationRecord> create(JS::Realm&, DeprecatedFlyString const& type, Node& target, NodeList& added_nodes, NodeList& removed_nodes, Node* previous_sibling, Node* next_sibling, DeprecatedString const& attribute_name, DeprecatedString const& attribute_namespace, DeprecatedString const& old_value);
virtual ~MutationRecord() override;
FlyString const& type() const { return m_type; }
DeprecatedFlyString const& type() const { return m_type; }
Node const* target() const { return m_target; }
NodeList const* added_nodes() const { return m_added_nodes; }
NodeList const* removed_nodes() const { return m_removed_nodes; }
@ -30,10 +30,10 @@ public:
DeprecatedString const& old_value() const { return m_old_value; }
private:
MutationRecord(JS::Realm& realm, FlyString const& type, Node& target, NodeList& added_nodes, NodeList& removed_nodes, Node* previous_sibling, Node* next_sibling, DeprecatedString const& attribute_name, DeprecatedString const& attribute_namespace, DeprecatedString const& old_value);
MutationRecord(JS::Realm& realm, DeprecatedFlyString const& type, Node& target, NodeList& added_nodes, NodeList& removed_nodes, Node* previous_sibling, Node* next_sibling, DeprecatedString const& attribute_name, DeprecatedString const& attribute_namespace, DeprecatedString const& old_value);
virtual void visit_edges(Cell::Visitor&) override;
FlyString m_type;
DeprecatedFlyString m_type;
JS::GCPtr<Node> m_target;
JS::GCPtr<NodeList> m_added_nodes;
JS::GCPtr<NodeList> m_removed_nodes;

View file

@ -8,7 +8,7 @@
namespace Web::DOM::MutationType {
#define __ENUMERATE_MUTATION_TYPE(name) FlyString name;
#define __ENUMERATE_MUTATION_TYPE(name) DeprecatedFlyString name;
ENUMERATE_MUTATION_TYPES
#undef __ENUMERATE_MUTATION_TYPE

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/FlyString.h>
#include <AK/DeprecatedFlyString.h>
namespace Web::DOM::MutationType {
@ -15,7 +15,7 @@ namespace Web::DOM::MutationType {
__ENUMERATE_MUTATION_TYPE(characterData) \
__ENUMERATE_MUTATION_TYPE(childList)
#define __ENUMERATE_MUTATION_TYPE(name) extern FlyString name;
#define __ENUMERATE_MUTATION_TYPE(name) extern DeprecatedFlyString name;
ENUMERATE_MUTATION_TYPES
#undef __ENUMERATE_MUTATION_TYPE

View file

@ -301,7 +301,7 @@ JS::Value NamedNodeMap::item_value(size_t index) const
return node;
}
JS::Value NamedNodeMap::named_item_value(FlyString const& name) const
JS::Value NamedNodeMap::named_item_value(DeprecatedFlyString const& name) const
{
auto const* node = get_named_item(name);
if (!node)

View file

@ -28,7 +28,7 @@ public:
virtual bool is_supported_property_index(u32 index) const override;
virtual Vector<DeprecatedString> supported_property_names() const override;
virtual JS::Value item_value(size_t index) const override;
virtual JS::Value named_item_value(FlyString const& name) const override;
virtual JS::Value named_item_value(DeprecatedFlyString const& name) const override;
size_t length() const { return m_attributes.size(); }
bool is_empty() const { return m_attributes.is_empty(); }

View file

@ -126,7 +126,7 @@ const HTML::HTMLElement* Node::enclosing_html_element() const
return first_ancestor_of_type<HTML::HTMLElement>();
}
const HTML::HTMLElement* Node::enclosing_html_element_with_attribute(FlyString const& attribute) const
const HTML::HTMLElement* Node::enclosing_html_element_with_attribute(DeprecatedFlyString const& attribute) const
{
for (auto* node = this; node; node = node->parent()) {
if (is<HTML::HTMLElement>(*node) && verify_cast<HTML::HTMLElement>(*node).has_attribute(attribute))
@ -1375,7 +1375,7 @@ Painting::PaintableBox const* Node::paint_box() const
}
// https://dom.spec.whatwg.org/#queue-a-mutation-record
void Node::queue_mutation_record(FlyString const& type, DeprecatedString attribute_name, DeprecatedString attribute_namespace, DeprecatedString old_value, JS::NonnullGCPtr<NodeList> added_nodes, JS::NonnullGCPtr<NodeList> removed_nodes, Node* previous_sibling, Node* next_sibling)
void Node::queue_mutation_record(DeprecatedFlyString const& type, DeprecatedString attribute_name, DeprecatedString attribute_namespace, DeprecatedString old_value, JS::NonnullGCPtr<NodeList> added_nodes, JS::NonnullGCPtr<NodeList> removed_nodes, Node* previous_sibling, Node* next_sibling)
{
// NOTE: We defer garbage collection until the end of the scope, since we can't safely use MutationObserver* as a hashmap key otherwise.
// FIXME: This is a total hack.

View file

@ -108,7 +108,7 @@ public:
JS::NonnullGCPtr<NodeList> child_nodes();
Vector<JS::Handle<Node>> children_as_vector() const;
virtual FlyString node_name() const = 0;
virtual DeprecatedFlyString node_name() const = 0;
DeprecatedString base_uri() const;
@ -126,7 +126,7 @@ public:
const HTML::HTMLAnchorElement* enclosing_link_element() const;
const HTML::HTMLElement* enclosing_html_element() const;
const HTML::HTMLElement* enclosing_html_element_with_attribute(FlyString const&) const;
const HTML::HTMLElement* enclosing_html_element_with_attribute(DeprecatedFlyString const&) const;
DeprecatedString child_text_content() const;
@ -223,7 +223,7 @@ public:
void add_registered_observer(RegisteredObserver& registered_observer) { m_registered_observer_list.append(registered_observer); }
void queue_mutation_record(FlyString const& type, DeprecatedString attribute_name, DeprecatedString attribute_namespace, DeprecatedString old_value, JS::NonnullGCPtr<NodeList> added_nodes, JS::NonnullGCPtr<NodeList> removed_nodes, Node* previous_sibling, Node* next_sibling);
void queue_mutation_record(DeprecatedFlyString const& type, DeprecatedString attribute_name, DeprecatedString attribute_namespace, DeprecatedString old_value, JS::NonnullGCPtr<NodeList> added_nodes, JS::NonnullGCPtr<NodeList> removed_nodes, Node* previous_sibling, Node* next_sibling);
// https://dom.spec.whatwg.org/#concept-shadow-including-descendant
template<typename Callback>

View file

@ -17,7 +17,7 @@ namespace Web::DOM {
template<typename NodeType>
class NonElementParentNode {
public:
JS::GCPtr<Element> get_element_by_id(FlyString const& id) const
JS::GCPtr<Element> get_element_by_id(DeprecatedFlyString const& id) const
{
JS::GCPtr<Element> found_element;
static_cast<NodeType const*>(this)->template for_each_in_inclusive_subtree_of_type<Element>([&](auto& element) {
@ -29,7 +29,7 @@ public:
});
return found_element;
}
JS::GCPtr<Element> get_element_by_id(FlyString const& id)
JS::GCPtr<Element> get_element_by_id(DeprecatedFlyString const& id)
{
return const_cast<NonElementParentNode const*>(this)->get_element_by_id(id);
}

View file

@ -103,7 +103,7 @@ JS::NonnullGCPtr<HTMLCollection> ParentNode::children()
// https://dom.spec.whatwg.org/#concept-getelementsbytagname
// NOTE: This method is only exposed on Document and Element, but is in ParentNode to prevent code duplication.
JS::NonnullGCPtr<HTMLCollection> ParentNode::get_elements_by_tag_name(FlyString const& qualified_name)
JS::NonnullGCPtr<HTMLCollection> ParentNode::get_elements_by_tag_name(DeprecatedFlyString const& qualified_name)
{
// 1. If qualifiedName is "*" (U+002A), return a HTMLCollection rooted at root, whose filter matches only descendant elements.
if (qualified_name == "*") {
@ -132,7 +132,7 @@ JS::NonnullGCPtr<HTMLCollection> ParentNode::get_elements_by_tag_name(FlyString
// https://dom.spec.whatwg.org/#concept-getelementsbytagnamens
// NOTE: This method is only exposed on Document and Element, but is in ParentNode to prevent code duplication.
JS::NonnullGCPtr<HTMLCollection> ParentNode::get_elements_by_tag_name_ns(FlyString const& nullable_namespace, FlyString const& local_name)
JS::NonnullGCPtr<HTMLCollection> ParentNode::get_elements_by_tag_name_ns(DeprecatedFlyString const& nullable_namespace, DeprecatedFlyString const& local_name)
{
// 1. If namespace is the empty string, set it to null.
DeprecatedString namespace_ = nullable_namespace;

View file

@ -28,8 +28,8 @@ public:
JS::NonnullGCPtr<HTMLCollection> children();
JS::NonnullGCPtr<HTMLCollection> get_elements_by_tag_name(FlyString const&);
JS::NonnullGCPtr<HTMLCollection> get_elements_by_tag_name_ns(FlyString const&, FlyString const&);
JS::NonnullGCPtr<HTMLCollection> get_elements_by_tag_name(DeprecatedFlyString const&);
JS::NonnullGCPtr<HTMLCollection> get_elements_by_tag_name_ns(DeprecatedFlyString const&, DeprecatedFlyString const&);
WebIDL::ExceptionOr<void> prepend(Vector<Variant<JS::Handle<Node>, DeprecatedString>> const& nodes);
WebIDL::ExceptionOr<void> append(Vector<Variant<JS::Handle<Node>, DeprecatedString>> const& nodes);

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/FlyString.h>
#include <AK/DeprecatedFlyString.h>
#include <LibWeb/DOM/CharacterData.h>
namespace Web::DOM {
@ -17,7 +17,7 @@ class ProcessingInstruction final : public CharacterData {
public:
virtual ~ProcessingInstruction() override = default;
virtual FlyString node_name() const override { return m_target; }
virtual DeprecatedFlyString node_name() const override { return m_target; }
DeprecatedString const& target() const { return m_target; }

View file

@ -25,7 +25,7 @@ struct ImplTraits : public Traits<QualifiedName::Impl*> {
static HashTable<QualifiedName::Impl*, ImplTraits> impls;
static NonnullRefPtr<QualifiedName::Impl> ensure_impl(FlyString const& local_name, FlyString const& prefix, FlyString const& namespace_)
static NonnullRefPtr<QualifiedName::Impl> ensure_impl(DeprecatedFlyString const& local_name, DeprecatedFlyString const& prefix, DeprecatedFlyString const& namespace_)
{
auto hash = pair_int_hash(local_name.hash(), pair_int_hash(prefix.hash(), namespace_.hash()));
auto it = impls.find(hash, [&](QualifiedName::Impl* entry) {
@ -38,12 +38,12 @@ static NonnullRefPtr<QualifiedName::Impl> ensure_impl(FlyString const& local_nam
return adopt_ref(*new QualifiedName::Impl(local_name, prefix, namespace_));
}
QualifiedName::QualifiedName(FlyString const& local_name, FlyString const& prefix, FlyString const& namespace_)
QualifiedName::QualifiedName(DeprecatedFlyString const& local_name, DeprecatedFlyString const& prefix, DeprecatedFlyString const& namespace_)
: m_impl(ensure_impl(local_name, prefix, namespace_))
{
}
QualifiedName::Impl::Impl(FlyString const& a_local_name, FlyString const& a_prefix, FlyString const& a_namespace)
QualifiedName::Impl::Impl(DeprecatedFlyString const& a_local_name, DeprecatedFlyString const& a_prefix, DeprecatedFlyString const& a_namespace)
: local_name(a_local_name)
, prefix(a_prefix)
, namespace_(a_namespace)

View file

@ -7,28 +7,28 @@
#pragma once
#include <AK/FlyString.h>
#include <AK/DeprecatedFlyString.h>
namespace Web::DOM {
class QualifiedName {
public:
QualifiedName(FlyString const& local_name, FlyString const& prefix, FlyString const& namespace_);
QualifiedName(DeprecatedFlyString const& local_name, DeprecatedFlyString const& prefix, DeprecatedFlyString const& namespace_);
FlyString const& local_name() const { return m_impl->local_name; }
FlyString const& prefix() const { return m_impl->prefix; }
FlyString const& namespace_() const { return m_impl->namespace_; }
DeprecatedFlyString const& local_name() const { return m_impl->local_name; }
DeprecatedFlyString const& prefix() const { return m_impl->prefix; }
DeprecatedFlyString const& namespace_() const { return m_impl->namespace_; }
DeprecatedString const& as_string() const { return m_impl->as_string; }
struct Impl : public RefCounted<Impl> {
Impl(FlyString const& local_name, FlyString const& prefix, FlyString const& namespace_);
Impl(DeprecatedFlyString const& local_name, DeprecatedFlyString const& prefix, DeprecatedFlyString const& namespace_);
~Impl();
void make_internal_string();
FlyString local_name;
FlyString prefix;
FlyString namespace_;
DeprecatedFlyString local_name;
DeprecatedFlyString prefix;
DeprecatedFlyString namespace_;
DeprecatedString as_string;
};

View file

@ -35,7 +35,7 @@ private:
ShadowRoot(Document&, Element&);
// ^Node
virtual FlyString node_name() const override { return "#shadow-root"; }
virtual DeprecatedFlyString node_name() const override { return "#shadow-root"; }
virtual bool is_shadow_root() const final { return true; }
// NOTE: The specification doesn't seem to specify a default value for closed. Assuming false for now.

View file

@ -6,8 +6,8 @@
#pragma once
#include <AK/DeprecatedFlyString.h>
#include <AK/DeprecatedString.h>
#include <AK/FlyString.h>
#include <LibWeb/DOM/CharacterData.h>
namespace Web::DOM {
@ -21,7 +21,7 @@ public:
static JS::NonnullGCPtr<Text> construct_impl(JS::Realm& realm, DeprecatedString const& data);
// ^Node
virtual FlyString node_name() const override { return "#text"; }
virtual DeprecatedFlyString node_name() const override { return "#text"; }
virtual bool is_editable() const override { return m_always_editable || CharacterData::is_editable(); }
void set_always_editable(bool b) { m_always_editable = b; }