LibWeb: Port AttributeNames to FlyString

This commit is contained in:
Shannon Booth 2023-10-08 11:42:00 +13:00 committed by Tim Flynn
parent 6a3f27509f
commit e4f8c59210
Notes: sideshowbarker 2024-07-18 04:46:35 +09:00
93 changed files with 148 additions and 149 deletions

View File

@ -3013,7 +3013,7 @@ JS_DEFINE_NATIVE_FUNCTION(@class_name@::@attribute.setter_callback@)
if (!cpp_value)
impl->remove_attribute(HTML::AttributeNames::@attribute.reflect_name@);
else
MUST(impl->set_attribute(HTML::AttributeNames::@attribute.reflect_name@, DeprecatedString::empty()));
MUST(impl->set_attribute(HTML::AttributeNames::@attribute.reflect_name@, String {}));
)~~~");
}

View File

@ -61,7 +61,7 @@ using Token = Web::HTML::HTMLToken;
#define EXPECT_TAG_TOKEN_ATTRIBUTE(name, attribute_value, name_start_column, name_end_column, value_start_column, value_end_column) \
VERIFY(last_token); \
auto name##_attr = last_token->raw_attribute(#name); \
auto name##_attr = last_token->raw_attribute(#name##_fly_string); \
VERIFY(name##_attr.has_value()); \
EXPECT_EQ(name##_attr->value, attribute_value); \
EXPECT_EQ(name##_attr->name_start_position.column, name_start_column); \

View File

@ -46,14 +46,14 @@ JS::ThrowCompletionOr<JS::NonnullGCPtr<JS::Object>> AudioConstructor::construct(
auto audio = TRY(Bindings::throw_dom_exception_if_needed(vm, [&]() { return DOM::create_element(document, HTML::TagNames::audio, Namespace::HTML); }));
// 3. Set an attribute value for audio using "preload" and "auto".
MUST(audio->set_attribute(HTML::AttributeNames::preload, "auto"sv));
MUST(audio->set_attribute(HTML::AttributeNames::preload, "auto"_string));
auto src_value = vm.argument(0);
// 4. If src is given, then set an attribute value for audio using "src" and src.
// (This will cause the user agent to invoke the object's resource selection algorithm before returning.)
if (!src_value.is_undefined()) {
auto src = TRY(src_value.to_deprecated_string(vm));
auto src = TRY(src_value.to_string(vm));
MUST(audio->set_attribute(HTML::AttributeNames::src, move(src)));
}

View File

@ -48,13 +48,13 @@ JS::ThrowCompletionOr<JS::NonnullGCPtr<JS::Object>> ImageConstructor::construct(
// 3. If width is given, then set an attribute value for img using "width" and width.
if (vm.argument_count() > 0) {
u32 width = TRY(vm.argument(0).to_u32(vm));
MUST(image_element->set_attribute(HTML::AttributeNames::width, DeprecatedString::formatted("{}", width)));
MUST(image_element->set_attribute(HTML::AttributeNames::width, MUST(String::formatted("{}", width))));
}
// 4. If height is given, then set an attribute value for img using "height" and height.
if (vm.argument_count() > 1) {
u32 height = TRY(vm.argument(1).to_u32(vm));
MUST(image_element->set_attribute(HTML::AttributeNames::height, DeprecatedString::formatted("{}", height)));
MUST(image_element->set_attribute(HTML::AttributeNames::height, MUST(String::formatted("{}", height))));
}
// 5. Return img.

View File

@ -61,7 +61,7 @@ JS::ThrowCompletionOr<JS::NonnullGCPtr<JS::Object>> OptionConstructor::construct
// 4. If value is given, then set an attribute value for option using "value" and value.
if (vm.argument_count() > 1) {
auto value = TRY(vm.argument(1).to_deprecated_string(vm));
auto value = TRY(vm.argument(1).to_string(vm));
MUST(option_element->set_attribute(HTML::AttributeNames::value, value));
}
@ -69,7 +69,7 @@ JS::ThrowCompletionOr<JS::NonnullGCPtr<JS::Object>> OptionConstructor::construct
if (vm.argument_count() > 2) {
auto default_selected = vm.argument(2).to_boolean();
if (default_selected) {
MUST(option_element->set_attribute(HTML::AttributeNames::selected, ""));
MUST(option_element->set_attribute(HTML::AttributeNames::selected, String {}));
}
}

View File

@ -183,7 +183,7 @@ void ElementInlineCSSStyleDeclaration::update_style_attribute()
m_updating = true;
// 5. Set an attribute value for owner node using "style" and the result of serializing declaration block.
MUST(m_element->set_attribute(HTML::AttributeNames::style, serialized()));
MUST(m_element->set_attribute(HTML::AttributeNames::style, MUST(String::from_deprecated_string(serialized()))));
// 6. Unset declaration blocks updating flag.
m_updating = false;

View File

@ -115,7 +115,7 @@ void Attr::handle_attribute_changes(Element& element, DeprecatedString const& ol
}
// 3. Run the attribute change steps with element, attributes local name, oldValue, newValue, and attributes namespace.
element.run_attribute_change_steps(local_name().to_deprecated_fly_string(), old_value, new_value, deprecated_namespace_uri);
element.run_attribute_change_steps(local_name(), old_value, new_value, deprecated_namespace_uri);
}
}

View File

@ -126,7 +126,7 @@ static bool build_image_document(DOM::Document& document, ByteBuffer const& data
MUST(html_element->append_child(body_element));
auto image_element = DOM::create_element(document, HTML::TagNames::img, Namespace::HTML).release_value_but_fixme_should_propagate_errors();
MUST(image_element->set_attribute(HTML::AttributeNames::src, document.url().to_deprecated_string()));
MUST(image_element->set_attribute(HTML::AttributeNames::src, MUST(document.url().to_string())));
MUST(body_element->append_child(image_element));
return true;
@ -170,9 +170,9 @@ static bool build_video_document(DOM::Document& document)
MUST(html_element->append_child(body_element));
auto video_element = DOM::create_element(document, HTML::TagNames::video, Namespace::HTML).release_value_but_fixme_should_propagate_errors();
MUST(video_element->set_attribute(HTML::AttributeNames::src, document.url().to_deprecated_string()));
MUST(video_element->set_attribute(HTML::AttributeNames::autoplay, DeprecatedString::empty()));
MUST(video_element->set_attribute(HTML::AttributeNames::controls, DeprecatedString::empty()));
MUST(video_element->set_attribute(HTML::AttributeNames::src, MUST(document.url().to_string())));
MUST(video_element->set_attribute(HTML::AttributeNames::autoplay, String {}));
MUST(video_element->set_attribute(HTML::AttributeNames::controls, String {}));
MUST(body_element->append_child(video_element));
return true;
@ -190,9 +190,9 @@ static bool build_audio_document(DOM::Document& document)
MUST(html_element->append_child(body_element));
auto video_element = DOM::create_element(document, HTML::TagNames::audio, Namespace::HTML).release_value_but_fixme_should_propagate_errors();
MUST(video_element->set_attribute(HTML::AttributeNames::src, document.url().to_deprecated_string()));
MUST(video_element->set_attribute(HTML::AttributeNames::autoplay, DeprecatedString::empty()));
MUST(video_element->set_attribute(HTML::AttributeNames::controls, DeprecatedString::empty()));
MUST(video_element->set_attribute(HTML::AttributeNames::src, MUST(document.url().to_string())));
MUST(video_element->set_attribute(HTML::AttributeNames::autoplay, String {}));
MUST(video_element->set_attribute(HTML::AttributeNames::controls, String {}));
MUST(body_element->append_child(video_element));
return true;

View File

@ -468,7 +468,7 @@ void Element::add_attribute_change_steps(AttributeChangeSteps steps)
m_attribute_change_steps.append(move(steps));
}
void Element::run_attribute_change_steps(DeprecatedFlyString const& local_name, DeprecatedString const& old_value, DeprecatedString const& value, DeprecatedFlyString const& namespace_)
void Element::run_attribute_change_steps(FlyString const& local_name, DeprecatedString const& old_value, DeprecatedString const& value, DeprecatedFlyString const& namespace_)
{
for (auto const& attribute_change_steps : m_attribute_change_steps)
attribute_change_steps(local_name, old_value, value, namespace_);
@ -478,7 +478,7 @@ void Element::run_attribute_change_steps(DeprecatedFlyString const& local_name,
invalidate_style_after_attribute_change(local_name);
}
void Element::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
void Element::attribute_changed(FlyString const& name, DeprecatedString const& value)
{
if (name == HTML::AttributeNames::class_) {
auto new_classes = value.split_view(Infra::is_ascii_whitespace);
@ -614,7 +614,7 @@ NonnullRefPtr<CSS::StyleProperties> Element::resolved_css_values()
DOMTokenList* Element::class_list()
{
if (!m_class_list)
m_class_list = DOMTokenList::create(*this, FlyString::from_deprecated_fly_string(HTML::AttributeNames::class_).release_value());
m_class_list = DOMTokenList::create(*this, HTML::AttributeNames::class_);
return m_class_list;
}
@ -1026,7 +1026,7 @@ i32 Element::tab_index() const
// https://html.spec.whatwg.org/multipage/interaction.html#dom-tabindex
void Element::set_tab_index(i32 tab_index)
{
MUST(set_attribute(HTML::AttributeNames::tabindex, DeprecatedString::number(tab_index)));
MUST(set_attribute(HTML::AttributeNames::tabindex, MUST(String::number(tab_index))));
}
// https://drafts.csswg.org/cssom-view/#potentially-scrollable
@ -1583,7 +1583,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(DeprecatedFlyString const& attribute_name)
void Element::invalidate_style_after_attribute_change(FlyString const& attribute_name)
{
// FIXME: Only invalidate if the attribute can actually affect style.
(void)attribute_name;
@ -1873,11 +1873,11 @@ void Element::set_prefix(Optional<FlyString> value)
m_qualified_name.set_prefix(move(value));
}
void Element::for_each_attribute(Function<void(DeprecatedFlyString const&, DeprecatedString const&)> callback) const
void Element::for_each_attribute(Function<void(FlyString const&, DeprecatedString const&)> callback) const
{
for (size_t i = 0; i < m_attributes->length(); ++i) {
auto const* attribute = m_attributes->item(i);
callback(attribute->name().to_deprecated_fly_string(), attribute->value().to_deprecated_string());
callback(attribute->name(), attribute->value().to_deprecated_string());
}
}

View File

@ -145,7 +145,7 @@ public:
int client_width() const;
int client_height() const;
void for_each_attribute(Function<void(DeprecatedFlyString const&, DeprecatedString const&)>) const;
void for_each_attribute(Function<void(FlyString const&, DeprecatedString const&)>) const;
bool has_class(FlyString const&, CaseSensitivity = CaseSensitivity::CaseSensitive) const;
Vector<FlyString> const& class_names() const { return m_classes; }
@ -153,11 +153,11 @@ public:
virtual void apply_presentational_hints(CSS::StyleProperties&) const { }
// https://dom.spec.whatwg.org/#concept-element-attributes-change-ext
using AttributeChangeSteps = Function<void(DeprecatedFlyString const& /*local_name*/, DeprecatedString const& /*old_value*/, DeprecatedString const& /*value*/, DeprecatedFlyString const& /*namespace_*/)>;
using AttributeChangeSteps = Function<void(FlyString const& /*local_name*/, DeprecatedString const& /*old_value*/, DeprecatedString const& /*value*/, DeprecatedFlyString const& /*namespace_*/)>;
void add_attribute_change_steps(AttributeChangeSteps steps);
void run_attribute_change_steps(DeprecatedFlyString const& local_name, DeprecatedString const& old_value, DeprecatedString const& value, DeprecatedFlyString const& namespace_);
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value);
void run_attribute_change_steps(FlyString const& local_name, DeprecatedString const& old_value, DeprecatedString const& value, DeprecatedFlyString const& namespace_);
virtual void attribute_changed(FlyString const& name, DeprecatedString const& value);
struct [[nodiscard]] RequiredInvalidationAfterStyleChange {
bool repaint { false };
@ -386,7 +386,7 @@ protected:
private:
void make_html_uppercased_qualified_name();
void invalidate_style_after_attribute_change(DeprecatedFlyString const& attribute_name);
void invalidate_style_after_attribute_change(FlyString const& attribute_name);
WebIDL::ExceptionOr<JS::GCPtr<Node>> insert_adjacent(DeprecatedString const& where, JS::NonnullGCPtr<Node> node);

View File

@ -131,7 +131,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(DeprecatedFlyString const& attribute) const
const HTML::HTMLElement* Node::enclosing_html_element_with_attribute(FlyString const& attribute) const
{
for (auto* node = this; node; node = node->parent()) {
if (is<HTML::HTMLElement>(*node) && verify_cast<HTML::HTMLElement>(*node).has_attribute(attribute))
@ -815,7 +815,7 @@ JS::NonnullGCPtr<Node> Node::clone_node(Document* document, bool clone_children)
element.for_each_attribute([&](auto& name, auto& value) {
// 1. Let copyAttribute be a clone of attribute.
// 2. Append copyAttribute to copy.
MUST(element_copy->set_attribute(name, value));
MUST(element_copy->set_attribute(name, MUST(String::from_deprecated_string(value))));
});
copy = move(element_copy);

View File

@ -158,7 +158,7 @@ public:
const HTML::HTMLAnchorElement* enclosing_link_element() const;
const HTML::HTMLElement* enclosing_html_element() const;
const HTML::HTMLElement* enclosing_html_element_with_attribute(DeprecatedFlyString const&) const;
const HTML::HTMLElement* enclosing_html_element_with_attribute(FlyString const&) const;
DeprecatedString child_text_content() const;

View File

@ -9,7 +9,7 @@
namespace Web::HTML {
namespace AttributeNames {
#define __ENUMERATE_HTML_ATTRIBUTE(name) DeprecatedFlyString name;
#define __ENUMERATE_HTML_ATTRIBUTE(name) FlyString name;
ENUMERATE_HTML_ATTRIBUTES
#undef __ENUMERATE_HTML_ATTRIBUTE
@ -19,19 +19,19 @@ void initialize_strings()
VERIFY(!s_initialized);
#define __ENUMERATE_HTML_ATTRIBUTE(name) \
name = #name;
name = #name##_fly_string;
ENUMERATE_HTML_ATTRIBUTES
#undef __ENUMERATE_HTML_ATTRIBUTE
// NOTE: Special cases for C++ keywords.
class_ = "class";
for_ = "for";
default_ = "default";
char_ = "char";
class_ = "class"_fly_string;
for_ = "for"_fly_string;
default_ = "default"_fly_string;
char_ = "char"_fly_string;
// NOTE: Special cases for attributes with dashes in them.
accept_charset = "accept-charset";
http_equiv = "http-equiv";
accept_charset = "accept-charset"_fly_string;
http_equiv = "http-equiv"_fly_string;
s_initialized = true;
}
@ -39,7 +39,7 @@ void initialize_strings()
}
// https://html.spec.whatwg.org/#boolean-attribute
bool is_boolean_attribute(DeprecatedFlyString const& attribute)
bool is_boolean_attribute(FlyString const& attribute)
{
// NOTE: This is the list of attributes from https://html.spec.whatwg.org/#attributes-3
// with a Value column value of "Boolean attribute".

View File

@ -6,8 +6,8 @@
#pragma once
#include <AK/DeprecatedFlyString.h>
#include <AK/Error.h>
#include <AK/FlyString.h>
namespace Web::HTML {
namespace AttributeNames {
@ -240,7 +240,7 @@ namespace AttributeNames {
__ENUMERATE_HTML_ATTRIBUTE(width) \
__ENUMERATE_HTML_ATTRIBUTE(wrap)
#define __ENUMERATE_HTML_ATTRIBUTE(name) extern DeprecatedFlyString name;
#define __ENUMERATE_HTML_ATTRIBUTE(name) extern FlyString name;
ENUMERATE_HTML_ATTRIBUTES
#undef __ENUMERATE_HTML_ATTRIBUTE
@ -248,6 +248,6 @@ void initialize_strings();
}
bool is_boolean_attribute(DeprecatedFlyString const& attribute);
bool is_boolean_attribute(FlyString const& attribute);
}

View File

@ -48,10 +48,10 @@ Vector<DOMStringMap::NameValuePair> DOMStringMap::get_name_value_pairs() const
// in the order that those attributes are listed in the element's attribute list, add a name-value pair to list whose name is the attribute's name with the first five characters removed and whose value
// is the attribute's value.
m_associated_element->for_each_attribute([&](auto& name, auto& value) {
if (!name.starts_with("data-"sv))
if (!name.bytes_as_string_view().starts_with("data-"sv))
return;
auto name_after_starting_data = name.view().substring_view(5);
auto name_after_starting_data = name.bytes_as_string_view().substring_view(5);
for (auto character : name_after_starting_data) {
if (is_ascii_upper_alpha(character))

View File

@ -27,7 +27,7 @@ void HTMLAnchorElement::initialize(JS::Realm& realm)
set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLAnchorElementPrototype>(realm, "HTMLAnchorElement"));
}
void HTMLAnchorElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLAnchorElement::attribute_changed(FlyString const& name, DeprecatedString const& value)
{
HTMLElement::attribute_changed(name, value);
if (name == HTML::AttributeNames::href) {
@ -40,7 +40,7 @@ DeprecatedString HTMLAnchorElement::hyperlink_element_utils_href() const
return deprecated_attribute(HTML::AttributeNames::href);
}
WebIDL::ExceptionOr<void> HTMLAnchorElement::set_hyperlink_element_utils_href(DeprecatedString href)
WebIDL::ExceptionOr<void> HTMLAnchorElement::set_hyperlink_element_utils_href(String href)
{
return set_attribute(HTML::AttributeNames::href, move(href));
}

View File

@ -43,13 +43,13 @@ private:
void run_activation_behavior(Web::DOM::Event const&);
// ^DOM::Element
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(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 DeprecatedString hyperlink_element_utils_href() const override;
virtual WebIDL::ExceptionOr<void> set_hyperlink_element_utils_href(DeprecatedString) override;
virtual WebIDL::ExceptionOr<void> set_hyperlink_element_utils_href(String) 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 void hyperlink_element_utils_queue_an_element_task(HTML::Task::Source source, Function<void()> steps) override

View File

@ -23,7 +23,7 @@ void HTMLAreaElement::initialize(JS::Realm& realm)
set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLAreaElementPrototype>(realm, "HTMLAreaElement"));
}
void HTMLAreaElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLAreaElement::attribute_changed(FlyString const& name, DeprecatedString const& value)
{
HTMLElement::attribute_changed(name, value);
if (name == HTML::AttributeNames::href) {
@ -36,7 +36,7 @@ DeprecatedString HTMLAreaElement::hyperlink_element_utils_href() const
return deprecated_attribute(HTML::AttributeNames::href);
}
WebIDL::ExceptionOr<void> HTMLAreaElement::set_hyperlink_element_utils_href(DeprecatedString href)
WebIDL::ExceptionOr<void> HTMLAreaElement::set_hyperlink_element_utils_href(String href)
{
return set_attribute(HTML::AttributeNames::href, move(href));
}

View File

@ -26,13 +26,13 @@ private:
virtual void initialize(JS::Realm&) override;
// ^DOM::Element
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(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 DeprecatedString hyperlink_element_utils_href() const override;
virtual WebIDL::ExceptionOr<void> set_hyperlink_element_utils_href(DeprecatedString) override;
virtual WebIDL::ExceptionOr<void> set_hyperlink_element_utils_href(String) 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 void hyperlink_element_utils_queue_an_element_task(HTML::Task::Source source, Function<void()> steps) override

View File

@ -43,7 +43,7 @@ void HTMLBaseElement::removed_from(Node* parent)
document().update_base_element({});
}
void HTMLBaseElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLBaseElement::attribute_changed(FlyString const& name, DeprecatedString const& value)
{
HTMLElement::attribute_changed(name, value);

View File

@ -23,7 +23,7 @@ public:
virtual void inserted() override;
virtual void removed_from(Node*) override;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(FlyString const& name, DeprecatedString const& value) override;
private:
HTMLBaseElement(DOM::Document&, DOM::QualifiedName);

View File

@ -55,7 +55,7 @@ void HTMLBodyElement::apply_presentational_hints(CSS::StyleProperties& style) co
});
}
void HTMLBodyElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLBodyElement::attribute_changed(FlyString const& name, DeprecatedString const& value)
{
HTMLElement::attribute_changed(name, value);
if (name.equals_ignoring_ascii_case("link"sv)) {

View File

@ -20,7 +20,7 @@ class HTMLBodyElement final
public:
virtual ~HTMLBodyElement() override;
virtual void attribute_changed(DeprecatedFlyString const&, DeprecatedString const&) override;
virtual void attribute_changed(FlyString const&, DeprecatedString const&) override;
virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
// https://www.w3.org/TR/html-aria/#el-body

View File

@ -111,7 +111,7 @@ void HTMLCanvasElement::reset_context_to_default_state()
WebIDL::ExceptionOr<void> HTMLCanvasElement::set_width(unsigned value)
{
TRY(set_attribute(HTML::AttributeNames::width, DeprecatedString::number(value)));
TRY(set_attribute(HTML::AttributeNames::width, MUST(String::number(value))));
m_bitmap = nullptr;
reset_context_to_default_state();
return {};
@ -119,7 +119,7 @@ WebIDL::ExceptionOr<void> HTMLCanvasElement::set_width(unsigned value)
WebIDL::ExceptionOr<void> HTMLCanvasElement::set_height(unsigned value)
{
TRY(set_attribute(HTML::AttributeNames::height, DeprecatedString::number(value)));
TRY(set_attribute(HTML::AttributeNames::height, MUST(String::number(value))));
m_bitmap = nullptr;
reset_context_to_default_state();
return {};

View File

@ -41,7 +41,7 @@ void HTMLDetailsElement::initialize(JS::Realm& realm)
create_shadow_tree(realm).release_value_but_fixme_should_propagate_errors();
}
void HTMLDetailsElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLDetailsElement::attribute_changed(FlyString const& name, DeprecatedString const& value)
{
Base::attribute_changed(name, value);
@ -160,13 +160,13 @@ void HTMLDetailsElement::update_shadow_tree_style()
if (has_attribute(HTML::AttributeNames::open)) {
MUST(m_descendants_slot->set_attribute(HTML::AttributeNames::style, R"~~~(
display: block;
)~~~"));
)~~~"_string));
} else {
// FIXME: Should be `display: block` but we do not support `content-visibility: hidden`.
MUST(m_descendants_slot->set_attribute(HTML::AttributeNames::style, R"~~~(
display: none;
content-visibility: hidden;
)~~~"));
)~~~"_string));
}
}

View File

@ -31,7 +31,7 @@ private:
virtual void visit_edges(Cell::Visitor&) override;
virtual void children_changed() override;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(FlyString const& name, DeprecatedString const& value) override;
void queue_a_details_toggle_event_task(String old_state, String new_state);

View File

@ -112,11 +112,11 @@ WebIDL::ExceptionOr<void> HTMLElement::set_content_editable(StringView content_e
return {};
}
if (content_editable.equals_ignoring_ascii_case("true"sv)) {
MUST(set_attribute(HTML::AttributeNames::contenteditable, "true"));
MUST(set_attribute(HTML::AttributeNames::contenteditable, "true"_string));
return {};
}
if (content_editable.equals_ignoring_ascii_case("false"sv)) {
MUST(set_attribute(HTML::AttributeNames::contenteditable, "false"));
MUST(set_attribute(HTML::AttributeNames::contenteditable, "false"_string));
return {};
}
return WebIDL::SyntaxError::create(realm(), "Invalid contentEditable value, must be 'true', 'false', or 'inherit'"_fly_string);
@ -224,7 +224,7 @@ bool HTMLElement::cannot_navigate() const
return !is<HTML::HTMLAnchorElement>(this) && !is_connected();
}
void HTMLElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLElement::attribute_changed(FlyString const& name, DeprecatedString const& value)
{
Element::attribute_changed(name, value);

View File

@ -70,7 +70,7 @@ protected:
virtual void initialize(JS::Realm&) override;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(FlyString const& name, DeprecatedString const& value) override;
virtual void visit_edges(Cell::Visitor&) override;

View File

@ -23,7 +23,7 @@ void HTMLFrameSetElement::initialize(JS::Realm& realm)
set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLFrameSetElementPrototype>(realm, "HTMLFrameSetElement"));
}
void HTMLFrameSetElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLFrameSetElement::attribute_changed(FlyString const& name, DeprecatedString const& value)
{
HTMLElement::attribute_changed(name, value);

View File

@ -24,7 +24,7 @@ private:
HTMLFrameSetElement(DOM::Document&, DOM::QualifiedName);
virtual void initialize(JS::Realm&) override;
virtual void attribute_changed(DeprecatedFlyString const&, DeprecatedString const&) override;
virtual void attribute_changed(FlyString const&, DeprecatedString const&) override;
// ^HTML::GlobalEventHandlers
virtual EventTarget& global_event_handlers_to_event_target(FlyString const& event_name) override;

View File

@ -441,10 +441,10 @@ DeprecatedString HTMLHyperlinkElementUtils::href() const
}
// https://html.spec.whatwg.org/multipage/links.html#dom-hyperlink-href
WebIDL::ExceptionOr<void> HTMLHyperlinkElementUtils::set_href(StringView href)
WebIDL::ExceptionOr<void> HTMLHyperlinkElementUtils::set_href(String href)
{
// The href attribute's setter must set this element's href content attribute's value to the given value.
return set_hyperlink_element_utils_href(href);
return set_hyperlink_element_utils_href(move(href));
}
// https://html.spec.whatwg.org/multipage/links.html#update-href

View File

@ -20,7 +20,7 @@ public:
DeprecatedString origin() const;
DeprecatedString href() const;
WebIDL::ExceptionOr<void> set_href(StringView);
WebIDL::ExceptionOr<void> set_href(String);
DeprecatedString protocol() const;
void set_protocol(StringView);
@ -52,7 +52,7 @@ public:
protected:
virtual DOM::Document& hyperlink_element_utils_document() = 0;
virtual DeprecatedString hyperlink_element_utils_href() const = 0;
virtual WebIDL::ExceptionOr<void> set_hyperlink_element_utils_href(DeprecatedString) = 0;
virtual WebIDL::ExceptionOr<void> set_hyperlink_element_utils_href(String) = 0;
virtual bool hyperlink_element_utils_is_html_anchor_element() const = 0;
virtual bool hyperlink_element_utils_is_connected() const = 0;
virtual DeprecatedString hyperlink_element_utils_get_an_elements_target() const = 0;

View File

@ -33,7 +33,7 @@ JS::GCPtr<Layout::Node> HTMLIFrameElement::create_layout_node(NonnullRefPtr<CSS:
return heap().allocate_without_realm<Layout::FrameBox>(document(), *this, move(style));
}
void HTMLIFrameElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLIFrameElement::attribute_changed(FlyString const& name, DeprecatedString const& value)
{
HTMLElement::attribute_changed(name, value);
if (m_content_navigable)

View File

@ -36,7 +36,7 @@ private:
// ^DOM::Element
virtual void inserted() override;
virtual void removed_from(Node*) override;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(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

View File

@ -95,7 +95,7 @@ void HTMLImageElement::apply_presentational_hints(CSS::StyleProperties& style) c
});
}
void HTMLImageElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLImageElement::attribute_changed(FlyString const& name, DeprecatedString const& value)
{
HTMLElement::attribute_changed(name, value);
@ -190,7 +190,7 @@ unsigned HTMLImageElement::width() const
WebIDL::ExceptionOr<void> HTMLImageElement::set_width(unsigned width)
{
return set_attribute(HTML::AttributeNames::width, DeprecatedString::number(width));
return set_attribute(HTML::AttributeNames::width, MUST(String::number(width)));
}
// https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-height
@ -218,7 +218,7 @@ unsigned HTMLImageElement::height() const
WebIDL::ExceptionOr<void> HTMLImageElement::set_height(unsigned height)
{
return set_attribute(HTML::AttributeNames::height, DeprecatedString::number(height));
return set_attribute(HTML::AttributeNames::height, MUST(String::number(height)));
}
// https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-naturalwidth

View File

@ -32,7 +32,7 @@ class HTMLImageElement final
public:
virtual ~HTMLImageElement() override;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(FlyString const& name, DeprecatedString const& value) override;
DeprecatedString alt() const { return deprecated_attribute(HTML::AttributeNames::alt); }
DeprecatedString src() const { return deprecated_attribute(HTML::AttributeNames::src); }

View File

@ -532,7 +532,7 @@ void HTMLInputElement::create_shadow_tree_if_needed()
white-space: pre;
border: none;
padding: 1px 2px;
)~~~"));
)~~~"_string));
m_placeholder_element = heap().allocate<PlaceholderElement>(realm(), document());
MUST(m_placeholder_element->style_for_bindings()->set_property(CSS::PropertyID::Height, "1lh"sv));
@ -586,7 +586,7 @@ void HTMLInputElement::did_lose_focus()
});
}
void HTMLInputElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLInputElement::attribute_changed(FlyString const& name, DeprecatedString const& value)
{
HTMLElement::attribute_changed(name, value);
if (name == HTML::AttributeNames::checked) {

View File

@ -111,7 +111,7 @@ public:
virtual bool is_focusable() const override { return m_type != TypeAttributeState::Hidden; }
// ^HTMLElement
virtual void attribute_changed(DeprecatedFlyString const&, DeprecatedString const&) override;
virtual void attribute_changed(FlyString const&, DeprecatedString const&) override;
// ^FormAssociatedElement
// https://html.spec.whatwg.org/multipage/forms.html#category-listed

View File

@ -77,7 +77,7 @@ bool HTMLLinkElement::has_loaded_icon() const
return m_relationship & Relationship::Icon && resource() && resource()->is_loaded() && resource()->has_encoded_data();
}
void HTMLLinkElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLLinkElement::attribute_changed(FlyString const& name, DeprecatedString const& value)
{
HTMLElement::attribute_changed(name, value);

View File

@ -39,7 +39,7 @@ private:
HTMLLinkElement(DOM::Document&, DOM::QualifiedName);
virtual void initialize(JS::Realm&) override;
void attribute_changed(DeprecatedFlyString const&, DeprecatedString const&) override;
void attribute_changed(FlyString const&, DeprecatedString const&) override;
// ^ResourceClient
virtual void resource_did_fail() override;

View File

@ -83,7 +83,7 @@ void HTMLMediaElement::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_fetch_controller);
}
void HTMLMediaElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLMediaElement::attribute_changed(FlyString const& name, DeprecatedString const& value)
{
Base::attribute_changed(name, value);

View File

@ -134,7 +134,7 @@ protected:
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(FlyString const& name, DeprecatedString const& value) override;
virtual void removed_from(DOM::Node*) override;
virtual void children_changed() override;

View File

@ -45,7 +45,7 @@ void HTMLObjectElement::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_image_request);
}
void HTMLObjectElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLObjectElement::attribute_changed(FlyString const& name, DeprecatedString const& value)
{
NavigableContainer::attribute_changed(name, value);

View File

@ -34,7 +34,7 @@ class HTMLObjectElement final
public:
virtual ~HTMLObjectElement() override;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(FlyString const& name, DeprecatedString const& value) override;
String data() const;
void set_data(String const& data) { MUST(set_attribute(HTML::AttributeNames::data, data)); }

View File

@ -31,7 +31,7 @@ void HTMLOptionElement::initialize(JS::Realm& realm)
set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLOptionElementPrototype>(realm, "HTMLOptionElement"));
}
void HTMLOptionElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLOptionElement::attribute_changed(FlyString const& name, DeprecatedString const& value)
{
HTMLElement::attribute_changed(name, value);

View File

@ -40,7 +40,7 @@ private:
virtual void initialize(JS::Realm&) override;
void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
void attribute_changed(FlyString const& name, DeprecatedString const& value) override;
void ask_for_a_reset();

View File

@ -71,7 +71,7 @@ WebIDL::ExceptionOr<void> HTMLProgressElement::set_value(double value)
if (value < 0)
return {};
TRY(set_attribute(HTML::AttributeNames::value, DeprecatedString::number(value)));
TRY(set_attribute(HTML::AttributeNames::value, MUST(String::number(value))));
progress_position_updated();
return {};
}
@ -98,7 +98,7 @@ WebIDL::ExceptionOr<void> HTMLProgressElement::set_max(double value)
if (value <= 0)
return {};
TRY(set_attribute(HTML::AttributeNames::max, DeprecatedString::number(value)));
TRY(set_attribute(HTML::AttributeNames::max, MUST(String::number(value))));
progress_position_updated();
return {};
}

View File

@ -45,7 +45,7 @@ void HTMLScriptElement::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_preparation_time_document.ptr());
}
void HTMLScriptElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLScriptElement::attribute_changed(FlyString const& name, DeprecatedString const& value)
{
Base::attribute_changed(name, value);

View File

@ -62,7 +62,7 @@ private:
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(FlyString const& name, DeprecatedString const& value) override;
// https://html.spec.whatwg.org/multipage/scripting.html#prepare-the-script-element
void prepare_script();

View File

@ -27,7 +27,7 @@ HTMLSummaryElement::HTMLSummaryElement(DOM::Document& document, DOM::QualifiedNa
if (parent->has_attribute(HTML::AttributeNames::open))
parent->remove_attribute(HTML::AttributeNames::open);
else
parent->set_attribute(HTML::AttributeNames::open, "").release_value_but_fixme_should_propagate_errors();
parent->set_attribute(HTML::AttributeNames::open, String {}).release_value_but_fixme_should_propagate_errors();
};
}

View File

@ -116,7 +116,7 @@ unsigned int HTMLTableCellElement::col_span() const
WebIDL::ExceptionOr<void> HTMLTableCellElement::set_col_span(unsigned int value)
{
return set_attribute(HTML::AttributeNames::colspan, DeprecatedString::number(value));
return set_attribute(HTML::AttributeNames::colspan, MUST(String::number(value)));
}
// This implements step 9 in the spec here:
@ -136,7 +136,7 @@ unsigned int HTMLTableCellElement::row_span() const
WebIDL::ExceptionOr<void> HTMLTableCellElement::set_row_span(unsigned int value)
{
return set_attribute(HTML::AttributeNames::rowspan, DeprecatedString::number(value));
return set_attribute(HTML::AttributeNames::rowspan, MUST(String::number(value)));
}
Optional<ARIA::Role> HTMLTableCellElement::default_role() const

View File

@ -40,7 +40,7 @@ void HTMLVideoElement::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_fetch_controller);
}
void HTMLVideoElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLVideoElement::attribute_changed(FlyString const& name, DeprecatedString const& value)
{
Base::attribute_changed(name, value);

View File

@ -47,7 +47,7 @@ private:
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(FlyString const& name, DeprecatedString const& value) override;
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;

View File

@ -247,28 +247,29 @@ public:
}
}
StringView attribute(DeprecatedFlyString const& attribute_name) const
StringView attribute(FlyString const& attribute_name) const
{
if (auto result = raw_attribute(attribute_name); result.has_value())
return result->value;
return {};
}
Optional<Attribute const&> raw_attribute(DeprecatedFlyString const& attribute_name) const
Optional<Attribute const&> raw_attribute(FlyString const& attribute_name) const
{
VERIFY(is_start_tag() || is_end_tag());
auto deprecated_attribute_name = attribute_name.to_deprecated_fly_string();
auto* ptr = tag_attributes();
if (!ptr)
return {};
for (auto& attribute : *ptr) {
if (attribute_name == attribute.local_name)
if (deprecated_attribute_name == attribute.local_name)
return attribute;
}
return {};
}
bool has_attribute(DeprecatedFlyString const& attribute_name)
bool has_attribute(FlyString const& attribute_name) const
{
return !attribute(attribute_name).is_null();
}

