1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 08:07:44 +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

@ -145,7 +145,7 @@ WebIDL::ExceptionOr<void> Element::set_attribute(DeprecatedFlyString const& name
attribute->set_value(value);
}
parse_attribute(attribute->local_name(), value);
attribute_changed(attribute->local_name(), value);
if (value != old_value) {
invalidate_style_after_attribute_change(name);
@ -261,7 +261,7 @@ WebIDL::ExceptionOr<bool> Element::toggle_attribute(DeprecatedFlyString const& n
auto new_attribute = TRY(Attr::create(document(), insert_as_lowercase ? name.to_lowercase() : name, ""));
m_attributes->append_attribute(new_attribute);
parse_attribute(new_attribute->local_name(), "");
attribute_changed(new_attribute->local_name(), "");
invalidate_style_after_attribute_change(name);
@ -361,7 +361,7 @@ CSS::CSSStyleDeclaration const* Element::inline_style() const
return m_inline_style.ptr();
}
void Element::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
void Element::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{
if (name == HTML::AttributeNames::class_) {
auto new_classes = value.split_view(Infra::is_ascii_whitespace);

View file

@ -121,7 +121,7 @@ public:
Vector<FlyString> const& class_names() const { return m_classes; }
virtual void apply_presentational_hints(CSS::StyleProperties&) const { }
virtual void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value);
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value);
virtual void did_remove_attribute(DeprecatedFlyString const&);
struct [[nodiscard]] RequiredInvalidationAfterStyleChange {

View file

@ -703,7 +703,7 @@ JS::ThrowCompletionOr<void> EventTarget::process_event_handler_for_event(FlyStri
// https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-attributes:concept-element-attributes-change-ext
void EventTarget::element_event_handler_attribute_changed(FlyString const& local_name, Optional<String> const& value)
{
// NOTE: Step 1 of this algorithm was handled in HTMLElement::parse_attribute.
// NOTE: Step 1 of this algorithm was handled in HTMLElement::attribute_changed.
// 2. Let eventTarget be the result of determining the target of an event handler given element and localName.
// NOTE: element is `this`.