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

LibWeb: Rename DOM::Element::parse_attribute() => attribute_changed()

This is a first step towards merging attribute change and removal
notifications into a single function.
This commit is contained in:
Andreas Kling 2023-07-03 17:08:37 +02:00
parent e1e04884b9
commit 5a74486b59
65 changed files with 99 additions and 99 deletions

View file

@ -29,9 +29,9 @@ JS::ThrowCompletionOr<void> HTMLAnchorElement::initialize(JS::Realm& realm)
return {};
}
void HTMLAnchorElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLAnchorElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{
HTMLElement::parse_attribute(name, value);
HTMLElement::attribute_changed(name, value);
if (name == HTML::AttributeNames::href) {
set_the_url();
}

View file

@ -43,7 +43,7 @@ private:
void run_activation_behavior(Web::DOM::Event const&);
// ^DOM::Element
virtual void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual i32 default_tab_index_value() const override;
// ^HTML::HTMLHyperlinkElementUtils

View file

@ -25,9 +25,9 @@ JS::ThrowCompletionOr<void> HTMLAreaElement::initialize(JS::Realm& realm)
return {};
}
void HTMLAreaElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLAreaElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{
HTMLElement::parse_attribute(name, value);
HTMLElement::attribute_changed(name, value);
if (name == HTML::AttributeNames::href) {
set_the_url();
}

View file

@ -26,7 +26,7 @@ private:
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
// ^DOM::Element
virtual void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual i32 default_tab_index_value() const override;
// ^HTML::HTMLHyperlinkElementUtils

View file

@ -45,9 +45,9 @@ void HTMLBaseElement::removed_from(Node* parent)
document().update_base_element({});
}
void HTMLBaseElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLBaseElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{
HTMLElement::parse_attribute(name, value);
HTMLElement::attribute_changed(name, value);
// The frozen base URL must be immediately set for an element whenever any of the following situations occur:
// - The base element is the first base element in tree order with an href content attribute in its Document, and its href content attribute is changed.

View file

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

View file

@ -50,9 +50,9 @@ void HTMLBodyElement::apply_presentational_hints(CSS::StyleProperties& style) co
});
}
void HTMLBodyElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLBodyElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{
HTMLElement::parse_attribute(name, value);
HTMLElement::attribute_changed(name, value);
if (name.equals_ignoring_ascii_case("link"sv)) {
// https://html.spec.whatwg.org/multipage/rendering.html#the-page:rules-for-parsing-a-legacy-colour-value-3
auto color = parse_legacy_color_value(value);

View file

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

View file

@ -228,9 +228,9 @@ bool HTMLElement::cannot_navigate() const
return !is<HTML::HTMLAnchorElement>(this) && !is_connected();
}
void HTMLElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{
Element::parse_attribute(name, value);
Element::attribute_changed(name, value);
if (name == HTML::AttributeNames::contenteditable) {
if ((!value.is_null() && value.is_empty()) || value.equals_ignoring_ascii_case("true"sv)) {

View file

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

View file

@ -25,9 +25,9 @@ JS::ThrowCompletionOr<void> HTMLFrameSetElement::initialize(JS::Realm& realm)
return {};
}
void HTMLFrameSetElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLFrameSetElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{
HTMLElement::parse_attribute(name, value);
HTMLElement::attribute_changed(name, value);
#undef __ENUMERATE
#define __ENUMERATE(attribute_name, event_name) \

View file

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

View file

@ -34,9 +34,9 @@ JS::GCPtr<Layout::Node> HTMLIFrameElement::create_layout_node(NonnullRefPtr<CSS:
return heap().allocate_without_realm<Layout::FrameBox>(document(), *this, move(style));
}
void HTMLIFrameElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLIFrameElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{
HTMLElement::parse_attribute(name, value);
HTMLElement::attribute_changed(name, value);
if (name == HTML::AttributeNames::src)
load_src(value);
}

View file

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

@ -75,9 +75,9 @@ void HTMLImageElement::apply_presentational_hints(CSS::StyleProperties& style) c
});
}
void HTMLImageElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLImageElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{
HTMLElement::parse_attribute(name, value);
HTMLElement::attribute_changed(name, value);
if (name == HTML::AttributeNames::crossorigin) {
m_cors_setting = cors_setting_attribute_from_keyword(String::from_deprecated_string(value).release_value_but_fixme_should_propagate_errors());

View file

@ -28,7 +28,7 @@ class HTMLImageElement final
public:
virtual ~HTMLImageElement() override;
virtual void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void did_remove_attribute(DeprecatedFlyString const& name) override;
DeprecatedString alt() const { return attribute(HTML::AttributeNames::alt); }

View file

@ -493,9 +493,9 @@ void HTMLInputElement::did_lose_focus()
});
}
void HTMLInputElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLInputElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{
HTMLElement::parse_attribute(name, value);
HTMLElement::attribute_changed(name, value);
if (name == HTML::AttributeNames::checked) {
// When the checked content attribute is added, if the control does not have dirty checkedness,
// the user agent must set the checkedness of the element to true

View file

@ -104,7 +104,7 @@ public:
virtual bool is_focusable() const override { return m_type != TypeAttributeState::Hidden; }
// ^HTMLElement
virtual void parse_attribute(DeprecatedFlyString const&, DeprecatedString const&) override;
virtual void attribute_changed(DeprecatedFlyString const&, DeprecatedString const&) override;
virtual void did_remove_attribute(DeprecatedFlyString const&) override;
// ^FormAssociatedElement

View file

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

View file

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

View file

@ -84,9 +84,9 @@ void HTMLMediaElement::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_fetch_controller);
}
void HTMLMediaElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLMediaElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{
Base::parse_attribute(name, value);
Base::attribute_changed(name, value);
if (name == HTML::AttributeNames::src)
load_element().release_value_but_fixme_should_propagate_errors();

View file

@ -124,7 +124,7 @@ protected:
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
virtual void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void did_remove_attribute(DeprecatedFlyString const&) override;
virtual void removed_from(DOM::Node*) override;
virtual void children_changed() override;

View file

@ -41,9 +41,9 @@ JS::ThrowCompletionOr<void> HTMLObjectElement::initialize(JS::Realm& realm)
return {};
}
void HTMLObjectElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLObjectElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{
NavigableContainer::parse_attribute(name, value);
NavigableContainer::attribute_changed(name, value);
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-object-element
// Whenever one of the following conditions occur:

View file

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

View file

@ -33,9 +33,9 @@ JS::ThrowCompletionOr<void> HTMLOptionElement::initialize(JS::Realm& realm)
return {};
}
void HTMLOptionElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLOptionElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{
HTMLElement::parse_attribute(name, value);
HTMLElement::attribute_changed(name, value);
if (name == HTML::AttributeNames::selected) {
// Except where otherwise specified, when the element is created, its selectedness must be set to true

View file

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

View file

@ -47,9 +47,9 @@ void HTMLScriptElement::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_preparation_time_document.ptr());
}
void HTMLScriptElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLScriptElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{
Base::parse_attribute(name, value);
Base::attribute_changed(name, value);
if (name == HTML::AttributeNames::crossorigin)
m_crossorigin = cors_setting_attribute_from_keyword(String::from_deprecated_string(value).release_value_but_fixme_should_propagate_errors());

View file

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

View file

@ -42,9 +42,9 @@ void HTMLVideoElement::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_fetch_controller);
}
void HTMLVideoElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLVideoElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{
Base::parse_attribute(name, value);
Base::attribute_changed(name, value);
if (name == HTML::AttributeNames::poster)
determine_element_poster_frame(value).release_value_but_fixme_should_propagate_errors();

View file

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