LibWeb: Consolidate the attribute change handlers

We currently have 2 virtual methods to inform DOM::Element subclasses
when an attribute has changed, one of which is spec-compliant. This
patch removes the non-compliant variant.
This commit is contained in:
Timothy Flynn 2024-11-14 08:14:16 -05:00 committed by Andreas Kling
parent c2988a7dd5
commit d4f8b598cb
Notes: github-actions[bot] 2024-11-14 18:19:35 +00:00
83 changed files with 224 additions and 228 deletions

View file

@ -444,10 +444,7 @@ JS::GCPtr<Layout::NodeWithStyle> Element::create_layout_node_for_display_type(DO
void Element::run_attribute_change_steps(FlyString const& local_name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
attribute_change_steps(local_name, old_value, value, namespace_);
// AD-HOC: Run our own internal attribute change handler.
attribute_changed(local_name, old_value, value);
attribute_changed(local_name, old_value, value, namespace_);
if (old_value != value) {
invalidate_style_after_attribute_change(local_name);
@ -455,63 +452,6 @@ void Element::run_attribute_change_steps(FlyString const& local_name, Optional<S
}
}
void Element::attribute_changed(FlyString const& name, Optional<String> const&, Optional<String> const& value)
{
auto value_or_empty = value.value_or(String {});
if (name == HTML::AttributeNames::id) {
if (value_or_empty.is_empty())
m_id = {};
else
m_id = value_or_empty;
document().element_id_changed({}, *this);
} else if (name == HTML::AttributeNames::name) {
if (value_or_empty.is_empty())
m_name = {};
else
m_name = value_or_empty;
document().element_name_changed({}, *this);
} else if (name == HTML::AttributeNames::class_) {
if (value_or_empty.is_empty()) {
m_classes.clear();
} else {
auto new_classes = value_or_empty.bytes_as_string_view().split_view_if(Infra::is_ascii_whitespace);
m_classes.clear();
m_classes.ensure_capacity(new_classes.size());
for (auto& new_class : new_classes) {
m_classes.unchecked_append(FlyString::from_utf8(new_class).release_value_but_fixme_should_propagate_errors());
}
}
if (m_class_list)
m_class_list->associated_attribute_changed(value_or_empty);
} else if (name == HTML::AttributeNames::style) {
if (!value.has_value()) {
if (m_inline_style) {
m_inline_style = nullptr;
set_needs_style_update(true);
}
} else {
// https://drafts.csswg.org/cssom/#ref-for-cssstyledeclaration-updating-flag
if (m_inline_style && m_inline_style->is_updating())
return;
m_inline_style = parse_css_style_attribute(CSS::Parser::ParsingContext(document()), *value, *this);
set_needs_style_update(true);
}
} else if (name == HTML::AttributeNames::dir) {
// https://html.spec.whatwg.org/multipage/dom.html#attr-dir
if (value_or_empty.equals_ignoring_ascii_case("ltr"sv))
m_dir = Dir::Ltr;
else if (value_or_empty.equals_ignoring_ascii_case("rtl"sv))
m_dir = Dir::Rtl;
else if (value_or_empty.equals_ignoring_ascii_case("auto"sv))
m_dir = Dir::Auto;
else
m_dir = {};
}
}
static CSS::RequiredInvalidationAfterStyleChange compute_required_invalidation(CSS::StyleProperties const& old_style, CSS::StyleProperties const& new_style)
{
CSS::RequiredInvalidationAfterStyleChange invalidation;
@ -2727,9 +2667,10 @@ Element::Directionality Element::parent_directionality() const
return Directionality::Ltr;
}
// https://dom.spec.whatwg.org/#ref-for-concept-element-attributes-change-ext
void Element::attribute_change_steps(FlyString const& local_name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
// https://dom.spec.whatwg.org/#concept-element-attributes-change-ext
void Element::attribute_changed(FlyString const& local_name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
// https://dom.spec.whatwg.org/#ref-for-concept-element-attributes-change-ext①
// 1. If localName is slot and namespace is null, then:
if (local_name == HTML::AttributeNames::slot && !namespace_.has_value()) {
// 1. If value is oldValue, then return.
@ -2757,6 +2698,61 @@ void Element::attribute_change_steps(FlyString const& local_name, Optional<Strin
// 7. Run assign a slot for element.
assign_a_slot(JS::NonnullGCPtr { *this });
return;
}
auto value_or_empty = value.value_or(String {});
if (local_name == HTML::AttributeNames::id) {
if (value_or_empty.is_empty())
m_id = {};
else
m_id = value_or_empty;
document().element_id_changed({}, *this);
} else if (local_name == HTML::AttributeNames::name) {
if (value_or_empty.is_empty())
m_name = {};
else
m_name = value_or_empty;
document().element_name_changed({}, *this);
} else if (local_name == HTML::AttributeNames::class_) {
if (value_or_empty.is_empty()) {
m_classes.clear();
} else {
auto new_classes = value_or_empty.bytes_as_string_view().split_view_if(Infra::is_ascii_whitespace);
m_classes.clear();
m_classes.ensure_capacity(new_classes.size());
for (auto& new_class : new_classes) {
m_classes.unchecked_append(FlyString::from_utf8(new_class).release_value_but_fixme_should_propagate_errors());
}
}
if (m_class_list)
m_class_list->associated_attribute_changed(value_or_empty);
} else if (local_name == HTML::AttributeNames::style) {
if (!value.has_value()) {
if (m_inline_style) {
m_inline_style = nullptr;
set_needs_style_update(true);
}
} else {
// https://drafts.csswg.org/cssom/#ref-for-cssstyledeclaration-updating-flag
if (m_inline_style && m_inline_style->is_updating())
return;
m_inline_style = parse_css_style_attribute(CSS::Parser::ParsingContext(document()), *value, *this);
set_needs_style_update(true);
}
} else if (local_name == HTML::AttributeNames::dir) {
// https://html.spec.whatwg.org/multipage/dom.html#attr-dir
if (value_or_empty.equals_ignoring_ascii_case("ltr"sv))
m_dir = Dir::Ltr;
else if (value_or_empty.equals_ignoring_ascii_case("rtl"sv))
m_dir = Dir::Rtl;
else if (value_or_empty.equals_ignoring_ascii_case("auto"sv))
m_dir = Dir::Auto;
else
m_dir = {};
}
}

View file

@ -173,11 +173,7 @@ public:
virtual void apply_presentational_hints(CSS::StyleProperties&) const { }
// https://dom.spec.whatwg.org/#concept-element-attributes-change-ext
virtual void attribute_change_steps(FlyString const& local_name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_);
void run_attribute_change_steps(FlyString const& local_name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_);
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value);
CSS::RequiredInvalidationAfterStyleChange recompute_style();
@ -430,6 +426,9 @@ protected:
virtual void children_changed() override;
virtual i32 default_tab_index_value() const;
// https://dom.spec.whatwg.org/#concept-element-attributes-change-ext
virtual void attribute_changed(FlyString const& local_name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_);
virtual void computed_css_values_changed() { }
virtual void visit_edges(Cell::Visitor&) override;

View file

@ -23,33 +23,33 @@ namespace Web::HTML {
// HTMLElement::inserted() -> Use form_associated_element_was_inserted()
// HTMLElement::removed_from() -> Use form_associated_element_was_removed()
//
#define FORM_ASSOCIATED_ELEMENT(ElementBaseClass, ElementClass) \
private: \
virtual HTMLElement& form_associated_element_to_html_element() override \
{ \
static_assert(IsBaseOf<HTMLElement, ElementClass>); \
return *this; \
} \
\
virtual void inserted() override \
{ \
ElementBaseClass::inserted(); \
form_node_was_inserted(); \
form_associated_element_was_inserted(); \
} \
\
virtual void removed_from(DOM::Node* node) override \
{ \
ElementBaseClass::removed_from(node); \
form_node_was_removed(); \
form_associated_element_was_removed(node); \
} \
\
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override \
{ \
ElementBaseClass::attribute_changed(name, old_value, value); \
form_node_attribute_changed(name, value); \
form_associated_element_attribute_changed(name, value); \
#define FORM_ASSOCIATED_ELEMENT(ElementBaseClass, ElementClass) \
private: \
virtual HTMLElement& form_associated_element_to_html_element() override \
{ \
static_assert(IsBaseOf<HTMLElement, ElementClass>); \
return *this; \
} \
\
virtual void inserted() override \
{ \
ElementBaseClass::inserted(); \
form_node_was_inserted(); \
form_associated_element_was_inserted(); \
} \
\
virtual void removed_from(DOM::Node* node) override \
{ \
ElementBaseClass::removed_from(node); \
form_node_was_removed(); \
form_associated_element_was_removed(node); \
} \
\
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override \
{ \
ElementBaseClass::attribute_changed(name, old_value, value, namespace_); \
form_node_attribute_changed(name, value); \
form_associated_element_attribute_changed(name, value); \
}
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#selection-direction

View file

@ -40,9 +40,10 @@ void HTMLAnchorElement::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_rel_list);
}
void HTMLAnchorElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
void HTMLAnchorElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
HTMLElement::attribute_changed(name, old_value, value);
Base::attribute_changed(name, old_value, value, namespace_);
if (name == HTML::AttributeNames::href) {
set_the_url();
} else if (name == HTML::AttributeNames::rel) {

View file

@ -46,7 +46,7 @@ private:
virtual bool has_download_preference() const;
// ^DOM::Element
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
virtual i32 default_tab_index_value() const override;
// ^HTML::HTMLHyperlinkElementUtils

View file

@ -33,9 +33,10 @@ void HTMLAreaElement::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_rel_list);
}
void HTMLAreaElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
void HTMLAreaElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
HTMLElement::attribute_changed(name, old_value, value);
Base::attribute_changed(name, old_value, value, namespace_);
if (name == HTML::AttributeNames::href) {
set_the_url();
} else if (name == HTML::AttributeNames::rel) {

View file

@ -29,7 +29,7 @@ private:
virtual void visit_edges(Cell::Visitor&) override;
// ^DOM::Element
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
virtual i32 default_tab_index_value() const override;
// ^HTML::HTMLHyperlinkElementUtils

View file

@ -46,9 +46,9 @@ void HTMLBaseElement::removed_from(Node* parent)
document().update_base_element({});
}
void HTMLBaseElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
void HTMLBaseElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
HTMLElement::attribute_changed(name, old_value, value);
Base::attribute_changed(name, old_value, value, namespace_);
// 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

@ -24,7 +24,7 @@ public:
virtual void inserted() override;
virtual void removed_from(Node*) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
private:
HTMLBaseElement(DOM::Document&, DOM::QualifiedName);

View file

@ -59,9 +59,10 @@ void HTMLBodyElement::apply_presentational_hints(CSS::StyleProperties& style) co
});
}
void HTMLBodyElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
void HTMLBodyElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
HTMLElement::attribute_changed(name, old_value, value);
Base::attribute_changed(name, old_value, value, namespace_);
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.value_or(String {}));

