summaryrefslogtreecommitdiff
path: root/Libraries/LibHTML/DOM
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-10-05 22:07:45 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-10-05 23:29:01 +0200
commit09dccb32245485e626048edfec484c52de145007 (patch)
tree780f134b4b620977e7e48d84dd472e88de1fdb96 /Libraries/LibHTML/DOM
parent7162347563ded87d57066080d481222505eca6df (diff)
downloadserenity-09dccb32245485e626048edfec484c52de145007.zip
LibHTML: Flesh out <img> element with LayoutImage and LayoutReplaced
This patch adds parsing of <img> into HTMLImageElement objects. It also adds LayoutImage and its parent class LayoutReplaced, which is going to represent CSS "replaced elements."
Diffstat (limited to 'Libraries/LibHTML/DOM')
-rw-r--r--Libraries/LibHTML/DOM/HTMLImageElement.cpp10
-rw-r--r--Libraries/LibHTML/DOM/HTMLImageElement.h12
2 files changed, 22 insertions, 0 deletions
diff --git a/Libraries/LibHTML/DOM/HTMLImageElement.cpp b/Libraries/LibHTML/DOM/HTMLImageElement.cpp
new file mode 100644
index 0000000000..864cc2b91e
--- /dev/null
+++ b/Libraries/LibHTML/DOM/HTMLImageElement.cpp
@@ -0,0 +1,10 @@
+#include <LibHTML/DOM/HTMLImageElement.h>
+
+HTMLImageElement::HTMLImageElement(Document& document, const String& tag_name)
+ : HTMLElement(document, tag_name)
+{
+}
+
+HTMLImageElement::~HTMLImageElement()
+{
+}
diff --git a/Libraries/LibHTML/DOM/HTMLImageElement.h b/Libraries/LibHTML/DOM/HTMLImageElement.h
new file mode 100644
index 0000000000..0bb37bd2ed
--- /dev/null
+++ b/Libraries/LibHTML/DOM/HTMLImageElement.h
@@ -0,0 +1,12 @@
+#pragma once
+
+#include <LibHTML/DOM/HTMLElement.h>
+
+class HTMLImageElement : public HTMLElement {
+public:
+ HTMLImageElement(Document&, const String& tag_name);
+ virtual ~HTMLImageElement() override;
+
+ String alt() const { return attribute("alt"); }
+ String src() const { return attribute("src"); }
+};