summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/SVG/SVGSVGElement.h
diff options
context:
space:
mode:
authorMacDue <macdue@dueutil.tech>2023-04-17 01:20:24 +0100
committerAndreas Kling <kling@serenityos.org>2023-04-17 07:32:31 +0200
commit5df4e64eb7e7a2556d282b634d66adf7d8edc5ec (patch)
tree343eb6dca7a90f903fe82ea536a1fc23684bbc08 /Userland/Libraries/LibWeb/SVG/SVGSVGElement.h
parent5a12e9f22292cd6b6393b5d4b09165ebdee3a8bb (diff)
downloadserenity-5df4e64eb7e7a2556d282b634d66adf7d8edc5ec.zip
LibWeb: Implement SVG `preserveAspectRatio` attribute
This attribute is used to define how the viewBox should be scaled. Previously the behaviour implemented was that of "xMidYMid meet", now all of them work (expect none :P). With this the Discord login backend is now correctly scaled/positioned. This also brings our SVG code a little closer to the spec! With spec comments and all :^) (Minor non-visible update to layout tests)
Diffstat (limited to 'Userland/Libraries/LibWeb/SVG/SVGSVGElement.h')
-rw-r--r--Userland/Libraries/LibWeb/SVG/SVGSVGElement.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/SVG/SVGSVGElement.h b/Userland/Libraries/LibWeb/SVG/SVGSVGElement.h
index 7f03fda104..a214843f8f 100644
--- a/Userland/Libraries/LibWeb/SVG/SVGSVGElement.h
+++ b/Userland/Libraries/LibWeb/SVG/SVGSVGElement.h
@@ -7,6 +7,7 @@
#pragma once
#include <LibGfx/Bitmap.h>
+#include <LibWeb/SVG/AttributeParser.h>
#include <LibWeb/SVG/SVGGraphicsElement.h>
#include <LibWeb/SVG/ViewBox.h>
@@ -24,6 +25,7 @@ public:
virtual bool is_svg_container() const override { return true; }
Optional<ViewBox> const& view_box() const { return m_view_box; }
+ Optional<PreserveAspectRatio> const& preserve_aspect_ratio() const { return m_preserve_aspect_ratio; }
private:
SVGSVGElement(DOM::Document&, DOM::QualifiedName);
@@ -35,6 +37,7 @@ private:
virtual void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) override;
Optional<ViewBox> m_view_box;
+ Optional<PreserveAspectRatio> m_preserve_aspect_ratio;
};
}