1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 22:48:11 +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); attribute->set_value(value);
} }
parse_attribute(attribute->local_name(), value); attribute_changed(attribute->local_name(), value);
if (value != old_value) { if (value != old_value) {
invalidate_style_after_attribute_change(name); 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, "")); auto new_attribute = TRY(Attr::create(document(), insert_as_lowercase ? name.to_lowercase() : name, ""));
m_attributes->append_attribute(new_attribute); m_attributes->append_attribute(new_attribute);
parse_attribute(new_attribute->local_name(), ""); attribute_changed(new_attribute->local_name(), "");
invalidate_style_after_attribute_change(name); invalidate_style_after_attribute_change(name);
@ -361,7 +361,7 @@ CSS::CSSStyleDeclaration const* Element::inline_style() const
return m_inline_style.ptr(); 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_) { if (name == HTML::AttributeNames::class_) {
auto new_classes = value.split_view(Infra::is_ascii_whitespace); 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; } Vector<FlyString> const& class_names() const { return m_classes; }
virtual void apply_presentational_hints(CSS::StyleProperties&) const { } 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&); virtual void did_remove_attribute(DeprecatedFlyString const&);
struct [[nodiscard]] RequiredInvalidationAfterStyleChange { 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 // 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) 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. // 2. Let eventTarget be the result of determining the target of an event handler given element and localName.
// NOTE: element is `this`. // NOTE: element is `this`.

View file

@ -29,9 +29,9 @@ JS::ThrowCompletionOr<void> HTMLAnchorElement::initialize(JS::Realm& realm)
return {}; 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) { if (name == HTML::AttributeNames::href) {
set_the_url(); set_the_url();
} }

View file

@ -43,7 +43,7 @@ private:
void run_activation_behavior(Web::DOM::Event const&); void run_activation_behavior(Web::DOM::Event const&);
// ^DOM::Element // ^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; virtual i32 default_tab_index_value() const override;
// ^HTML::HTMLHyperlinkElementUtils // ^HTML::HTMLHyperlinkElementUtils

View file

@ -25,9 +25,9 @@ JS::ThrowCompletionOr<void> HTMLAreaElement::initialize(JS::Realm& realm)
return {}; 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) { if (name == HTML::AttributeNames::href) {
set_the_url(); set_the_url();
} }

View file

@ -26,7 +26,7 @@ private:
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
// ^DOM::Element // ^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; virtual i32 default_tab_index_value() const override;
// ^HTML::HTMLHyperlinkElementUtils // ^HTML::HTMLHyperlinkElementUtils

View file

@ -45,9 +45,9 @@ void HTMLBaseElement::removed_from(Node* parent)
document().update_base_element({}); 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 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. // - 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 inserted() override;
virtual void removed_from(Node*) 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: private:
HTMLBaseElement(DOM::Document&, DOM::QualifiedName); 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)) { 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 // 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); auto color = parse_legacy_color_value(value);

View file

@ -20,7 +20,7 @@ class HTMLBodyElement final
public: public:
virtual ~HTMLBodyElement() override; 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; virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
// https://www.w3.org/TR/html-aria/#el-body // 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(); 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 (name == HTML::AttributeNames::contenteditable) {
if ((!value.is_null() && value.is_empty()) || value.equals_ignoring_ascii_case("true"sv)) { 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 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 did_remove_attribute(DeprecatedFlyString const& name) override;
virtual void visit_edges(Cell::Visitor&) override; virtual void visit_edges(Cell::Visitor&) override;

View file

@ -25,9 +25,9 @@ JS::ThrowCompletionOr<void> HTMLFrameSetElement::initialize(JS::Realm& realm)
return {}; 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 #undef __ENUMERATE
#define __ENUMERATE(attribute_name, event_name) \ #define __ENUMERATE(attribute_name, event_name) \

View file

@ -24,7 +24,7 @@ private:
HTMLFrameSetElement(DOM::Document&, DOM::QualifiedName); HTMLFrameSetElement(DOM::Document&, DOM::QualifiedName);
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; 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 // ^HTML::GlobalEventHandlers
virtual EventTarget& global_event_handlers_to_event_target(FlyString const& event_name) override; 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)); 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) if (name == HTML::AttributeNames::src)
load_src(value); load_src(value);
} }

