mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
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:
parent
c8d24d4966
commit
ea41aba6c7
Notes:
github-actions[bot]
2025-08-28 13:44:09 +00:00
Author: https://github.com/tcl3
Commit: ea41aba6c7
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6008
Reviewed-by: https://github.com/gmta ✅
16 changed files with 144 additions and 152 deletions
|
|
@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue