2020-01-18 05:38:21 -03:00
|
|
|
/*
|
2024-10-04 08:19:50 -03:00
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <andreas@ladybird.org>
|
2020-01-18 05:38:21 -03:00
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 05:38:21 -03:00
|
|
|
*/
|
|
|
|
|
|
2019-10-05 17:07:45 -03:00
|
|
|
#pragma once
|
|
|
|
|
|
2020-07-26 10:08:16 -03:00
|
|
|
#include <LibWeb/HTML/HTMLImageElement.h>
|
2020-11-22 11:53:01 -03:00
|
|
|
#include <LibWeb/Layout/ReplacedBox.h>
|
2019-10-05 17:07:45 -03:00
|
|
|
|
2020-11-22 11:53:01 -03:00
|
|
|
namespace Web::Layout {
|
2020-03-07 06:27:02 -03:00
|
|
|
|
2023-05-09 02:02:28 -03:00
|
|
|
class ImageBox final : public ReplacedBox {
|
2024-11-14 12:01:23 -03:00
|
|
|
GC_CELL(ImageBox, ReplacedBox);
|
|
|
|
|
GC_DECLARE_ALLOCATOR(ImageBox);
|
2022-10-17 09:41:50 -03:00
|
|
|
|
2019-10-05 17:07:45 -03:00
|
|
|
public:
|
2025-07-26 09:22:50 -03:00
|
|
|
ImageBox(DOM::Document&, GC::Ptr<DOM::Element>, GC::Ref<CSS::ComputedProperties>, ImageProvider const&);
|
2020-11-22 11:53:01 -03:00
|
|
|
virtual ~ImageBox() override;
|
2019-10-05 17:07:45 -03:00
|
|
|
|
2020-11-22 09:38:18 -03:00
|
|
|
virtual void prepare_for_replaced_layout() override;
|
2019-10-05 17:07:45 -03:00
|
|
|
|
2019-10-05 18:20:35 -03:00
|
|
|
bool renders_as_alt_text() const;
|
|
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
virtual GC::Ptr<Painting::Paintable> create_paintable() const override;
|
2022-03-10 10:02:25 -03:00
|
|
|
|
2023-05-12 02:17:01 -03:00
|
|
|
auto const& image_provider() const { return m_image_provider; }
|
|
|
|
|
auto& image_provider() { return m_image_provider; }
|
2022-03-10 10:02:25 -03:00
|
|
|
|
2024-02-18 22:10:37 -03:00
|
|
|
void dom_node_did_update_alt_text(Badge<ImageProvider>);
|
2022-09-07 11:46:05 -03:00
|
|
|
|
2019-10-05 17:07:45 -03:00
|
|
|
private:
|
2024-02-26 13:36:48 -03:00
|
|
|
virtual void visit_edges(Visitor&) override;
|
|
|
|
|
|
2023-05-12 02:17:01 -03:00
|
|
|
ImageProvider const& m_image_provider;
|
2022-09-07 11:46:05 -03:00
|
|
|
|
2022-11-04 17:54:05 -03:00
|
|
|
Optional<CSSPixels> m_cached_alt_text_width;
|
2019-10-05 17:07:45 -03:00
|
|
|
};
|
2019-12-18 16:52:36 -03:00
|
|
|
|
|
|
|
|
}
|