View file

@ -33,7 +33,7 @@ private:
// ^DOM::Element // ^DOM::Element
virtual void inserted() override; virtual void inserted() override;
virtual void removed_from(Node*) 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; virtual i32 default_tab_index_value() const override;
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#process-the-iframe-attributes // 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) { 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()); 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: public:
virtual ~HTMLImageElement() override; 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; virtual void did_remove_attribute(DeprecatedFlyString const& name) override;
DeprecatedString alt() const { return attribute(HTML::AttributeNames::alt); } 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) { if (name == HTML::AttributeNames::checked) {
// When the checked content attribute is added, if the control does not have dirty checkedness, // 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 // 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; } virtual bool is_focusable() const override { return m_type != TypeAttributeState::Hidden; }
// ^HTMLElement // ^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; virtual void did_remove_attribute(DeprecatedFlyString const&) override;
// ^FormAssociatedElement // ^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(); 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 // 4.6.7 Link types - https://html.spec.whatwg.org/multipage/links.html#linkTypes
if (name == HTML::AttributeNames::rel) { if (name == HTML::AttributeNames::rel) {

View file

@ -39,7 +39,7 @@ private:
HTMLLinkElement(DOM::Document&, DOM::QualifiedName); HTMLLinkElement(DOM::Document&, DOM::QualifiedName);
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; 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 // ^ResourceClient
virtual void resource_did_fail() override; virtual void resource_did_fail() override;

View file

@ -84,9 +84,9 @@ void HTMLMediaElement::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_fetch_controller); 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) if (name == HTML::AttributeNames::src)
load_element().release_value_but_fixme_should_propagate_errors(); 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 JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) 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 did_remove_attribute(DeprecatedFlyString const&) override;
virtual void removed_from(DOM::Node*) override; virtual void removed_from(DOM::Node*) override;
virtual void children_changed() override; virtual void children_changed() override;

View file

@ -41,9 +41,9 @@ JS::ThrowCompletionOr<void> HTMLObjectElement::initialize(JS::Realm& realm)
return {}; 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 // https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-object-element
// Whenever one of the following conditions occur: // Whenever one of the following conditions occur:

View file

@ -34,7 +34,7 @@ class HTMLObjectElement final
public: public:
virtual ~HTMLObjectElement() override; 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; DeprecatedString data() const;
void set_data(DeprecatedString const& data) { MUST(set_attribute(HTML::AttributeNames::data, data)); } 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 {}; 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) { if (name == HTML::AttributeNames::selected) {
// Except where otherwise specified, when the element is created, its selectedness must be set to true // 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; 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 did_remove_attribute(DeprecatedFlyString const& name) override;
void ask_for_a_reset(); 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()); 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) if (name == HTML::AttributeNames::crossorigin)
m_crossorigin = cors_setting_attribute_from_keyword(String::from_deprecated_string(value).release_value_but_fixme_should_propagate_errors()); 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 JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) 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 did_remove_attribute(DeprecatedFlyString const&) override;
// https://html.spec.whatwg.org/multipage/scripting.html#prepare-the-script-element // 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); 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) if (name == HTML::AttributeNames::poster)
determine_element_poster_frame(value).release_value_but_fixme_should_propagate_errors(); 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 JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) 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 did_remove_attribute(DeprecatedFlyString const&) override;
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override; virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;

View file

@ -24,9 +24,9 @@ JS::ThrowCompletionOr<void> SVGCircleElement::initialize(JS::Realm& realm)
return {}; return {};
} }
void SVGCircleElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) void SVGCircleElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{ {
SVGGeometryElement::parse_attribute(name, value); SVGGeometryElement::attribute_changed(name, value);
if (name == SVG::AttributeNames::cx) { if (name == SVG::AttributeNames::cx) {
m_center_x = AttributeParser::parse_coordinate(value); m_center_x = AttributeParser::parse_coordinate(value);

View file

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

View file

@ -37,9 +37,9 @@ void SVGElement::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_dataset); visitor.visit(m_dataset);
} }
void SVGElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) void SVGElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{ {
Base::parse_attribute(name, value); Base::attribute_changed(name, value);
update_use_elements_that_reference_this(); update_use_elements_that_reference_this();
} }