View File

@ -8,7 +8,7 @@
namespace Web::SVG::AttributeNames {
#define __ENUMERATE_SVG_ATTRIBUTE(name) DeprecatedFlyString name;
#define __ENUMERATE_SVG_ATTRIBUTE(name) FlyString name;
ENUMERATE_SVG_ATTRIBUTES(__ENUMERATE_SVG_ATTRIBUTE)
#undef __ENUMERATE_SVG_ATTRIBUTE
@ -18,7 +18,7 @@ void initialize_strings()
VERIFY(!s_initialized);
#define __ENUMERATE_SVG_ATTRIBUTE(name) \
name = #name;
name = #name##_fly_string;
ENUMERATE_SVG_ATTRIBUTES(__ENUMERATE_SVG_ATTRIBUTE)
#undef __ENUMERATE_SVG_ATTRIBUTE

View File

@ -6,8 +6,8 @@
#pragma once
#include <AK/DeprecatedFlyString.h>
#include <AK/Error.h>
#include <AK/FlyString.h>
namespace Web::SVG::AttributeNames {
@ -96,7 +96,7 @@ namespace Web::SVG::AttributeNames {
E(yChannelSelector) \
E(zoomAndPan)
#define __ENUMERATE_SVG_ATTRIBUTE(name) extern DeprecatedFlyString name;
#define __ENUMERATE_SVG_ATTRIBUTE(name) extern FlyString name;
ENUMERATE_SVG_ATTRIBUTES(__ENUMERATE_SVG_ATTRIBUTE)
#undef __ENUMERATE_SVG_ATTRIBUTE

View File

@ -22,7 +22,7 @@ void SVGCircleElement::initialize(JS::Realm& realm)
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGCircleElementPrototype>(realm, "SVGCircleElement"));
}
void SVGCircleElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
void SVGCircleElement::attribute_changed(FlyString const& name, DeprecatedString const& value)
{
SVGGeometryElement::attribute_changed(name, value);

View File

@ -17,7 +17,7 @@ class SVGCircleElement final : public SVGGeometryElement {
public:
virtual ~SVGCircleElement() override = default;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(FlyString const& name, DeprecatedString const& value) override;
virtual Gfx::Path& get_path() override;

View File

@ -34,7 +34,7 @@ void SVGElement::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_dataset);
}
void SVGElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
void SVGElement::attribute_changed(FlyString const& name, DeprecatedString const& value)
{
Base::attribute_changed(name, value);

View File

@ -17,7 +17,7 @@ class SVGElement : public DOM::Element {
public:
virtual bool requires_svg_container() const override { return true; }
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(FlyString const& name, DeprecatedString const& value) override;
virtual void children_changed() override;
virtual void inserted() override;

View File

@ -22,7 +22,7 @@ void SVGEllipseElement::initialize(JS::Realm& realm)
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGEllipseElementPrototype>(realm, "SVGEllipseElement"));
}
void SVGEllipseElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
void SVGEllipseElement::attribute_changed(FlyString const& name, DeprecatedString const& value)
{
SVGGeometryElement::attribute_changed(name, value);

View File

@ -17,7 +17,7 @@ class SVGEllipseElement final : public SVGGeometryElement {
public:
virtual ~SVGEllipseElement() override = default;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(FlyString const& name, DeprecatedString const& value) override;
virtual Gfx::Path& get_path() override;

View File

@ -17,7 +17,7 @@ SVGGradientElement::SVGGradientElement(DOM::Document& document, DOM::QualifiedNa
{
}
void SVGGradientElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
void SVGGradientElement::attribute_changed(FlyString const& name, DeprecatedString const& value)
{
SVGElement::attribute_changed(name, value);
if (name == AttributeNames::gradientUnits) {

View File

@ -40,7 +40,7 @@ class SVGGradientElement : public SVGElement {
public:
virtual ~SVGGradientElement() override = default;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(FlyString const& name, DeprecatedString const& value) override;
virtual Optional<Gfx::PaintStyle const&> to_gfx_paint_style(SVGPaintContext const&) const = 0;

View File

@ -32,7 +32,7 @@ void SVGGraphicsElement::initialize(JS::Realm& realm)
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGGraphicsElementPrototype>(realm, "SVGGraphicsElement"));
}
void SVGGraphicsElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
void SVGGraphicsElement::attribute_changed(FlyString const& name, DeprecatedString const& value)
{
SVGElement::attribute_changed(name, value);
if (name == "transform"sv) {

View File

@ -25,7 +25,7 @@ class SVGGraphicsElement : public SVGElement {
public:
virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(FlyString const& name, DeprecatedString const& value) override;
Optional<Gfx::Color> fill_color() const;
Optional<FillRule> fill_rule() const;

View File

@ -22,7 +22,7 @@ void SVGLineElement::initialize(JS::Realm& realm)
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGLineElementPrototype>(realm, "SVGLineElement"));
}
void SVGLineElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
void SVGLineElement::attribute_changed(FlyString const& name, DeprecatedString const& value)
{
SVGGeometryElement::attribute_changed(name, value);

View File

@ -17,7 +17,7 @@ class SVGLineElement final : public SVGGeometryElement {
public:
virtual ~SVGLineElement() override = default;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(FlyString const& name, DeprecatedString const& value) override;
virtual Gfx::Path& get_path() override;

View File

@ -24,7 +24,7 @@ void SVGLinearGradientElement::initialize(JS::Realm& realm)
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGLinearGradientElementPrototype>(realm, "SVGLinearGradientElement"));
}
void SVGLinearGradientElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
void SVGLinearGradientElement::attribute_changed(FlyString const& name, DeprecatedString const& value)
{
SVGGradientElement::attribute_changed(name, value);

View File

@ -18,7 +18,7 @@ class SVGLinearGradientElement : public SVGGradientElement {
public:
virtual ~SVGLinearGradientElement() override = default;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(FlyString const& name, DeprecatedString const& value) override;
virtual Optional<Gfx::PaintStyle const&> to_gfx_paint_style(SVGPaintContext const&) const override;

View File

@ -31,7 +31,7 @@ JS::GCPtr<Layout::Node> SVGMaskElement::create_layout_node(NonnullRefPtr<CSS::St
return heap().allocate_without_realm<Layout::SVGGraphicsBox>(document(), *this, move(style));
}
void SVGMaskElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
void SVGMaskElement::attribute_changed(FlyString const& name, DeprecatedString const& value)
{
SVGGraphicsElement::attribute_changed(name, value);
if (name == AttributeNames::maskUnits) {

View File

@ -17,7 +17,7 @@ class SVGMaskElement final : public SVGGraphicsElement {
public:
virtual ~SVGMaskElement() override;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(FlyString const& name, DeprecatedString const& value) override;
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;

View File

@ -95,7 +95,7 @@ void SVGPathElement::initialize(JS::Realm& realm)
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGPathElementPrototype>(realm, "SVGPathElement"));
}
void SVGPathElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
void SVGPathElement::attribute_changed(FlyString const& name, DeprecatedString const& value)
{
SVGGeometryElement::attribute_changed(name, value);

View File

@ -19,7 +19,7 @@ class SVGPathElement final : public SVGGeometryElement {
public:
virtual ~SVGPathElement() override = default;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(FlyString const& name, DeprecatedString const& value) override;
virtual Gfx::Path& get_path() override;

View File

@ -22,7 +22,7 @@ void SVGPolygonElement::initialize(JS::Realm& realm)
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGPolygonElementPrototype>(realm, "SVGPolygonElement"));
}
void SVGPolygonElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
void SVGPolygonElement::attribute_changed(FlyString const& name, DeprecatedString const& value)
{
SVGGeometryElement::attribute_changed(name, value);

View File

@ -16,7 +16,7 @@ class SVGPolygonElement final : public SVGGeometryElement {
public:
virtual ~SVGPolygonElement() override = default;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(FlyString const& name, DeprecatedString const& value) override;
virtual Gfx::Path& get_path() override;

View File

@ -22,7 +22,7 @@ void SVGPolylineElement::initialize(JS::Realm& realm)
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGPolylineElementPrototype>(realm, "SVGPolylineElement"));
}
void SVGPolylineElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
void SVGPolylineElement::attribute_changed(FlyString const& name, DeprecatedString const& value)
{
SVGGeometryElement::attribute_changed(name, value);

View File

@ -16,7 +16,7 @@ class SVGPolylineElement final : public SVGGeometryElement {
public:
virtual ~SVGPolylineElement() override = default;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(FlyString const& name, DeprecatedString const& value) override;
virtual Gfx::Path& get_path() override;

View File

@ -21,7 +21,7 @@ void SVGRadialGradientElement::initialize(JS::Realm& realm)
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGRadialGradientElementPrototype>(realm, "SVGRadialGradientElement"));
}
void SVGRadialGradientElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
void SVGRadialGradientElement::attribute_changed(FlyString const& name, DeprecatedString const& value)
{
SVGGradientElement::attribute_changed(name, value);

View File

@ -18,7 +18,7 @@ class SVGRadialGradientElement : public SVGGradientElement {
public:
virtual ~SVGRadialGradientElement() override = default;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(FlyString const& name, DeprecatedString const& value) override;
virtual Optional<Gfx::PaintStyle const&> to_gfx_paint_style(SVGPaintContext const&) const override;

View File

@ -24,7 +24,7 @@ void SVGRectElement::initialize(JS::Realm& realm)
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGRectElementPrototype>(realm, "SVGRectElement"));
}
void SVGRectElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
void SVGRectElement::attribute_changed(FlyString const& name, DeprecatedString const& value)
{
SVGGeometryElement::attribute_changed(name, value);

View File

@ -17,7 +17,7 @@ class SVGRectElement final : public SVGGeometryElement {
public:
virtual ~SVGRectElement() override = default;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(FlyString const& name, DeprecatedString const& value) override;
virtual Gfx::Path& get_path() override;

View File

@ -61,7 +61,7 @@ void SVGSVGElement::apply_presentational_hints(CSS::StyleProperties& style) cons
}
}
void SVGSVGElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
void SVGSVGElement::attribute_changed(FlyString const& name, DeprecatedString const& value)
{
SVGGraphicsElement::attribute_changed(name, value);

View File

@ -36,7 +36,7 @@ private:
virtual bool is_svg_svg_element() const override { return true; }
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(FlyString const& name, DeprecatedString const& value) override;
void update_fallback_view_box_for_svg_as_image();

View File

@ -19,7 +19,7 @@ SVGStopElement::SVGStopElement(DOM::Document& document, DOM::QualifiedName quali
{
}
void SVGStopElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
void SVGStopElement::attribute_changed(FlyString const& name, DeprecatedString const& value)
{
SVGElement::attribute_changed(name, value);
if (name == SVG::AttributeNames::offset) {

View File

@ -19,7 +19,7 @@ class SVGStopElement final : public SVGElement {
public:
virtual ~SVGStopElement() override = default;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(FlyString const& name, DeprecatedString const& value) override;
JS::NonnullGCPtr<SVGAnimatedNumber> offset() const;

View File

@ -39,7 +39,7 @@ void SVGSymbolElement::apply_presentational_hints(CSS::StyleProperties& style) c
}
}
void SVGSymbolElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
void SVGSymbolElement::attribute_changed(FlyString const& name, DeprecatedString const& value)
{
if (name.equals_ignoring_ascii_case(SVG::AttributeNames::viewBox))
m_view_box = try_parse_view_box(value);

View File

@ -29,7 +29,7 @@ private:
bool is_direct_child_of_use_shadow_tree() const;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(FlyString const& name, DeprecatedString const& value) override;
Optional<ViewBox> m_view_box;
};

View File

@ -28,7 +28,7 @@ void SVGTextPositioningElement::initialize(JS::Realm& realm)
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGTextPositioningElementPrototype>(realm, "SVGTextPositioningElement"));
}
void SVGTextPositioningElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
void SVGTextPositioningElement::attribute_changed(FlyString const& name, DeprecatedString const& value)
{
SVGGraphicsElement::attribute_changed(name, value);

View File

@ -16,7 +16,7 @@ class SVGTextPositioningElement : public SVGTextContentElement {
WEB_PLATFORM_OBJECT(SVGTextPositioningElement, SVGTextContentElement);
public:
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(FlyString const& name, DeprecatedString const& value) override;
Gfx::FloatPoint get_offset() const;

View File

@ -45,7 +45,7 @@ void SVGUseElement::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_document_observer);
}
void SVGUseElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
void SVGUseElement::attribute_changed(FlyString const& name, DeprecatedString const& value)
{
Base::attribute_changed(name, value);

View File

@ -19,7 +19,7 @@ class SVGUseElement final : public SVGGraphicsElement {
public:
virtual ~SVGUseElement() override = default;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(FlyString const& name, DeprecatedString const& value) override;
virtual void inserted() override;

View File

@ -1064,18 +1064,16 @@ Messages::WebDriverClient::GetElementAttributeResponse WebDriverConnection::get_
// 4. Let result be the result of the first matching condition:
Optional<DeprecatedString> result;
auto deprecated_name = name.to_deprecated_string();
// -> If name is a boolean attribute
if (Web::HTML::is_boolean_attribute(deprecated_name)) {
if (Web::HTML::is_boolean_attribute(name)) {
// "true" (string) if the element has the attribute, otherwise null.
if (element->has_attribute(deprecated_name))
if (element->has_attribute(name))
result = "true"sv;
}
// -> Otherwise
else {
// The result of getting an attribute by name name.
result = element->deprecated_get_attribute(deprecated_name);
result = element->deprecated_get_attribute(name);
}
// 5. Return success with data result.