View file

@ -21,7 +21,7 @@ class HTMLBodyElement final
public:
virtual ~HTMLBodyElement() override;
virtual void attribute_changed(FlyString const&, Optional<String> const& old_value, Optional<String> const&) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
// https://www.w3.org/TR/html-aria/#el-body

View file

@ -53,9 +53,9 @@ void HTMLDetailsElement::removed_from(DOM::Node*)
set_shadow_root(nullptr);
}
void HTMLDetailsElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
void HTMLDetailsElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
Base::attribute_changed(name, old_value, value);
Base::attribute_changed(name, old_value, value, namespace_);
// https://html.spec.whatwg.org/multipage/interactive-elements.html#details-notification-task-steps
if (name == HTML::AttributeNames::open) {

View file

@ -34,7 +34,7 @@ private:
virtual void inserted() override;
virtual void removed_from(DOM::Node*) override;
virtual void children_changed() override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
void queue_a_details_toggle_event_task(String old_state, String new_state);

View file

@ -595,9 +595,10 @@ bool HTMLElement::cannot_navigate() const
return !is<HTML::HTMLAnchorElement>(this) && !is_connected();
}
void HTMLElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
void HTMLElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
Element::attribute_changed(name, old_value, value);
Base::attribute_changed(name, old_value, value, namespace_);
HTMLOrSVGElement::attribute_changed(name, old_value, value, namespace_);
if (name == HTML::AttributeNames::contenteditable) {
if (!value.has_value()) {
@ -627,12 +628,6 @@ void HTMLElement::attribute_changed(FlyString const& name, Optional<String> cons
#undef __ENUMERATE
}
void HTMLElement::attribute_change_steps(FlyString const& local_name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
Base::attribute_change_steps(local_name, old_value, value, namespace_);
HTMLOrSVGElement::attribute_change_steps(local_name, old_value, value, namespace_);
}
WebIDL::ExceptionOr<void> HTMLElement::cloned(Web::DOM::Node& copy, bool clone_children)
{
TRY(Base::cloned(copy, clone_children));

View file

@ -81,8 +81,7 @@ protected:
virtual void initialize(JS::Realm&) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual void attribute_change_steps(FlyString const&, Optional<String> const&, Optional<String> const&, Optional<FlyString> const&) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
virtual WebIDL::ExceptionOr<void> cloned(DOM::Node&, bool) override;
virtual void inserted() override;

View file

@ -602,9 +602,10 @@ WebIDL::ExceptionOr<void> HTMLFormElement::set_action(String const& value)
return set_attribute(AttributeNames::action, value);
}
void HTMLFormElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
void HTMLFormElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
HTMLElement::attribute_changed(name, old_value, value);
Base::attribute_changed(name, old_value, value, namespace_);
if (name == HTML::AttributeNames::rel) {
if (m_rel_list)
m_rel_list->associated_attribute_changed(value.value_or(String {}));

View file

@ -108,7 +108,7 @@ private:
virtual JS::Value named_item_value(FlyString const& name) const override;
virtual Vector<FlyString> supported_property_names() const override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
ErrorOr<String> pick_an_encoding() const;

View file

@ -65,9 +65,9 @@ void HTMLFrameElement::removed_from(DOM::Node* node)
}
// https://html.spec.whatwg.org/multipage/obsolete.html#frames:frame-3
void HTMLFrameElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
void HTMLFrameElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
Base::attribute_changed(name, old_value, value);
Base::attribute_changed(name, old_value, value, namespace_);
// Whenever a frame element with a non-null content navigable has its src attribute set, changed, or removed, the
// user agent must process the frame attributes.

View file

@ -26,7 +26,7 @@ private:
// ^DOM::Element
virtual void inserted() override;
virtual void removed_from(Node*) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
virtual i32 default_tab_index_value() const override;
virtual void adjust_computed_style(CSS::StyleProperties&) override;

View file

@ -34,9 +34,9 @@ void HTMLFrameSetElement::initialize(JS::Realm& realm)
WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLFrameSetElement);
}
void HTMLFrameSetElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
void HTMLFrameSetElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
HTMLElement::attribute_changed(name, old_value, value);
Base::attribute_changed(name, old_value, value, namespace_);
#undef __ENUMERATE
#define __ENUMERATE(attribute_name, event_name) \

