mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 17:55:07 +02:00
Remove 11 heavy includes from Document.h that were only needed for pointer/reference types (already forward-declared in Forward.h), and extract the nested ViewportClient interface to a standalone header. This reduces Document.h's recompilation cascade from ~1228 files to ~717 files (42% reduction). Headers like BrowsingContext.h that were previously transitively included see even larger improvements (from ~1228 down to ~73 dependents).
50 lines
1.3 KiB
C++
50 lines
1.3 KiB
C++
/*
|
|
* Copyright (c) 2022, Andreas Kling <andreas@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibWeb/DOM/ViewportClient.h>
|
|
#include <LibWeb/Layout/ImageBox.h>
|
|
#include <LibWeb/Layout/SVGImageBox.h>
|
|
#include <LibWeb/Painting/PaintableBox.h>
|
|
|
|
namespace Web::Painting {
|
|
|
|
class ImagePaintable final
|
|
: public PaintableBox
|
|
, public DOM::ViewportClient {
|
|
GC_CELL(ImagePaintable, PaintableBox);
|
|
GC_DECLARE_ALLOCATOR(ImagePaintable);
|
|
|
|
public:
|
|
static constexpr bool OVERRIDES_FINALIZE = true;
|
|
|
|
static GC::Ref<ImagePaintable> create(Layout::ImageBox const& layout_box);
|
|
static GC::Ref<ImagePaintable> create(Layout::SVGImageBox const& layout_box);
|
|
|
|
virtual void paint(DisplayListRecordingContext&, PaintPhase) const override;
|
|
virtual void reset_for_relayout() override;
|
|
|
|
private:
|
|
// ^JS::Cell
|
|
virtual void visit_edges(Visitor&) override;
|
|
virtual void finalize() override;
|
|
|
|
// ^Document::ViewportClient
|
|
virtual void did_set_viewport_rect(CSSPixelRect const&) final;
|
|
|
|
ImagePaintable(Layout::Box const& layout_box, Layout::ImageProvider const& image_provider, bool renders_as_alt_text, String alt_text, bool is_svg_image);
|
|
|
|
bool m_renders_as_alt_text { false };
|
|
String m_alt_text;
|
|
|
|
Layout::ImageProvider const& m_image_provider;
|
|
|
|
bool m_is_svg_image { false };
|
|
};
|
|
|
|
}
|