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

LibWeb: Add SVGSVGElement.viewBox attribute

This attribute has some compatbility issues...
- The spec says it should be an SVGAnimatedRect which contains
  a DOMRect and a DOMReadOnlyRect.
- Blink gives you an SVGAnimatedRect with 2x SVGRect
- Gecko gives you an SVGAnimatedRect with 2x SVGRect? (nullable)

I ended up with something similar to Gecko, an SVGAnimatedRect
with 2x DOMRect? (nullable)

With this fixed, we can now load https://polar.sh/ :^)
This commit is contained in:
Andreas Kling 2024-01-24 22:54:16 +01:00
parent 2fd034d1df
commit b12541b286
12 changed files with 228 additions and 2 deletions

View file

@ -30,10 +30,13 @@ public:
void set_fallback_view_box_for_svg_as_image(Optional<ViewBox>);
JS::NonnullGCPtr<SVGAnimatedRect> view_box_for_bindings() { return *m_view_box_for_bindings; }
private:
SVGSVGElement(DOM::Document&, DOM::QualifiedName);
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Visitor&) override;
virtual bool is_svg_svg_element() const override { return true; }
@ -45,6 +48,8 @@ private:
Optional<PreserveAspectRatio> m_preserve_aspect_ratio;
Optional<ViewBox> m_fallback_view_box_for_svg_as_image;
JS::GCPtr<SVGAnimatedRect> m_view_box_for_bindings;
};
}