1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-11 18:20:43 +09:00

LibWeb: Rename DOM::Element::parse_attribute() => attribute_changed()

This is a first step towards merging attribute change and removal
notifications into a single function.
This commit is contained in:
Andreas Kling 2023-07-03 17:08:37 +02:00
parent e1e04884b9
commit 5a74486b59
Notes: sideshowbarker 2024-07-17 02:28:18 +09:00
65 changed files with 99 additions and 99 deletions

View file

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

View file

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

View file

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

View file

@ -29,9 +29,9 @@ JS::ThrowCompletionOr<void> HTMLAnchorElement::initialize(JS::Realm& realm)
return {};
}
void HTMLAnchorElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLAnchorElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{
HTMLElement::parse_attribute(name, value);
HTMLElement::attribute_changed(name, value);
if (name == HTML::AttributeNames::href) {
set_the_url();
}

View file

@ -43,7 +43,7 @@ private:
void run_activation_behavior(Web::DOM::Event const&);
// ^DOM::Element
virtual void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual i32 default_tab_index_value() const override;
// ^HTML::HTMLHyperlinkElementUtils

View file

@ -25,9 +25,9 @@ JS::ThrowCompletionOr<void> HTMLAreaElement::initialize(JS::Realm& realm)
return {};
}
void HTMLAreaElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLAreaElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{
HTMLElement::parse_attribute(name, value);
HTMLElement::attribute_changed(name, value);
if (name == HTML::AttributeNames::href) {
set_the_url();
}

View file

@ -26,7 +26,7 @@ private:
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
// ^DOM::Element
virtual void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual i32 default_tab_index_value() const override;
// ^HTML::HTMLHyperlinkElementUtils

View file

@ -45,9 +45,9 @@ void HTMLBaseElement::removed_from(Node* parent)
document().update_base_element({});
}
void HTMLBaseElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLBaseElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{
HTMLElement::parse_attribute(name, value);
HTMLElement::attribute_changed(name, value);
// The frozen base URL must be immediately set for an element whenever any of the following situations occur:
// - The base element is the first base element in tree order with an href content attribute in its Document, and its href content attribute is changed.

View file

@ -23,7 +23,7 @@ public:
virtual void inserted() override;
virtual void removed_from(Node*) override;
virtual void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
private:
HTMLBaseElement(DOM::Document&, DOM::QualifiedName);

View file

@ -50,9 +50,9 @@ void HTMLBodyElement::apply_presentational_hints(CSS::StyleProperties& style) co
});
}
void HTMLBodyElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLBodyElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{
HTMLElement::parse_attribute(name, value);
HTMLElement::attribute_changed(name, value);
if (name.equals_ignoring_ascii_case("link"sv)) {
// 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);

View file

@ -20,7 +20,7 @@ class HTMLBodyElement final
public:
virtual ~HTMLBodyElement() override;
virtual void parse_attribute(DeprecatedFlyString const&, DeprecatedString const&) override;
virtual void attribute_changed(DeprecatedFlyString const&, DeprecatedString const&) override;
virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
// https://www.w3.org/TR/html-aria/#el-body

View file

@ -228,9 +228,9 @@ bool HTMLElement::cannot_navigate() const
return !is<HTML::HTMLAnchorElement>(this) && !is_connected();
}
void HTMLElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{
Element::parse_attribute(name, value);
Element::attribute_changed(name, value);
if (name == HTML::AttributeNames::contenteditable) {
if ((!value.is_null() && value.is_empty()) || value.equals_ignoring_ascii_case("true"sv)) {

View file

@ -70,7 +70,7 @@ protected:
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
virtual void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void did_remove_attribute(DeprecatedFlyString const& name) override;
virtual void visit_edges(Cell::Visitor&) override;

View file

@ -25,9 +25,9 @@ JS::ThrowCompletionOr<void> HTMLFrameSetElement::initialize(JS::Realm& realm)
return {};
}
void HTMLFrameSetElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLFrameSetElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{
HTMLElement::parse_attribute(name, value);
HTMLElement::attribute_changed(name, value);
#undef __ENUMERATE
#define __ENUMERATE(attribute_name, event_name) \

View file

@ -24,7 +24,7 @@ private:
HTMLFrameSetElement(DOM::Document&, DOM::QualifiedName);
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
virtual void parse_attribute(DeprecatedFlyString const&, DeprecatedString const&) override;
virtual void attribute_changed(DeprecatedFlyString const&, DeprecatedString const&) override;
// ^HTML::GlobalEventHandlers
virtual EventTarget& global_event_handlers_to_event_target(FlyString const& event_name) override;

View file

@ -34,9 +34,9 @@ JS::GCPtr<Layout::Node> HTMLIFrameElement::create_layout_node(NonnullRefPtr<CSS:
return heap().allocate_without_realm<Layout::FrameBox>(document(), *this, move(style));
}
void HTMLIFrameElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLIFrameElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{
HTMLElement::parse_attribute(name, value);
HTMLElement::attribute_changed(name, value);
if (name == HTML::AttributeNames::src)
load_src(value);
}

View file

@ -33,7 +33,7 @@ private:
// ^DOM::Element
virtual void inserted() override;
virtual void removed_from(Node*) override;
virtual void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual i32 default_tab_index_value() const override;
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#process-the-iframe-attributes

View file

@ -75,9 +75,9 @@ void HTMLImageElement::apply_presentational_hints(CSS::StyleProperties& style) c
});
}
void HTMLImageElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLImageElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{
HTMLElement::parse_attribute(name, value);
HTMLElement::attribute_changed(name, value);
if (name == HTML::AttributeNames::crossorigin) {
m_cors_setting = cors_setting_attribute_from_keyword(String::from_deprecated_string(value).release_value_but_fixme_should_propagate_errors());

View file

@ -28,7 +28,7 @@ class HTMLImageElement final
public:
virtual ~HTMLImageElement() override;
virtual void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void did_remove_attribute(DeprecatedFlyString const& name) override;
DeprecatedString alt() const { return attribute(HTML::AttributeNames::alt); }

View file

@ -493,9 +493,9 @@ void HTMLInputElement::did_lose_focus()
});
}
void HTMLInputElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLInputElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{
HTMLElement::parse_attribute(name, value);
HTMLElement::attribute_changed(name, value);
if (name == HTML::AttributeNames::checked) {
// When the checked content attribute is added, if the control does not have dirty checkedness,
// the user agent must set the checkedness of the element to true

View file

@ -104,7 +104,7 @@ public:
virtual bool is_focusable() const override { return m_type != TypeAttributeState::Hidden; }
// ^HTMLElement
virtual void parse_attribute(DeprecatedFlyString const&, DeprecatedString const&) override;
virtual void attribute_changed(DeprecatedFlyString const&, DeprecatedString const&) override;
virtual void did_remove_attribute(DeprecatedFlyString const&) override;
// ^FormAssociatedElement

View file

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

View file

@ -39,7 +39,7 @@ private:
HTMLLinkElement(DOM::Document&, DOM::QualifiedName);
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
void parse_attribute(DeprecatedFlyString const&, DeprecatedString const&) override;
void attribute_changed(DeprecatedFlyString const&, DeprecatedString const&) override;
// ^ResourceClient
virtual void resource_did_fail() override;

View file

@ -84,9 +84,9 @@ void HTMLMediaElement::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_fetch_controller);
}
void HTMLMediaElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLMediaElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{
Base::parse_attribute(name, value);
Base::attribute_changed(name, value);
if (name == HTML::AttributeNames::src)
load_element().release_value_but_fixme_should_propagate_errors();

View file

@ -124,7 +124,7 @@ protected:
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
virtual void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void did_remove_attribute(DeprecatedFlyString const&) override;
virtual void removed_from(DOM::Node*) override;
virtual void children_changed() override;

View file

@ -41,9 +41,9 @@ JS::ThrowCompletionOr<void> HTMLObjectElement::initialize(JS::Realm& realm)
return {};
}
void HTMLObjectElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLObjectElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{
NavigableContainer::parse_attribute(name, value);
NavigableContainer::attribute_changed(name, value);
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-object-element
// Whenever one of the following conditions occur:

View file

@ -34,7 +34,7 @@ class HTMLObjectElement final
public:
virtual ~HTMLObjectElement() override;
virtual void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
DeprecatedString data() const;
void set_data(DeprecatedString const& data) { MUST(set_attribute(HTML::AttributeNames::data, data)); }

View file

@ -33,9 +33,9 @@ JS::ThrowCompletionOr<void> HTMLOptionElement::initialize(JS::Realm& realm)
return {};
}
void HTMLOptionElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLOptionElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{
HTMLElement::parse_attribute(name, value);
HTMLElement::attribute_changed(name, value);
if (name == HTML::AttributeNames::selected) {
// Except where otherwise specified, when the element is created, its selectedness must be set to true

View file

@ -40,7 +40,7 @@ private:
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) override;
void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
void did_remove_attribute(DeprecatedFlyString const& name) override;
void ask_for_a_reset();

View file

@ -47,9 +47,9 @@ void HTMLScriptElement::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_preparation_time_document.ptr());
}
void HTMLScriptElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLScriptElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{
Base::parse_attribute(name, value);
Base::attribute_changed(name, value);
if (name == HTML::AttributeNames::crossorigin)
m_crossorigin = cors_setting_attribute_from_keyword(String::from_deprecated_string(value).release_value_but_fixme_should_propagate_errors());

View file

@ -62,7 +62,7 @@ private:
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
virtual void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void did_remove_attribute(DeprecatedFlyString const&) override;
// https://html.spec.whatwg.org/multipage/scripting.html#prepare-the-script-element

View file

@ -42,9 +42,9 @@ void HTMLVideoElement::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_fetch_controller);
}
void HTMLVideoElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value)
void HTMLVideoElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{
Base::parse_attribute(name, value);
Base::attribute_changed(name, value);
if (name == HTML::AttributeNames::poster)
determine_element_poster_frame(value).release_value_but_fixme_should_propagate_errors();

View file

@ -47,7 +47,7 @@ private:
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
virtual void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value) override;
virtual void did_remove_attribute(DeprecatedFlyString const&) override;
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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