mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:37:36 +00:00
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)
This commit is contained in:
parent
5a12e9f222
commit
5df4e64eb7
6 changed files with 205 additions and 25 deletions
|
@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue