1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 20:57:35 +00:00

LibWeb: Port Element::attribute_changed from DeprecatedString to String

Which as you would expect has a bunch of fallout, but also results in a
whole lot of awkward conversions falling away.
This commit is contained in:
Shannon Booth 2023-11-19 18:10:36 +13:00 committed by Sam Atkins
parent 6a2a7cad61
commit eca9874e56
77 changed files with 178 additions and 193 deletions

View file

@ -22,18 +22,18 @@ void SVGCircleElement::initialize(JS::Realm& realm)
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGCircleElementPrototype>(realm, "SVGCircleElement"));
}
void SVGCircleElement::attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value)
void SVGCircleElement::attribute_changed(FlyString const& name, Optional<String> const& value)
{
SVGGeometryElement::attribute_changed(name, value);
if (name == SVG::AttributeNames::cx) {
m_center_x = AttributeParser::parse_coordinate(value.value_or(""));
m_center_x = AttributeParser::parse_coordinate(value.value_or(String {}));
m_path.clear();
} else if (name == SVG::AttributeNames::cy) {
m_center_y = AttributeParser::parse_coordinate(value.value_or(""));
m_center_y = AttributeParser::parse_coordinate(value.value_or(String {}));
m_path.clear();
} else if (name == SVG::AttributeNames::r) {
m_radius = AttributeParser::parse_positive_length(value.value_or(""));
m_radius = AttributeParser::parse_positive_length(value.value_or(String {}));
m_path.clear();
}
}

View file

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

View file

@ -34,7 +34,7 @@ void SVGElement::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_dataset);
}
void SVGElement::attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value)
void SVGElement::attribute_changed(FlyString const& name, Optional<String> const& value)
{
Base::attribute_changed(name, value);

View file

@ -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<DeprecatedString> const& value) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
virtual void children_changed() override;
virtual void inserted() override;

View file

@ -22,21 +22,21 @@ void SVGEllipseElement::initialize(JS::Realm& realm)
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGEllipseElementPrototype>(realm, "SVGEllipseElement"));
}
void SVGEllipseElement::attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value)
void SVGEllipseElement::attribute_changed(FlyString const& name, Optional<String> const& value)
{
SVGGeometryElement::attribute_changed(name, value);
if (name == SVG::AttributeNames::cx) {
m_center_x = AttributeParser::parse_coordinate(value.value_or(""));
m_center_x = AttributeParser::parse_coordinate(value.value_or(String {}));
m_path.clear();
} else if (name == SVG::AttributeNames::cy) {
m_center_y = AttributeParser::parse_coordinate(value.value_or(""));
m_center_y = AttributeParser::parse_coordinate(value.value_or(String {}));
m_path.clear();
} else if (name == SVG::AttributeNames::rx) {
m_radius_x = AttributeParser::parse_positive_length(value.value_or(""));
m_radius_x = AttributeParser::parse_positive_length(value.value_or(String {}));
m_path.clear();
} else if (name == SVG::AttributeNames::ry) {
m_radius_y = AttributeParser::parse_positive_length(value.value_or(""));
m_radius_y = AttributeParser::parse_positive_length(value.value_or(String {}));
m_path.clear();
}
}

View file

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

View file

@ -17,15 +17,15 @@ SVGGradientElement::SVGGradientElement(DOM::Document& document, DOM::QualifiedNa
{
}
void SVGGradientElement::attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value)
void SVGGradientElement::attribute_changed(FlyString const& name, Optional<String> const& value)
{
SVGElement::attribute_changed(name, value);
if (name == AttributeNames::gradientUnits) {
m_gradient_units = AttributeParser::parse_units(value.value_or(""));
m_gradient_units = AttributeParser::parse_units(value.value_or(String {}));
} else if (name == AttributeNames::spreadMethod) {
m_spread_method = AttributeParser::parse_spread_method(value.value_or(""));
m_spread_method = AttributeParser::parse_spread_method(value.value_or(String {}));
} else if (name == AttributeNames::gradientTransform) {
if (auto transform_list = AttributeParser::parse_transform(value.value_or("")); transform_list.has_value()) {
if (auto transform_list = AttributeParser::parse_transform(value.value_or(String {})); transform_list.has_value()) {
m_gradient_transform = transform_from_transform_list(*transform_list);
} else {
m_gradient_transform = {};

View file

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

View file

@ -32,11 +32,11 @@ void SVGGraphicsElement::initialize(JS::Realm& realm)
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGGraphicsElementPrototype>(realm, "SVGGraphicsElement"));
}
void SVGGraphicsElement::attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value)
void SVGGraphicsElement::attribute_changed(FlyString const& name, Optional<String> const& value)
{
SVGElement::attribute_changed(name, value);
if (name == "transform"sv) {
auto transform_list = AttributeParser::parse_transform(value.value_or(""));
auto transform_list = AttributeParser::parse_transform(value.value_or(String {}));
if (transform_list.has_value())
m_transform = transform_from_transform_list(*transform_list);
}

View file

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

View file

@ -22,21 +22,21 @@ void SVGLineElement::initialize(JS::Realm& realm)
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGLineElementPrototype>(realm, "SVGLineElement"));
}
void SVGLineElement::attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value)
void SVGLineElement::attribute_changed(FlyString const& name, Optional<String> const& value)
{
SVGGeometryElement::attribute_changed(name, value);
if (name == SVG::AttributeNames::x1) {
m_x1 = AttributeParser::parse_coordinate(value.value_or(""));
m_x1 = AttributeParser::parse_coordinate(value.value_or(String {}));
m_path.clear();
} else if (name == SVG::AttributeNames::y1) {
m_y1 = AttributeParser::parse_coordinate(value.value_or(""));
m_y1 = AttributeParser::parse_coordinate(value.value_or(String {}));
m_path.clear();
} else if (name == SVG::AttributeNames::x2) {
m_x2 = AttributeParser::parse_coordinate(value.value_or(""));
m_x2 = AttributeParser::parse_coordinate(value.value_or(String {}));
m_path.clear();
} else if (name == SVG::AttributeNames::y2) {
m_y2 = AttributeParser::parse_coordinate(value.value_or(""));
m_y2 = AttributeParser::parse_coordinate(value.value_or(String {}));
m_path.clear();
}
}

View file

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

View file

@ -24,22 +24,22 @@ void SVGLinearGradientElement::initialize(JS::Realm& realm)
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGLinearGradientElementPrototype>(realm, "SVGLinearGradientElement"));
}
void SVGLinearGradientElement::attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value)
void SVGLinearGradientElement::attribute_changed(FlyString const& name, Optional<String> const& value)
{
SVGGradientElement::attribute_changed(name, value);
// FIXME: Should allow for `<number-percentage> | <length>` for x1, x2, y1, y2
if (name == SVG::AttributeNames::x1) {
m_x1 = AttributeParser::parse_number_percentage(value.value_or(""));
m_x1 = AttributeParser::parse_number_percentage(value.value_or(String {}));
m_paint_style = nullptr;
} else if (name == SVG::AttributeNames::y1) {
m_y1 = AttributeParser::parse_number_percentage(value.value_or(""));
m_y1 = AttributeParser::parse_number_percentage(value.value_or(String {}));
m_paint_style = nullptr;
} else if (name == SVG::AttributeNames::x2) {
m_x2 = AttributeParser::parse_number_percentage(value.value_or(""));
m_x2 = AttributeParser::parse_number_percentage(value.value_or(String {}));
m_paint_style = nullptr;
} else if (name == SVG::AttributeNames::y2) {
m_y2 = AttributeParser::parse_number_percentage(value.value_or(""));
m_y2 = AttributeParser::parse_number_percentage(value.value_or(String {}));
m_paint_style = nullptr;
}
}

View file

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

View file

@ -31,13 +31,13 @@ JS::GCPtr<Layout::Node> SVGMaskElement::create_layout_node(NonnullRefPtr<CSS::St
return heap().allocate_without_realm<Layout::SVGGraphicsBox>(document(), *this, move(style));
}
void SVGMaskElement::attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value)
void SVGMaskElement::attribute_changed(FlyString const& name, Optional<String> const& value)
{
SVGGraphicsElement::attribute_changed(name, value);
if (name == AttributeNames::maskUnits) {
m_mask_units = AttributeParser::parse_units(value.value_or(""));
m_mask_units = AttributeParser::parse_units(value.value_or(String {}));
} else if (name == AttributeNames::maskContentUnits) {
m_mask_content_units = AttributeParser::parse_units(value.value_or(""));
m_mask_content_units = AttributeParser::parse_units(value.value_or(String {}));
}
}

View file

@ -17,7 +17,7 @@ class SVGMaskElement final : public SVGGraphicsElement {
public:
virtual ~SVGMaskElement() override;
virtual void attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& value) override;
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;

View file

@ -93,12 +93,12 @@ void SVGPathElement::initialize(JS::Realm& realm)
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGPathElementPrototype>(realm, "SVGPathElement"));
}
void SVGPathElement::attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value)
void SVGPathElement::attribute_changed(FlyString const& name, Optional<String> const& value)
{
SVGGeometryElement::attribute_changed(name, value);
if (name == "d") {
m_instructions = AttributeParser::parse_path_data(value.value_or(""));
m_instructions = AttributeParser::parse_path_data(value.value_or(String {}));
m_path.clear();
}
}

View file

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

View file

@ -22,12 +22,12 @@ void SVGPolygonElement::initialize(JS::Realm& realm)
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGPolygonElementPrototype>(realm, "SVGPolygonElement"));
}
void SVGPolygonElement::attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value)
void SVGPolygonElement::attribute_changed(FlyString const& name, Optional<String> const& value)
{
SVGGeometryElement::attribute_changed(name, value);
if (name == SVG::AttributeNames::points) {
m_points = AttributeParser::parse_points(value.value_or(""));
m_points = AttributeParser::parse_points(value.value_or(String {}));
m_path.clear();
}
}

View file

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

View file

@ -22,12 +22,12 @@ void SVGPolylineElement::initialize(JS::Realm& realm)
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGPolylineElementPrototype>(realm, "SVGPolylineElement"));
}
void SVGPolylineElement::attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value)
void SVGPolylineElement::attribute_changed(FlyString const& name, Optional<String> const& value)
{
SVGGeometryElement::attribute_changed(name, value);
if (name == SVG::AttributeNames::points) {
m_points = AttributeParser::parse_points(value.value_or(""));
m_points = AttributeParser::parse_points(value.value_or(String {}));
m_path.clear();
}
}

View file

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

View file

@ -21,29 +21,29 @@ void SVGRadialGradientElement::initialize(JS::Realm& realm)
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGRadialGradientElementPrototype>(realm, "SVGRadialGradientElement"));
}
void SVGRadialGradientElement::attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value)
void SVGRadialGradientElement::attribute_changed(FlyString const& name, Optional<String> const& 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.
if (name == SVG::AttributeNames::cx) {
m_cx = AttributeParser::parse_number_percentage(value.value_or(""));
m_cx = AttributeParser::parse_number_percentage(value.value_or(String {}));
m_paint_style = nullptr;
} else if (name == SVG::AttributeNames::cy) {
m_cy = AttributeParser::parse_number_percentage(value.value_or(""));
m_cy = AttributeParser::parse_number_percentage(value.value_or(String {}));
m_paint_style = nullptr;
} else if (name == SVG::AttributeNames::fx) {
m_fx = AttributeParser::parse_number_percentage(value.value_or(""));
m_fx = AttributeParser::parse_number_percentage(value.value_or(String {}));
m_paint_style = nullptr;
} else if (name == SVG::AttributeNames::fy) {
m_fy = AttributeParser::parse_number_percentage(value.value_or(""));
m_fy = AttributeParser::parse_number_percentage(value.value_or(String {}));
m_paint_style = nullptr;
} else if (name == SVG::AttributeNames::fr) {
m_fr = AttributeParser::parse_number_percentage(value.value_or(""));
m_fr = AttributeParser::parse_number_percentage(value.value_or(String {}));
m_paint_style = nullptr;
} else if (name == SVG::AttributeNames::r) {
m_r = AttributeParser::parse_number_percentage(value.value_or(""));
m_r = AttributeParser::parse_number_percentage(value.value_or(String {}));
m_paint_style = nullptr;
}
}

View file

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

View file

@ -24,27 +24,27 @@ void SVGRectElement::initialize(JS::Realm& realm)
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGRectElementPrototype>(realm, "SVGRectElement"));
}
void SVGRectElement::attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value)
void SVGRectElement::attribute_changed(FlyString const& name, Optional<String> const& value)
{
SVGGeometryElement::attribute_changed(name, value);
if (name == SVG::AttributeNames::x) {
m_x = AttributeParser::parse_coordinate(value.value_or(""));
m_x = AttributeParser::parse_coordinate(value.value_or(String {}));
m_path.clear();
} else if (name == SVG::AttributeNames::y) {
m_y = AttributeParser::parse_coordinate(value.value_or(""));
m_y = AttributeParser::parse_coordinate(value.value_or(String {}));
m_path.clear();
} else if (name == SVG::AttributeNames::width) {
m_width = AttributeParser::parse_positive_length(value.value_or(""));
m_width = AttributeParser::parse_positive_length(value.value_or(String {}));
m_path.clear();
} else if (name == SVG::AttributeNames::height) {
m_height = AttributeParser::parse_positive_length(value.value_or(""));
m_height = AttributeParser::parse_positive_length(value.value_or(String {}));
m_path.clear();
} else if (name == SVG::AttributeNames::rx) {
m_radius_x = AttributeParser::parse_length(value.value_or(""));
m_radius_x = AttributeParser::parse_length(value.value_or(String {}));
m_path.clear();
} else if (name == SVG::AttributeNames::ry) {
m_radius_y = AttributeParser::parse_length(value.value_or(""));
m_radius_y = AttributeParser::parse_length(value.value_or(String {}));
m_path.clear();
}
}

View file

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

View file

@ -61,14 +61,14 @@ void SVGSVGElement::apply_presentational_hints(CSS::StyleProperties& style) cons
}
}
void SVGSVGElement::attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value)
void SVGSVGElement::attribute_changed(FlyString const& name, Optional<String> const& value)
{
SVGGraphicsElement::attribute_changed(name, value);
if (name.equals_ignoring_ascii_case(SVG::AttributeNames::viewBox))
m_view_box = try_parse_view_box(value.value_or(""));
m_view_box = try_parse_view_box(value.value_or(String {}));
if (name.equals_ignoring_ascii_case(SVG::AttributeNames::preserveAspectRatio))
m_preserve_aspect_ratio = AttributeParser::parse_preserve_aspect_ratio(value.value_or(""));
m_preserve_aspect_ratio = AttributeParser::parse_preserve_aspect_ratio(value.value_or(String {}));
if (name.equals_ignoring_ascii_case(SVG::AttributeNames::width) || name.equals_ignoring_ascii_case(SVG::AttributeNames::height))
update_fallback_view_box_for_svg_as_image();
}

View file

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

View file

@ -19,11 +19,11 @@ SVGStopElement::SVGStopElement(DOM::Document& document, DOM::QualifiedName quali
{
}
void SVGStopElement::attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value)
void SVGStopElement::attribute_changed(FlyString const& name, Optional<String> const& value)
{
SVGElement::attribute_changed(name, value);
if (name == SVG::AttributeNames::offset) {
m_offset = AttributeParser::parse_number_percentage(value.value_or(""));
m_offset = AttributeParser::parse_number_percentage(value.value_or(String {}));
}
}

View file

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

View file

@ -39,11 +39,11 @@ void SVGSymbolElement::apply_presentational_hints(CSS::StyleProperties& style) c
}
}
void SVGSymbolElement::attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value)
void SVGSymbolElement::attribute_changed(FlyString const& name, Optional<String> const& value)
{
Base::attribute_changed(name, value);
if (name.equals_ignoring_ascii_case(SVG::AttributeNames::viewBox))
m_view_box = try_parse_view_box(value.value_or(""));
m_view_box = try_parse_view_box(value.value_or(String {}));
}
bool SVGSymbolElement::is_direct_child_of_use_shadow_tree() const

View file

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

View file

@ -28,18 +28,18 @@ void SVGTextPositioningElement::initialize(JS::Realm& realm)
set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGTextPositioningElementPrototype>(realm, "SVGTextPositioningElement"));
}
void SVGTextPositioningElement::attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value)
void SVGTextPositioningElement::attribute_changed(FlyString const& name, Optional<String> const& value)
{
SVGGraphicsElement::attribute_changed(name, value);
if (name == SVG::AttributeNames::x) {
m_x = AttributeParser::parse_coordinate(value.value_or("")).value_or(m_x);
m_x = AttributeParser::parse_coordinate(value.value_or(String {})).value_or(m_x);
} else if (name == SVG::AttributeNames::y) {
m_y = AttributeParser::parse_coordinate(value.value_or("")).value_or(m_y);
m_y = AttributeParser::parse_coordinate(value.value_or(String {})).value_or(m_y);
} else if (name == SVG::AttributeNames::dx) {
m_dx = AttributeParser::parse_coordinate(value.value_or("")).value_or(m_dx);
m_dx = AttributeParser::parse_coordinate(value.value_or(String {})).value_or(m_dx);
} else if (name == SVG::AttributeNames::dy) {
m_dy = AttributeParser::parse_coordinate(value.value_or("")).value_or(m_dy);
m_dy = AttributeParser::parse_coordinate(value.value_or(String {})).value_or(m_dy);
}
}

View file

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

View file

@ -45,18 +45,18 @@ void SVGUseElement::visit_edges(Cell::Visitor& visitor)
visitor.visit(m_document_observer);
}
void SVGUseElement::attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value)
void SVGUseElement::attribute_changed(FlyString const& name, Optional<String> const& value)
{
Base::attribute_changed(name, value);
// https://svgwg.org/svg2-draft/struct.html#UseLayout
if (name == SVG::AttributeNames::x) {
m_x = AttributeParser::parse_coordinate(value.value_or(""));
m_x = AttributeParser::parse_coordinate(value.value_or(String {}));
} else if (name == SVG::AttributeNames::y) {
m_y = AttributeParser::parse_coordinate(value.value_or(""));
m_y = AttributeParser::parse_coordinate(value.value_or(String {}));
} else if (name == SVG::AttributeNames::href) {
// FIXME: Support the xlink:href attribute as a fallback
m_referenced_id = parse_id_from_href(value.value_or(""));
m_referenced_id = parse_id_from_href(value.value_or(String {}).to_deprecated_string());
clone_element_tree_as_our_shadow_tree(referenced_element());
}

View file

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