ladybird/Libraries/LibWeb/SVG/SVGFEImageElement.h
Aliaksandr Kalenik f8640d813a LibGfx+LibWeb: Make DecodedImageFrame a value type
DecodedImageFrame only wraps a ref-counted Bitmap and color-space
metadata. The frame object itself does not provide shared mutable
state or lifetime ownership beyond those members, so ref-counting it
adds an unnecessary layer of indirection.
2026-05-07 16:08:13 +02:00

47 lines
1.4 KiB
C++

/*
* Copyright (c) 2025, Tim Ledbetter <tim.ledbetter@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Optional.h>
#include <LibGfx/DecodedImageFrame.h>
#include <LibWeb/Forward.h>
#include <LibWeb/SVG/SVGElement.h>
#include <LibWeb/SVG/SVGFilterPrimitiveStandardAttributes.h>
#include <LibWeb/SVG/SVGURIReference.h>
namespace Web::SVG {
class SVGFEImageElement final
: public SVGElement
, public SVGFilterPrimitiveStandardAttributes<SVGFEImageElement>
, public SVGURIReferenceMixin<SupportsXLinkHref::Yes> {
WEB_PLATFORM_OBJECT(SVGFEImageElement, SVGElement);
GC_DECLARE_ALLOCATOR(SVGFEImageElement);
public:
virtual ~SVGFEImageElement() override = default;
GC::Ptr<HTML::DecodedImageData> image_data() const;
Optional<Gfx::DecodedImageFrame> current_image_frame(Gfx::IntSize = {}) const;
Optional<Gfx::IntRect> content_rect() const;
private:
SVGFEImageElement(DOM::Document&, DOM::QualifiedName);
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
void process_href(Optional<String> const& href);
Optional<URL::URL> m_href;
GC::Ptr<HTML::SharedResourceRequest> m_resource_request;
};
};