View file

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

View file

@ -24,9 +24,9 @@ JS::ThrowCompletionOr<void> SVGEllipseElement::initialize(JS::Realm& realm)
return {}; return {};
} }
void SVGEllipseElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) void SVGEllipseElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{ {
SVGGeometryElement::parse_attribute(name, value); SVGGeometryElement::attribute_changed(name, value);
if (name == SVG::AttributeNames::cx) { if (name == SVG::AttributeNames::cx) {
m_center_x = AttributeParser::parse_coordinate(value); m_center_x = AttributeParser::parse_coordinate(value);

View file

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

View file

@ -17,9 +17,9 @@ SVGGradientElement::SVGGradientElement(DOM::Document& document, DOM::QualifiedNa
{ {
} }
void SVGGradientElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) void SVGGradientElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{ {
SVGElement::parse_attribute(name, value); SVGElement::attribute_changed(name, value);
if (name == AttributeNames::gradientUnits) { if (name == AttributeNames::gradientUnits) {
m_gradient_units = AttributeParser::parse_gradient_units(value); m_gradient_units = AttributeParser::parse_gradient_units(value);
} else if (name == AttributeNames::gradientTransform) { } else if (name == AttributeNames::gradientTransform) {

View file

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

View file

@ -32,9 +32,9 @@ JS::ThrowCompletionOr<void> SVGGraphicsElement::initialize(JS::Realm& realm)
return {}; return {};
} }
void SVGGraphicsElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) void SVGGraphicsElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{ {
SVGElement::parse_attribute(name, value); SVGElement::attribute_changed(name, value);
if (name == "transform"sv) { if (name == "transform"sv) {
auto transform_list = AttributeParser::parse_transform(value); auto transform_list = AttributeParser::parse_transform(value);
if (transform_list.has_value()) if (transform_list.has_value())

View file

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

View file

@ -24,9 +24,9 @@ JS::ThrowCompletionOr<void> SVGLineElement::initialize(JS::Realm& realm)
return {}; return {};
} }
void SVGLineElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) void SVGLineElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{ {
SVGGeometryElement::parse_attribute(name, value); SVGGeometryElement::attribute_changed(name, value);
if (name == SVG::AttributeNames::x1) { if (name == SVG::AttributeNames::x1) {
m_x1 = AttributeParser::parse_coordinate(value); m_x1 = AttributeParser::parse_coordinate(value);

View file

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

View file

@ -26,9 +26,9 @@ JS::ThrowCompletionOr<void> SVGLinearGradientElement::initialize(JS::Realm& real
return {}; return {};
} }
void SVGLinearGradientElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) void SVGLinearGradientElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{ {
SVGGradientElement::parse_attribute(name, value); SVGGradientElement::attribute_changed(name, value);
// FIXME: Should allow for `<number-percentage> | <length>` for x1, x2, y1, y2 // FIXME: Should allow for `<number-percentage> | <length>` for x1, x2, y1, y2
if (name == SVG::AttributeNames::x1) { if (name == SVG::AttributeNames::x1) {

View file

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

View file

@ -97,9 +97,9 @@ JS::ThrowCompletionOr<void> SVGPathElement::initialize(JS::Realm& realm)
return {}; return {};
} }
void SVGPathElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) void SVGPathElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{ {
SVGGeometryElement::parse_attribute(name, value); SVGGeometryElement::attribute_changed(name, value);
if (name == "d") { if (name == "d") {
m_instructions = AttributeParser::parse_path_data(value); m_instructions = AttributeParser::parse_path_data(value);

View file

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

View file

@ -24,9 +24,9 @@ JS::ThrowCompletionOr<void> SVGPolygonElement::initialize(JS::Realm& realm)
return {}; return {};
} }
void SVGPolygonElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) void SVGPolygonElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{ {
SVGGeometryElement::parse_attribute(name, value); SVGGeometryElement::attribute_changed(name, value);
if (name == SVG::AttributeNames::points) { if (name == SVG::AttributeNames::points) {
m_points = AttributeParser::parse_points(value); m_points = AttributeParser::parse_points(value);

View file

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

View file

@ -24,9 +24,9 @@ JS::ThrowCompletionOr<void> SVGPolylineElement::initialize(JS::Realm& realm)
return {}; return {};
} }
void SVGPolylineElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) void SVGPolylineElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{ {
SVGGeometryElement::parse_attribute(name, value); SVGGeometryElement::attribute_changed(name, value);
if (name == SVG::AttributeNames::points) { if (name == SVG::AttributeNames::points) {
m_points = AttributeParser::parse_points(value); m_points = AttributeParser::parse_points(value);

View file

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

View file

@ -23,9 +23,9 @@ JS::ThrowCompletionOr<void> SVGRadialGradientElement::initialize(JS::Realm& real
return {}; return {};
} }
void SVGRadialGradientElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) void SVGRadialGradientElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{ {
SVGGradientElement::parse_attribute(name, value); SVGGradientElement::attribute_changed(name, value);
// FIXME: These are <length> or <coordinate> in the spec, but all examples seem to allow percentages // FIXME: These are <length> or <coordinate> in the spec, but all examples seem to allow percentages
// and unitless values. // and unitless values.

View file

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

View file

@ -26,9 +26,9 @@ JS::ThrowCompletionOr<void> SVGRectElement::initialize(JS::Realm& realm)
return {}; return {};
} }
void SVGRectElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) void SVGRectElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{ {
SVGGeometryElement::parse_attribute(name, value); SVGGeometryElement::attribute_changed(name, value);
if (name == SVG::AttributeNames::x) { if (name == SVG::AttributeNames::x) {
m_x = AttributeParser::parse_coordinate(value); m_x = AttributeParser::parse_coordinate(value);

View file

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

View file

@ -70,9 +70,9 @@ void SVGSVGElement::apply_presentational_hints(CSS::StyleProperties& style) cons
} }
} }
void SVGSVGElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) void SVGSVGElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{ {
SVGGraphicsElement::parse_attribute(name, value); SVGGraphicsElement::attribute_changed(name, value);
if (name.equals_ignoring_ascii_case(SVG::AttributeNames::viewBox)) if (name.equals_ignoring_ascii_case(SVG::AttributeNames::viewBox))
m_view_box = try_parse_view_box(value); m_view_box = try_parse_view_box(value);

View file

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

View file

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

View file

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

View file

@ -30,9 +30,9 @@ JS::ThrowCompletionOr<void> SVGTextContentElement::initialize(JS::Realm& realm)
return {}; return {};
} }
void SVGTextContentElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) void SVGTextContentElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{ {
SVGGraphicsElement::parse_attribute(name, value); SVGGraphicsElement::attribute_changed(name, value);
if (name == SVG::AttributeNames::x) { if (name == SVG::AttributeNames::x) {
m_x = AttributeParser::parse_coordinate(value).value_or(m_x); m_x = AttributeParser::parse_coordinate(value).value_or(m_x);

View file

@ -18,7 +18,7 @@ class SVGTextContentElement : public SVGGraphicsElement {
public: public:
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override; virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
virtual void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) override; virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
WebIDL::ExceptionOr<int> get_number_of_chars() const; WebIDL::ExceptionOr<int> get_number_of_chars() const;

View file

@ -46,9 +46,9 @@ void SVGUseElement::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_document_observer); visitor.visit(m_document_observer);
} }
void SVGUseElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) void SVGUseElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{ {
Base::parse_attribute(name, value); Base::attribute_changed(name, value);
// https://svgwg.org/svg2-draft/struct.html#UseLayout // https://svgwg.org/svg2-draft/struct.html#UseLayout
if (name == SVG::AttributeNames::x) { if (name == SVG::AttributeNames::x) {
@ -87,7 +87,7 @@ void SVGUseElement::svg_element_changed(SVGElement& svg_element)
return; return;
} }
// NOTE: We need to check the ancestor because parse_attribute of a child doesn't call children_changed on the parent(s) // NOTE: We need to check the ancestor because attribute_changed of a child doesn't call children_changed on the parent(s)
if (to_clone == &svg_element || to_clone->is_ancestor_of(svg_element)) { if (to_clone == &svg_element || to_clone->is_ancestor_of(svg_element)) {
clone_element_tree_as_our_shadow_tree(to_clone); clone_element_tree_as_our_shadow_tree(to_clone);
} }

View file

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