2019-10-05 17:07:45 -03:00
|
|
|
#pragma once
|
|
|
|
|
|
2019-10-05 18:41:14 -03:00
|
|
|
#include <LibDraw/GraphicsBitmap.h>
|
2019-10-19 14:56:49 -03:00
|
|
|
#include <LibDraw/ImageDecoder.h>
|
2019-10-05 17:07:45 -03:00
|
|
|
#include <LibHTML/DOM/HTMLElement.h>
|
|
|
|
|
|
2019-12-18 16:57:18 -03:00
|
|
|
class LayoutDocument;
|
|
|
|
|
|
2019-10-05 17:07:45 -03:00
|
|
|
class HTMLImageElement : public HTMLElement {
|
|
|
|
|
public:
|
|
|
|
|
HTMLImageElement(Document&, const String& tag_name);
|
|
|
|
|
virtual ~HTMLImageElement() override;
|
|
|
|
|
|
2019-10-06 09:03:51 -03:00
|
|
|
virtual void parse_attribute(const String& name, const String& value) override;
|
|
|
|
|
|
2019-10-05 17:07:45 -03:00
|
|
|
String alt() const { return attribute("alt"); }
|
|
|
|
|
String src() const { return attribute("src"); }
|
2019-10-06 09:15:30 -03:00
|
|
|
int preferred_width() const;
|
|
|
|
|
int preferred_height() const;
|
2019-10-05 18:20:35 -03:00
|
|
|
|
2019-10-05 18:41:14 -03:00
|
|
|
const GraphicsBitmap* bitmap() const;
|
2019-10-20 05:39:59 -03:00
|
|
|
const ImageDecoder* image_decoder() const { return m_image_decoder; }
|
2019-10-05 18:41:14 -03:00
|
|
|
|
2019-12-18 16:57:18 -03:00
|
|
|
void set_volatile(Badge<LayoutDocument>, bool);
|
|
|
|
|
|
2019-10-05 18:20:35 -03:00
|
|
|
private:
|
2019-10-06 09:03:51 -03:00
|
|
|
void load_image(const String& src);
|
|
|
|
|
|
2019-10-15 10:06:16 -03:00
|
|
|
virtual RefPtr<LayoutNode> create_layout_node(const StyleProperties* parent_style) const override;
|
2019-10-05 18:41:14 -03:00
|
|
|
|
2019-10-20 05:39:59 -03:00
|
|
|
RefPtr<ImageDecoder> m_image_decoder;
|
2019-12-11 14:30:42 -03:00
|
|
|
ByteBuffer m_encoded_data;
|
2019-10-05 17:07:45 -03:00
|
|
|
};
|