mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
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:
parent
c2988a7dd5
commit
d4f8b598cb
Notes:
github-actions[bot]
2024-11-14 18:19:35 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/d4f8b598cb6 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2337
83 changed files with 224 additions and 228 deletions
|
@ -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_)
|
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_);
|
attribute_changed(local_name, old_value, value, namespace_);
|
||||||
|
|
||||||
// AD-HOC: Run our own internal attribute change handler.
|
|
||||||
attribute_changed(local_name, old_value, value);
|
|
||||||
|
|
||||||
if (old_value != value) {
|
if (old_value != value) {
|
||||||
invalidate_style_after_attribute_change(local_name);
|
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)
|
static CSS::RequiredInvalidationAfterStyleChange compute_required_invalidation(CSS::StyleProperties const& old_style, CSS::StyleProperties const& new_style)
|
||||||
{
|
{
|
||||||
CSS::RequiredInvalidationAfterStyleChange invalidation;
|
CSS::RequiredInvalidationAfterStyleChange invalidation;
|
||||||
|
@ -2727,9 +2667,10 @@ Element::Directionality Element::parent_directionality() const
|
||||||
return Directionality::Ltr;
|
return Directionality::Ltr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://dom.spec.whatwg.org/#ref-for-concept-element-attributes-change-ext①
|
// https://dom.spec.whatwg.org/#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_)
|
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:
|
// 1. If localName is slot and namespace is null, then:
|
||||||
if (local_name == HTML::AttributeNames::slot && !namespace_.has_value()) {
|
if (local_name == HTML::AttributeNames::slot && !namespace_.has_value()) {
|
||||||
// 1. If value is oldValue, then return.
|
// 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.
|
// 7. Run assign a slot for element.
|
||||||
assign_a_slot(JS::NonnullGCPtr { *this });
|
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 = {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -173,11 +173,7 @@ public:
|
||||||
|
|
||||||
virtual void apply_presentational_hints(CSS::StyleProperties&) const { }
|
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_);
|
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();
|
CSS::RequiredInvalidationAfterStyleChange recompute_style();
|
||||||
|
|
||||||
|
@ -430,6 +426,9 @@ protected:
|
||||||
virtual void children_changed() override;
|
virtual void children_changed() override;
|
||||||
virtual i32 default_tab_index_value() const;
|
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 computed_css_values_changed() { }
|
||||||
|
|
||||||
virtual void visit_edges(Cell::Visitor&) override;
|
virtual void visit_edges(Cell::Visitor&) override;
|
||||||
|
|
|
@ -23,33 +23,33 @@ namespace Web::HTML {
|
||||||
// HTMLElement::inserted() -> Use form_associated_element_was_inserted()
|
// HTMLElement::inserted() -> Use form_associated_element_was_inserted()
|
||||||
// HTMLElement::removed_from() -> Use form_associated_element_was_removed()
|
// HTMLElement::removed_from() -> Use form_associated_element_was_removed()
|
||||||
//
|
//
|
||||||
#define FORM_ASSOCIATED_ELEMENT(ElementBaseClass, ElementClass) \
|
#define FORM_ASSOCIATED_ELEMENT(ElementBaseClass, ElementClass) \
|
||||||
private: \
|
private: \
|
||||||
virtual HTMLElement& form_associated_element_to_html_element() override \
|
virtual HTMLElement& form_associated_element_to_html_element() override \
|
||||||
{ \
|
{ \
|
||||||
static_assert(IsBaseOf<HTMLElement, ElementClass>); \
|
static_assert(IsBaseOf<HTMLElement, ElementClass>); \
|
||||||
return *this; \
|
return *this; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
virtual void inserted() override \
|
virtual void inserted() override \
|
||||||
{ \
|
{ \
|
||||||
ElementBaseClass::inserted(); \
|
ElementBaseClass::inserted(); \
|
||||||
form_node_was_inserted(); \
|
form_node_was_inserted(); \
|
||||||
form_associated_element_was_inserted(); \
|
form_associated_element_was_inserted(); \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
virtual void removed_from(DOM::Node* node) override \
|
virtual void removed_from(DOM::Node* node) override \
|
||||||
{ \
|
{ \
|
||||||
ElementBaseClass::removed_from(node); \
|
ElementBaseClass::removed_from(node); \
|
||||||
form_node_was_removed(); \
|
form_node_was_removed(); \
|
||||||
form_associated_element_was_removed(node); \
|
form_associated_element_was_removed(node); \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
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 \
|
||||||
{ \
|
{ \
|
||||||
ElementBaseClass::attribute_changed(name, old_value, value); \
|
ElementBaseClass::attribute_changed(name, old_value, value, namespace_); \
|
||||||
form_node_attribute_changed(name, value); \
|
form_node_attribute_changed(name, value); \
|
||||||
form_associated_element_attribute_changed(name, value); \
|
form_associated_element_attribute_changed(name, value); \
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#selection-direction
|
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#selection-direction
|
||||||
|
|
|
@ -40,9 +40,10 @@ void HTMLAnchorElement::visit_edges(Cell::Visitor& visitor)
|
||||||
visitor.visit(m_rel_list);
|
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) {
|
if (name == HTML::AttributeNames::href) {
|
||||||
set_the_url();
|
set_the_url();
|
||||||
} else if (name == HTML::AttributeNames::rel) {
|
} else if (name == HTML::AttributeNames::rel) {
|
||||||
|
|
|
@ -46,7 +46,7 @@ private:
|
||||||
virtual bool has_download_preference() const;
|
virtual bool has_download_preference() const;
|
||||||
|
|
||||||
// ^DOM::Element
|
// ^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;
|
virtual i32 default_tab_index_value() const override;
|
||||||
|
|
||||||
// ^HTML::HTMLHyperlinkElementUtils
|
// ^HTML::HTMLHyperlinkElementUtils
|
||||||
|
|
|
@ -33,9 +33,10 @@ void HTMLAreaElement::visit_edges(Cell::Visitor& visitor)
|
||||||
visitor.visit(m_rel_list);
|
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) {
|
if (name == HTML::AttributeNames::href) {
|
||||||
set_the_url();
|
set_the_url();
|
||||||
} else if (name == HTML::AttributeNames::rel) {
|
} else if (name == HTML::AttributeNames::rel) {
|
||||||
|
|
|
@ -29,7 +29,7 @@ private:
|
||||||
virtual void visit_edges(Cell::Visitor&) override;
|
virtual void visit_edges(Cell::Visitor&) override;
|
||||||
|
|
||||||
// ^DOM::Element
|
// ^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;
|
virtual i32 default_tab_index_value() const override;
|
||||||
|
|
||||||
// ^HTML::HTMLHyperlinkElementUtils
|
// ^HTML::HTMLHyperlinkElementUtils
|
||||||
|
|
|
@ -46,9 +46,9 @@ void HTMLBaseElement::removed_from(Node* parent)
|
||||||
document().update_base_element({});
|
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 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.
|
||||||
|
|
|
@ -24,7 +24,7 @@ public:
|
||||||
|
|
||||||
virtual void inserted() override;
|
virtual void inserted() override;
|
||||||
virtual void removed_from(Node*) 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:
|
private:
|
||||||
HTMLBaseElement(DOM::Document&, DOM::QualifiedName);
|
HTMLBaseElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
|
@ -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)) {
|
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.value_or(String {}));
|
auto color = parse_legacy_color_value(value.value_or(String {}));
|
||||||
|
|
|
@ -21,7 +21,7 @@ class HTMLBodyElement final
|
||||||
public:
|
public:
|
||||||
virtual ~HTMLBodyElement() override;
|
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;
|
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
|
||||||
|
|
|
@ -53,9 +53,9 @@ void HTMLDetailsElement::removed_from(DOM::Node*)
|
||||||
set_shadow_root(nullptr);
|
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
|
// https://html.spec.whatwg.org/multipage/interactive-elements.html#details-notification-task-steps
|
||||||
if (name == HTML::AttributeNames::open) {
|
if (name == HTML::AttributeNames::open) {
|
||||||
|
|
|
@ -34,7 +34,7 @@ private:
|
||||||
virtual void inserted() override;
|
virtual void inserted() 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;
|
||||||
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);
|
void queue_a_details_toggle_event_task(String old_state, String new_state);
|
||||||
|
|
||||||
|
|
|
@ -595,9 +595,10 @@ bool HTMLElement::cannot_navigate() const
|
||||||
return !is<HTML::HTMLAnchorElement>(this) && !is_connected();
|
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 (name == HTML::AttributeNames::contenteditable) {
|
||||||
if (!value.has_value()) {
|
if (!value.has_value()) {
|
||||||
|
@ -627,12 +628,6 @@ void HTMLElement::attribute_changed(FlyString const& name, Optional<String> cons
|
||||||
#undef __ENUMERATE
|
#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)
|
WebIDL::ExceptionOr<void> HTMLElement::cloned(Web::DOM::Node& copy, bool clone_children)
|
||||||
{
|
{
|
||||||
TRY(Base::cloned(copy, clone_children));
|
TRY(Base::cloned(copy, clone_children));
|
||||||
|
|
|
@ -81,8 +81,7 @@ protected:
|
||||||
|
|
||||||
virtual void initialize(JS::Realm&) override;
|
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_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
|
||||||
virtual void attribute_change_steps(FlyString const&, Optional<String> const&, Optional<String> const&, Optional<FlyString> const&) override;
|
|
||||||
virtual WebIDL::ExceptionOr<void> cloned(DOM::Node&, bool) override;
|
virtual WebIDL::ExceptionOr<void> cloned(DOM::Node&, bool) override;
|
||||||
virtual void inserted() override;
|
virtual void inserted() override;
|
||||||
|
|
||||||
|
|
|
@ -602,9 +602,10 @@ WebIDL::ExceptionOr<void> HTMLFormElement::set_action(String const& value)
|
||||||
return set_attribute(AttributeNames::action, 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 (name == HTML::AttributeNames::rel) {
|
||||||
if (m_rel_list)
|
if (m_rel_list)
|
||||||
m_rel_list->associated_attribute_changed(value.value_or(String {}));
|
m_rel_list->associated_attribute_changed(value.value_or(String {}));
|
||||||
|
|
|
@ -108,7 +108,7 @@ private:
|
||||||
virtual JS::Value named_item_value(FlyString const& name) const override;
|
virtual JS::Value named_item_value(FlyString const& name) const override;
|
||||||
virtual Vector<FlyString> supported_property_names() 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;
|
ErrorOr<String> pick_an_encoding() const;
|
||||||
|
|
||||||
|
|
|
@ -65,9 +65,9 @@ void HTMLFrameElement::removed_from(DOM::Node* node)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/obsolete.html#frames:frame-3
|
// 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
|
// 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.
|
// user agent must process the frame attributes.
|
||||||
|
|
|
@ -26,7 +26,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 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 i32 default_tab_index_value() const override;
|
||||||
virtual void adjust_computed_style(CSS::StyleProperties&) override;
|
virtual void adjust_computed_style(CSS::StyleProperties&) override;
|
||||||
|
|
||||||
|
|
|
@ -34,9 +34,9 @@ void HTMLFrameSetElement::initialize(JS::Realm& realm)
|
||||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLFrameSetElement);
|
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
|
#undef __ENUMERATE
|
||||||
#define __ENUMERATE(attribute_name, event_name) \
|
#define __ENUMERATE(attribute_name, event_name) \
|
||||||
|
|
|
@ -27,7 +27,7 @@ private:
|
||||||
virtual void adjust_computed_style(CSS::StyleProperties&) override;
|
virtual void adjust_computed_style(CSS::StyleProperties&) override;
|
||||||
|
|
||||||
virtual void initialize(JS::Realm&) 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
|
// ^HTML::GlobalEventHandlers
|
||||||
virtual JS::GCPtr<EventTarget> global_event_handlers_to_event_target(FlyString const& event_name) override;
|
virtual JS::GCPtr<EventTarget> global_event_handlers_to_event_target(FlyString const& event_name) override;
|
||||||
|
|
|
@ -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)));
|
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-2
|
||||||
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-iframe-element:process-the-iframe-attributes-3
|
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-iframe-element:process-the-iframe-attributes-3
|
||||||
|
|
|
@ -41,7 +41,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 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 i32 default_tab_index_value() const override;
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-iframe-element:dimension-attributes
|
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-iframe-element:dimension-attributes
|
||||||
|
|
|
@ -129,9 +129,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::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
|
// 4.6.7 Link types - https://html.spec.whatwg.org/multipage/links.html#linkTypes
|
||||||
if (name == HTML::AttributeNames::rel) {
|
if (name == HTML::AttributeNames::rel) {
|
||||||
|
|
|
@ -47,7 +47,7 @@ private:
|
||||||
HTMLLinkElement(DOM::Document&, DOM::QualifiedName);
|
HTMLLinkElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
||||||
virtual void initialize(JS::Realm&) 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;
|
||||||
|
|
||||||
// ^ResourceClient
|
// ^ResourceClient
|
||||||
virtual void resource_did_fail() override;
|
virtual void resource_did_fail() override;
|
||||||
|
|
|
@ -98,9 +98,9 @@ void HTMLMediaElement::visit_edges(Cell::Visitor& visitor)
|
||||||
visitor.visit(m_pending_play_promises);
|
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) {
|
if (name == HTML::AttributeNames::src) {
|
||||||
load_element().release_value_but_fixme_should_propagate_errors();
|
load_element().release_value_but_fixme_should_propagate_errors();
|
||||||
|
|
|
@ -140,7 +140,7 @@ protected:
|
||||||
virtual void finalize() override;
|
virtual void finalize() override;
|
||||||
virtual void visit_edges(Cell::Visitor&) 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 removed_from(DOM::Node*) override;
|
||||||
virtual void children_changed() override;
|
virtual void children_changed() override;
|
||||||
|
|
||||||
|
|
|
@ -34,9 +34,9 @@ void HTMLOptionElement::initialize(JS::Realm& realm)
|
||||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLOptionElement);
|
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 (name == HTML::AttributeNames::selected) {
|
||||||
if (!value.has_value()) {
|
if (!value.has_value()) {
|
||||||
|
|
|
@ -44,7 +44,7 @@ private:
|
||||||
|
|
||||||
virtual void initialize(JS::Realm&) override;
|
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();
|
void ask_for_a_reset();
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ void HTMLOrSVGElement<ElementBase>::blur()
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/#dom-noncedelement-nonce
|
// https://html.spec.whatwg.org/#dom-noncedelement-nonce
|
||||||
template<typename ElementBase>
|
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.
|
// 1. If element does not include HTMLOrSVGElement, then return.
|
||||||
// 2. If localName is not nonce or namespace is not null, then return.
|
// 2. If localName is not nonce or namespace is not null, then return.
|
||||||
|
|
|
@ -25,7 +25,7 @@ public:
|
||||||
void blur();
|
void blur();
|
||||||
|
|
||||||
protected:
|
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);
|
WebIDL::ExceptionOr<void> cloned(DOM::Node&, bool);
|
||||||
void inserted();
|
void inserted();
|
||||||
void visit_edges(JS::Cell::Visitor&);
|
void visit_edges(JS::Cell::Visitor&);
|
||||||
|
|
|
@ -50,9 +50,9 @@ void HTMLScriptElement::visit_edges(Cell::Visitor& visitor)
|
||||||
visitor.visit(m_preparation_time_document);
|
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) {
|
if (name == HTML::AttributeNames::crossorigin) {
|
||||||
m_crossorigin = cors_setting_attribute_from_keyword(value);
|
m_crossorigin = cors_setting_attribute_from_keyword(value);
|
||||||
|
|
|
@ -70,7 +70,7 @@ private:
|
||||||
virtual void initialize(JS::Realm&) override;
|
virtual void initialize(JS::Realm&) override;
|
||||||
virtual void visit_edges(Cell::Visitor&) 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
|
// https://html.spec.whatwg.org/multipage/scripting.html#prepare-the-script-element
|
||||||
void prepare_script();
|
void prepare_script();
|
||||||
|
|
|
@ -117,9 +117,9 @@ void HTMLSlotElement::assign(Vector<SlottableHandle> nodes)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://dom.spec.whatwg.org/#ref-for-concept-element-attributes-change-ext
|
// 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:
|
// 1. If element is a slot, localName is name, and namespace is null, then:
|
||||||
if (local_name == AttributeNames::name && !namespace_.has_value()) {
|
if (local_name == AttributeNames::name && !namespace_.has_value()) {
|
||||||
|
|
|
@ -45,7 +45,7 @@ private:
|
||||||
virtual void initialize(JS::Realm&) override;
|
virtual void initialize(JS::Realm&) override;
|
||||||
virtual void visit_edges(JS::Cell::Visitor&) 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
|
// https://html.spec.whatwg.org/multipage/scripting.html#manually-assigned-nodes
|
||||||
Vector<DOM::Slottable> m_manually_assigned_nodes;
|
Vector<DOM::Slottable> m_manually_assigned_nodes;
|
||||||
|
|
|
@ -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 (name == HTML::AttributeNames::cellpadding) {
|
||||||
if (value.has_value())
|
if (value.has_value())
|
||||||
m_padding = max(0, parse_integer(value.value()).value_or(0));
|
m_padding = max(0, parse_integer(value.value()).value_or(0));
|
||||||
|
|
|
@ -59,7 +59,7 @@ private:
|
||||||
virtual void visit_edges(Cell::Visitor&) override;
|
virtual void visit_edges(Cell::Visitor&) override;
|
||||||
|
|
||||||
virtual void apply_presentational_hints(CSS::StyleProperties&) const 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_rows;
|
||||||
JS::GCPtr<DOM::HTMLCollection> mutable m_t_bodies;
|
JS::GCPtr<DOM::HTMLCollection> mutable m_t_bodies;
|
||||||
|
|
|
@ -35,9 +35,9 @@ void HTMLTrackElement::visit_edges(Cell::Visitor& visitor)
|
||||||
visitor.visit(m_track);
|
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
|
// 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.
|
// As the kind, label, and srclang attributes are set, changed, or removed, the text track must update accordingly, as per the definitions above.
|
||||||
|
|
|
@ -30,7 +30,7 @@ private:
|
||||||
virtual void visit_edges(Cell::Visitor&) override;
|
virtual void visit_edges(Cell::Visitor&) override;
|
||||||
|
|
||||||
// ^DOM::Element
|
// ^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;
|
JS::GCPtr<TextTrack> m_track;
|
||||||
};
|
};
|
||||||
|
|
|
@ -54,9 +54,9 @@ void HTMLVideoElement::visit_edges(Cell::Visitor& visitor)
|
||||||
visitor.visit(m_fetch_controller);
|
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) {
|
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();
|
||||||
|
|
|
@ -55,7 +55,7 @@ private:
|
||||||
virtual void finalize() override;
|
virtual void finalize() override;
|
||||||
virtual void visit_edges(Cell::Visitor&) 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
|
// https://html.spec.whatwg.org/multipage/media.html#the-video-element:dimension-attributes
|
||||||
virtual bool supports_dimension_attributes() const override { return true; }
|
virtual bool supports_dimension_attributes() const override { return true; }
|
||||||
|
|
|
@ -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_);
|
Base::attribute_changed(local_name, old_value, value, namespace_);
|
||||||
HTMLOrSVGElement::attribute_change_steps(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)
|
WebIDL::ExceptionOr<void> MathMLElement::cloned(DOM::Node& node, bool clone_children)
|
||||||
|
|
|
@ -24,7 +24,7 @@ public:
|
||||||
virtual Optional<ARIA::Role> default_role() const override;
|
virtual Optional<ARIA::Role> default_role() const override;
|
||||||
|
|
||||||
protected:
|
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 WebIDL::ExceptionOr<void> cloned(DOM::Node&, bool) override;
|
||||||
virtual void inserted() override;
|
virtual void inserted() override;
|
||||||
virtual JS::GCPtr<DOM::EventTarget> global_event_handlers_to_event_target(FlyString const&) override { return *this; }
|
virtual JS::GCPtr<DOM::EventTarget> global_event_handlers_to_event_target(FlyString const&) override { return *this; }
|
||||||
|
|
|
@ -34,9 +34,10 @@ void SVGAElement::visit_edges(Cell::Visitor& visitor)
|
||||||
visitor.visit(m_rel_list);
|
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) {
|
if (name == SVG::AttributeNames::href) {
|
||||||
invalidate_style(DOM::StyleInvalidationReason::HTMLHyperlinkElementHrefChange);
|
invalidate_style(DOM::StyleInvalidationReason::HTMLHyperlinkElementHrefChange);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ private:
|
||||||
virtual void visit_edges(Cell::Visitor&) override;
|
virtual void visit_edges(Cell::Visitor&) override;
|
||||||
|
|
||||||
// ^DOM::Element
|
// ^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;
|
virtual i32 default_tab_index_value() const override;
|
||||||
|
|
||||||
JS::GCPtr<DOM::DOMTokenList> m_rel_list;
|
JS::GCPtr<DOM::DOMTokenList> m_rel_list;
|
||||||
|
|
|
@ -28,9 +28,10 @@ void SVGClipPathElement::initialize(JS::Realm& realm)
|
||||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGClipPathElement);
|
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)
|
if (name == AttributeNames::clipPathUnits)
|
||||||
m_clip_path_units = AttributeParser::parse_units(value.value_or(String {}));
|
m_clip_path_units = AttributeParser::parse_units(value.value_or(String {}));
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ public:
|
||||||
return PreserveAspectRatio { PreserveAspectRatio::Align::None, {} };
|
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
|
ClipPathUnits clip_path_units() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,19 +35,14 @@ void SVGElement::visit_edges(Cell::Visitor& visitor)
|
||||||
visitor.visit(m_class_name_animated_string);
|
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();
|
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)
|
WebIDL::ExceptionOr<void> SVGElement::cloned(DOM::Node& copy, bool clone_children)
|
||||||
{
|
{
|
||||||
TRY(Base::cloned(copy, clone_children));
|
TRY(Base::cloned(copy, clone_children));
|
||||||
|
|
|
@ -31,8 +31,7 @@ protected:
|
||||||
virtual void initialize(JS::Realm&) override;
|
virtual void initialize(JS::Realm&) override;
|
||||||
virtual void visit_edges(Cell::Visitor&) 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 attribute_change_steps(FlyString const&, Optional<String> const&, Optional<String> const&, Optional<FlyString> const&) override;
|
|
||||||
virtual WebIDL::ExceptionOr<void> cloned(DOM::Node&, bool) override;
|
virtual WebIDL::ExceptionOr<void> cloned(DOM::Node&, bool) override;
|
||||||
virtual void children_changed() override;
|
virtual void children_changed() override;
|
||||||
virtual void inserted() override;
|
virtual void inserted() override;
|
||||||
|
|
|
@ -26,9 +26,9 @@ void SVGEllipseElement::initialize(JS::Realm& realm)
|
||||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGEllipseElement);
|
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) {
|
if (name == SVG::AttributeNames::cx) {
|
||||||
m_center_x = AttributeParser::parse_coordinate(value.value_or(String {}));
|
m_center_x = AttributeParser::parse_coordinate(value.value_or(String {}));
|
||||||
|
|
|
@ -18,7 +18,7 @@ class SVGEllipseElement final : public SVGGeometryElement {
|
||||||
public:
|
public:
|
||||||
virtual ~SVGEllipseElement() override = default;
|
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;
|
virtual Gfx::Path get_path(CSSPixelSize viewport_size) override;
|
||||||
|
|
||||||
|
|
|
@ -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) {
|
if (name == AttributeNames::gradientUnits) {
|
||||||
m_gradient_units = AttributeParser::parse_units(value.value_or(String {}));
|
m_gradient_units = AttributeParser::parse_units(value.value_or(String {}));
|
||||||
} else if (name == AttributeNames::spreadMethod) {
|
} else if (name == AttributeNames::spreadMethod) {
|
||||||
|
|
|
@ -43,7 +43,7 @@ class SVGGradientElement
|
||||||
public:
|
public:
|
||||||
virtual ~SVGGradientElement() override = default;
|
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;
|
virtual Optional<Painting::PaintStyle> to_gfx_paint_style(SVGPaintContext const&) const = 0;
|
||||||
|
|
||||||
|
|
|
@ -37,9 +37,10 @@ void SVGGraphicsElement::initialize(JS::Realm& realm)
|
||||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGGraphicsElement);
|
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) {
|
if (name == "transform"sv) {
|
||||||
auto transform_list = AttributeParser::parse_transform(value.value_or(String {}));
|
auto transform_list = AttributeParser::parse_transform(value.value_or(String {}));
|
||||||
if (transform_list.has_value())
|
if (transform_list.has_value())
|
||||||
|
|
|
@ -32,7 +32,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 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> fill_color() const;
|
||||||
Optional<Gfx::Color> stroke_color() const;
|
Optional<Gfx::Color> stroke_color() const;
|
||||||
|
|
|
@ -42,9 +42,10 @@ void SVGImageElement::visit_edges(Cell::Visitor& visitor)
|
||||||
visitor.visit(m_resource_request);
|
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) {
|
if (name == SVG::AttributeNames::x) {
|
||||||
auto parsed_value = AttributeParser::parse_coordinate(value.value_or(String {}));
|
auto parsed_value = AttributeParser::parse_coordinate(value.value_or(String {}));
|
||||||
MUST(x()->base_val()->set_value(parsed_value.value_or(0)));
|
MUST(x()->base_val()->set_value(parsed_value.value_or(0)));
|
||||||
|
|
|
@ -20,7 +20,7 @@ class SVGImageElement
|
||||||
WEB_PLATFORM_OBJECT(SVGImageElement, SVGGraphicsElement);
|
WEB_PLATFORM_OBJECT(SVGImageElement, SVGGraphicsElement);
|
||||||
|
|
||||||
public:
|
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> x();
|
||||||
JS::NonnullGCPtr<SVG::SVGAnimatedLength> y();
|
JS::NonnullGCPtr<SVG::SVGAnimatedLength> y();
|
||||||
|
|
|
@ -26,9 +26,9 @@ void SVGLineElement::initialize(JS::Realm& realm)
|
||||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGLineElement);
|
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) {
|
if (name == SVG::AttributeNames::x1) {
|
||||||
m_x1 = AttributeParser::parse_number_percentage(value.value_or(String {}));
|
m_x1 = AttributeParser::parse_number_percentage(value.value_or(String {}));
|
||||||
|
|
|
@ -18,7 +18,7 @@ class SVGLineElement final : public SVGGeometryElement {
|
||||||
public:
|
public:
|
||||||
virtual ~SVGLineElement() override = default;
|
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;
|
virtual Gfx::Path get_path(CSSPixelSize viewport_size) override;
|
||||||
|
|
||||||
|
|
|
@ -28,9 +28,9 @@ void SVGLinearGradientElement::initialize(JS::Realm& realm)
|
||||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGLinearGradientElement);
|
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
|
// FIXME: Should allow for `<number-percentage> | <length>` for x1, x2, y1, y2
|
||||||
if (name == SVG::AttributeNames::x1) {
|
if (name == SVG::AttributeNames::x1) {
|
||||||
|
|
|
@ -19,7 +19,7 @@ class SVGLinearGradientElement : public SVGGradientElement {
|
||||||
public:
|
public:
|
||||||
virtual ~SVGLinearGradientElement() override = default;
|
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;
|
virtual Optional<Painting::PaintStyle> to_gfx_paint_style(SVGPaintContext const&) const override;
|
||||||
|
|
||||||
|
|
|
@ -33,9 +33,10 @@ JS::GCPtr<Layout::Node> SVGMaskElement::create_layout_node(CSS::StyleProperties)
|
||||||
return nullptr;
|
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) {
|
if (name == AttributeNames::maskUnits) {
|
||||||
m_mask_units = AttributeParser::parse_units(value.value_or(String {}));
|
m_mask_units = AttributeParser::parse_units(value.value_or(String {}));
|
||||||
} else if (name == AttributeNames::maskContentUnits) {
|
} else if (name == AttributeNames::maskContentUnits) {
|
||||||
|
|
|
@ -36,7 +36,7 @@ public:
|
||||||
return PreserveAspectRatio { PreserveAspectRatio::Align::None, {} };
|
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;
|
virtual JS::GCPtr<Layout::Node> create_layout_node(CSS::StyleProperties) override;
|
||||||
|
|
||||||
|
|
|
@ -97,9 +97,9 @@ void SVGPathElement::initialize(JS::Realm& realm)
|
||||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGPathElement);
|
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")
|
if (name == "d")
|
||||||
m_instructions = AttributeParser::parse_path_data(value.value_or(String {}));
|
m_instructions = AttributeParser::parse_path_data(value.value_or(String {}));
|
||||||
|
|
|
@ -20,7 +20,7 @@ class SVGPathElement final : public SVGGeometryElement {
|
||||||
public:
|
public:
|
||||||
virtual ~SVGPathElement() override = default;
|
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;
|
virtual Gfx::Path get_path(CSSPixelSize viewport_size) override;
|
||||||
|
|
||||||
|
|
|
@ -26,9 +26,9 @@ void SVGPolygonElement::initialize(JS::Realm& realm)
|
||||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGPolygonElement);
|
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)
|
if (name == SVG::AttributeNames::points)
|
||||||
m_points = AttributeParser::parse_points(value.value_or(String {}));
|
m_points = AttributeParser::parse_points(value.value_or(String {}));
|
||||||
|
|
|
@ -17,7 +17,7 @@ class SVGPolygonElement final : public SVGGeometryElement {
|
||||||
public:
|
public:
|
||||||
virtual ~SVGPolygonElement() override = default;
|
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;
|
virtual Gfx::Path get_path(CSSPixelSize viewport_size) override;
|
||||||
|
|
||||||
|
|
|
@ -26,9 +26,9 @@ void SVGPolylineElement::initialize(JS::Realm& realm)
|
||||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGPolylineElement);
|
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)
|
if (name == SVG::AttributeNames::points)
|
||||||
m_points = AttributeParser::parse_points(value.value_or(String {}));
|
m_points = AttributeParser::parse_points(value.value_or(String {}));
|
||||||
|
|
|
@ -17,7 +17,7 @@ class SVGPolylineElement final : public SVGGeometryElement {
|
||||||
public:
|
public:
|
||||||
virtual ~SVGPolylineElement() override = default;
|
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;
|
virtual Gfx::Path get_path(CSSPixelSize viewport_size) override;
|
||||||
|
|
||||||
|
|
|
@ -25,9 +25,9 @@ void SVGRadialGradientElement::initialize(JS::Realm& realm)
|
||||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGRadialGradientElement);
|
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
|
// FIXME: These are <length> or <coordinate> in the spec, but all examples seem to allow percentages
|
||||||
// and unitless values.
|
// and unitless values.
|
||||||
|
|
|
@ -19,7 +19,7 @@ class SVGRadialGradientElement : public SVGGradientElement {
|
||||||
public:
|
public:
|
||||||
virtual ~SVGRadialGradientElement() override = default;
|
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;
|
virtual Optional<Painting::PaintStyle> to_gfx_paint_style(SVGPaintContext const&) const override;
|
||||||
|
|
||||||
|
|
|
@ -28,9 +28,9 @@ void SVGRectElement::initialize(JS::Realm& realm)
|
||||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGRectElement);
|
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) {
|
if (name == SVG::AttributeNames::x) {
|
||||||
m_x = AttributeParser::parse_coordinate(value.value_or(String {}));
|
m_x = AttributeParser::parse_coordinate(value.value_or(String {}));
|
||||||
|
|
|
@ -18,7 +18,7 @@ class SVGRectElement final : public SVGGeometryElement {
|
||||||
public:
|
public:
|
||||||
virtual ~SVGRectElement() override = default;
|
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;
|
virtual Gfx::Path get_path(CSSPixelSize viewport_size) override;
|
||||||
|
|
||||||
|
|
|
@ -101,9 +101,9 @@ void SVGSVGElement::apply_presentational_hints(CSS::StyleProperties& style) cons
|
||||||
style.set_property(CSS::PropertyID::Height, height.release_nonnull());
|
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 (name.equals_ignoring_ascii_case(SVG::AttributeNames::viewBox)) {
|
||||||
if (!value.has_value()) {
|
if (!value.has_value()) {
|
||||||
|
|
|
@ -91,7 +91,7 @@ private:
|
||||||
|
|
||||||
virtual bool is_svg_svg_element() const override { return true; }
|
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();
|
void update_fallback_view_box_for_svg_as_image();
|
||||||
|
|
||||||
|
|
|
@ -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) {
|
if (name == SVG::AttributeNames::offset) {
|
||||||
m_offset = AttributeParser::parse_number_percentage(value.value_or(String {}));
|
m_offset = AttributeParser::parse_number_percentage(value.value_or(String {}));
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ class SVGStopElement final : public SVGElement {
|
||||||
public:
|
public:
|
||||||
virtual ~SVGStopElement() override = default;
|
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;
|
JS::NonnullGCPtr<SVGAnimatedNumber> offset() const;
|
||||||
|
|
||||||
|
|
|
@ -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)) {
|
if (name.equals_ignoring_ascii_case(SVG::AttributeNames::viewBox)) {
|
||||||
m_view_box = try_parse_view_box(value.value_or(String {}));
|
m_view_box = try_parse_view_box(value.value_or(String {}));
|
||||||
m_view_box_for_bindings->set_nulled(!m_view_box.has_value());
|
m_view_box_for_bindings->set_nulled(!m_view_box.has_value());
|
||||||
|
|
|
@ -40,7 +40,7 @@ private:
|
||||||
|
|
||||||
bool is_direct_child_of_use_shadow_tree() const;
|
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;
|
Optional<ViewBox> m_view_box;
|
||||||
|
|
||||||
|
|
|
@ -29,9 +29,9 @@ void SVGTextPositioningElement::initialize(JS::Realm& realm)
|
||||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGTextPositioningElement);
|
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) {
|
if (name == SVG::AttributeNames::x) {
|
||||||
m_x = AttributeParser::parse_number_percentage(value.value_or(String {}));
|
m_x = AttributeParser::parse_number_percentage(value.value_or(String {}));
|
||||||
|
|
|
@ -16,7 +16,7 @@ class SVGTextPositioningElement : public SVGTextContentElement {
|
||||||
WEB_PLATFORM_OBJECT(SVGTextPositioningElement, SVGTextContentElement);
|
WEB_PLATFORM_OBJECT(SVGTextPositioningElement, SVGTextContentElement);
|
||||||
|
|
||||||
public:
|
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;
|
Gfx::FloatPoint get_offset(CSSPixelSize const& viewport_size) const;
|
||||||
|
|
||||||
|
|
|
@ -55,9 +55,9 @@ void SVGUseElement::visit_edges(Cell::Visitor& visitor)
|
||||||
visitor.visit(m_resource_request);
|
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
|
// https://svgwg.org/svg2-draft/struct.html#UseLayout
|
||||||
if (name == SVG::AttributeNames::x) {
|
if (name == SVG::AttributeNames::x) {
|
||||||
|
|
|
@ -24,7 +24,7 @@ class SVGUseElement final
|
||||||
public:
|
public:
|
||||||
virtual ~SVGUseElement() override = default;
|
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;
|
virtual void inserted() override;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue