LibWeb: Move common SVGViewport code into an SVGFitToViewBox class

Special handling for SVGClipPathElement and SVGMaskElement, which use a
a ViewBox and PreserveAspectRatio value internally, has been moved to
`SVGFormattingContext`.
This commit is contained in:
Tim Ledbetter 2025-08-27 22:17:33 +01:00 committed by Jelle Raaijmakers
parent c8d24d4966
commit ea41aba6c7
Notes: github-actions[bot] 2025-08-28 13:44:09 +00:00
16 changed files with 144 additions and 152 deletions

View file

@ -6,14 +6,13 @@
#pragma once
#include <LibWeb/SVG/SVGFitToViewBox.h>
#include <LibWeb/SVG/SVGGraphicsElement.h>
#include <LibWeb/SVG/SVGViewport.h>
#include <LibWeb/SVG/ViewBox.h>
namespace Web::SVG {
class SVGViewElement final : public SVGGraphicsElement
, public SVGViewport {
, public SVGFitToViewBox {
WEB_PLATFORM_OBJECT(SVGViewElement, SVGGraphicsElement);
GC_DECLARE_ALLOCATOR(SVGViewElement);
@ -21,11 +20,6 @@ public:
virtual bool is_presentational_hint(FlyString const&) const override;
virtual void apply_presentational_hints(GC::Ref<CSS::CascadedProperties>) const override;
virtual Optional<ViewBox> view_box() const override { return m_view_box; }
virtual Optional<PreserveAspectRatio> preserve_aspect_ratio() const override { return m_preserve_aspect_ratio; }
GC::Ref<SVGAnimatedRect> view_box_for_bindings() { return *m_view_box_for_bindings; }
private:
SVGViewElement(DOM::Document&, DOM::QualifiedName);
@ -35,10 +29,6 @@ private:
virtual bool is_svg_view_element() const override { return true; }
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
Optional<ViewBox> m_view_box;
Optional<PreserveAspectRatio> m_preserve_aspect_ratio;
GC::Ptr<SVGAnimatedRect> m_view_box_for_bindings;
};
}