View file

@ -27,7 +27,7 @@ private:
virtual void adjust_computed_style(CSS::StyleProperties&) override;
virtual void initialize(JS::Realm&) override;
virtual void attribute_changed(FlyString const&, Optional<String> const& old_value, Optional<String> const&) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
// ^HTML::GlobalEventHandlers
virtual JS::GCPtr<EventTarget> global_event_handlers_to_event_target(FlyString const& event_name) override;

View file

@ -45,9 +45,9 @@ void HTMLIFrameElement::adjust_computed_style(CSS::StyleProperties& style)
style.set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::None)));
}
void HTMLIFrameElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
void HTMLIFrameElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
HTMLElement::attribute_changed(name, old_value, value);
Base::attribute_changed(name, old_value, value, namespace_);
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-iframe-element:process-the-iframe-attributes-2
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-iframe-element:process-the-iframe-attributes-3

View file

@ -41,7 +41,7 @@ private:
// ^DOM::Element
virtual void inserted() override;
virtual void removed_from(Node*) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
virtual i32 default_tab_index_value() const override;
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-iframe-element:dimension-attributes

View file

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

View file

@ -47,7 +47,7 @@ private:
HTMLLinkElement(DOM::Document&, DOM::QualifiedName);
virtual void initialize(JS::Realm&) override;
virtual void attribute_changed(FlyString const&, Optional<String> const& old_value, Optional<String> const&) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
// ^ResourceClient
virtual void resource_did_fail() override;

View file

@ -98,9 +98,9 @@ void HTMLMediaElement::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_pending_play_promises);
}
void HTMLMediaElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
void HTMLMediaElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
Base::attribute_changed(name, old_value, value);
Base::attribute_changed(name, old_value, value, namespace_);
if (name == HTML::AttributeNames::src) {
load_element().release_value_but_fixme_should_propagate_errors();

View file

@ -140,7 +140,7 @@ protected:
virtual void finalize() override;
virtual void visit_edges(Cell::Visitor&) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
virtual void removed_from(DOM::Node*) override;
virtual void children_changed() override;

View file

@ -34,9 +34,9 @@ void HTMLOptionElement::initialize(JS::Realm& realm)
WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLOptionElement);
}
void HTMLOptionElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
void HTMLOptionElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
HTMLElement::attribute_changed(name, old_value, value);
Base::attribute_changed(name, old_value, value, namespace_);
if (name == HTML::AttributeNames::selected) {
if (!value.has_value()) {

View file

@ -44,7 +44,7 @@ private:
virtual void initialize(JS::Realm&) override;
void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
void ask_for_a_reset();

View file

@ -58,7 +58,7 @@ void HTMLOrSVGElement<ElementBase>::blur()
// https://html.spec.whatwg.org/#dom-noncedelement-nonce
template<typename ElementBase>
void HTMLOrSVGElement<ElementBase>::attribute_change_steps(FlyString const& local_name, Optional<String> const&, Optional<String> const& value, Optional<FlyString> const& namespace_)
void HTMLOrSVGElement<ElementBase>::attribute_changed(FlyString const& local_name, Optional<String> const&, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
// 1. If element does not include HTMLOrSVGElement, then return.
// 2. If localName is not nonce or namespace is not null, then return.

View file

@ -25,7 +25,7 @@ public:
void blur();
protected:
void attribute_change_steps(FlyString const&, Optional<String> const&, Optional<String> const&, Optional<FlyString> const&);
void attribute_changed(FlyString const&, Optional<String> const&, Optional<String> const&, Optional<FlyString> const&);
WebIDL::ExceptionOr<void> cloned(DOM::Node&, bool);
void inserted();
void visit_edges(JS::Cell::Visitor&);

View file

@ -50,9 +50,9 @@ void HTMLScriptElement::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_preparation_time_document);
}
void HTMLScriptElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
void HTMLScriptElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
Base::attribute_changed(name, old_value, value);
Base::attribute_changed(name, old_value, value, namespace_);
if (name == HTML::AttributeNames::crossorigin) {
m_crossorigin = cors_setting_attribute_from_keyword(value);

View file

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

View file

@ -117,9 +117,9 @@ void HTMLSlotElement::assign(Vector<SlottableHandle> nodes)
}
// https://dom.spec.whatwg.org/#ref-for-concept-element-attributes-change-ext
void HTMLSlotElement::attribute_change_steps(FlyString const& local_name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
void HTMLSlotElement::attribute_changed(FlyString const& local_name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
Base::attribute_change_steps(local_name, old_value, value, namespace_);
Base::attribute_changed(local_name, old_value, value, namespace_);
// 1. If element is a slot, localName is name, and namespace is null, then:
if (local_name == AttributeNames::name && !namespace_.has_value()) {

View file

@ -45,7 +45,7 @@ private:
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(JS::Cell::Visitor&) override;
virtual void attribute_change_steps(FlyString const& local_name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
// https://html.spec.whatwg.org/multipage/scripting.html#manually-assigned-nodes
Vector<DOM::Slottable> m_manually_assigned_nodes;

View file

@ -108,9 +108,10 @@ void HTMLTableElement::apply_presentational_hints(CSS::StyleProperties& style) c
});
}
void HTMLTableElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
void HTMLTableElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
Base::attribute_changed(name, old_value, value);
Base::attribute_changed(name, old_value, value, namespace_);
if (name == HTML::AttributeNames::cellpadding) {
if (value.has_value())
m_padding = max(0, parse_integer(value.value()).value_or(0));

View file

@ -59,7 +59,7 @@ private:
virtual void visit_edges(Cell::Visitor&) override;
virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
JS::GCPtr<DOM::HTMLCollection> mutable m_rows;
JS::GCPtr<DOM::HTMLCollection> mutable m_t_bodies;

View file

@ -35,9 +35,9 @@ void HTMLTrackElement::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_track);
}
void HTMLTrackElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
void HTMLTrackElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
HTMLElement::attribute_changed(name, old_value, value);
Base::attribute_changed(name, old_value, value, namespace_);
// https://html.spec.whatwg.org/multipage/media.html#sourcing-out-of-band-text-tracks
// As the kind, label, and srclang attributes are set, changed, or removed, the text track must update accordingly, as per the definitions above.

View file

@ -30,7 +30,7 @@ private:
virtual void visit_edges(Cell::Visitor&) override;
// ^DOM::Element
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
JS::GCPtr<TextTrack> m_track;
};

