mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
LibWeb: Pass the old attribute value to Element::attribute_changed()
This commit is contained in:
parent
190a419715
commit
a552bda8d9
Notes:
sideshowbarker
2024-07-17 18:13:59 +09:00
Author: https://github.com/tcl3 Commit: https://github.com/LadybirdBrowser/ladybird/commit/a552bda8d9 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/538
71 changed files with 132 additions and 132 deletions
|
@ -445,13 +445,13 @@ void Element::run_attribute_change_steps(FlyString const& local_name, Optional<S
|
|||
attribute_change_steps(local_name, old_value, value, namespace_);
|
||||
|
||||
// AD-HOC: Run our own internal attribute change handler.
|
||||
attribute_changed(local_name, value);
|
||||
attribute_changed(local_name, old_value, value);
|
||||
invalidate_style_after_attribute_change(local_name);
|
||||
|
||||
document().bump_dom_tree_version();
|
||||
}
|
||||
|
||||
void Element::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
void Element::attribute_changed(FlyString const& name, Optional<String> const&, Optional<String> const& value)
|
||||
{
|
||||
auto value_or_empty = value.value_or(String {});
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ public:
|
|||
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& value);
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value);
|
||||
|
||||
CSS::RequiredInvalidationAfterStyleChange recompute_style();
|
||||
|
||||
|
|
|
@ -19,33 +19,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& value) override \
|
||||
{ \
|
||||
ElementBaseClass::attribute_changed(name, 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) override \
|
||||
{ \
|
||||
ElementBaseClass::attribute_changed(name, old_value, value); \
|
||||
form_node_attribute_changed(name, value); \
|
||||
form_associated_element_attribute_changed(name, value); \
|
||||
}
|
||||
|
||||
class FormAssociatedElement {
|
||||
|
|
|
@ -40,9 +40,9 @@ void HTMLAnchorElement::visit_edges(Cell::Visitor& visitor)
|
|||
visitor.visit(m_rel_list);
|
||||
}
|
||||
|
||||
void HTMLAnchorElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
void HTMLAnchorElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
|
||||
{
|
||||
HTMLElement::attribute_changed(name, value);
|
||||
HTMLElement::attribute_changed(name, old_value, value);
|
||||
if (name == HTML::AttributeNames::href) {
|
||||
set_the_url();
|
||||
} else if (name == HTML::AttributeNames::rel) {
|
||||
|
|
|
@ -45,7 +45,7 @@ private:
|
|||
virtual void activation_behavior(Web::DOM::Event const&) override;
|
||||
|
||||
// ^DOM::Element
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
|
||||
virtual i32 default_tab_index_value() const override;
|
||||
|
||||
// ^HTML::HTMLHyperlinkElementUtils
|
||||
|
|
|
@ -33,9 +33,9 @@ void HTMLAreaElement::visit_edges(Cell::Visitor& visitor)
|
|||
visitor.visit(m_rel_list);
|
||||
}
|
||||
|
||||
void HTMLAreaElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
void HTMLAreaElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
|
||||
{
|
||||
HTMLElement::attribute_changed(name, value);
|
||||
HTMLElement::attribute_changed(name, old_value, value);
|
||||
if (name == HTML::AttributeNames::href) {
|
||||
set_the_url();
|
||||
} else if (name == HTML::AttributeNames::rel) {
|
||||
|
|
|
@ -29,7 +29,7 @@ private:
|
|||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
// ^DOM::Element
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
|
||||
virtual i32 default_tab_index_value() const override;
|
||||
|
||||
// ^HTML::HTMLHyperlinkElementUtils
|
||||
|
|
|
@ -46,9 +46,9 @@ void HTMLBaseElement::removed_from(Node* parent)
|
|||
document().update_base_element({});
|
||||
}
|
||||
|
||||
void HTMLBaseElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
void HTMLBaseElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
|
||||
{
|
||||
HTMLElement::attribute_changed(name, value);
|
||||
HTMLElement::attribute_changed(name, old_value, value);
|
||||
|
||||
// The frozen base URL must be immediately set for an element whenever any of the following situations occur:
|
||||
// - The base element is the first base element in tree order with an href content attribute in its Document, and its href content attribute is changed.
|
||||
|
|
|
@ -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& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
|
||||
|
||||
private:
|
||||
HTMLBaseElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
|
|
@ -59,9 +59,9 @@ void HTMLBodyElement::apply_presentational_hints(CSS::StyleProperties& style) co
|
|||
});
|
||||
}
|
||||
|
||||
void HTMLBodyElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
void HTMLBodyElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
|
||||
{
|
||||
HTMLElement::attribute_changed(name, value);
|
||||
HTMLElement::attribute_changed(name, old_value, value);
|
||||
if (name.equals_ignoring_ascii_case("link"sv)) {
|
||||
// https://html.spec.whatwg.org/multipage/rendering.html#the-page:rules-for-parsing-a-legacy-colour-value-3
|
||||
auto color = parse_legacy_color_value(value.value_or(String {}));
|
||||
|
|
|
@ -21,7 +21,7 @@ class HTMLBodyElement final
|
|||
public:
|
||||
virtual ~HTMLBodyElement() override;
|
||||
|
||||
virtual void attribute_changed(FlyString const&, Optional<String> const&) override;
|
||||
virtual void attribute_changed(FlyString const&, Optional<String> const& old_value, Optional<String> const&) override;
|
||||
virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
|
||||
|
||||
// https://www.w3.org/TR/html-aria/#el-body
|
||||
|
|
|
@ -53,9 +53,9 @@ void HTMLDetailsElement::removed_from(DOM::Node*)
|
|||
set_shadow_root(nullptr);
|
||||
}
|
||||
|
||||
void HTMLDetailsElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
void HTMLDetailsElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
|
||||
{
|
||||
Base::attribute_changed(name, value);
|
||||
Base::attribute_changed(name, old_value, value);
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/interactive-elements.html#details-notification-task-steps
|
||||
if (name == HTML::AttributeNames::open) {
|
||||
|
|
|
@ -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& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
|
||||
|
||||
void queue_a_details_toggle_event_task(String old_state, String new_state);
|
||||
|
||||
|
|
|
@ -358,9 +358,9 @@ bool HTMLElement::cannot_navigate() const
|
|||
return !is<HTML::HTMLAnchorElement>(this) && !is_connected();
|
||||
}
|
||||
|
||||
void HTMLElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
void HTMLElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
|
||||
{
|
||||
Element::attribute_changed(name, value);
|
||||
Element::attribute_changed(name, old_value, value);
|
||||
|
||||
if (name == HTML::AttributeNames::contenteditable) {
|
||||
if (!value.has_value()) {
|
||||
|
|
|
@ -85,7 +85,7 @@ protected:
|
|||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
|
||||
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
|
|
|
@ -622,9 +622,9 @@ 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& value)
|
||||
void HTMLFormElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
|
||||
{
|
||||
HTMLElement::attribute_changed(name, value);
|
||||
HTMLElement::attribute_changed(name, old_value, value);
|
||||
if (name == HTML::AttributeNames::rel) {
|
||||
if (m_rel_list)
|
||||
m_rel_list->associated_attribute_changed(value.value_or(String {}));
|
||||
|
|
|
@ -111,7 +111,7 @@ private:
|
|||
virtual Vector<FlyString> supported_property_names() const override;
|
||||
virtual bool is_supported_property_index(u32) const override;
|
||||
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
|
||||
|
||||
ErrorOr<String> pick_an_encoding() const;
|
||||
|
||||
|
|
|
@ -26,9 +26,9 @@ void HTMLFrameSetElement::initialize(JS::Realm& realm)
|
|||
WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLFrameSetElement);
|
||||
}
|
||||
|
||||
void HTMLFrameSetElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
void HTMLFrameSetElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
|
||||
{
|
||||
HTMLElement::attribute_changed(name, value);
|
||||
HTMLElement::attribute_changed(name, old_value, value);
|
||||
|
||||
#undef __ENUMERATE
|
||||
#define __ENUMERATE(attribute_name, event_name) \
|
||||
|
|
|
@ -25,7 +25,7 @@ private:
|
|||
HTMLFrameSetElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void attribute_changed(FlyString const&, Optional<String> const&) override;
|
||||
virtual void attribute_changed(FlyString const&, Optional<String> const& old_value, Optional<String> const&) override;
|
||||
|
||||
// ^HTML::GlobalEventHandlers
|
||||
virtual JS::GCPtr<EventTarget> global_event_handlers_to_event_target(FlyString const& event_name) override;
|
||||
|
|
|
@ -37,9 +37,9 @@ JS::GCPtr<Layout::Node> HTMLIFrameElement::create_layout_node(NonnullRefPtr<CSS:
|
|||
return heap().allocate_without_realm<Layout::FrameBox>(document(), *this, move(style));
|
||||
}
|
||||
|
||||
void HTMLIFrameElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
void HTMLIFrameElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
|
||||
{
|
||||
HTMLElement::attribute_changed(name, value);
|
||||
HTMLElement::attribute_changed(name, old_value, value);
|
||||
|
||||
// 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
|
||||
|
|
|
@ -40,7 +40,7 @@ private:
|
|||
// ^DOM::Element
|
||||
virtual void inserted() override;
|
||||
virtual void removed_from(Node*) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
|
||||
virtual i32 default_tab_index_value() const override;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-iframe-element:dimension-attributes
|
||||
|
|
|
@ -128,9 +128,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& value)
|
||||
void HTMLLinkElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
|
||||
{
|
||||
HTMLElement::attribute_changed(name, value);
|
||||
HTMLElement::attribute_changed(name, old_value, value);
|
||||
|
||||
// 4.6.7 Link types - https://html.spec.whatwg.org/multipage/links.html#linkTypes
|
||||
if (name == HTML::AttributeNames::rel) {
|
||||
|
|
|
@ -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&) override;
|
||||
virtual void attribute_changed(FlyString const&, Optional<String> const& old_value, Optional<String> const&) override;
|
||||
|
||||
// ^ResourceClient
|
||||
virtual void resource_did_fail() override;
|
||||
|
|
|
@ -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& value)
|
||||
void HTMLMediaElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
|
||||
{
|
||||
Base::attribute_changed(name, value);
|
||||
Base::attribute_changed(name, old_value, value);
|
||||
|
||||
if (name == HTML::AttributeNames::src) {
|
||||
load_element().release_value_but_fixme_should_propagate_errors();
|
||||
|
|
|
@ -139,7 +139,7 @@ protected:
|
|||
virtual void finalize() override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
|
||||
virtual void removed_from(DOM::Node*) override;
|
||||
virtual void children_changed() override;
|
||||
|
||||
|
|
|
@ -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& value)
|
||||
void HTMLOptionElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
|
||||
{
|
||||
HTMLElement::attribute_changed(name, value);
|
||||
HTMLElement::attribute_changed(name, old_value, value);
|
||||
|
||||
if (name == HTML::AttributeNames::selected) {
|
||||
if (!value.has_value()) {
|
||||
|
|
|
@ -43,7 +43,7 @@ private:
|
|||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
|
||||
void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
|
||||
|
||||
void ask_for_a_reset();
|
||||
|
||||
|
|
|
@ -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& value)
|
||||
void HTMLScriptElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
|
||||
{
|
||||
Base::attribute_changed(name, value);
|
||||
Base::attribute_changed(name, old_value, value);
|
||||
|
||||
if (name == HTML::AttributeNames::crossorigin) {
|
||||
m_crossorigin = cors_setting_attribute_from_keyword(value);
|
||||
|
|
|
@ -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& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/scripting.html#prepare-the-script-element
|
||||
void prepare_script();
|
||||
|
|
|
@ -102,9 +102,9 @@ void HTMLTableElement::apply_presentational_hints(CSS::StyleProperties& style) c
|
|||
});
|
||||
}
|
||||
|
||||
void HTMLTableElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
void HTMLTableElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
|
||||
{
|
||||
Base::attribute_changed(name, value);
|
||||
Base::attribute_changed(name, old_value, value);
|
||||
if (name == HTML::AttributeNames::cellpadding) {
|
||||
if (value.has_value())
|
||||
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 apply_presentational_hints(CSS::StyleProperties&) const override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
|
||||
|
||||
JS::GCPtr<DOM::HTMLCollection> mutable m_rows;
|
||||
JS::GCPtr<DOM::HTMLCollection> mutable m_t_bodies;
|
||||
|
|
|
@ -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& value)
|
||||
void HTMLTrackElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
|
||||
{
|
||||
HTMLElement::attribute_changed(name, value);
|
||||
HTMLElement::attribute_changed(name, old_value, value);
|
||||
|
||||
// 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.
|
||||
|
|
|
@ -28,7 +28,7 @@ private:
|
|||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
// ^DOM::Element
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
|
||||
|
||||
JS::GCPtr<TextTrack> m_track;
|
||||
};
|
||||
|
|
|
@ -53,9 +53,9 @@ void HTMLVideoElement::visit_edges(Cell::Visitor& visitor)
|
|||
visitor.visit(m_fetch_controller);
|
||||
}
|
||||
|
||||
void HTMLVideoElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
void HTMLVideoElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
|
||||
{
|
||||
Base::attribute_changed(name, value);
|
||||
Base::attribute_changed(name, old_value, value);
|
||||
|
||||
if (name == HTML::AttributeNames::poster) {
|
||||
determine_element_poster_frame(value).release_value_but_fixme_should_propagate_errors();
|
||||
|
|
|
@ -49,7 +49,7 @@ private:
|
|||
virtual void finalize() override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/media.html#the-video-element:dimension-attributes
|
||||
virtual bool supports_dimension_attributes() const override { return true; }
|
||||
|
|
|
@ -28,9 +28,9 @@ void SVGClipPathElement::initialize(JS::Realm& realm)
|
|||
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGClipPathElement);
|
||||
}
|
||||
|
||||
void SVGClipPathElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
void SVGClipPathElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
|
||||
{
|
||||
SVGElement::attribute_changed(name, value);
|
||||
SVGElement::attribute_changed(name, old_value, value);
|
||||
if (name == AttributeNames::clipPathUnits)
|
||||
m_clip_path_units = AttributeParser::parse_units(value.value_or(String {}));
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
return PreserveAspectRatio { PreserveAspectRatio::Align::None, {} };
|
||||
}
|
||||
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
|
||||
|
||||
ClipPathUnits clip_path_units() const
|
||||
{
|
||||
|
|
|
@ -41,9 +41,9 @@ JS::NonnullGCPtr<HTML::DOMStringMap> SVGElement::dataset()
|
|||
return *m_dataset;
|
||||
}
|
||||
|
||||
void SVGElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
void SVGElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
|
||||
{
|
||||
Base::attribute_changed(name, value);
|
||||
Base::attribute_changed(name, old_value, value);
|
||||
|
||||
update_use_elements_that_reference_this();
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ class SVGElement : public DOM::Element {
|
|||
public:
|
||||
virtual bool requires_svg_container() const override { return true; }
|
||||
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
|
||||
|
||||
virtual void children_changed() override;
|
||||
virtual void inserted() override;
|
||||
|
|
|
@ -25,9 +25,9 @@ void SVGEllipseElement::initialize(JS::Realm& realm)
|
|||
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGEllipseElement);
|
||||
}
|
||||
|
||||
void SVGEllipseElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
void SVGEllipseElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
|
||||
{
|
||||
SVGGeometryElement::attribute_changed(name, value);
|
||||
SVGGeometryElement::attribute_changed(name, old_value, value);
|
||||
|
||||
if (name == SVG::AttributeNames::cx) {
|
||||
m_center_x = AttributeParser::parse_coordinate(value.value_or(String {}));
|
||||
|
|
|
@ -18,7 +18,7 @@ class SVGEllipseElement final : public SVGGeometryElement {
|
|||
public:
|
||||
virtual ~SVGEllipseElement() override = default;
|
||||
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
|
||||
|
||||
virtual Gfx::Path get_path(CSSPixelSize viewport_size) override;
|
||||
|
||||
|
|
|
@ -19,9 +19,9 @@ SVGGradientElement::SVGGradientElement(DOM::Document& document, DOM::QualifiedNa
|
|||
{
|
||||
}
|
||||
|
||||
void SVGGradientElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
void SVGGradientElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
|
||||
{
|
||||
SVGElement::attribute_changed(name, value);
|
||||
SVGElement::attribute_changed(name, old_value, value);
|
||||
if (name == AttributeNames::gradientUnits) {
|
||||
m_gradient_units = AttributeParser::parse_units(value.value_or(String {}));
|
||||
} else if (name == AttributeNames::spreadMethod) {
|
||||
|
|
|
@ -41,7 +41,7 @@ class SVGGradientElement : public SVGElement {
|
|||
public:
|
||||
virtual ~SVGGradientElement() override = default;
|
||||
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
|
||||
|
||||
virtual Optional<Painting::PaintStyle> to_gfx_paint_style(SVGPaintContext const&) const = 0;
|
||||
|
||||
|
|
|
@ -37,9 +37,9 @@ void SVGGraphicsElement::initialize(JS::Realm& realm)
|
|||
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGGraphicsElement);
|
||||
}
|
||||
|
||||
void SVGGraphicsElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
void SVGGraphicsElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
|
||||
{
|
||||
SVGElement::attribute_changed(name, value);
|
||||
SVGElement::attribute_changed(name, old_value, value);
|
||||
if (name == "transform"sv) {
|
||||
auto transform_list = AttributeParser::parse_transform(value.value_or(String {}));
|
||||
if (transform_list.has_value())
|
||||
|
|
|
@ -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& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
|
||||
|
||||
Optional<Gfx::Color> fill_color() const;
|
||||
Optional<Gfx::Color> stroke_color() const;
|
||||
|
|
|
@ -25,9 +25,9 @@ void SVGLineElement::initialize(JS::Realm& realm)
|
|||
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGLineElement);
|
||||
}
|
||||
|
||||
void SVGLineElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
void SVGLineElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
|
||||
{
|
||||
SVGGeometryElement::attribute_changed(name, value);
|
||||
SVGGeometryElement::attribute_changed(name, old_value, value);
|
||||
|
||||
if (name == SVG::AttributeNames::x1) {
|
||||
m_x1 = AttributeParser::parse_coordinate(value.value_or(String {}));
|
||||
|
|
|
@ -18,7 +18,7 @@ class SVGLineElement final : public SVGGeometryElement {
|
|||
public:
|
||||
virtual ~SVGLineElement() override = default;
|
||||
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) 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);
|
||||
}
|
||||
|
||||
void SVGLinearGradientElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
void SVGLinearGradientElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
|
||||
{
|
||||
SVGGradientElement::attribute_changed(name, value);
|
||||
SVGGradientElement::attribute_changed(name, old_value, value);
|
||||
|
||||
// FIXME: Should allow for `<number-percentage> | <length>` for x1, x2, y1, y2
|
||||
if (name == SVG::AttributeNames::x1) {
|
||||
|
|
|
@ -19,7 +19,7 @@ class SVGLinearGradientElement : public SVGGradientElement {
|
|||
public:
|
||||
virtual ~SVGLinearGradientElement() override = default;
|
||||
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
|
||||
|
||||
virtual Optional<Painting::PaintStyle> to_gfx_paint_style(SVGPaintContext const&) const override;
|
||||
|
||||
|
|
|
@ -33,9 +33,9 @@ JS::GCPtr<Layout::Node> SVGMaskElement::create_layout_node(NonnullRefPtr<CSS::St
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void SVGMaskElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
void SVGMaskElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
|
||||
{
|
||||
SVGGraphicsElement::attribute_changed(name, value);
|
||||
SVGGraphicsElement::attribute_changed(name, old_value, value);
|
||||
if (name == AttributeNames::maskUnits) {
|
||||
m_mask_units = AttributeParser::parse_units(value.value_or(String {}));
|
||||
} else if (name == AttributeNames::maskContentUnits) {
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
return PreserveAspectRatio { PreserveAspectRatio::Align::None, {} };
|
||||
}
|
||||
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
|
||||
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
|
||||
|
|
|
@ -96,9 +96,9 @@ void SVGPathElement::initialize(JS::Realm& realm)
|
|||
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGPathElement);
|
||||
}
|
||||
|
||||
void SVGPathElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
void SVGPathElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
|
||||
{
|
||||
SVGGeometryElement::attribute_changed(name, value);
|
||||
SVGGeometryElement::attribute_changed(name, old_value, value);
|
||||
|
||||
if (name == "d")
|
||||
m_instructions = AttributeParser::parse_path_data(value.value_or(String {}));
|
||||
|
|
|
@ -20,7 +20,7 @@ class SVGPathElement final : public SVGGeometryElement {
|
|||
public:
|
||||
virtual ~SVGPathElement() override = default;
|
||||
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
|
||||
|
||||
virtual Gfx::Path get_path(CSSPixelSize viewport_size) override;
|
||||
|
||||
|
|
|
@ -25,9 +25,9 @@ void SVGPolygonElement::initialize(JS::Realm& realm)
|
|||
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGPolygonElement);
|
||||
}
|
||||
|
||||
void SVGPolygonElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
void SVGPolygonElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
|
||||
{
|
||||
SVGGeometryElement::attribute_changed(name, value);
|
||||
SVGGeometryElement::attribute_changed(name, old_value, value);
|
||||
|
||||
if (name == SVG::AttributeNames::points)
|
||||
m_points = AttributeParser::parse_points(value.value_or(String {}));
|
||||
|
|
|
@ -17,7 +17,7 @@ class SVGPolygonElement final : public SVGGeometryElement {
|
|||
public:
|
||||
virtual ~SVGPolygonElement() override = default;
|
||||
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
|
||||
|
||||
virtual Gfx::Path get_path(CSSPixelSize viewport_size) override;
|
||||
|
||||
|
|
|
@ -25,9 +25,9 @@ void SVGPolylineElement::initialize(JS::Realm& realm)
|
|||
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGPolylineElement);
|
||||
}
|
||||
|
||||
void SVGPolylineElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
void SVGPolylineElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
|
||||
{
|
||||
SVGGeometryElement::attribute_changed(name, value);
|
||||
SVGGeometryElement::attribute_changed(name, old_value, value);
|
||||
|
||||
if (name == SVG::AttributeNames::points)
|
||||
m_points = AttributeParser::parse_points(value.value_or(String {}));
|
||||
|
|
|
@ -17,7 +17,7 @@ class SVGPolylineElement final : public SVGGeometryElement {
|
|||
public:
|
||||
virtual ~SVGPolylineElement() override = default;
|
||||
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) 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);
|
||||
}
|
||||
|
||||
void SVGRadialGradientElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
void SVGRadialGradientElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
|
||||
{
|
||||
SVGGradientElement::attribute_changed(name, value);
|
||||
SVGGradientElement::attribute_changed(name, old_value, value);
|
||||
|
||||
// FIXME: These are <length> or <coordinate> in the spec, but all examples seem to allow percentages
|
||||
// and unitless values.
|
||||
|
|
|
@ -19,7 +19,7 @@ class SVGRadialGradientElement : public SVGGradientElement {
|
|||
public:
|
||||
virtual ~SVGRadialGradientElement() override = default;
|
||||
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
|
||||
|
||||
virtual Optional<Painting::PaintStyle> to_gfx_paint_style(SVGPaintContext const&) const override;
|
||||
|
||||
|
|
|
@ -27,9 +27,9 @@ void SVGRectElement::initialize(JS::Realm& realm)
|
|||
WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGRectElement);
|
||||
}
|
||||
|
||||
void SVGRectElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
void SVGRectElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
|
||||
{
|
||||
SVGGeometryElement::attribute_changed(name, value);
|
||||
SVGGeometryElement::attribute_changed(name, old_value, value);
|
||||
|
||||
if (name == SVG::AttributeNames::x) {
|
||||
m_x = AttributeParser::parse_coordinate(value.value_or(String {}));
|
||||
|
|
|
@ -18,7 +18,7 @@ class SVGRectElement final : public SVGGeometryElement {
|
|||
public:
|
||||
virtual ~SVGRectElement() override = default;
|
||||
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
|
||||
|
||||
virtual Gfx::Path get_path(CSSPixelSize viewport_size) override;
|
||||
|
||||
|
|
|
@ -84,9 +84,9 @@ void SVGSVGElement::apply_presentational_hints(CSS::StyleProperties& style) cons
|
|||
}
|
||||
}
|
||||
|
||||
void SVGSVGElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
void SVGSVGElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
|
||||
{
|
||||
SVGGraphicsElement::attribute_changed(name, value);
|
||||
SVGGraphicsElement::attribute_changed(name, old_value, value);
|
||||
|
||||
if (name.equals_ignoring_ascii_case(SVG::AttributeNames::viewBox)) {
|
||||
if (!value.has_value()) {
|
||||
|
|
|
@ -88,7 +88,7 @@ private:
|
|||
|
||||
virtual bool is_svg_svg_element() const override { return true; }
|
||||
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
|
||||
|
||||
void update_fallback_view_box_for_svg_as_image();
|
||||
|
||||
|
|
|
@ -21,9 +21,9 @@ SVGStopElement::SVGStopElement(DOM::Document& document, DOM::QualifiedName quali
|
|||
{
|
||||
}
|
||||
|
||||
void SVGStopElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
void SVGStopElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
|
||||
{
|
||||
SVGElement::attribute_changed(name, value);
|
||||
SVGElement::attribute_changed(name, old_value, value);
|
||||
if (name == SVG::AttributeNames::offset) {
|
||||
m_offset = AttributeParser::parse_number_percentage(value.value_or(String {}));
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ class SVGStopElement final : public SVGElement {
|
|||
public:
|
||||
virtual ~SVGStopElement() override = default;
|
||||
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
|
||||
|
||||
JS::NonnullGCPtr<SVGAnimatedNumber> offset() const;
|
||||
|
||||
|
|
|
@ -42,9 +42,9 @@ void SVGSymbolElement::apply_presentational_hints(CSS::StyleProperties& style) c
|
|||
}
|
||||
}
|
||||
|
||||
void SVGSymbolElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
void SVGSymbolElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
|
||||
{
|
||||
Base::attribute_changed(name, value);
|
||||
Base::attribute_changed(name, old_value, value);
|
||||
if (name.equals_ignoring_ascii_case(SVG::AttributeNames::viewBox))
|
||||
m_view_box = try_parse_view_box(value.value_or(String {}));
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ private:
|
|||
|
||||
bool is_direct_child_of_use_shadow_tree() const;
|
||||
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
|
||||
|
||||
Optional<ViewBox> m_view_box;
|
||||
};
|
||||
|
|
|
@ -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& value)
|
||||
void SVGTextPositioningElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
|
||||
{
|
||||
SVGGraphicsElement::attribute_changed(name, value);
|
||||
SVGGraphicsElement::attribute_changed(name, old_value, value);
|
||||
|
||||
if (name == SVG::AttributeNames::x) {
|
||||
m_x = AttributeParser::parse_coordinate(value.value_or(String {})).value_or(m_x);
|
||||
|
|
|
@ -16,7 +16,7 @@ class SVGTextPositioningElement : public SVGTextContentElement {
|
|||
WEB_PLATFORM_OBJECT(SVGTextPositioningElement, SVGTextContentElement);
|
||||
|
||||
public:
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
|
||||
|
||||
Gfx::FloatPoint get_offset() const;
|
||||
|
||||
|
|
|
@ -50,9 +50,9 @@ void SVGUseElement::visit_edges(Cell::Visitor& visitor)
|
|||
visitor.visit(m_document_observer);
|
||||
}
|
||||
|
||||
void SVGUseElement::attribute_changed(FlyString const& name, Optional<String> const& value)
|
||||
void SVGUseElement::attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value)
|
||||
{
|
||||
Base::attribute_changed(name, value);
|
||||
Base::attribute_changed(name, old_value, value);
|
||||
|
||||
// https://svgwg.org/svg2-draft/struct.html#UseLayout
|
||||
if (name == SVG::AttributeNames::x) {
|
||||
|
|
|
@ -24,7 +24,7 @@ class SVGUseElement final
|
|||
public:
|
||||
virtual ~SVGUseElement() override = default;
|
||||
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
|
||||
|
||||
virtual void inserted() override;
|
||||
|
||||
|
|
Loading…
Reference in a new issue