summaryrefslogtreecommitdiff
path: root/Libraries/LibHTML/Layout/LayoutImage.h
blob: 5fcf62ca55ed9c7072e8952299d78e87ccaef7a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#pragma once

#include <LibHTML/DOM/HTMLImageElement.h>
#include <LibHTML/Layout/LayoutReplaced.h>

class HTMLImageElement;

class LayoutImage : public LayoutReplaced {
public:
    LayoutImage(const HTMLImageElement&, NonnullRefPtr<StyleProperties>);
    virtual ~LayoutImage() override;

    virtual void layout() override;
    virtual void render(RenderingContext&) override;

    const HTMLImageElement& node() const { return static_cast<const HTMLImageElement&>(LayoutReplaced::node()); }

    bool renders_as_alt_text() const;

private:
    virtual const char* class_name() const override { return "LayoutImage"; }
    virtual bool is_image() const override { return true; }
};

template<>
inline bool is<LayoutImage>(const LayoutNode& node)
{
    return node.is_image();
}