View file

@ -54,9 +54,9 @@ void HTMLVideoElement::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_fetch_controller);
}
void HTMLVideoElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
void HTMLVideoElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
Base::attribute_changed(name, old_value, value);
Base::attribute_changed(name, old_value, value, namespace_);
if (name == HTML::AttributeNames::poster) {
determine_element_poster_frame(value).release_value_but_fixme_should_propagate_errors();

View file

@ -55,7 +55,7 @@ private:
virtual void finalize() override;
virtual void visit_edges(Cell::Visitor&) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
// https://html.spec.whatwg.org/multipage/media.html#the-video-element:dimension-attributes
virtual bool supports_dimension_attributes() const override { return true; }

View file

@ -20,10 +20,10 @@ MathMLElement::MathMLElement(DOM::Document& document, DOM::QualifiedName qualifi
{
}
void MathMLElement::attribute_change_steps(FlyString const& local_name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
void MathMLElement::attribute_changed(FlyString const& local_name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
Base::attribute_change_steps(local_name, old_value, value, namespace_);
HTMLOrSVGElement::attribute_change_steps(local_name, old_value, value, namespace_);
Base::attribute_changed(local_name, old_value, value, namespace_);
HTMLOrSVGElement::attribute_changed(local_name, old_value, value, namespace_);
}
WebIDL::ExceptionOr<void> MathMLElement::cloned(DOM::Node& node, bool clone_children)

View file

@ -24,7 +24,7 @@ public:
virtual Optional<ARIA::Role> default_role() const override;
protected:
virtual void attribute_change_steps(FlyString const&, Optional<String> const&, Optional<String> const&, Optional<FlyString> const&) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
virtual WebIDL::ExceptionOr<void> cloned(DOM::Node&, bool) override;
virtual void inserted() override;
virtual JS::GCPtr<DOM::EventTarget> global_event_handlers_to_event_target(FlyString const&) override { return *this; }

View file

@ -34,9 +34,10 @@ void SVGAElement::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_rel_list);
}
void SVGAElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
void SVGAElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
Base::attribute_changed(name, old_value, value);
Base::attribute_changed(name, old_value, value, namespace_);
if (name == SVG::AttributeNames::href) {
invalidate_style(DOM::StyleInvalidationReason::HTMLHyperlinkElementHrefChange);
}

View file

@ -32,7 +32,7 @@ private:
virtual void visit_edges(Cell::Visitor&) override;
// ^DOM::Element
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
virtual i32 default_tab_index_value() const override;
JS::GCPtr<DOM::DOMTokenList> m_rel_list;

View file

@ -28,9 +28,10 @@ void SVGClipPathElement::initialize(JS::Realm& realm)
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGClipPathElement);
}
void SVGClipPathElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
void SVGClipPathElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
SVGElement::attribute_changed(name, old_value, value);
Base::attribute_changed(name, old_value, value, namespace_);
if (name == AttributeNames::clipPathUnits)
m_clip_path_units = AttributeParser::parse_units(value.value_or(String {}));
}

View file

@ -33,7 +33,7 @@ public:
return PreserveAspectRatio { PreserveAspectRatio::Align::None, {} };
}
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
ClipPathUnits clip_path_units() const
{

View file

@ -35,19 +35,14 @@ void SVGElement::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_class_name_animated_string);
}
void SVGElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
void SVGElement::attribute_changed(FlyString const& local_name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
Base::attribute_changed(name, old_value, value);
Base::attribute_changed(local_name, old_value, value, namespace_);
HTMLOrSVGElement::attribute_changed(local_name, old_value, value, namespace_);
update_use_elements_that_reference_this();
}
void SVGElement::attribute_change_steps(FlyString const& local_name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
Base::attribute_change_steps(local_name, old_value, value, namespace_);
HTMLOrSVGElement::attribute_change_steps(local_name, old_value, value, namespace_);
}
WebIDL::ExceptionOr<void> SVGElement::cloned(DOM::Node& copy, bool clone_children)
{
TRY(Base::cloned(copy, clone_children));

View file

@ -31,8 +31,7 @@ protected:
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual void attribute_change_steps(FlyString const&, Optional<String> const&, Optional<String> const&, Optional<FlyString> const&) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
virtual WebIDL::ExceptionOr<void> cloned(DOM::Node&, bool) override;
virtual void children_changed() override;
virtual void inserted() override;

View file

@ -26,9 +26,9 @@ void SVGEllipseElement::initialize(JS::Realm& realm)
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGEllipseElement);
}
void SVGEllipseElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
void SVGEllipseElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
SVGGeometryElement::attribute_changed(name, old_value, value);
Base::attribute_changed(name, old_value, value, namespace_);
if (name == SVG::AttributeNames::cx) {
m_center_x = AttributeParser::parse_coordinate(value.value_or(String {}));

View file

@ -18,7 +18,7 @@ class SVGEllipseElement final : public SVGGeometryElement {
public:
virtual ~SVGEllipseElement() override = default;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
virtual Gfx::Path get_path(CSSPixelSize viewport_size) override;

View file

@ -19,9 +19,10 @@ SVGGradientElement::SVGGradientElement(DOM::Document& document, DOM::QualifiedNa
{
}
void SVGGradientElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
void SVGGradientElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
SVGElement::attribute_changed(name, old_value, value);
Base::attribute_changed(name, old_value, value, namespace_);
if (name == AttributeNames::gradientUnits) {
m_gradient_units = AttributeParser::parse_units(value.value_or(String {}));
} else if (name == AttributeNames::spreadMethod) {

View file

@ -43,7 +43,7 @@ class SVGGradientElement
public:
virtual ~SVGGradientElement() override = default;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
virtual Optional<Painting::PaintStyle> to_gfx_paint_style(SVGPaintContext const&) const = 0;

View file

@ -37,9 +37,10 @@ void SVGGraphicsElement::initialize(JS::Realm& realm)
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGGraphicsElement);
}
void SVGGraphicsElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
void SVGGraphicsElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
SVGElement::attribute_changed(name, old_value, value);
Base::attribute_changed(name, old_value, value, namespace_);
if (name == "transform"sv) {
auto transform_list = AttributeParser::parse_transform(value.value_or(String {}));
if (transform_list.has_value())

View file

@ -32,7 +32,7 @@ class SVGGraphicsElement : public SVGElement {
public:
virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
Optional<Gfx::Color> fill_color() const;
Optional<Gfx::Color> stroke_color() const;

View file

@ -42,9 +42,10 @@ void SVGImageElement::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_resource_request);
}
void SVGImageElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
void SVGImageElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
SVGGraphicsElement::attribute_changed(name, old_value, value);
Base::attribute_changed(name, old_value, value, namespace_);
if (name == SVG::AttributeNames::x) {
auto parsed_value = AttributeParser::parse_coordinate(value.value_or(String {}));
MUST(x()->base_val()->set_value(parsed_value.value_or(0)));

View file

@ -20,7 +20,7 @@ class SVGImageElement
WEB_PLATFORM_OBJECT(SVGImageElement, SVGGraphicsElement);
public:
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
JS::NonnullGCPtr<SVG::SVGAnimatedLength> x();
JS::NonnullGCPtr<SVG::SVGAnimatedLength> y();

View file

@ -26,9 +26,9 @@ void SVGLineElement::initialize(JS::Realm& realm)
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGLineElement);
}
void SVGLineElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
void SVGLineElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
SVGGeometryElement::attribute_changed(name, old_value, value);
Base::attribute_changed(name, old_value, value, namespace_);
if (name == SVG::AttributeNames::x1) {
m_x1 = AttributeParser::parse_number_percentage(value.value_or(String {}));

View file

@ -18,7 +18,7 @@ class SVGLineElement final : public SVGGeometryElement {
public:
virtual ~SVGLineElement() override = default;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
virtual Gfx::Path get_path(CSSPixelSize viewport_size) override;

View file

@ -28,9 +28,9 @@ void SVGLinearGradientElement::initialize(JS::Realm& realm)
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGLinearGradientElement);
}
void SVGLinearGradientElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
void SVGLinearGradientElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
SVGGradientElement::attribute_changed(name, old_value, value);
Base::attribute_changed(name, old_value, value, namespace_);
// FIXME: Should allow for `<number-percentage> | <length>` for x1, x2, y1, y2
if (name == SVG::AttributeNames::x1) {

View file

@ -19,7 +19,7 @@ class SVGLinearGradientElement : public SVGGradientElement {
public:
virtual ~SVGLinearGradientElement() override = default;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
virtual Optional<Painting::PaintStyle> to_gfx_paint_style(SVGPaintContext const&) const override;

View file

@ -33,9 +33,10 @@ JS::GCPtr<Layout::Node> SVGMaskElement::create_layout_node(CSS::StyleProperties)
return nullptr;
}
void SVGMaskElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
void SVGMaskElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
SVGGraphicsElement::attribute_changed(name, old_value, value);
Base::attribute_changed(name, old_value, value, namespace_);
if (name == AttributeNames::maskUnits) {
m_mask_units = AttributeParser::parse_units(value.value_or(String {}));
} else if (name == AttributeNames::maskContentUnits) {

View file

@ -36,7 +36,7 @@ public:
return PreserveAspectRatio { PreserveAspectRatio::Align::None, {} };
}
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;

View file

@ -97,9 +97,9 @@ void SVGPathElement::initialize(JS::Realm& realm)
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGPathElement);
}
void SVGPathElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
void SVGPathElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
SVGGeometryElement::attribute_changed(name, old_value, value);
Base::attribute_changed(name, old_value, value, namespace_);
if (name == "d")
m_instructions = AttributeParser::parse_path_data(value.value_or(String {}));

View file

@ -20,7 +20,7 @@ class SVGPathElement final : public SVGGeometryElement {
public:
virtual ~SVGPathElement() override = default;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
virtual Gfx::Path get_path(CSSPixelSize viewport_size) override;

View file

@ -26,9 +26,9 @@ void SVGPolygonElement::initialize(JS::Realm& realm)
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGPolygonElement);
}
void SVGPolygonElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
void SVGPolygonElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
SVGGeometryElement::attribute_changed(name, old_value, value);
Base::attribute_changed(name, old_value, value, namespace_);
if (name == SVG::AttributeNames::points)
m_points = AttributeParser::parse_points(value.value_or(String {}));

View file

@ -17,7 +17,7 @@ class SVGPolygonElement final : public SVGGeometryElement {
public:
virtual ~SVGPolygonElement() override = default;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
virtual Gfx::Path get_path(CSSPixelSize viewport_size) override;

View file

@ -26,9 +26,9 @@ void SVGPolylineElement::initialize(JS::Realm& realm)
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGPolylineElement);
}
void SVGPolylineElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
void SVGPolylineElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
SVGGeometryElement::attribute_changed(name, old_value, value);
Base::attribute_changed(name, old_value, value, namespace_);
if (name == SVG::AttributeNames::points)
m_points = AttributeParser::parse_points(value.value_or(String {}));

View file

