ladybird/Userland/Libraries/LibWeb/Layout/ImageBox.h
Andreas Kling 4190fd2199 LibWeb: Rename Web::Frame to Web::BrowsingContext
Our "frame" concept very closely matches what the web specs call a
"browsing context", so let's rename it to that. :^)

The "main frame" becomes the "top-level browsing context",
and "sub-frames" are now "nested browsing contexts".
2021-05-30 12:39:53 +02:00

38 lines
976 B
C++

/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/HTML/HTMLImageElement.h>
#include <LibWeb/Layout/ReplacedBox.h>
#include <LibWeb/Page/BrowsingContext.h>
namespace Web::Layout {
class ImageBox
: public ReplacedBox
, public BrowsingContext::ViewportClient {
public:
ImageBox(DOM::Document&, DOM::Element&, NonnullRefPtr<CSS::StyleProperties>, const ImageLoader&);
virtual ~ImageBox() override;
virtual void prepare_for_replaced_layout() override;
virtual void paint(PaintContext&, PaintPhase) override;
const DOM::Element& dom_node() const { return static_cast<const DOM::Element&>(ReplacedBox::dom_node()); }
bool renders_as_alt_text() const;
private:
virtual void frame_did_set_viewport_rect(const Gfx::IntRect&) final;
int preferred_width() const;
int preferred_height() const;
const ImageLoader& m_image_loader;
};
}