mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:57:45 +00:00
LibWeb: Port AttributeNames to FlyString
This commit is contained in:
parent
6a3f27509f
commit
e4f8c59210
93 changed files with 148 additions and 149 deletions
|
@ -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".
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {};
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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); }
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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)); }
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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 {};
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue