summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Layout/SVGGeometryBox.h
diff options
context:
space:
mode:
authorTobias Christiansen <tobyase@serenityos.org>2022-02-27 21:00:04 +0100
committerAndreas Kling <kling@serenityos.org>2022-02-28 16:49:24 +0100
commit8461791ce2d15e7ba30cb7220a76c2b5bf8503d0 (patch)
treee12542128abbffc64a4b757d1c5935123e014d5f /Userland/Libraries/LibWeb/Layout/SVGGeometryBox.h
parent4f1df48bd9fe3bd0ac807e96dc29e4eb49aa1517 (diff)
downloadserenity-8461791ce2d15e7ba30cb7220a76c2b5bf8503d0.zip
LibWeb: Add support for 'view-box' attribute to SVGs
This patch begins the support for the 'view-box' attribute that can be attached to <svg>'s. The FormattingContext determines the size of the Element according to the specified 'width' and 'height' or if they are not given by the 'viewbox' or by the bounding box of the path if nothing is specified. When we try to paint a SVG Path that belongs to a <svg> that has the 'view-box' and a specified 'height'/'width', all the parts of the path get scaled/moved accordingly. There probably are many edge cases and bugs still to be found, but this is a nice start. :^)
Diffstat (limited to 'Userland/Libraries/LibWeb/Layout/SVGGeometryBox.h')
-rw-r--r--Userland/Libraries/LibWeb/Layout/SVGGeometryBox.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/SVGGeometryBox.h b/Userland/Libraries/LibWeb/Layout/SVGGeometryBox.h
index 197750d1b5..e53ee44df5 100644
--- a/Userland/Libraries/LibWeb/Layout/SVGGeometryBox.h
+++ b/Userland/Libraries/LibWeb/Layout/SVGGeometryBox.h
@@ -21,6 +21,9 @@ public:
virtual void paint(PaintContext& context, PaintPhase phase) override;
+ float viewbox_scaling() const;
+ Gfx::FloatPoint viewbox_origin() const;
+
private:
virtual bool is_svg_geometry_box() const final { return true; }
};