mirror of
https://github.com/RGBCube/serenity
synced 2025-05-18 20:15:08 +00:00

Images being aware of being visible inside the viewport is a painting concern, not a layout concern.
37 lines
866 B
C++
37 lines
866 B
C++
/*
|
|
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibWeb/HTML/BrowsingContext.h>
|
|
#include <LibWeb/Layout/ImageBox.h>
|
|
#include <LibWeb/Painting/PaintableBox.h>
|
|
|
|
namespace Web::Painting {
|
|
|
|
class ImagePaintable final
|
|
: public PaintableBox
|
|
, public HTML::BrowsingContext::ViewportClient {
|
|
JS_CELL(ImagePaintable, PaintableBox);
|
|
|
|
public:
|
|
static JS::NonnullGCPtr<ImagePaintable> create(Layout::ImageBox const&);
|
|
|
|
virtual void paint(PaintContext&, PaintPhase) const override;
|
|
|
|
Layout::ImageBox const& layout_box() const;
|
|
|
|
private:
|
|
// ^JS::Cell
|
|
virtual void finalize() override;
|
|
|
|
// ^BrowsingContext::ViewportClient
|
|
virtual void browsing_context_did_set_viewport_rect(CSSPixelRect const&) final;
|
|
|
|
ImagePaintable(Layout::ImageBox const&);
|
|
};
|
|
|
|
}
|