@ -17,7 +17,7 @@ class SVGPolylineElement final : public SVGGeometryElement {
public:
virtual ~SVGPolylineElement() override = default;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
virtual Gfx::Path get_path(CSSPixelSize viewport_size) override;

View file

@ -25,9 +25,9 @@ void SVGRadialGradientElement::initialize(JS::Realm& realm)
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGRadialGradientElement);
}
void SVGRadialGradientElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
void SVGRadialGradientElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
SVGGradientElement::attribute_changed(name, old_value, value);
Base::attribute_changed(name, old_value, value, namespace_);
// FIXME: These are <length> or <coordinate> in the spec, but all examples seem to allow percentages
// and unitless values.

View file

@ -19,7 +19,7 @@ class SVGRadialGradientElement : public SVGGradientElement {
public:
virtual ~SVGRadialGradientElement() override = default;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
virtual Optional<Painting::PaintStyle> to_gfx_paint_style(SVGPaintContext const&) const override;

View file

@ -28,9 +28,9 @@ void SVGRectElement::initialize(JS::Realm& realm)
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGRectElement);
}
void SVGRectElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
void SVGRectElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
SVGGeometryElement::attribute_changed(name, old_value, value);
Base::attribute_changed(name, old_value, value, namespace_);
if (name == SVG::AttributeNames::x) {
m_x = AttributeParser::parse_coordinate(value.value_or(String {}));

View file

@ -18,7 +18,7 @@ class SVGRectElement final : public SVGGeometryElement {
public:
virtual ~SVGRectElement() override = default;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
virtual Gfx::Path get_path(CSSPixelSize viewport_size) override;

View file

@ -101,9 +101,9 @@ void SVGSVGElement::apply_presentational_hints(CSS::StyleProperties& style) cons
style.set_property(CSS::PropertyID::Height, height.release_nonnull());
}
void SVGSVGElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
void SVGSVGElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
SVGGraphicsElement::attribute_changed(name, old_value, value);
Base::attribute_changed(name, old_value, value, namespace_);
if (name.equals_ignoring_ascii_case(SVG::AttributeNames::viewBox)) {
if (!value.has_value()) {

View file

@ -91,7 +91,7 @@ private:
virtual bool is_svg_svg_element() const override { return true; }
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
void update_fallback_view_box_for_svg_as_image();

View file

@ -21,9 +21,10 @@ SVGStopElement::SVGStopElement(DOM::Document& document, DOM::QualifiedName quali
{
}
void SVGStopElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
void SVGStopElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
SVGElement::attribute_changed(name, old_value, value);
Base::attribute_changed(name, old_value, value, namespace_);
if (name == SVG::AttributeNames::offset) {
m_offset = AttributeParser::parse_number_percentage(value.value_or(String {}));
}

View file

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

View file

@ -50,9 +50,10 @@ void SVGSymbolElement::apply_presentational_hints(CSS::StyleProperties& style) c
}
}
void SVGSymbolElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
void SVGSymbolElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
Base::attribute_changed(name, old_value, value);
Base::attribute_changed(name, old_value, value, namespace_);
if (name.equals_ignoring_ascii_case(SVG::AttributeNames::viewBox)) {
m_view_box = try_parse_view_box(value.value_or(String {}));
m_view_box_for_bindings->set_nulled(!m_view_box.has_value());

View file

@ -40,7 +40,7 @@ private:
bool is_direct_child_of_use_shadow_tree() const;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
Optional<ViewBox> m_view_box;

View file

@ -29,9 +29,9 @@ void SVGTextPositioningElement::initialize(JS::Realm& realm)
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGTextPositioningElement);
}
void SVGTextPositioningElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
void SVGTextPositioningElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
SVGGraphicsElement::attribute_changed(name, old_value, value);
Base::attribute_changed(name, old_value, value, namespace_);
if (name == SVG::AttributeNames::x) {
m_x = AttributeParser::parse_number_percentage(value.value_or(String {}));

View file

@ -16,7 +16,7 @@ class SVGTextPositioningElement : public SVGTextContentElement {
WEB_PLATFORM_OBJECT(SVGTextPositioningElement, SVGTextContentElement);
public:
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
Gfx::FloatPoint get_offset(CSSPixelSize const& viewport_size) const;

View file

@ -55,9 +55,9 @@ void SVGUseElement::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_resource_request);
}
void SVGUseElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
void SVGUseElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)
{
Base::attribute_changed(name, old_value, value);
Base::attribute_changed(name, old_value, value, namespace_);
// https://svgwg.org/svg2-draft/struct.html#UseLayout
if (name == SVG::AttributeNames::x) {

View file

@ -24,7 +24,7 @@ class SVGUseElement final
public:
virtual ~SVGUseElement() override = default;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
virtual void inserted() override;