Skip to content

Truly independent web browser

1.4 KB
Raw Blame
/*
 * Copyright (c) 2025, Tim Ledbetter <[email protected]>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <AK/Optional.h>
#include <LibWeb/Forward.h>
#include <LibWeb/SVG/SVGAnimatedPreserveAspectRatio.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_WRAPPABLE(SVGFEImageElement, SVGElement);
    GC_DECLARE_ALLOCATOR(SVGFEImageElement);

public:
    virtual ~SVGFEImageElement() override = default;

    GC::Ptr<HTML::DecodedImageData> image_data() const;

    GC::Ref<SVGAnimatedPreserveAspectRatio> preserve_aspect_ratio_for_bindings();

private:
    SVGFEImageElement(DOM::Document&, DOM::QualifiedName);
    virtual void visit_edges(Cell::Visitor&) override;

    virtual void attribute_changed(Utf16FlyString const& name, Optional<Utf16String> const& old_value, Optional<Utf16String> const& value, Optional<Utf16FlyString> const& namespace_) override;
    virtual void adopted_from(DOM::Document&) override;

    void process_href(Optional<Utf16String> const& href);

    Optional<URL::URL> m_href;

    GC::Ptr<HTML::SharedResourceRequest> m_resource_request;
    GC::Ptr<SVGAnimatedPreserveAspectRatio> m_preserve_aspect_ratio;
};

};