summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-01-12 12:17:30 +0100
committerAndreas Kling <kling@serenityos.org>2021-01-12 12:17:46 +0100
commit13d7c09125f8eec703d0a43a9a87fc8aa08f7319 (patch)
tree70fd643c429cea5c1f9362c2674511d17a53f3b5 /Userland/Libraries/LibWeb/HTML
parentdc28c07fa526841e05e16161c74a6c23984f1dd5 (diff)
downloadserenity-13d7c09125f8eec703d0a43a9a87fc8aa08f7319.zip
Libraries: Move to Userland/Libraries/
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML')
-rw-r--r--Userland/Libraries/LibWeb/HTML/AttributeNames.cpp63
-rw-r--r--Userland/Libraries/LibWeb/HTML/AttributeNames.h163
-rw-r--r--Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp227
-rw-r--r--Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.h103
-rw-r--r--Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.idl29
-rw-r--r--Userland/Libraries/LibWeb/HTML/EventNames.cpp49
-rw-r--r--Userland/Libraries/LibWeb/HTML/EventNames.h85
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h46
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.idl16
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLAreaElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLAreaElement.idl5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLAudioElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLAudioElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLAudioElement.idl5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLBRElement.cpp46
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLBRElement.h43
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLBRElement.idl5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLBaseElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLBaseElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLBaseElement.idl5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLBlinkElement.cpp57
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLBlinkElement.h45
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp81
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLBodyElement.h47
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLBodyElement.idl10
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLButtonElement.idl8
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp105
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h58
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.idl7
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLDListElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLDListElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLDListElement.idl5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLDataElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLDataElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLDataElement.idl5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLDataListElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLDataListElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLDataListElement.idl5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.idl5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLDialogElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLDialogElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLDialogElement.idl5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.h42
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.idl5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLDivElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLDivElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLDivElement.idl5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLElement.cpp141
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLElement.h60
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLElement.idl11
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.idl11
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h47
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.idl5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLFontElement.cpp53
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLFontElement.h43
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLFontElement.idl7
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp151
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLFormElement.h53
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLFormElement.idl10
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLFrameElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLFrameElement.h42
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLFrameElement.idl9
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.h42
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.idl6
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLHRElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLHRElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLHRElement.idl9
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLHeadElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLHeadElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLHeadElement.idl5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.idl5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.idl5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp108
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h60
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.idl19
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp100
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLImageElement.h61
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLImageElement.idl14
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp117
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLInputElement.h57
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLInputElement.idl27
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLLIElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLLIElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLLIElement.idl5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLLabelElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLLabelElement.idl5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLLegendElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLLegendElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLLegendElement.idl5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp104
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLLinkElement.h69
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLLinkElement.idl17
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLMapElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLMapElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLMapElement.idl5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.h42
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.idl9
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLMediaElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLMediaElement.idl10
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLMenuElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLMenuElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLMenuElement.idl5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLMetaElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLMetaElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLMetaElement.idl9
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLMeterElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLMeterElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLMeterElement.idl5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLModElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLModElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLModElement.idl6
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLOListElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLOListElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLOListElement.idl8
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp77
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h55
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLObjectElement.idl19
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.idl6
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLOptionElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLOptionElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLOptionElement.idl6
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLOutputElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h47
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLOutputElement.idl5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.idl5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLParamElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLParamElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLParamElement.idl9
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLPictureElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLPictureElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLPictureElement.idl5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLPreElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLPreElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLPreElement.idl5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLProgressElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLProgressElement.idl5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.idl5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp193
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLScriptElement.h70
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLScriptElement.idl13
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLSelectElement.idl7
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLSlotElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLSlotElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLSlotElement.idl5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLSourceElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLSourceElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLSourceElement.idl9
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLSpanElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLSpanElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLSpanElement.idl5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp67
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLStyleElement.h47
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLStyleElement.idl7
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.idl5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp65
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.h44
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.idl18
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTableColElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTableColElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTableColElement.idl9
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp63
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTableElement.h44
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTableElement.idl14
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.idl10
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.idl8
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.cpp61
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.h50
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.idl5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h47
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.idl12
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTimeElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTimeElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTimeElement.idl5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTitleElement.cpp49
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTitleElement.h44
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTitleElement.idl5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTrackElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTrackElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLTrackElement.idl8
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLUListElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLUListElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLUListElement.idl6
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.idl5
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLVideoElement.cpp40
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLVideoElement.h41
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLVideoElement.idl6
-rw-r--r--Userland/Libraries/LibWeb/HTML/ImageData.cpp85
-rw-r--r--Userland/Libraries/LibWeb/HTML/ImageData.h61
-rw-r--r--Userland/Libraries/LibWeb/HTML/ImageData.idl7
-rw-r--r--Userland/Libraries/LibWeb/HTML/Parser/Entities.cpp2302
-rw-r--r--Userland/Libraries/LibWeb/HTML/Parser/Entities.h43
-rw-r--r--Userland/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.cpp3027
-rw-r--r--Userland/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.h193
-rw-r--r--Userland/Libraries/LibWeb/HTML/Parser/HTMLToken.cpp83
-rw-r--r--Userland/Libraries/LibWeb/HTML/Parser/HTMLToken.h226
-rw-r--r--Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp2663
-rw-r--r--Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.h190
-rw-r--r--Userland/Libraries/LibWeb/HTML/Parser/ListOfActiveFormattingElements.cpp84
-rw-r--r--Userland/Libraries/LibWeb/HTML/Parser/ListOfActiveFormattingElements.h65
-rw-r--r--Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.cpp159
-rw-r--r--Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.h82
-rw-r--r--Userland/Libraries/LibWeb/HTML/SubmitEvent.h54
-rw-r--r--Userland/Libraries/LibWeb/HTML/SubmitEvent.idl5
-rw-r--r--Userland/Libraries/LibWeb/HTML/TagNames.cpp51
-rw-r--r--Userland/Libraries/LibWeb/HTML/TagNames.h178
241 files changed, 17826 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/AttributeNames.cpp b/Userland/Libraries/LibWeb/HTML/AttributeNames.cpp
new file mode 100644
index 0000000000..e7a21e6b39
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/AttributeNames.cpp
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/AttributeNames.h>
+
+namespace Web {
+namespace HTML {
+namespace AttributeNames {
+
+#define __ENUMERATE_HTML_ATTRIBUTE(name) FlyString name;
+ENUMERATE_HTML_ATTRIBUTES
+#undef __ENUMERATE_HTML_ATTRIBUTE
+
+[[gnu::constructor]] static void initialize()
+{
+ static bool s_initialized = false;
+ if (s_initialized)
+ return;
+
+#define __ENUMERATE_HTML_ATTRIBUTE(name) \
+ name = #name;
+ ENUMERATE_HTML_ATTRIBUTES
+#undef __ENUMERATE_HTML_ATTRIBUTE
+
+ // NOTE: Special cases for C++ keywords.
+ class_ = "class";
+ for_ = "for";
+ default_ = "default";
+ char_ = "char";
+
+ // NOTE: Special cases for attributes with dashes in them.
+ accept_charset = "accept-charset";
+ http_equiv = "http-equiv";
+
+ s_initialized = true;
+}
+
+}
+}
+}
diff --git a/Userland/Libraries/LibWeb/HTML/AttributeNames.h b/Userland/Libraries/LibWeb/HTML/AttributeNames.h
new file mode 100644
index 0000000000..670ec9bdb4
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/AttributeNames.h
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <AK/FlyString.h>
+
+namespace Web {
+namespace HTML {
+namespace AttributeNames {
+
+#define ENUMERATE_HTML_ATTRIBUTES \
+ __ENUMERATE_HTML_ATTRIBUTE(abbr) \
+ __ENUMERATE_HTML_ATTRIBUTE(accept) \
+ __ENUMERATE_HTML_ATTRIBUTE(accept_charset) \
+ __ENUMERATE_HTML_ATTRIBUTE(action) \
+ __ENUMERATE_HTML_ATTRIBUTE(align) \
+ __ENUMERATE_HTML_ATTRIBUTE(alink) \
+ __ENUMERATE_HTML_ATTRIBUTE(allow) \
+ __ENUMERATE_HTML_ATTRIBUTE(allowfullscreen) \
+ __ENUMERATE_HTML_ATTRIBUTE(alt) \
+ __ENUMERATE_HTML_ATTRIBUTE(archive) \
+ __ENUMERATE_HTML_ATTRIBUTE(async) \
+ __ENUMERATE_HTML_ATTRIBUTE(autoplay) \
+ __ENUMERATE_HTML_ATTRIBUTE(axis) \
+ __ENUMERATE_HTML_ATTRIBUTE(background) \
+ __ENUMERATE_HTML_ATTRIBUTE(behaviour) \
+ __ENUMERATE_HTML_ATTRIBUTE(bgcolor) \
+ __ENUMERATE_HTML_ATTRIBUTE(border) \
+ __ENUMERATE_HTML_ATTRIBUTE(cellpadding) \
+ __ENUMERATE_HTML_ATTRIBUTE(cellspacing) \
+ __ENUMERATE_HTML_ATTRIBUTE(char_) \
+ __ENUMERATE_HTML_ATTRIBUTE(charoff) \
+ __ENUMERATE_HTML_ATTRIBUTE(charset) \
+ __ENUMERATE_HTML_ATTRIBUTE(checked) \
+ __ENUMERATE_HTML_ATTRIBUTE(cite) \
+ __ENUMERATE_HTML_ATTRIBUTE(class_) \
+ __ENUMERATE_HTML_ATTRIBUTE(clear) \
+ __ENUMERATE_HTML_ATTRIBUTE(code) \
+ __ENUMERATE_HTML_ATTRIBUTE(codetype) \
+ __ENUMERATE_HTML_ATTRIBUTE(color) \
+ __ENUMERATE_HTML_ATTRIBUTE(cols) \
+ __ENUMERATE_HTML_ATTRIBUTE(colspan) \
+ __ENUMERATE_HTML_ATTRIBUTE(compact) \
+ __ENUMERATE_HTML_ATTRIBUTE(content) \
+ __ENUMERATE_HTML_ATTRIBUTE(contenteditable) \
+ __ENUMERATE_HTML_ATTRIBUTE(controls) \
+ __ENUMERATE_HTML_ATTRIBUTE(coords) \
+ __ENUMERATE_HTML_ATTRIBUTE(data) \
+ __ENUMERATE_HTML_ATTRIBUTE(datetime) \
+ __ENUMERATE_HTML_ATTRIBUTE(declare) \
+ __ENUMERATE_HTML_ATTRIBUTE(default_) \
+ __ENUMERATE_HTML_ATTRIBUTE(defer) \
+ __ENUMERATE_HTML_ATTRIBUTE(disabled) \
+ __ENUMERATE_HTML_ATTRIBUTE(download) \
+ __ENUMERATE_HTML_ATTRIBUTE(direction) \
+ __ENUMERATE_HTML_ATTRIBUTE(dirname) \
+ __ENUMERATE_HTML_ATTRIBUTE(event) \
+ __ENUMERATE_HTML_ATTRIBUTE(face) \
+ __ENUMERATE_HTML_ATTRIBUTE(for_) \
+ __ENUMERATE_HTML_ATTRIBUTE(formnovalidate) \
+ __ENUMERATE_HTML_ATTRIBUTE(formtarget) \
+ __ENUMERATE_HTML_ATTRIBUTE(frame) \
+ __ENUMERATE_HTML_ATTRIBUTE(frameborder) \
+ __ENUMERATE_HTML_ATTRIBUTE(headers) \
+ __ENUMERATE_HTML_ATTRIBUTE(height) \
+ __ENUMERATE_HTML_ATTRIBUTE(hidden) \
+ __ENUMERATE_HTML_ATTRIBUTE(href) \
+ __ENUMERATE_HTML_ATTRIBUTE(hreflang) \
+ __ENUMERATE_HTML_ATTRIBUTE(http_equiv) \
+ __ENUMERATE_HTML_ATTRIBUTE(id) \
+ __ENUMERATE_HTML_ATTRIBUTE(imagesizes) \
+ __ENUMERATE_HTML_ATTRIBUTE(imagesrcset) \
+ __ENUMERATE_HTML_ATTRIBUTE(integrity) \
+ __ENUMERATE_HTML_ATTRIBUTE(ismap) \
+ __ENUMERATE_HTML_ATTRIBUTE(label) \
+ __ENUMERATE_HTML_ATTRIBUTE(lang) \
+ __ENUMERATE_HTML_ATTRIBUTE(link) \
+ __ENUMERATE_HTML_ATTRIBUTE(longdesc) \
+ __ENUMERATE_HTML_ATTRIBUTE(loop) \
+ __ENUMERATE_HTML_ATTRIBUTE(max) \
+ __ENUMERATE_HTML_ATTRIBUTE(marginheight) \
+ __ENUMERATE_HTML_ATTRIBUTE(marginwidth) \
+ __ENUMERATE_HTML_ATTRIBUTE(media) \
+ __ENUMERATE_HTML_ATTRIBUTE(method) \
+ __ENUMERATE_HTML_ATTRIBUTE(min) \
+ __ENUMERATE_HTML_ATTRIBUTE(multiple) \
+ __ENUMERATE_HTML_ATTRIBUTE(name) \
+ __ENUMERATE_HTML_ATTRIBUTE(nohref) \
+ __ENUMERATE_HTML_ATTRIBUTE(nomodule) \
+ __ENUMERATE_HTML_ATTRIBUTE(noshade) \
+ __ENUMERATE_HTML_ATTRIBUTE(novalidate) \
+ __ENUMERATE_HTML_ATTRIBUTE(nowrap) \
+ __ENUMERATE_HTML_ATTRIBUTE(open) \
+ __ENUMERATE_HTML_ATTRIBUTE(pattern) \
+ __ENUMERATE_HTML_ATTRIBUTE(ping) \
+ __ENUMERATE_HTML_ATTRIBUTE(placeholder) \
+ __ENUMERATE_HTML_ATTRIBUTE(playsinline) \
+ __ENUMERATE_HTML_ATTRIBUTE(poster) \
+ __ENUMERATE_HTML_ATTRIBUTE(readonly) \
+ __ENUMERATE_HTML_ATTRIBUTE(rel) \
+ __ENUMERATE_HTML_ATTRIBUTE(required) \
+ __ENUMERATE_HTML_ATTRIBUTE(rev) \
+ __ENUMERATE_HTML_ATTRIBUTE(reversed) \
+ __ENUMERATE_HTML_ATTRIBUTE(rows) \
+ __ENUMERATE_HTML_ATTRIBUTE(rules) \
+ __ENUMERATE_HTML_ATTRIBUTE(scheme) \
+ __ENUMERATE_HTML_ATTRIBUTE(scrolling) \
+ __ENUMERATE_HTML_ATTRIBUTE(selected) \
+ __ENUMERATE_HTML_ATTRIBUTE(shape) \
+ __ENUMERATE_HTML_ATTRIBUTE(size) \
+ __ENUMERATE_HTML_ATTRIBUTE(sizes) \
+ __ENUMERATE_HTML_ATTRIBUTE(src) \
+ __ENUMERATE_HTML_ATTRIBUTE(srcdoc) \
+ __ENUMERATE_HTML_ATTRIBUTE(srclang) \
+ __ENUMERATE_HTML_ATTRIBUTE(srcset) \
+ __ENUMERATE_HTML_ATTRIBUTE(standby) \
+ __ENUMERATE_HTML_ATTRIBUTE(step) \
+ __ENUMERATE_HTML_ATTRIBUTE(style) \
+ __ENUMERATE_HTML_ATTRIBUTE(summary) \
+ __ENUMERATE_HTML_ATTRIBUTE(target) \
+ __ENUMERATE_HTML_ATTRIBUTE(text) \
+ __ENUMERATE_HTML_ATTRIBUTE(title) \
+ __ENUMERATE_HTML_ATTRIBUTE(type) \
+ __ENUMERATE_HTML_ATTRIBUTE(usemap) \
+ __ENUMERATE_HTML_ATTRIBUTE(value) \
+ __ENUMERATE_HTML_ATTRIBUTE(valuetype) \
+ __ENUMERATE_HTML_ATTRIBUTE(valign) \
+ __ENUMERATE_HTML_ATTRIBUTE(version) \
+ __ENUMERATE_HTML_ATTRIBUTE(vlink) \
+ __ENUMERATE_HTML_ATTRIBUTE(width) \
+ __ENUMERATE_HTML_ATTRIBUTE(wrap)
+
+#define __ENUMERATE_HTML_ATTRIBUTE(name) extern FlyString name;
+ENUMERATE_HTML_ATTRIBUTES
+#undef __ENUMERATE_HTML_ATTRIBUTE
+
+}
+}
+}
diff --git a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp
new file mode 100644
index 0000000000..d029e77eb8
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp
@@ -0,0 +1,227 @@
+/*
+ * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <AK/OwnPtr.h>
+#include <LibGfx/Painter.h>
+#include <LibWeb/Bindings/CanvasRenderingContext2DWrapper.h>
+#include <LibWeb/HTML/CanvasRenderingContext2D.h>
+#include <LibWeb/HTML/HTMLCanvasElement.h>
+#include <LibWeb/HTML/HTMLImageElement.h>
+#include <LibWeb/HTML/ImageData.h>
+
+namespace Web::HTML {
+
+CanvasRenderingContext2D::CanvasRenderingContext2D(HTMLCanvasElement& element)
+ : m_element(element)
+{
+}
+
+CanvasRenderingContext2D::~CanvasRenderingContext2D()
+{
+}
+
+void CanvasRenderingContext2D::set_fill_style(String style)
+{
+ m_fill_style = Gfx::Color::from_string(style).value_or(Color::Black);
+}
+
+String CanvasRenderingContext2D::fill_style() const
+{
+ return m_fill_style.to_string();
+}
+
+void CanvasRenderingContext2D::fill_rect(float x, float y, float width, float height)
+{
+ auto painter = this->painter();
+ if (!painter)
+ return;
+
+ auto rect = m_transform.map(Gfx::FloatRect(x, y, width, height));
+ painter->fill_rect(enclosing_int_rect(rect), m_fill_style);
+ did_draw(rect);
+}
+
+void CanvasRenderingContext2D::set_stroke_style(String style)
+{
+ m_stroke_style = Gfx::Color::from_string(style).value_or(Color::Black);
+}
+
+String CanvasRenderingContext2D::stroke_style() const
+{
+ return m_fill_style.to_string();
+}
+
+void CanvasRenderingContext2D::stroke_rect(float x, float y, float width, float height)
+{
+ auto painter = this->painter();
+ if (!painter)
+ return;
+
+ auto rect = m_transform.map(Gfx::FloatRect(x, y, width, height));
+
+ auto top_left = m_transform.map(Gfx::FloatPoint(x, y)).to_type<int>();
+ auto top_right = m_transform.map(Gfx::FloatPoint(x + width - 1, y)).to_type<int>();
+ auto bottom_left = m_transform.map(Gfx::FloatPoint(x, y + height - 1)).to_type<int>();
+ auto bottom_right = m_transform.map(Gfx::FloatPoint(x + width - 1, y + height - 1)).to_type<int>();
+
+ painter->draw_line(top_left, top_right, m_stroke_style, m_line_width);
+ painter->draw_line(top_right, bottom_right, m_stroke_style, m_line_width);
+ painter->draw_line(bottom_right, bottom_left, m_stroke_style, m_line_width);
+ painter->draw_line(bottom_left, top_left, m_stroke_style, m_line_width);
+
+ did_draw(rect);
+}
+
+void CanvasRenderingContext2D::draw_image(const HTMLImageElement& image_element, float x, float y)
+{
+ if (!image_element.bitmap())
+ return;
+
+ auto painter = this->painter();
+ if (!painter)
+ return;
+
+ auto src_rect = image_element.bitmap()->rect();
+ Gfx::FloatRect dst_rect = { x, y, (float)image_element.bitmap()->width(), (float)image_element.bitmap()->height() };
+ auto rect = m_transform.map(dst_rect);
+
+ painter->draw_scaled_bitmap(enclosing_int_rect(rect), *image_element.bitmap(), src_rect);
+}
+
+void CanvasRenderingContext2D::scale(float sx, float sy)
+{
+ dbg() << "CanvasRenderingContext2D::scale(): " << sx << ", " << sy;
+ m_transform.scale(sx, sy);
+}
+
+void CanvasRenderingContext2D::translate(float tx, float ty)
+{
+ dbg() << "CanvasRenderingContext2D::translate(): " << tx << ", " << ty;
+ m_transform.translate(tx, ty);
+}
+
+void CanvasRenderingContext2D::rotate(float radians)
+{
+ dbg() << "CanvasRenderingContext2D::rotate(): " << radians;
+ m_transform.rotate_radians(radians);
+}
+
+void CanvasRenderingContext2D::did_draw(const Gfx::FloatRect&)
+{
+ // FIXME: Make use of the rect to reduce the invalidated area when possible.
+ if (!m_element)
+ return;
+ if (!m_element->layout_node())
+ return;
+ m_element->layout_node()->set_needs_display();
+}
+
+OwnPtr<Gfx::Painter> CanvasRenderingContext2D::painter()
+{
+ if (!m_element)
+ return {};
+
+ if (!m_element->bitmap()) {
+ if (!m_element->create_bitmap())
+ return {};
+ }
+
+ return make<Gfx::Painter>(*m_element->bitmap());
+}
+
+void CanvasRenderingContext2D::begin_path()
+{
+ m_path = Gfx::Path();
+}
+
+void CanvasRenderingContext2D::close_path()
+{
+ m_path.close();
+}
+
+void CanvasRenderingContext2D::move_to(float x, float y)
+{
+ m_path.move_to({ x, y });
+}
+
+void CanvasRenderingContext2D::line_to(float x, float y)
+{
+ m_path.line_to({ x, y });
+}
+
+void CanvasRenderingContext2D::quadratic_curve_to(float cx, float cy, float x, float y)
+{
+ m_path.quadratic_bezier_curve_to({ cx, cy }, { x, y });
+}
+
+void CanvasRenderingContext2D::stroke()
+{
+ auto painter = this->painter();
+ if (!painter)
+ return;
+
+ painter->stroke_path(m_path, m_stroke_style, m_line_width);
+}
+
+void CanvasRenderingContext2D::fill(Gfx::Painter::WindingRule winding)
+{
+ auto painter = this->painter();
+ if (!painter)
+ return;
+
+ auto path = m_path;
+ path.close_all_subpaths();
+ painter->fill_path(path, m_fill_style, winding);
+}
+
+void CanvasRenderingContext2D::fill(const String& fill_rule)
+{
+ if (fill_rule == "evenodd")
+ return fill(Gfx::Painter::WindingRule::EvenOdd);
+ return fill(Gfx::Painter::WindingRule::Nonzero);
+}
+
+RefPtr<ImageData> CanvasRenderingContext2D::create_image_data(int width, int height) const
+{
+ if (!wrapper()) {
+ dbgln("Hmm! Attempted to create ImageData for wrapper-less CRC2D.");
+ return {};
+ }
+ return ImageData::create_with_size(wrapper()->global_object(), width, height);
+}
+
+void CanvasRenderingContext2D::put_image_data(const ImageData& image_data, float x, float y)
+{
+ auto painter = this->painter();
+ if (!painter)
+ return;
+
+ painter->blit(Gfx::IntPoint(x, y), image_data.bitmap(), image_data.bitmap().rect());
+
+ did_draw(Gfx::FloatRect(x, y, image_data.width(), image_data.height()));
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.h b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.h
new file mode 100644
index 0000000000..58cccfc6e6
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.h
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <AK/RefCounted.h>
+#include <LibGfx/AffineTransform.h>
+#include <LibGfx/Color.h>
+#include <LibGfx/Forward.h>
+#include <LibGfx/Painter.h>
+#include <LibGfx/Path.h>
+#include <LibWeb/Bindings/Wrappable.h>
+
+namespace Web::HTML {
+
+class CanvasRenderingContext2D
+ : public RefCounted<CanvasRenderingContext2D>
+ , public Bindings::Wrappable {
+
+ AK_MAKE_NONCOPYABLE(CanvasRenderingContext2D);
+ AK_MAKE_NONMOVABLE(CanvasRenderingContext2D);
+
+public:
+ using WrapperType = Bindings::CanvasRenderingContext2DWrapper;
+
+ static NonnullRefPtr<CanvasRenderingContext2D> create(HTMLCanvasElement& element) { return adopt(*new CanvasRenderingContext2D(element)); }
+ ~CanvasRenderingContext2D();
+
+ void set_fill_style(String);
+ String fill_style() const;
+
+ void set_stroke_style(String);
+ String stroke_style() const;
+
+ void fill_rect(float x, float y, float width, float height);
+ void stroke_rect(float x, float y, float width, float height);
+
+ void draw_image(const HTMLImageElement&, float x, float y);
+
+ void scale(float sx, float sy);
+ void translate(float x, float y);
+ void rotate(float degrees);
+
+ void set_line_width(float line_width) { m_line_width = line_width; }
+ float line_width() const { return m_line_width; }
+
+ void begin_path();
+ void close_path();
+ void move_to(float x, float y);
+ void line_to(float x, float y);
+ void quadratic_curve_to(float cx, float cy, float x, float y);
+ void stroke();
+
+ // FIXME: We should only have one fill(), really. Fix the wrapper generator!
+ void fill(Gfx::Painter::WindingRule);
+ void fill(const String& fill_rule);
+
+ RefPtr<ImageData> create_image_data(int width, int height) const;
+ void put_image_data(const ImageData&, float x, float y);
+
+ HTMLCanvasElement* canvas() { return m_element; }
+
+private:
+ explicit CanvasRenderingContext2D(HTMLCanvasElement&);
+
+ void did_draw(const Gfx::FloatRect&);
+
+ OwnPtr<Gfx::Painter> painter();
+
+ WeakPtr<HTMLCanvasElement> m_element;
+
+ Gfx::AffineTransform m_transform;
+ Gfx::Color m_fill_style;
+ Gfx::Color m_stroke_style;
+ float m_line_width { 1 };
+
+ Gfx::Path m_path;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.idl b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.idl
new file mode 100644
index 0000000000..bcfa544c67
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.idl
@@ -0,0 +1,29 @@
+interface CanvasRenderingContext2D {
+
+ undefined fillRect(double x, double y, double w, double h);
+ undefined strokeRect(double x, double y, double w, double h);
+
+ undefined scale(double x, double y);
+ undefined translate(double x, double y);
+ undefined rotate(double radians);
+
+ undefined beginPath();
+ undefined closePath();
+ undefined fill(DOMString fillRule);
+ undefined stroke();
+ undefined moveTo(double x, double y);
+ undefined lineTo(double x, double y);
+ undefined quadraticCurveTo(double cpx, double cpy, double x, double y);
+
+ undefined drawImage(HTMLImageElement image, double dx, double dy);
+
+ attribute DOMString fillStyle;
+ attribute DOMString strokeStyle;
+ attribute double lineWidth;
+
+ ImageData createImageData(double sw, double sh);
+ undefined putImageData(ImageData imagedata, double dx, double dy);
+
+ readonly attribute HTMLCanvasElement canvas;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/EventNames.cpp b/Userland/Libraries/LibWeb/HTML/EventNames.cpp
new file mode 100644
index 0000000000..6856aa2d03
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/EventNames.cpp
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2020, the SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/EventNames.h>
+
+namespace Web::HTML::EventNames {
+
+#define __ENUMERATE_HTML_EVENT(name) FlyString name;
+ENUMERATE_HTML_EVENTS
+#undef __ENUMERATE_HTML_EVENT
+
+[[gnu::constructor]] static void initialize()
+{
+ static bool s_initialized = false;
+ if (s_initialized)
+ return;
+
+#define __ENUMERATE_HTML_EVENT(name) \
+ name = #name;
+ ENUMERATE_HTML_EVENTS
+#undef __ENUMERATE_HTML_EVENT
+
+ s_initialized = true;
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/EventNames.h b/Userland/Libraries/LibWeb/HTML/EventNames.h
new file mode 100644
index 0000000000..d36056ef01
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/EventNames.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2020, the SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <AK/FlyString.h>
+
+namespace Web::HTML::EventNames {
+
+// FIXME: Add media events https://html.spec.whatwg.org/multipage/media.html#mediaevents
+// FIXME: Add app cache events https://html.spec.whatwg.org/multipage/offline.html#appcacheevents
+// FIXME: Add drag and drop events https://html.spec.whatwg.org/multipage/dnd.html#dndevents
+
+#define ENUMERATE_HTML_EVENTS \
+ __ENUMERATE_HTML_EVENT(abort) \
+ __ENUMERATE_HTML_EVENT(DOMContentLoaded) \
+ __ENUMERATE_HTML_EVENT(afterprint) \
+ __ENUMERATE_HTML_EVENT(beforeprint) \
+ __ENUMERATE_HTML_EVENT(beforeunload) \
+ __ENUMERATE_HTML_EVENT(blur) \
+ __ENUMERATE_HTML_EVENT(cancel) \
+ __ENUMERATE_HTML_EVENT(change) \
+ __ENUMERATE_HTML_EVENT(click) \
+ __ENUMERATE_HTML_EVENT(close) \
+ __ENUMERATE_HTML_EVENT(connect) \
+ __ENUMERATE_HTML_EVENT(contextmenu) \
+ __ENUMERATE_HTML_EVENT(copy) \
+ __ENUMERATE_HTML_EVENT(cut) \
+ __ENUMERATE_HTML_EVENT(error) \
+ __ENUMERATE_HTML_EVENT(focus) \
+ __ENUMERATE_HTML_EVENT(formdata) \
+ __ENUMERATE_HTML_EVENT(hashchange) \
+ __ENUMERATE_HTML_EVENT(input) \
+ __ENUMERATE_HTML_EVENT(invalid) \
+ __ENUMERATE_HTML_EVENT(languagechange) \
+ __ENUMERATE_HTML_EVENT(load) \
+ __ENUMERATE_HTML_EVENT(message) \
+ __ENUMERATE_HTML_EVENT(messageerror) \
+ __ENUMERATE_HTML_EVENT(offline) \
+ __ENUMERATE_HTML_EVENT(online) \
+ __ENUMERATE_HTML_EVENT(open) \
+ __ENUMERATE_HTML_EVENT(pagehide) \
+ __ENUMERATE_HTML_EVENT(pageshow) \
+ __ENUMERATE_HTML_EVENT(paste) \
+ __ENUMERATE_HTML_EVENT(popstate) \
+ __ENUMERATE_HTML_EVENT(readystatechange) \
+ __ENUMERATE_HTML_EVENT(rejectionhandled) \
+ __ENUMERATE_HTML_EVENT(reset) \
+ __ENUMERATE_HTML_EVENT(securitypolicyviolation) \
+ __ENUMERATE_HTML_EVENT(select) \
+ __ENUMERATE_HTML_EVENT(slotchange) \
+ __ENUMERATE_HTML_EVENT(storage) \
+ __ENUMERATE_HTML_EVENT(submit) \
+ __ENUMERATE_HTML_EVENT(toggle) \
+ __ENUMERATE_HTML_EVENT(unhandledrejection) \
+ __ENUMERATE_HTML_EVENT(unload)
+
+#define __ENUMERATE_HTML_EVENT(name) extern FlyString name;
+ENUMERATE_HTML_EVENTS
+#undef __ENUMERATE_HTML_EVENT
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp
new file mode 100644
index 0000000000..f79debf4cc
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLAnchorElement.h>
+
+namespace Web::HTML {
+
+HTMLAnchorElement::HTMLAnchorElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLAnchorElement::~HTMLAnchorElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h
new file mode 100644
index 0000000000..02d7349116
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLAnchorElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLAnchorElementWrapper;
+
+ HTMLAnchorElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLAnchorElement() override;
+
+ String href() const { return attribute(HTML::AttributeNames::href); }
+ String target() const { return attribute(HTML::AttributeNames::target); }
+
+ virtual bool is_focusable() const override { return has_attribute(HTML::AttributeNames::href); }
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.idl
new file mode 100644
index 0000000000..829b9039ee
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.idl
@@ -0,0 +1,16 @@
+interface HTMLAnchorElement : HTMLElement {
+
+ [Reflect] attribute DOMString target;
+ [Reflect] attribute DOMString download;
+ [Reflect] attribute DOMString ping;
+ [Reflect] attribute DOMString rel;
+ [Reflect] attribute DOMString hreflang;
+ [Reflect] attribute DOMString type;
+
+ [Reflect] attribute DOMString coords;
+ [Reflect] attribute DOMString charset;
+ [Reflect] attribute DOMString name;
+ [Reflect] attribute DOMString rev;
+ [Reflect] attribute DOMString shape;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp
new file mode 100644
index 0000000000..fe9c9a2147
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLAreaElement.h>
+
+namespace Web::HTML {
+
+HTMLAreaElement::HTMLAreaElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLAreaElement::~HTMLAreaElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.h b/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.h
new file mode 100644
index 0000000000..29fa82ffa0
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLAreaElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLAreaElementWrapper;
+
+ HTMLAreaElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLAreaElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.idl
new file mode 100644
index 0000000000..7cd0058305
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.idl
@@ -0,0 +1,5 @@
+interface HTMLAreaElement : HTMLElement {
+
+ [Reflect=nohref] attribute boolean noHref;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.cpp
new file mode 100644
index 0000000000..2653ebf944
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLAudioElement.h>
+
+namespace Web::HTML {
+
+HTMLAudioElement::HTMLAudioElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLMediaElement(document, qualified_name)
+{
+}
+
+HTMLAudioElement::~HTMLAudioElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.h b/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.h
new file mode 100644
index 0000000000..ce6a43b021
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLMediaElement.h>
+
+namespace Web::HTML {
+
+class HTMLAudioElement final : public HTMLMediaElement {
+public:
+ using WrapperType = Bindings::HTMLAudioElementWrapper;
+
+ HTMLAudioElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLAudioElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.idl
new file mode 100644
index 0000000000..c56ca47938
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.idl
@@ -0,0 +1,5 @@
+interface HTMLAudioElement : HTMLMediaElement {
+
+
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBRElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLBRElement.cpp
new file mode 100644
index 0000000000..d3a0bc1b9e
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLBRElement.cpp
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLBRElement.h>
+#include <LibWeb/Layout/BreakNode.h>
+
+namespace Web::HTML {
+
+HTMLBRElement::HTMLBRElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLBRElement::~HTMLBRElement()
+{
+}
+
+RefPtr<Layout::Node> HTMLBRElement::create_layout_node()
+{
+ return adopt(*new Layout::BreakNode(document(), *this));
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBRElement.h b/Userland/Libraries/LibWeb/HTML/HTMLBRElement.h
new file mode 100644
index 0000000000..5e453c6ecb
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLBRElement.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLBRElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLBRElementWrapper;
+
+ HTMLBRElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLBRElement() override;
+
+ virtual RefPtr<Layout::Node> create_layout_node() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBRElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLBRElement.idl
new file mode 100644
index 0000000000..a71383c890
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLBRElement.idl
@@ -0,0 +1,5 @@
+interface HTMLBRElement : HTMLElement {
+
+ [Reflect] attribute DOMString clear;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.cpp
new file mode 100644
index 0000000000..975d0bddda
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLBaseElement.h>
+
+namespace Web::HTML {
+
+HTMLBaseElement::HTMLBaseElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLBaseElement::~HTMLBaseElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.h b/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.h
new file mode 100644
index 0000000000..ce2be21e0d
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLBaseElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLBaseElementWrapper;
+
+ HTMLBaseElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLBaseElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.idl
new file mode 100644
index 0000000000..868e4a84a4
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.idl
@@ -0,0 +1,5 @@
+interface HTMLBaseElement : HTMLElement {
+
+ [Reflect] attribute DOMString target;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBlinkElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLBlinkElement.cpp
new file mode 100644
index 0000000000..911a8940bd
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLBlinkElement.cpp
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibCore/Timer.h>
+#include <LibWeb/CSS/StyleProperties.h>
+#include <LibWeb/CSS/StyleValue.h>
+#include <LibWeb/HTML/HTMLBlinkElement.h>
+#include <LibWeb/Layout/Node.h>
+
+namespace Web::HTML {
+
+HTMLBlinkElement::HTMLBlinkElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+ , m_timer(Core::Timer::construct())
+{
+ m_timer->set_interval(500);
+ m_timer->on_timeout = [this] { blink(); };
+ m_timer->start();
+}
+
+HTMLBlinkElement::~HTMLBlinkElement()
+{
+}
+
+void HTMLBlinkElement::blink()
+{
+ if (!layout_node())
+ return;
+
+ layout_node()->set_visible(!layout_node()->is_visible());
+ layout_node()->set_needs_display();
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBlinkElement.h b/Userland/Libraries/LibWeb/HTML/HTMLBlinkElement.h
new file mode 100644
index 0000000000..e4c4c3421f
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLBlinkElement.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibCore/Forward.h>
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLBlinkElement final : public HTMLElement {
+public:
+ HTMLBlinkElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLBlinkElement() override;
+
+private:
+ void blink();
+
+ NonnullRefPtr<Core::Timer> m_timer;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp
new file mode 100644
index 0000000000..e6b7272f8d
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/CSS/StyleProperties.h>
+#include <LibWeb/CSS/StyleValue.h>
+#include <LibWeb/DOM/Document.h>
+#include <LibWeb/HTML/HTMLBodyElement.h>
+
+namespace Web::HTML {
+
+HTMLBodyElement::HTMLBodyElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLBodyElement::~HTMLBodyElement()
+{
+}
+
+void HTMLBodyElement::apply_presentational_hints(CSS::StyleProperties& style) const
+{
+ for_each_attribute([&](auto& name, auto& value) {
+ if (name.equals_ignoring_case("bgcolor")) {
+ auto color = Color::from_string(value);
+ if (color.has_value())
+ style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value()));
+ } else if (name.equals_ignoring_case("text")) {
+ auto color = Color::from_string(value);
+ if (color.has_value())
+ style.set_property(CSS::PropertyID::Color, CSS::ColorStyleValue::create(color.value()));
+ } else if (name.equals_ignoring_case("background")) {
+ ASSERT(m_background_style_value);
+ style.set_property(CSS::PropertyID::BackgroundImage, *m_background_style_value);
+ }
+ });
+}
+
+void HTMLBodyElement::parse_attribute(const FlyString& name, const String& value)
+{
+ HTMLElement::parse_attribute(name, value);
+ if (name.equals_ignoring_case("link")) {
+ auto color = Color::from_string(value);
+ if (color.has_value())
+ document().set_link_color(color.value());
+ } else if (name.equals_ignoring_case("alink")) {
+ auto color = Color::from_string(value);
+ if (color.has_value())
+ document().set_active_link_color(color.value());
+ } else if (name.equals_ignoring_case("vlink")) {
+ auto color = Color::from_string(value);
+ if (color.has_value())
+ document().set_visited_link_color(color.value());
+ } else if (name.equals_ignoring_case("background")) {
+ m_background_style_value = CSS::ImageStyleValue::create(document().complete_url(value), const_cast<DOM::Document&>(document()));
+ }
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.h b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.h
new file mode 100644
index 0000000000..d8d41cbb7b
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLBodyElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLBodyElementWrapper;
+
+ HTMLBodyElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLBodyElement() override;
+
+ virtual void parse_attribute(const FlyString&, const String&) override;
+ virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
+
+private:
+ RefPtr<CSS::ImageStyleValue> m_background_style_value;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.idl
new file mode 100644
index 0000000000..dcd0b4d753
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.idl
@@ -0,0 +1,10 @@
+interface HTMLBodyElement : HTMLElement {
+
+ [LegacyNullToEmptyString, Reflect] attribute DOMString text;
+ [LegacyNullToEmptyString, Reflect] attribute DOMString link;
+ [LegacyNullToEmptyString, Reflect=vlink] attribute DOMString vLink;
+ [LegacyNullToEmptyString, Reflect=alink] attribute DOMString aLink;
+ [LegacyNullToEmptyString, Reflect=bgcolor] attribute DOMString bgColor;
+ [Reflect] attribute DOMString background;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp
new file mode 100644
index 0000000000..ec4925965b
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLButtonElement.h>
+
+namespace Web::HTML {
+
+HTMLButtonElement::HTMLButtonElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLButtonElement::~HTMLButtonElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h
new file mode 100644
index 0000000000..234656a97d
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLButtonElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLButtonElementWrapper;
+
+ HTMLButtonElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLButtonElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.idl
new file mode 100644
index 0000000000..7e50852e64
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.idl
@@ -0,0 +1,8 @@
+interface HTMLButtonElement : HTMLElement {
+
+ [Reflect=formnovalidate] attribute boolean formNoValidate;
+ [Reflect=formtarget] attribute DOMString formTarget;
+ [Reflect] attribute DOMString name;
+ [Reflect] attribute DOMString value;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp
new file mode 100644
index 0000000000..d015225460
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <AK/Checked.h>
+#include <LibGfx/Bitmap.h>
+#include <LibWeb/CSS/StyleResolver.h>
+#include <LibWeb/DOM/Document.h>
+#include <LibWeb/HTML/CanvasRenderingContext2D.h>
+#include <LibWeb/HTML/HTMLCanvasElement.h>
+#include <LibWeb/Layout/CanvasBox.h>
+
+namespace Web::HTML {
+
+static constexpr auto max_canvas_area = 16384 * 16384;
+
+HTMLCanvasElement::HTMLCanvasElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLCanvasElement::~HTMLCanvasElement()
+{
+}
+
+unsigned HTMLCanvasElement::width() const
+{
+ return attribute(HTML::AttributeNames::width).to_uint().value_or(300);
+}
+
+unsigned HTMLCanvasElement::height() const
+{
+ return attribute(HTML::AttributeNames::height).to_uint().value_or(150);
+}
+
+RefPtr<Layout::Node> HTMLCanvasElement::create_layout_node()
+{
+ auto style = document().style_resolver().resolve_style(*this);
+ if (style->display() == CSS::Display::None)
+ return nullptr;
+ return adopt(*new Layout::CanvasBox(document(), *this, move(style)));
+}
+
+CanvasRenderingContext2D* HTMLCanvasElement::get_context(String type)
+{
+ ASSERT(type == "2d");
+ if (!m_context)
+ m_context = CanvasRenderingContext2D::create(*this);
+ return m_context;
+}
+
+static Gfx::IntSize bitmap_size_for_canvas(const HTMLCanvasElement& canvas)
+{
+ auto width = canvas.width();
+ auto height = canvas.height();
+
+ Checked<size_t> area = width;
+ area *= height;
+
+ if (area.has_overflow()) {
+ dbgln("Refusing to create {}x{} canvas (overflow)", width, height);
+ return {};
+ }
+ if (area.value() > max_canvas_area) {
+ dbgln("Refusing to create {}x{} canvas (exceeds maximum size)", width, height);
+ return {};
+ }
+ return Gfx::IntSize(width, height);
+}
+
+bool HTMLCanvasElement::create_bitmap()
+{
+ auto size = bitmap_size_for_canvas(*this);
+ if (size.is_empty()) {
+ m_bitmap = nullptr;
+ return false;
+ }
+ if (!m_bitmap || m_bitmap->size() != size)
+ m_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::RGBA32, size);
+ return m_bitmap;
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h
new file mode 100644
index 0000000000..9616af98b7
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <AK/ByteBuffer.h>
+#include <LibGfx/Forward.h>
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLCanvasElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLCanvasElementWrapper;
+
+ HTMLCanvasElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLCanvasElement() override;
+
+ const Gfx::Bitmap* bitmap() const { return m_bitmap; }
+ Gfx::Bitmap* bitmap() { return m_bitmap; }
+ bool create_bitmap();
+
+ CanvasRenderingContext2D* get_context(String type);
+
+ unsigned width() const;
+ unsigned height() const;
+
+private:
+ virtual RefPtr<Layout::Node> create_layout_node() override;
+
+ RefPtr<Gfx::Bitmap> m_bitmap;
+ RefPtr<CanvasRenderingContext2D> m_context;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.idl
new file mode 100644
index 0000000000..5a04895fb4
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.idl
@@ -0,0 +1,7 @@
+interface HTMLCanvasElement : HTMLElement {
+
+ CanvasRenderingContext2D? getContext(DOMString contextId);
+ readonly attribute unsigned long width;
+ readonly attribute unsigned long height;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDListElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDListElement.cpp
new file mode 100644
index 0000000000..ce68845ca6
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLDListElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLDListElement.h>
+
+namespace Web::HTML {
+
+HTMLDListElement::HTMLDListElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLDListElement::~HTMLDListElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDListElement.h b/Userland/Libraries/LibWeb/HTML/HTMLDListElement.h
new file mode 100644
index 0000000000..cf0fe2a9c2
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLDListElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLDListElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLDListElementWrapper;
+
+ HTMLDListElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLDListElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDListElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLDListElement.idl
new file mode 100644
index 0000000000..16b3b881ac
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLDListElement.idl
@@ -0,0 +1,5 @@
+interface HTMLDListElement : HTMLElement {
+
+ [Reflect] attribute boolean compact;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDataElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDataElement.cpp
new file mode 100644
index 0000000000..1a23f48fd9
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLDataElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLDataElement.h>
+
+namespace Web::HTML {
+
+HTMLDataElement::HTMLDataElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLDataElement::~HTMLDataElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDataElement.h b/Userland/Libraries/LibWeb/HTML/HTMLDataElement.h
new file mode 100644
index 0000000000..21918958cd
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLDataElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLDataElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLDataElementWrapper;
+
+ HTMLDataElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLDataElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDataElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLDataElement.idl
new file mode 100644
index 0000000000..4edce306fa
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLDataElement.idl
@@ -0,0 +1,5 @@
+interface HTMLDataElement : HTMLElement {
+
+ [Reflect] attribute DOMString value;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.cpp
new file mode 100644
index 0000000000..32bae03035
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLDataListElement.h>
+
+namespace Web::HTML {
+
+HTMLDataListElement::HTMLDataListElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLDataListElement::~HTMLDataListElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.h b/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.h
new file mode 100644
index 0000000000..85bc7ccf7d
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLDataListElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLDataListElementWrapper;
+
+ HTMLDataListElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLDataListElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.idl
new file mode 100644
index 0000000000..c9383448e4
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.idl
@@ -0,0 +1,5 @@
+interface HTMLDataListElement : HTMLElement {
+
+
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.cpp
new file mode 100644
index 0000000000..abcdf0801a
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLDetailsElement.h>
+
+namespace Web::HTML {
+
+HTMLDetailsElement::HTMLDetailsElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLDetailsElement::~HTMLDetailsElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.h b/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.h
new file mode 100644
index 0000000000..2bdbf673f8
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLDetailsElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLDetailsElementWrapper;
+
+ HTMLDetailsElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLDetailsElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.idl
new file mode 100644
index 0000000000..2b0daa6c7f
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.idl
@@ -0,0 +1,5 @@
+interface HTMLDetailsElement : HTMLElement {
+
+ [Reflect] attribute boolean open;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.cpp
new file mode 100644
index 0000000000..7437ca2261
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLDialogElement.h>
+
+namespace Web::HTML {
+
+HTMLDialogElement::HTMLDialogElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLDialogElement::~HTMLDialogElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.h b/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.h
new file mode 100644
index 0000000000..133f65ddbd
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLDialogElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLDialogElementWrapper;
+
+ HTMLDialogElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLDialogElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.idl
new file mode 100644
index 0000000000..0d37547ed3
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.idl
@@ -0,0 +1,5 @@
+interface HTMLDialogElement : HTMLElement {
+
+ [Reflect] attribute boolean open;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.cpp
new file mode 100644
index 0000000000..53fee8b14a
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLDirectoryElement.h>
+
+namespace Web::HTML {
+
+HTMLDirectoryElement::HTMLDirectoryElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLDirectoryElement::~HTMLDirectoryElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.h b/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.h
new file mode 100644
index 0000000000..39a9f5ae94
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+// NOTE: This element is marked as obsolete, but is still listed as required by the specification.
+class HTMLDirectoryElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLDirectoryElementWrapper;
+
+ HTMLDirectoryElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLDirectoryElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.idl
new file mode 100644
index 0000000000..9adb6ad670
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.idl
@@ -0,0 +1,5 @@
+interface HTMLDirectoryElement : HTMLElement {
+
+ [Reflect] attribute boolean compact;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDivElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDivElement.cpp
new file mode 100644
index 0000000000..7392f8ec80
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLDivElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLDivElement.h>
+
+namespace Web::HTML {
+
+HTMLDivElement::HTMLDivElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLDivElement::~HTMLDivElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDivElement.h b/Userland/Libraries/LibWeb/HTML/HTMLDivElement.h
new file mode 100644
index 0000000000..eade002544
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLDivElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLDivElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLDivElementWrapper;
+
+ HTMLDivElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLDivElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDivElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLDivElement.idl
new file mode 100644
index 0000000000..bb5cfba9b4
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLDivElement.idl
@@ -0,0 +1,5 @@
+interface HTMLDivElement : HTMLElement {
+
+ [Reflect] attribute DOMString align;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp
new file mode 100644
index 0000000000..eb5356a594
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <AK/StringBuilder.h>
+#include <LibWeb/DOM/Document.h>
+#include <LibWeb/HTML/HTMLAnchorElement.h>
+#include <LibWeb/HTML/HTMLElement.h>
+#include <LibWeb/Layout/BreakNode.h>
+#include <LibWeb/Layout/TextNode.h>
+
+namespace Web::HTML {
+
+HTMLElement::HTMLElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : Element(document, qualified_name)
+{
+}
+
+HTMLElement::~HTMLElement()
+{
+}
+
+HTMLElement::ContentEditableState HTMLElement::content_editable_state() const
+{
+ auto contenteditable = attribute(HTML::AttributeNames::contenteditable);
+ // "true" and the empty string map to the "true" state.
+ if ((!contenteditable.is_null() && contenteditable.is_empty()) || contenteditable.equals_ignoring_case("true"))
+ return ContentEditableState::True;
+ // "false" maps to the "false" state.
+ if (contenteditable.equals_ignoring_case("false"))
+ return ContentEditableState::False;
+ // "inherit", an invalid value, and a missing value all map to the "inherit" state.
+ return ContentEditableState::Inherit;
+}
+
+bool HTMLElement::is_editable() const
+{
+ switch (content_editable_state()) {
+ case ContentEditableState::True:
+ return true;
+ case ContentEditableState::False:
+ return false;
+ case ContentEditableState::Inherit:
+ return parent() && parent()->is_editable();
+ default:
+ ASSERT_NOT_REACHED();
+ }
+}
+
+String HTMLElement::content_editable() const
+{
+ switch (content_editable_state()) {
+ case ContentEditableState::True:
+ return "true";
+ case ContentEditableState::False:
+ return "false";
+ case ContentEditableState::Inherit:
+ return "inherit";
+ default:
+ ASSERT_NOT_REACHED();
+ }
+}
+
+void HTMLElement::set_content_editable(const String& content_editable)
+{
+ if (content_editable.equals_ignoring_case("inherit")) {
+ remove_attribute(HTML::AttributeNames::contenteditable);
+ return;
+ }
+ if (content_editable.equals_ignoring_case("true")) {
+ set_attribute(HTML::AttributeNames::contenteditable, "true");
+ return;
+ }
+ if (content_editable.equals_ignoring_case("false")) {
+ set_attribute(HTML::AttributeNames::contenteditable, "false");
+ return;
+ }
+ // FIXME: otherwise the attribute setter must throw a "SyntaxError" DOMException.
+}
+
+void HTMLElement::set_inner_text(StringView text)
+{
+ remove_all_children();
+ append_child(document().create_text_node(text));
+
+ set_needs_style_update(true);
+ document().invalidate_layout();
+}
+
+String HTMLElement::inner_text()
+{
+ StringBuilder builder;
+
+ // innerText for element being rendered takes visibility into account, so force a layout and then walk the layout tree.
+ document().update_layout();
+ if (!layout_node())
+ return text_content();
+
+ Function<void(const Layout::Node&)> recurse = [&](auto& node) {
+ for (auto* child = node.first_child(); child; child = child->next_sibling()) {
+ if (is<Layout::TextNode>(child))
+ builder.append(downcast<Layout::TextNode>(*child).text_for_rendering());
+ if (is<Layout::BreakNode>(child))
+ builder.append('\n');
+ recurse(*child);
+ }
+ };
+ recurse(*layout_node());
+
+ return builder.to_string();
+}
+
+bool HTMLElement::cannot_navigate() const
+{
+ // FIXME: Return true if element's node document is not fully active
+ return !is<HTML::HTMLAnchorElement>(this) && !is_connected();
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLElement.h b/Userland/Libraries/LibWeb/HTML/HTMLElement.h
new file mode 100644
index 0000000000..ee602a62b5
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLElement.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/DOM/Element.h>
+
+namespace Web::HTML {
+
+class HTMLElement : public DOM::Element {
+public:
+ using WrapperType = Bindings::HTMLElementWrapper;
+
+ HTMLElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLElement() override;
+
+ String title() const { return attribute(HTML::AttributeNames::title); }
+
+ virtual bool is_editable() const final;
+ String content_editable() const;
+ void set_content_editable(const String&);
+
+ String inner_text();
+ void set_inner_text(StringView);
+
+ bool cannot_navigate() const;
+
+private:
+ enum class ContentEditableState {
+ True,
+ False,
+ Inherit,
+ };
+ ContentEditableState content_editable_state() const;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLElement.idl
new file mode 100644
index 0000000000..6b5de34cdb
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLElement.idl
@@ -0,0 +1,11 @@
+interface HTMLElement : Element {
+
+ [Reflect] attribute DOMString title;
+ [Reflect] attribute DOMString lang;
+
+ [Reflect] attribute boolean hidden;
+
+ attribute DOMString contentEditable;
+
+ [LegacyNullToEmptyString] attribute DOMString innerText;
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.cpp
new file mode 100644
index 0000000000..1ec87b0fd0
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLEmbedElement.h>
+
+namespace Web::HTML {
+
+HTMLEmbedElement::HTMLEmbedElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLEmbedElement::~HTMLEmbedElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.h b/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.h
new file mode 100644
index 0000000000..1ceaaae634
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLEmbedElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLEmbedElementWrapper;
+
+ HTMLEmbedElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLEmbedElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.idl
new file mode 100644
index 0000000000..5eb48b3509
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.idl
@@ -0,0 +1,11 @@
+interface HTMLEmbedElement : HTMLElement {
+
+ [Reflect] attribute DOMString src;
+ [Reflect] attribute DOMString type;
+ [Reflect] attribute DOMString width;
+ [Reflect] attribute DOMString height;
+
+ [Reflect] attribute DOMString align;
+ [Reflect] attribute DOMString name;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.cpp
new file mode 100644
index 0000000000..6a6c5bf87e
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLFieldSetElement.h>
+
+namespace Web::HTML {
+
+HTMLFieldSetElement::HTMLFieldSetElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLFieldSetElement::~HTMLFieldSetElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h b/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h
new file mode 100644
index 0000000000..b9ffcf43be
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLFieldSetElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLFieldSetElementWrapper;
+
+ HTMLFieldSetElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLFieldSetElement() override;
+
+ const String& type() const
+ {
+ static String fieldset = "fieldset";
+ return fieldset;
+ }
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.idl
new file mode 100644
index 0000000000..4901c8aae8
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.idl
@@ -0,0 +1,5 @@
+interface HTMLFieldSetElement : HTMLElement {
+
+ readonly attribute DOMString type;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFontElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFontElement.cpp
new file mode 100644
index 0000000000..50ef0e37f5
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLFontElement.cpp
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/CSS/StyleProperties.h>
+#include <LibWeb/CSS/StyleValue.h>
+#include <LibWeb/HTML/HTMLFontElement.h>
+
+namespace Web::HTML {
+
+HTMLFontElement::HTMLFontElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLFontElement::~HTMLFontElement()
+{
+}
+
+void HTMLFontElement::apply_presentational_hints(CSS::StyleProperties& style) const
+{
+ for_each_attribute([&](auto& name, auto& value) {
+ if (name.equals_ignoring_case("color")) {
+ auto color = Color::from_string(value);
+ if (color.has_value())
+ style.set_property(CSS::PropertyID::Color, CSS::ColorStyleValue::create(color.value()));
+ }
+ });
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFontElement.h b/Userland/Libraries/LibWeb/HTML/HTMLFontElement.h
new file mode 100644
index 0000000000..d414abc5a8
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLFontElement.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLFontElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLFontElementWrapper;
+
+ HTMLFontElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLFontElement() override;
+
+ virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFontElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLFontElement.idl
new file mode 100644
index 0000000000..578e313ed0
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLFontElement.idl
@@ -0,0 +1,7 @@
+interface HTMLFontElement : HTMLElement {
+
+ [LegacyNullToEmptyString, Reflect] attribute DOMString color;
+ [Reflect] attribute DOMString face;
+ [Reflect] attribute DOMString size;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp
new file mode 100644
index 0000000000..b632dab482
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <AK/StringBuilder.h>
+#include <LibWeb/HTML/EventNames.h>
+#include <LibWeb/HTML/HTMLFormElement.h>
+#include <LibWeb/HTML/HTMLInputElement.h>
+#include <LibWeb/HTML/SubmitEvent.h>
+#include <LibWeb/InProcessWebView.h>
+#include <LibWeb/Page/Frame.h>
+#include <LibWeb/URLEncoder.h>
+
+namespace Web::HTML {
+
+HTMLFormElement::HTMLFormElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLFormElement::~HTMLFormElement()
+{
+}
+
+void HTMLFormElement::submit_form(RefPtr<HTMLElement> submitter, bool from_submit_binding)
+{
+ if (cannot_navigate())
+ return;
+
+ if (action().is_null()) {
+ dbgln("Unsupported form action ''");
+ return;
+ }
+
+ auto effective_method = method().to_lowercase();
+
+ if (effective_method == "dialog") {
+ dbgln("Failed to submit form: Unsupported form method '{}'", method());
+ return;
+ }
+
+ if (effective_method != "get" && effective_method != "post") {
+ effective_method = "get";
+ }
+
+ if (!from_submit_binding) {
+ if (m_firing_submission_events)
+ return;
+
+ m_firing_submission_events = true;
+
+ // FIXME: If the submitter element's no-validate state is false...
+
+ RefPtr<HTMLElement> submitter_button;
+
+ if (submitter != this)
+ submitter_button = submitter;
+
+ auto submit_event = SubmitEvent::create(EventNames::submit, submitter_button);
+ submit_event->set_bubbles(true);
+ submit_event->set_cancelable(true);
+ bool continue_ = dispatch_event(submit_event);
+
+ m_firing_submission_events = false;
+
+ if (!continue_)
+ return;
+
+ // This is checked again because arbitrary JS may have run when handling submit,
+ // which may have changed the result.
+ if (cannot_navigate())
+ return;
+ }
+
+ URL url(document().complete_url(action()));
+
+ if (!url.is_valid()) {
+ dbgln("Failed to submit form: Invalid URL: {}", action());
+ return;
+ }
+
+ if (url.protocol() == "file") {
+ if (document().url().protocol() != "file") {
+ dbgln("Failed to submit form: Security violation: {} may not submit to {}", document().url(), url);
+ return;
+ }
+ if (effective_method != "get") {
+ dbgln("Failed to submit form: Unsupported form method '{}' for URL: {}", method(), url);
+ return;
+ }
+ } else if (url.protocol() != "http" && url.protocol() != "https") {
+ dbgln("Failed to submit form: Unsupported protocol for URL: {}", url);
+ return;
+ }
+
+ Vector<URLQueryParam> parameters;
+
+ for_each_in_subtree_of_type<HTMLInputElement>([&](auto& node) {
+ auto& input = downcast<HTMLInputElement>(node);
+ if (!input.name().is_null() && (input.type() != "submit" || &input == submitter))
+ parameters.append({ input.name(), input.value() });
+ return IterationDecision::Continue;
+ });
+
+ if (effective_method == "get") {
+ url.set_query(urlencode(parameters));
+ }
+
+ LoadRequest request;
+ request.set_url(url);
+
+ if (effective_method == "post") {
+ auto body = urlencode(parameters).to_byte_buffer();
+ request.set_method("POST");
+ request.set_header("Content-Type", "application/x-www-form-urlencoded");
+ request.set_header("Content-Length", String::number(body.size()));
+ request.set_body(body);
+ }
+
+ if (auto* page = document().page())
+ page->load(request);
+}
+
+void HTMLFormElement::submit()
+{
+ submit_form(this, true);
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.h b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.h
new file mode 100644
index 0000000000..8f90e8f3f7
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+#include <LibWeb/HTML/HTMLInputElement.h>
+
+namespace Web::HTML {
+
+class HTMLFormElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLFormElementWrapper;
+
+ HTMLFormElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLFormElement() override;
+
+ String action() const { return attribute(HTML::AttributeNames::action); }
+ String method() const { return attribute(HTML::AttributeNames::method); }
+
+ void submit_form(RefPtr<HTMLElement> submitter, bool from_submit_binding = false);
+
+ // NOTE: This is for the JS bindings. Use submit_form instead.
+ void submit();
+
+private:
+ bool m_firing_submission_events { false };
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.idl
new file mode 100644
index 0000000000..81d4fe37f4
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.idl
@@ -0,0 +1,10 @@
+interface HTMLFormElement : HTMLElement {
+
+ [Reflect] attribute DOMString name;
+ [Reflect] attribute DOMString rel;
+ [Reflect=accept-charset] attribute DOMString acceptCharset;
+ [Reflect=novalidate] attribute boolean noValidate;
+
+ undefined submit();
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.cpp
new file mode 100644
index 0000000000..ba2e0fb470
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLFrameElement.h>
+
+namespace Web::HTML {
+
+HTMLFrameElement::HTMLFrameElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLFrameElement::~HTMLFrameElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.h b/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.h
new file mode 100644
index 0000000000..7541bc80b5
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+// NOTE: This element is marked as obsolete, but is still listed as required by the specification.
+class HTMLFrameElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLFrameElementWrapper;
+
+ HTMLFrameElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLFrameElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.idl
new file mode 100644
index 0000000000..e1092ce79e
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.idl
@@ -0,0 +1,9 @@
+interface HTMLFrameElement : HTMLElement {
+
+ [Reflect] attribute DOMString name;
+ [Reflect] attribute DOMString scrolling;
+ [Reflect] attribute DOMString src;
+ [Reflect=frameborder] attribute DOMString frameBorder;
+ [Reflect=longdesc] attribute DOMString longDesc;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.cpp
new file mode 100644
index 0000000000..128da69ccf
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLFrameSetElement.h>
+
+namespace Web::HTML {
+
+HTMLFrameSetElement::HTMLFrameSetElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLFrameSetElement::~HTMLFrameSetElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.h b/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.h
new file mode 100644
index 0000000000..0c2af01678
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+// NOTE: This element is marked as obsolete, but is still listed as required by the specification.
+class HTMLFrameSetElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLFrameSetElementWrapper;
+
+ HTMLFrameSetElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLFrameSetElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.idl
new file mode 100644
index 0000000000..abf5699ec4
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.idl
@@ -0,0 +1,6 @@
+interface HTMLFrameSetElement : HTMLElement {
+
+ [Reflect] attribute DOMString cols;
+ [Reflect] attribute DOMString rows;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHRElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLHRElement.cpp
new file mode 100644
index 0000000000..82574cf789
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLHRElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLHRElement.h>
+
+namespace Web::HTML {
+
+HTMLHRElement::HTMLHRElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLHRElement::~HTMLHRElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHRElement.h b/Userland/Libraries/LibWeb/HTML/HTMLHRElement.h
new file mode 100644
index 0000000000..e8a23c1a19
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLHRElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLHRElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLHRElementWrapper;
+
+ HTMLHRElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLHRElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHRElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLHRElement.idl
new file mode 100644
index 0000000000..5cfd1e700e
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLHRElement.idl
@@ -0,0 +1,9 @@
+interface HTMLHRElement : HTMLElement {
+
+ [Reflect] attribute DOMString align;
+ [Reflect] attribute DOMString color;
+ [Reflect=noshade] attribute boolean noShade;
+ [Reflect] attribute DOMString size;
+ [Reflect] attribute DOMString width;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.cpp
new file mode 100644
index 0000000000..a17ead858b
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLHeadElement.h>
+
+namespace Web::HTML {
+
+HTMLHeadElement::HTMLHeadElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLHeadElement::~HTMLHeadElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.h b/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.h
new file mode 100644
index 0000000000..d378e1af77
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLHeadElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLHeadElementWrapper;
+
+ HTMLHeadElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLHeadElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.idl
new file mode 100644
index 0000000000..8730e7c1e4
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.idl
@@ -0,0 +1,5 @@
+interface HTMLHeadElement : HTMLElement {
+
+
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.cpp
new file mode 100644
index 0000000000..b899c873a5
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLHeadingElement.h>
+
+namespace Web::HTML {
+
+HTMLHeadingElement::HTMLHeadingElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLHeadingElement::~HTMLHeadingElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.h b/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.h
new file mode 100644
index 0000000000..654b75baf9
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLHeadingElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLHeadingElementWrapper;
+
+ HTMLHeadingElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLHeadingElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.idl
new file mode 100644
index 0000000000..fa3d5a4ed7
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.idl
@@ -0,0 +1,5 @@
+interface HTMLHeadingElement : HTMLElement {
+
+ [Reflect] attribute DOMString align;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.cpp
new file mode 100644
index 0000000000..ab1233f739
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLHtmlElement.h>
+
+namespace Web::HTML {
+
+HTMLHtmlElement::HTMLHtmlElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLHtmlElement::~HTMLHtmlElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.h b/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.h
new file mode 100644
index 0000000000..3e34c52f6c
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLHtmlElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLHtmlElementWrapper;
+
+ HTMLHtmlElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLHtmlElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.idl
new file mode 100644
index 0000000000..dad97564c8
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.idl
@@ -0,0 +1,5 @@
+interface HTMLHtmlElement : HTMLElement {
+
+ [Reflect] attribute DOMString version;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp
new file mode 100644
index 0000000000..e59818ba82
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibGUI/Button.h>
+#include <LibGUI/TextBox.h>
+#include <LibWeb/Bindings/WindowObject.h>
+#include <LibWeb/DOM/Document.h>
+#include <LibWeb/DOM/Event.h>
+#include <LibWeb/DOM/Window.h>
+#include <LibWeb/Dump.h>
+#include <LibWeb/HTML/EventNames.h>
+#include <LibWeb/HTML/HTMLFormElement.h>
+#include <LibWeb/HTML/HTMLIFrameElement.h>
+#include <LibWeb/HTML/Parser/HTMLDocumentParser.h>
+#include <LibWeb/InProcessWebView.h>
+#include <LibWeb/Layout/FrameBox.h>
+#include <LibWeb/Loader/ResourceLoader.h>
+#include <LibWeb/Origin.h>
+#include <LibWeb/Page/Frame.h>
+
+namespace Web::HTML {
+
+HTMLIFrameElement::HTMLIFrameElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+ ASSERT(document.frame());
+ m_content_frame = Frame::create_subframe(*this, document.frame()->main_frame());
+}
+
+HTMLIFrameElement::~HTMLIFrameElement()
+{
+}
+
+RefPtr<Layout::Node> HTMLIFrameElement::create_layout_node()
+{
+ auto style = document().style_resolver().resolve_style(*this);
+ return adopt(*new Layout::FrameBox(document(), *this, move(style)));
+}
+
+void HTMLIFrameElement::parse_attribute(const FlyString& name, const String& value)
+{
+ HTMLElement::parse_attribute(name, value);
+ if (name == HTML::AttributeNames::src)
+ load_src(value);
+}
+
+void HTMLIFrameElement::load_src(const String& value)
+{
+ auto url = document().complete_url(value);
+ if (!url.is_valid()) {
+ dbg() << "iframe failed to load URL: Invalid URL: " << value;
+ return;
+ }
+ if (url.protocol() == "file" && document().origin().protocol() != "file") {
+ dbg() << "iframe failed to load URL: Security violation: " << document().url() << " may not load " << url;
+ return;
+ }
+
+ dbg() << "Loading iframe document from " << value;
+ m_content_frame->loader().load(url, FrameLoader::Type::IFrame);
+}
+
+Origin HTMLIFrameElement::content_origin() const
+{
+ if (!m_content_frame || !m_content_frame->document())
+ return {};
+ return m_content_frame->document()->origin();
+}
+
+bool HTMLIFrameElement::may_access_from_origin(const Origin& origin) const
+{
+ return origin.is_same(content_origin());
+}
+
+const DOM::Document* HTMLIFrameElement::content_document() const
+{
+ return m_content_frame ? m_content_frame->document() : nullptr;
+}
+
+void HTMLIFrameElement::content_frame_did_load(Badge<FrameLoader>)
+{
+ dispatch_event(DOM::Event::create(EventNames::load));
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h
new file mode 100644
index 0000000000..0237ea3c91
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLIFrameElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLIFrameElementWrapper;
+
+ HTMLIFrameElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLIFrameElement() override;
+
+ virtual RefPtr<Layout::Node> create_layout_node() override;
+
+ Frame* content_frame() { return m_content_frame; }
+ const Frame* content_frame() const { return m_content_frame; }
+
+ const DOM::Document* content_document() const;
+
+ Origin content_origin() const;
+ bool may_access_from_origin(const Origin&) const;
+
+ void content_frame_did_load(Badge<FrameLoader>);
+
+private:
+ virtual void parse_attribute(const FlyString& name, const String& value) override;
+
+ void load_src(const String&);
+
+ RefPtr<Frame> m_content_frame;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.idl
new file mode 100644
index 0000000000..a219b66071
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.idl
@@ -0,0 +1,19 @@
+interface HTMLIFrameElement : HTMLElement {
+
+ [Reflect] attribute DOMString src;
+ [Reflect] attribute DOMString srcdoc;
+ [Reflect] attribute DOMString name;
+ [Reflect] attribute DOMString allow;
+ [Reflect] attribute DOMString width;
+ [Reflect] attribute DOMString height;
+ [Reflect=allowfullscreen] attribute boolean allowFullscreen;
+
+ [ReturnNullIfCrossOrigin] readonly attribute Document? contentDocument;
+
+ [Reflect] attribute DOMString align;
+ [Reflect] attribute DOMString scrolling;
+ [Reflect=frameborder] attribute DOMString frameBorder;
+
+ [LegacyNullToEmptyString, Reflect=marginheight] attribute DOMString marginHeight;
+ [LegacyNullToEmptyString, Reflect=marginwidth] attribute DOMString marginWidth;
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp
new file mode 100644
index 0000000000..61b99f0ffa
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibGfx/Bitmap.h>
+#include <LibGfx/ImageDecoder.h>
+#include <LibWeb/CSS/Parser/CSSParser.h>
+#include <LibWeb/CSS/StyleResolver.h>
+#include <LibWeb/DOM/Document.h>
+#include <LibWeb/DOM/Event.h>
+#include <LibWeb/HTML/EventNames.h>
+#include <LibWeb/HTML/HTMLImageElement.h>
+#include <LibWeb/Layout/ImageBox.h>
+#include <LibWeb/Loader/ResourceLoader.h>
+
+namespace Web::HTML {
+
+HTMLImageElement::HTMLImageElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+ m_image_loader.on_load = [this] {
+ this->document().update_layout();
+ dispatch_event(DOM::Event::create(EventNames::load));
+ };
+
+ m_image_loader.on_fail = [this] {
+ dbgln("HTMLImageElement: Resource did fail: {}", src());
+ this->document().update_layout();
+ dispatch_event(DOM::Event::create(EventNames::error));
+ };
+
+ m_image_loader.on_animate = [this] {
+ if (layout_node())
+ layout_node()->set_needs_display();
+ };
+}
+
+HTMLImageElement::~HTMLImageElement()
+{
+}
+
+void HTMLImageElement::apply_presentational_hints(CSS::StyleProperties& style) const
+{
+ for_each_attribute([&](auto& name, auto& value) {
+ if (name == HTML::AttributeNames::width) {
+ if (auto parsed_value = parse_html_length(document(), value)) {
+ style.set_property(CSS::PropertyID::Width, parsed_value.release_nonnull());
+ }
+ } else if (name == HTML::AttributeNames::height) {
+ if (auto parsed_value = parse_html_length(document(), value)) {
+ style.set_property(CSS::PropertyID::Height, parsed_value.release_nonnull());
+ }
+ }
+ });
+}
+
+void HTMLImageElement::parse_attribute(const FlyString& name, const String& value)
+{
+ HTMLElement::parse_attribute(name, value);
+
+ if (name == HTML::AttributeNames::src)
+ m_image_loader.load(document().complete_url(value));
+}
+
+RefPtr<Layout::Node> HTMLImageElement::create_layout_node()
+{
+ auto style = document().style_resolver().resolve_style(*this);
+ if (style->display() == CSS::Display::None)
+ return nullptr;
+ return adopt(*new Layout::ImageBox(document(), *this, move(style), m_image_loader));
+}
+
+const Gfx::Bitmap* HTMLImageElement::bitmap() const
+{
+ return m_image_loader.bitmap();
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h
new file mode 100644
index 0000000000..7cc97f1983
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <AK/ByteBuffer.h>
+#include <AK/OwnPtr.h>
+#include <LibGfx/Forward.h>
+#include <LibWeb/HTML/HTMLElement.h>
+#include <LibWeb/Loader/ImageLoader.h>
+
+namespace Web::HTML {
+
+class HTMLImageElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLImageElementWrapper;
+
+ HTMLImageElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLImageElement() override;
+
+ virtual void parse_attribute(const FlyString& name, const String& value) override;
+
+ String alt() const { return attribute(HTML::AttributeNames::alt); }
+ String src() const { return attribute(HTML::AttributeNames::src); }
+
+ const Gfx::Bitmap* bitmap() const;
+
+private:
+ virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
+
+ void animate();
+
+ virtual RefPtr<Layout::Node> create_layout_node() override;
+
+ ImageLoader m_image_loader;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.idl
new file mode 100644
index 0000000000..d0d4330a9a
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.idl
@@ -0,0 +1,14 @@
+interface HTMLImageElement : HTMLElement {
+
+ [Reflect] attribute DOMString src;
+ [Reflect] attribute DOMString alt;
+ [Reflect] attribute DOMString srcset;
+ [Reflect] attribute DOMString sizes;
+ [Reflect=usemap] attribute DOMString useMap;
+ [Reflect=ismap] attribute boolean isMap;
+
+ [Reflect] attribute DOMString name;
+ [Reflect] attribute DOMString align;
+ [LegacyNullToEmptyString, Reflect] attribute DOMString border;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
new file mode 100644
index 0000000000..c5654c3530
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibGUI/Button.h>
+#include <LibGUI/TextBox.h>
+#include <LibGfx/FontDatabase.h>
+#include <LibWeb/DOM/Document.h>
+#include <LibWeb/DOM/Event.h>
+#include <LibWeb/HTML/EventNames.h>
+#include <LibWeb/HTML/HTMLFormElement.h>
+#include <LibWeb/HTML/HTMLInputElement.h>
+#include <LibWeb/InProcessWebView.h>
+#include <LibWeb/Layout/ButtonBox.h>
+#include <LibWeb/Layout/CheckBox.h>
+#include <LibWeb/Layout/WidgetBox.h>
+#include <LibWeb/Page/Frame.h>
+
+namespace Web::HTML {
+
+HTMLInputElement::HTMLInputElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLInputElement::~HTMLInputElement()
+{
+}
+
+void HTMLInputElement::did_click_button(Badge<Layout::ButtonBox>)
+{
+ // FIXME: This should be a PointerEvent.
+ dispatch_event(DOM::Event::create(EventNames::click));
+
+ if (type().equals_ignoring_case("submit")) {
+ if (auto* form = first_ancestor_of_type<HTMLFormElement>()) {
+ form->submit_form(this);
+ }
+ return;
+ }
+}
+
+RefPtr<Layout::Node> HTMLInputElement::create_layout_node()
+{
+ ASSERT(document().page());
+ auto& page = *document().page();
+ auto& page_view = const_cast<InProcessWebView&>(static_cast<const InProcessWebView&>(page.client()));
+
+ if (type() == "hidden")
+ return nullptr;
+
+ auto style = document().style_resolver().resolve_style(*this);
+ if (style->display() == CSS::Display::None)
+ return nullptr;
+
+ if (type().equals_ignoring_case("submit") || type().equals_ignoring_case("button"))
+ return adopt(*new Layout::ButtonBox(document(), *this, move(style)));
+
+ if (type() == "checkbox")
+ return adopt(*new Layout::CheckBox(document(), *this, move(style)));
+
+ auto& text_box = page_view.add<GUI::TextBox>();
+ text_box.set_text(value());
+ text_box.on_change = [this] {
+ auto& widget = downcast<Layout::WidgetBox>(layout_node())->widget();
+ const_cast<HTMLInputElement*>(this)->set_attribute(HTML::AttributeNames::value, static_cast<const GUI::TextBox&>(widget).text());
+ };
+ int text_width = Gfx::FontDatabase::default_font().width(value());
+ auto size_value = attribute(HTML::AttributeNames::size);
+ if (!size_value.is_null()) {
+ auto size = size_value.to_uint();
+ if (size.has_value())
+ text_width = Gfx::FontDatabase::default_font().glyph_width('x') * size.value();
+ }
+ text_box.set_relative_rect(0, 0, text_width + 20, 20);
+ return adopt(*new Layout::WidgetBox(document(), *this, text_box));
+}
+
+void HTMLInputElement::set_checked(bool checked)
+{
+ if (m_checked == checked)
+ return;
+ m_checked = checked;
+ if (layout_node())
+ layout_node()->set_needs_display();
+
+ dispatch_event(DOM::Event::create(EventNames::change));
+}
+
+bool HTMLInputElement::enabled() const
+{
+ return !has_attribute(HTML::AttributeNames::disabled);
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h
new file mode 100644
index 0000000000..b887118263
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLInputElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLInputElementWrapper;
+
+ HTMLInputElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLInputElement() override;
+
+ virtual RefPtr<Layout::Node> create_layout_node() override;
+
+ String type() const { return attribute(HTML::AttributeNames::type); }
+ String value() const { return attribute(HTML::AttributeNames::value); }
+ String name() const { return attribute(HTML::AttributeNames::name); }
+
+ bool checked() const { return m_checked; }
+ void set_checked(bool);
+
+ bool enabled() const;
+
+ void did_click_button(Badge<Layout::ButtonBox>);
+
+private:
+ bool m_checked { false };
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.idl
new file mode 100644
index 0000000000..037b65c280
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.idl
@@ -0,0 +1,27 @@
+interface HTMLInputElement : HTMLElement {
+
+ [Reflect] attribute DOMString accept;
+ [Reflect] attribute DOMString alt;
+ [Reflect] attribute DOMString max;
+ [Reflect] attribute DOMString min;
+ [Reflect] attribute DOMString pattern;
+ [Reflect] attribute DOMString placeholder;
+ [Reflect] attribute DOMString src;
+ [Reflect] attribute DOMString step;
+ [Reflect=dirname] attribute DOMString dirName;
+ [Reflect=value] attribute DOMString defaultValue;
+
+ attribute boolean checked;
+
+ [Reflect] attribute boolean disabled;
+ [Reflect=checked] attribute boolean defaultChecked;
+ [Reflect=formnovalidate] attribute boolean formNoValidate;
+ [Reflect=formtarget] attribute DOMString formTarget;
+ [Reflect] attribute boolean multiple;
+ [Reflect=readonly] attribute boolean readOnly;
+ [Reflect] attribute boolean required;
+
+ [Reflect] attribute DOMString align;
+ [Reflect=usemap] attribute DOMString useMap;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLIElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLLIElement.cpp
new file mode 100644
index 0000000000..fbdb4d0444
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLLIElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLLIElement.h>
+
+namespace Web::HTML {
+
+HTMLLIElement::HTMLLIElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLLIElement::~HTMLLIElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLIElement.h b/Userland/Libraries/LibWeb/HTML/HTMLLIElement.h
new file mode 100644
index 0000000000..b0113aef9c
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLLIElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLLIElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLLIElementWrapper;
+
+ HTMLLIElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLLIElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLIElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLLIElement.idl
new file mode 100644
index 0000000000..9330aa88b1
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLLIElement.idl
@@ -0,0 +1,5 @@
+interface HTMLLIElement : HTMLElement {
+
+ [Reflect] attribute DOMString type;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp
new file mode 100644
index 0000000000..766c64eecd
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLLabelElement.h>
+
+namespace Web::HTML {
+
+HTMLLabelElement::HTMLLabelElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLLabelElement::~HTMLLabelElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.h b/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.h
new file mode 100644
index 0000000000..210e366ee0
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLLabelElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLLabelElementWrapper;
+
+ HTMLLabelElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLLabelElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.idl
new file mode 100644
index 0000000000..bbddd2052f
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.idl
@@ -0,0 +1,5 @@
+interface HTMLLabelElement : HTMLElement {
+
+ [Reflect=for] attribute DOMString htmlFor;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.cpp
new file mode 100644
index 0000000000..aa2bbc2049
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLLegendElement.h>
+
+namespace Web::HTML {
+
+HTMLLegendElement::HTMLLegendElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLLegendElement::~HTMLLegendElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.h b/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.h
new file mode 100644
index 0000000000..02a8b24585
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLLegendElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLLegendElementWrapper;
+
+ HTMLLegendElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLLegendElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.idl
new file mode 100644
index 0000000000..49ee03cd21
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.idl
@@ -0,0 +1,5 @@
+interface HTMLLegendElement : HTMLElement {
+
+ [Reflect] attribute DOMString align;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp
new file mode 100644
index 0000000000..323c642d61
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <AK/ByteBuffer.h>
+#include <AK/URL.h>
+#include <LibCore/File.h>
+#include <LibWeb/CSS/Parser/CSSParser.h>
+#include <LibWeb/DOM/Document.h>
+#include <LibWeb/HTML/HTMLLinkElement.h>
+#include <LibWeb/Loader/ResourceLoader.h>
+
+namespace Web::HTML {
+
+HTMLLinkElement::HTMLLinkElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLLinkElement::~HTMLLinkElement()
+{
+}
+
+void HTMLLinkElement::inserted_into(Node& node)
+{
+ HTMLElement::inserted_into(node);
+
+ if (m_relationship & Relationship::Stylesheet && !(m_relationship & Relationship::Alternate))
+ load_stylesheet(document().complete_url(href()));
+}
+
+void HTMLLinkElement::resource_did_fail()
+{
+}
+
+void HTMLLinkElement::resource_did_load()
+{
+ ASSERT(resource());
+ if (!resource()->has_encoded_data())
+ return;
+
+ dbg() << "HTMLLinkElement: Resource did load, looks good! " << href();
+
+ auto sheet = parse_css(CSS::ParsingContext(document()), resource()->encoded_data());
+ if (!sheet) {
+ dbg() << "HTMLLinkElement: Failed to parse stylesheet: " << href();
+ return;
+ }
+
+ // Transfer the rules from the successfully parsed sheet into the sheet we've already inserted.
+ m_style_sheet->rules() = sheet->rules();
+
+ document().update_style();
+}
+
+void HTMLLinkElement::load_stylesheet(const URL& url)
+{
+ // First insert an empty style sheet in the document sheet list.
+ // There's probably a nicer way to do this, but this ensures that sheets are in document order.
+ m_style_sheet = CSS::StyleSheet::create({});
+ document().style_sheets().add_sheet(*m_style_sheet);
+
+ LoadRequest request;
+ request.set_url(url);
+ set_resource(ResourceLoader::the().load_resource(Resource::Type::Generic, request));
+}
+
+void HTMLLinkElement::parse_attribute(const FlyString& name, const String& value)
+{
+ if (name == HTML::AttributeNames::rel) {
+ m_relationship = 0;
+ auto parts = value.split_view(' ');
+ for (auto& part : parts) {
+ if (part == "stylesheet")
+ m_relationship |= Relationship::Stylesheet;
+ else if (part == "alternate")
+ m_relationship |= Relationship::Alternate;
+ }
+ }
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.h b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.h
new file mode 100644
index 0000000000..ac91ecbe21
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+#include <LibWeb/Loader/Resource.h>
+
+namespace Web::HTML {
+
+class HTMLLinkElement final
+ : public HTMLElement
+ , public ResourceClient {
+public:
+ using WrapperType = Bindings::HTMLLinkElementWrapper;
+
+ HTMLLinkElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLLinkElement() override;
+
+ virtual void inserted_into(Node&) override;
+
+ String rel() const { return attribute(HTML::AttributeNames::rel); }
+ String type() const { return attribute(HTML::AttributeNames::type); }
+ String href() const { return attribute(HTML::AttributeNames::href); }
+
+private:
+ // ^ResourceClient
+ virtual void resource_did_fail() override;
+ virtual void resource_did_load() override;
+
+ void parse_attribute(const FlyString&, const String&) override;
+
+ void load_stylesheet(const URL&);
+
+ struct Relationship {
+ enum {
+ Alternate = 1 << 0,
+ Stylesheet = 1 << 1,
+ };
+ };
+
+ unsigned m_relationship { 0 };
+ RefPtr<CSS::StyleSheet> m_style_sheet;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.idl
new file mode 100644
index 0000000000..e1999c74b8
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.idl
@@ -0,0 +1,17 @@
+interface HTMLLinkElement : HTMLElement {
+
+ [Reflect] attribute DOMString href;
+ [Reflect] attribute DOMString hreflang;
+ [Reflect] attribute DOMString integrity;
+ [Reflect] attribute DOMString media;
+ [Reflect] attribute DOMString rel;
+ [Reflect] attribute DOMString type;
+ [Reflect=imagesrcset] attribute DOMString imageSrcset;
+ [Reflect=imagesizes] attribute DOMString imageSizes;
+ [Reflect] attribute boolean disabled;
+
+ [Reflect] attribute DOMString charset;
+ [Reflect] attribute DOMString rev;
+ [Reflect] attribute DOMString target;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMapElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMapElement.cpp
new file mode 100644
index 0000000000..c85b871c71
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLMapElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLMapElement.h>
+
+namespace Web::HTML {
+
+HTMLMapElement::HTMLMapElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLMapElement::~HTMLMapElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMapElement.h b/Userland/Libraries/LibWeb/HTML/HTMLMapElement.h
new file mode 100644
index 0000000000..23b59ce6fc
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLMapElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLMapElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLMapElementWrapper;
+
+ HTMLMapElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLMapElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMapElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLMapElement.idl
new file mode 100644
index 0000000000..636a96f8a5
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLMapElement.idl
@@ -0,0 +1,5 @@
+interface HTMLMapElement : HTMLElement {
+
+ [Reflect] attribute DOMString name;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp
new file mode 100644
index 0000000000..02e5e2ec6c
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLMarqueeElement.h>
+
+namespace Web::HTML {
+
+HTMLMarqueeElement::HTMLMarqueeElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLMarqueeElement::~HTMLMarqueeElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.h b/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.h
new file mode 100644
index 0000000000..0a2e5f5e32
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+// NOTE: This element is marked as obsolete, but is still listed as required by the specification.
+class HTMLMarqueeElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLMarqueeElementWrapper;
+
+ HTMLMarqueeElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLMarqueeElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.idl
new file mode 100644
index 0000000000..49ff70654d
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.idl
@@ -0,0 +1,9 @@
+interface HTMLMarqueeElement : HTMLElement {
+
+ [Reflect] attribute DOMString behaviour;
+ [Reflect=bgcolor] attribute DOMString bgColor;
+ [Reflect] attribute DOMString direction;
+ [Reflect] attribute DOMString height;
+ [Reflect] attribute DOMString width;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp
new file mode 100644
index 0000000000..15e4c01195
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLMediaElement.h>
+
+namespace Web::HTML {
+
+HTMLMediaElement::HTMLMediaElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLMediaElement::~HTMLMediaElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.h b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.h
new file mode 100644
index 0000000000..53adde12e3
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLMediaElement : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLMediaElementWrapper;
+
+ HTMLMediaElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLMediaElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.idl
new file mode 100644
index 0000000000..dda7615580
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.idl
@@ -0,0 +1,10 @@
+interface HTMLMediaElement : HTMLElement {
+
+ [Reflect] attribute DOMString src;
+
+ [Reflect] attribute boolean autoplay;
+ [Reflect] attribute boolean loop;
+
+ [Reflect] attribute boolean controls;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.cpp
new file mode 100644
index 0000000000..bcda7e5f56
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLMenuElement.h>
+
+namespace Web::HTML {
+
+HTMLMenuElement::HTMLMenuElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLMenuElement::~HTMLMenuElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.h b/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.h
new file mode 100644
index 0000000000..8fe2acca90
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLMenuElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLMenuElementWrapper;
+
+ HTMLMenuElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLMenuElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.idl
new file mode 100644
index 0000000000..f9dc7ed7a0
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.idl
@@ -0,0 +1,5 @@
+interface HTMLMenuElement : HTMLElement {
+
+ [Reflect] attribute boolean compact;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.cpp
new file mode 100644
index 0000000000..64c50a19e3
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLMetaElement.h>
+
+namespace Web::HTML {
+
+HTMLMetaElement::HTMLMetaElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLMetaElement::~HTMLMetaElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.h b/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.h
new file mode 100644
index 0000000000..e48271c826
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLMetaElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLMetaElementWrapper;
+
+ HTMLMetaElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLMetaElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.idl
new file mode 100644
index 0000000000..de1868b65c
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.idl
@@ -0,0 +1,9 @@
+interface HTMLMetaElement : HTMLElement {
+
+ [Reflect] attribute DOMString name;
+ [Reflect] attribute DOMString content;
+ [Reflect=http-equiv] attribute DOMString httpEquiv;
+
+ [Reflect] attribute DOMString scheme;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.cpp
new file mode 100644
index 0000000000..07bfeee98f
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLMeterElement.h>
+
+namespace Web::HTML {
+
+HTMLMeterElement::HTMLMeterElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLMeterElement::~HTMLMeterElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.h b/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.h
new file mode 100644
index 0000000000..f6d983a6b0
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLMeterElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLMeterElementWrapper;
+
+ HTMLMeterElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLMeterElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.idl
new file mode 100644
index 0000000000..72f6c1d4fe
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.idl
@@ -0,0 +1,5 @@
+interface HTMLMeterElement : HTMLElement {
+
+
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLModElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLModElement.cpp
new file mode 100644
index 0000000000..5fcd7603b0
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLModElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLModElement.h>
+
+namespace Web::HTML {
+
+HTMLModElement::HTMLModElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLModElement::~HTMLModElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLModElement.h b/Userland/Libraries/LibWeb/HTML/HTMLModElement.h
new file mode 100644
index 0000000000..f75c8bef9e
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLModElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLModElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLModElementWrapper;
+
+ HTMLModElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLModElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLModElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLModElement.idl
new file mode 100644
index 0000000000..8e3a489fa4
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLModElement.idl
@@ -0,0 +1,6 @@
+interface HTMLModElement : HTMLElement {
+
+ [Reflect] attribute DOMString cite;
+ [Reflect=datetime] attribute DOMString dateTime;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOListElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLOListElement.cpp
new file mode 100644
index 0000000000..48ac66fd8d
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLOListElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLOListElement.h>
+
+namespace Web::HTML {
+
+HTMLOListElement::HTMLOListElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLOListElement::~HTMLOListElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOListElement.h b/Userland/Libraries/LibWeb/HTML/HTMLOListElement.h
new file mode 100644
index 0000000000..8f5a849c75
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLOListElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLOListElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLOListElementWrapper;
+
+ HTMLOListElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLOListElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOListElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLOListElement.idl
new file mode 100644
index 0000000000..c81faf9c0e
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLOListElement.idl
@@ -0,0 +1,8 @@
+interface HTMLOListElement : HTMLElement {
+
+ [Reflect] attribute boolean reversed;
+ [Reflect] attribute DOMString type;
+
+ [Reflect] attribute boolean compact;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp
new file mode 100644
index 0000000000..a7514179d4
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibGfx/Bitmap.h>
+#include <LibGfx/ImageDecoder.h>
+#include <LibWeb/CSS/StyleResolver.h>
+#include <LibWeb/DOM/Document.h>
+#include <LibWeb/DOM/Event.h>
+#include <LibWeb/HTML/HTMLObjectElement.h>
+#include <LibWeb/Layout/ImageBox.h>
+#include <LibWeb/Loader/ResourceLoader.h>
+
+namespace Web::HTML {
+
+HTMLObjectElement::HTMLObjectElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+ m_image_loader.on_load = [this] {
+ m_should_show_fallback_content = false;
+ this->document().force_layout();
+ };
+
+ m_image_loader.on_fail = [this] {
+ m_should_show_fallback_content = true;
+ this->document().force_layout();
+ };
+}
+
+HTMLObjectElement::~HTMLObjectElement()
+{
+}
+
+void HTMLObjectElement::parse_attribute(const FlyString& name, const String& value)
+{
+ HTMLElement::parse_attribute(name, value);
+
+ if (name == HTML::AttributeNames::data)
+ m_image_loader.load(document().complete_url(value));
+}
+
+RefPtr<Layout::Node> HTMLObjectElement::create_layout_node()
+{
+ if (m_should_show_fallback_content)
+ return HTMLElement::create_layout_node();
+
+ auto style = document().style_resolver().resolve_style(*this);
+ if (style->display() == CSS::Display::None)
+ return nullptr;
+ if (m_image_loader.has_image())
+ return adopt(*new Layout::ImageBox(document(), *this, move(style), m_image_loader));
+ return nullptr;
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h
new file mode 100644
index 0000000000..f07e122ff7
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibCore/Forward.h>
+#include <LibGfx/Forward.h>
+#include <LibWeb/HTML/HTMLElement.h>
+#include <LibWeb/Loader/ImageLoader.h>
+
+namespace Web::HTML {
+
+class HTMLObjectElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLObjectElementWrapper;
+
+ HTMLObjectElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLObjectElement() override;
+
+ virtual void parse_attribute(const FlyString& name, const String& value) override;
+
+ String data() const { return attribute(HTML::AttributeNames::data); }
+ String type() const { return attribute(HTML::AttributeNames::type); }
+
+private:
+ virtual RefPtr<Layout::Node> create_layout_node() override;
+
+ ImageLoader m_image_loader;
+ bool m_should_show_fallback_content { false };
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.idl
new file mode 100644
index 0000000000..3c5790bcc5
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.idl
@@ -0,0 +1,19 @@
+interface HTMLObjectElement : HTMLElement {
+
+ [Reflect] attribute DOMString data;
+ [Reflect] attribute DOMString type;
+ [Reflect] attribute DOMString name;
+ [Reflect=usemap] attribute DOMString useMap;
+ [Reflect] attribute DOMString width;
+ [Reflect] attribute DOMString height;
+
+ [Reflect] attribute DOMString align;
+ [Reflect] attribute DOMString archive;
+ [Reflect] attribute DOMString code;
+ [Reflect] attribute boolean declare;
+ [Reflect] attribute DOMString standby;
+ [Reflect=codetype] attribute DOMString codeType;
+
+ [LegacyNullToEmptyString, Reflect] attribute DOMString border;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.cpp
new file mode 100644
index 0000000000..50c7d23b6f
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLOptGroupElement.h>
+
+namespace Web::HTML {
+
+HTMLOptGroupElement::HTMLOptGroupElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLOptGroupElement::~HTMLOptGroupElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.h b/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.h
new file mode 100644
index 0000000000..77a90aebcb
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLOptGroupElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLOptGroupElementWrapper;
+
+ HTMLOptGroupElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLOptGroupElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.idl
new file mode 100644
index 0000000000..d442091b1a
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.idl
@@ -0,0 +1,6 @@
+interface HTMLOptGroupElement : HTMLElement {
+
+ [Reflect] attribute boolean disabled;
+ [Reflect] attribute DOMString label;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.cpp
new file mode 100644
index 0000000000..c22fbb3668
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLOptionElement.h>
+
+namespace Web::HTML {
+
+HTMLOptionElement::HTMLOptionElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLOptionElement::~HTMLOptionElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.h b/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.h
new file mode 100644
index 0000000000..e2bead49f6
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLOptionElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLOptionElementWrapper;
+
+ HTMLOptionElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLOptionElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.idl
new file mode 100644
index 0000000000..96dcaec548
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.idl
@@ -0,0 +1,6 @@
+interface HTMLOptionElement : HTMLElement {
+
+ [Reflect] attribute boolean disabled;
+ [Reflect=selected] attribute boolean defaultSelected;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.cpp
new file mode 100644
index 0000000000..80f9d82dd5
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLOutputElement.h>
+
+namespace Web::HTML {
+
+HTMLOutputElement::HTMLOutputElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLOutputElement::~HTMLOutputElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h b/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h
new file mode 100644
index 0000000000..110225535f
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLOutputElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLOutputElementWrapper;
+
+ HTMLOutputElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLOutputElement() override;
+
+ const String& type() const
+ {
+ static String output = "output";
+ return output;
+ }
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.idl
new file mode 100644
index 0000000000..94c45e99f3
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.idl
@@ -0,0 +1,5 @@
+interface HTMLOutputElement : HTMLElement {
+
+ readonly attribute DOMString type;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.cpp
new file mode 100644
index 0000000000..9e0fab9859
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLParagraphElement.h>
+
+namespace Web::HTML {
+
+HTMLParagraphElement::HTMLParagraphElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLParagraphElement::~HTMLParagraphElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.h b/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.h
new file mode 100644
index 0000000000..660855edb9
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLParagraphElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLParagraphElementWrapper;
+
+ HTMLParagraphElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLParagraphElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.idl
new file mode 100644
index 0000000000..e1248da905
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.idl
@@ -0,0 +1,5 @@
+interface HTMLParagraphElement : HTMLElement {
+
+ [Reflect] attribute DOMString align;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLParamElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLParamElement.cpp
new file mode 100644
index 0000000000..838ae13ef8
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLParamElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLParamElement.h>
+
+namespace Web::HTML {
+
+HTMLParamElement::HTMLParamElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLParamElement::~HTMLParamElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLParamElement.h b/Userland/Libraries/LibWeb/HTML/HTMLParamElement.h
new file mode 100644
index 0000000000..642551cdd0
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLParamElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLParamElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLParamElementWrapper;
+
+ HTMLParamElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLParamElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLParamElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLParamElement.idl
new file mode 100644
index 0000000000..a848fc5364
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLParamElement.idl
@@ -0,0 +1,9 @@
+interface HTMLParamElement : HTMLElement {
+
+ [Reflect] attribute DOMString name;
+ [Reflect] attribute DOMString value;
+
+ [Reflect] attribute DOMString type;
+ [Reflect=valuetype] attribute DOMString valueType;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.cpp
new file mode 100644
index 0000000000..5aec65b51a
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLPictureElement.h>
+
+namespace Web::HTML {
+
+HTMLPictureElement::HTMLPictureElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLPictureElement::~HTMLPictureElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.h b/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.h
new file mode 100644
index 0000000000..8d12df2b16
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLPictureElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLPictureElementWrapper;
+
+ HTMLPictureElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLPictureElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.idl
new file mode 100644
index 0000000000..9bd6cefe16
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.idl
@@ -0,0 +1,5 @@
+interface HTMLPictureElement : HTMLElement {
+
+
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLPreElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLPreElement.cpp
new file mode 100644
index 0000000000..69349d7238
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLPreElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLPreElement.h>
+
+namespace Web::HTML {
+
+HTMLPreElement::HTMLPreElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLPreElement::~HTMLPreElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLPreElement.h b/Userland/Libraries/LibWeb/HTML/HTMLPreElement.h
new file mode 100644
index 0000000000..b87197f600
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLPreElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLPreElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLPreElementWrapper;
+
+ HTMLPreElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLPreElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLPreElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLPreElement.idl
new file mode 100644
index 0000000000..27a0404ba5
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLPreElement.idl
@@ -0,0 +1,5 @@
+interface HTMLPreElement : HTMLElement {
+
+
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp
new file mode 100644
index 0000000000..cfad730312
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLProgressElement.h>
+
+namespace Web::HTML {
+
+HTMLProgressElement::HTMLProgressElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLProgressElement::~HTMLProgressElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.h b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.h
new file mode 100644
index 0000000000..cb18e317f2
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLProgressElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLProgressElementWrapper;
+
+ HTMLProgressElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLProgressElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.idl
new file mode 100644
index 0000000000..1d00f9b3fc
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.idl
@@ -0,0 +1,5 @@
+interface HTMLProgressElement : HTMLElement {
+
+
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.cpp
new file mode 100644
index 0000000000..07bf149640
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLQuoteElement.h>
+
+namespace Web::HTML {
+
+HTMLQuoteElement::HTMLQuoteElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLQuoteElement::~HTMLQuoteElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.h b/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.h
new file mode 100644
index 0000000000..98e254f213
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLQuoteElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLQuoteElementWrapper;
+
+ HTMLQuoteElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLQuoteElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.idl
new file mode 100644
index 0000000000..390074f746
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.idl
@@ -0,0 +1,5 @@
+interface HTMLQuoteElement : HTMLElement {
+
+ [Reflect] attribute DOMString cite;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp
new file mode 100644
index 0000000000..cc3031984c
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp
@@ -0,0 +1,193 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <AK/StringBuilder.h>
+#include <LibJS/Parser.h>
+#include <LibWeb/DOM/Document.h>
+#include <LibWeb/DOM/Event.h>
+#include <LibWeb/DOM/Text.h>
+#include <LibWeb/HTML/EventNames.h>
+#include <LibWeb/HTML/HTMLScriptElement.h>
+#include <LibWeb/Loader/ResourceLoader.h>
+
+namespace Web::HTML {
+
+HTMLScriptElement::HTMLScriptElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLScriptElement::~HTMLScriptElement()
+{
+}
+
+void HTMLScriptElement::set_parser_document(Badge<HTMLDocumentParser>, DOM::Document& document)
+{
+ m_parser_document = document;
+}
+
+void HTMLScriptElement::set_non_blocking(Badge<HTMLDocumentParser>, bool non_blocking)
+{
+ m_non_blocking = non_blocking;
+}
+
+void HTMLScriptElement::execute_script()
+{
+ document().run_javascript(m_script_source);
+
+ if (has_attribute(HTML::AttributeNames::src))
+ dispatch_event(DOM::Event::create(EventNames::load));
+}
+
+void HTMLScriptElement::prepare_script(Badge<HTMLDocumentParser>)
+{
+ if (m_already_started)
+ return;
+ RefPtr<DOM::Document> parser_document = m_parser_document.ptr();
+ m_parser_document = nullptr;
+
+ if (parser_document && !has_attribute(HTML::AttributeNames::async)) {
+ m_non_blocking = true;
+ }
+
+ auto source_text = child_text_content();
+ if (!has_attribute(HTML::AttributeNames::src) && source_text.is_empty())
+ return;
+
+ if (!is_connected())
+ return;
+
+ // FIXME: Check the "type" and "language" attributes
+
+ if (parser_document) {
+ m_parser_document = *parser_document;
+ m_non_blocking = false;
+ }
+
+ m_already_started = true;
+ m_preparation_time_document = document();
+
+ if (parser_document && parser_document.ptr() != m_preparation_time_document.ptr()) {
+ return;
+ }
+
+ // FIXME: Check if scripting is disabled, if so return
+ // FIXME: Check the "nomodule" content attribute
+ // FIXME: Check CSP
+ // FIXME: Check "event" and "for" attributes
+ // FIXME: Check "charset" attribute
+ // FIXME: Check CORS
+ // FIXME: Module script credentials mode
+ // FIXME: Cryptographic nonce
+ // FIXME: Check "integrity" attribute
+ // FIXME: Check "referrerpolicy" attribute
+
+ m_parser_inserted = !!m_parser_document;
+
+ // FIXME: Check fetch options
+
+ if (has_attribute(HTML::AttributeNames::src)) {
+ auto src = attribute(HTML::AttributeNames::src);
+ if (src.is_empty()) {
+ // FIXME: Fire an "error" event at the element and return
+ ASSERT_NOT_REACHED();
+ }
+ m_from_an_external_file = true;
+
+ auto url = document().complete_url(src);
+ if (!url.is_valid()) {
+ // FIXME: Fire an "error" event at the element and return
+ ASSERT_NOT_REACHED();
+ }
+
+ // FIXME: Check classic vs. module script type
+
+ // FIXME: This load should be made asynchronous and the parser should spin an event loop etc.
+ ResourceLoader::the().load_sync(
+ url,
+ [this, url](auto data, auto&) {
+ if (data.is_null()) {
+ dbgln("HTMLScriptElement: Failed to load {}", url);
+ return;
+ }
+ m_script_source = String::copy(data);
+ script_became_ready();
+ },
+ [this](auto&) {
+ m_failed_to_load = true;
+ });
+ } else {
+ // FIXME: Check classic vs. module script type
+ m_script_source = source_text;
+ script_became_ready();
+ }
+
+ // FIXME: Check classic vs. module
+ if (has_attribute(HTML::AttributeNames::src) && has_attribute(HTML::AttributeNames::defer) && m_parser_inserted && !has_attribute(HTML::AttributeNames::async)) {
+ document().add_script_to_execute_when_parsing_has_finished({}, *this);
+ }
+
+ else if (has_attribute(HTML::AttributeNames::src) && m_parser_inserted && !has_attribute(HTML::AttributeNames::async)) {
+
+ document().set_pending_parsing_blocking_script({}, this);
+ when_the_script_is_ready([this] {
+ m_ready_to_be_parser_executed = true;
+ });
+ }
+
+ else if (has_attribute(HTML::AttributeNames::src) && !has_attribute(HTML::AttributeNames::async) && !m_non_blocking) {
+ ASSERT_NOT_REACHED();
+ }
+
+ else if (has_attribute(HTML::AttributeNames::src)) {
+ m_preparation_time_document->add_script_to_execute_as_soon_as_possible({}, *this);
+ }
+
+ else {
+ // Immediately execute the script block, even if other scripts are already executing.
+ execute_script();
+ }
+}
+
+void HTMLScriptElement::script_became_ready()
+{
+ m_script_ready = true;
+ if (!m_script_ready_callback)
+ return;
+ m_script_ready_callback();
+ m_script_ready_callback = nullptr;
+}
+
+void HTMLScriptElement::when_the_script_is_ready(Function<void()> callback)
+{
+ if (m_script_ready) {
+ callback();
+ return;
+ }
+ m_script_ready_callback = move(callback);
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.h b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.h
new file mode 100644
index 0000000000..b15afcdd7a
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <AK/Function.h>
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLScriptElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLScriptElementWrapper;
+
+ HTMLScriptElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLScriptElement() override;
+
+ bool is_non_blocking() const { return m_non_blocking; }
+ bool is_ready_to_be_parser_executed() const { return m_ready_to_be_parser_executed; }
+ bool failed_to_load() const { return m_failed_to_load; }
+
+ void set_parser_document(Badge<HTMLDocumentParser>, DOM::Document&);
+ void set_non_blocking(Badge<HTMLDocumentParser>, bool);
+ void set_already_started(Badge<HTMLDocumentParser>, bool b) { m_already_started = b; }
+ void prepare_script(Badge<HTMLDocumentParser>);
+ void execute_script();
+
+private:
+ void script_became_ready();
+ void when_the_script_is_ready(Function<void()>);
+
+ WeakPtr<DOM::Document> m_parser_document;
+ WeakPtr<DOM::Document> m_preparation_time_document;
+ bool m_non_blocking { false };
+ bool m_already_started { false };
+ bool m_parser_inserted { false };
+ bool m_from_an_external_file { false };
+ bool m_script_ready { false };
+ bool m_ready_to_be_parser_executed { false };
+ bool m_failed_to_load { false };
+
+ Function<void()> m_script_ready_callback;
+
+ String m_script_source;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.idl
new file mode 100644
index 0000000000..370dadd29a
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.idl
@@ -0,0 +1,13 @@
+interface HTMLScriptElement : HTMLElement {
+
+ [Reflect] attribute DOMString src;
+ [Reflect] attribute DOMString type;
+ [Reflect=nomodule] attribute boolean noModule;
+ [Reflect] attribute boolean defer;
+ [Reflect] attribute DOMString integrity;
+
+ [Reflect] attribute DOMString charset;
+ [Reflect] attribute DOMString event;
+ [Reflect=for] attribute DOMString htmlFor;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp
new file mode 100644
index 0000000000..9c4b486b05
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLSelectElement.h>
+
+namespace Web::HTML {
+
+HTMLSelectElement::HTMLSelectElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLSelectElement::~HTMLSelectElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h
new file mode 100644
index 0000000000..49d66970b9
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLSelectElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLSelectElementWrapper;
+
+ HTMLSelectElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLSelectElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.idl
new file mode 100644
index 0000000000..808db0b45f
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.idl
@@ -0,0 +1,7 @@
+interface HTMLSelectElement : HTMLElement {
+
+ [Reflect] attribute boolean disabled;
+ [Reflect] attribute boolean multiple;
+ [Reflect] attribute boolean required;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.cpp
new file mode 100644
index 0000000000..cb32ab7772
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLSlotElement.h>
+
+namespace Web::HTML {
+
+HTMLSlotElement::HTMLSlotElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLSlotElement::~HTMLSlotElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.h b/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.h
new file mode 100644
index 0000000000..96c42ff6f2
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLSlotElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLSlotElementWrapper;
+
+ HTMLSlotElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLSlotElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.idl
new file mode 100644
index 0000000000..04dc7a7111
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.idl
@@ -0,0 +1,5 @@
+interface HTMLSlotElement : HTMLElement {
+
+ [Reflect] attribute DOMString name;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.cpp
new file mode 100644
index 0000000000..3dcf89815e
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLSourceElement.h>
+
+namespace Web::HTML {
+
+HTMLSourceElement::HTMLSourceElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLSourceElement::~HTMLSourceElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.h b/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.h
new file mode 100644
index 0000000000..f126968ddd
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLSourceElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLSourceElementWrapper;
+
+ HTMLSourceElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLSourceElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.idl
new file mode 100644
index 0000000000..5496d55a1a
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.idl
@@ -0,0 +1,9 @@
+interface HTMLSourceElement : HTMLElement {
+
+ [Reflect] attribute DOMString src;
+ [Reflect] attribute DOMString type;
+ [Reflect] attribute DOMString srcset;
+ [Reflect] attribute DOMString sizes;
+ [Reflect] attribute DOMString media;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.cpp
new file mode 100644
index 0000000000..568d24f891
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLSpanElement.h>
+
+namespace Web::HTML {
+
+HTMLSpanElement::HTMLSpanElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLSpanElement::~HTMLSpanElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.h b/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.h
new file mode 100644
index 0000000000..1906eb2a56
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLSpanElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLSpanElementWrapper;
+
+ HTMLSpanElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLSpanElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.idl
new file mode 100644
index 0000000000..a87dda0eb7
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.idl
@@ -0,0 +1,5 @@
+interface HTMLSpanElement : HTMLElement {
+
+
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp
new file mode 100644
index 0000000000..44fa6daea0
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <AK/StringBuilder.h>
+#include <LibWeb/CSS/Parser/CSSParser.h>
+#include <LibWeb/DOM/Document.h>
+#include <LibWeb/DOM/Text.h>
+#include <LibWeb/HTML/HTMLStyleElement.h>
+
+namespace Web::HTML {
+
+HTMLStyleElement::HTMLStyleElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLStyleElement::~HTMLStyleElement()
+{
+}
+
+void HTMLStyleElement::children_changed()
+{
+ StringBuilder builder;
+ for_each_child([&](auto& child) {
+ if (is<DOM::Text>(child))
+ builder.append(downcast<DOM::Text>(child).text_content());
+ });
+ m_stylesheet = parse_css(CSS::ParsingContext(document()), builder.to_string());
+ if (m_stylesheet)
+ document().style_sheets().add_sheet(*m_stylesheet);
+ else
+ document().style_sheets().add_sheet(CSS::StyleSheet::create({}));
+ HTMLElement::children_changed();
+}
+
+void HTMLStyleElement::removed_from(Node& old_parent)
+{
+ if (m_stylesheet) {
+ // FIXME: Remove the sheet from the document
+ }
+ return HTMLElement::removed_from(old_parent);
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.h b/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.h
new file mode 100644
index 0000000000..9e3b615c0c
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLStyleElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLStyleElementWrapper;
+
+ HTMLStyleElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLStyleElement() override;
+
+ virtual void children_changed() override;
+ virtual void removed_from(Node&) override;
+
+private:
+ RefPtr<CSS::StyleSheet> m_stylesheet;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.idl
new file mode 100644
index 0000000000..a5ab2934f3
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.idl
@@ -0,0 +1,7 @@
+interface HTMLStyleElement : HTMLElement {
+
+ [Reflect] attribute DOMString media;
+
+ [Reflect] attribute DOMString type;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.cpp
new file mode 100644
index 0000000000..a9c3e62a98
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLTableCaptionElement.h>
+
+namespace Web::HTML {
+
+HTMLTableCaptionElement::HTMLTableCaptionElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLTableCaptionElement::~HTMLTableCaptionElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.h
new file mode 100644
index 0000000000..691b49ab3c
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLTableCaptionElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLTableCaptionElementWrapper;
+
+ HTMLTableCaptionElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLTableCaptionElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.idl
new file mode 100644
index 0000000000..97d9419ccf
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.idl
@@ -0,0 +1,5 @@
+interface HTMLTableCaptionElement : HTMLElement {
+
+ [Reflect] attribute DOMString align;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp
new file mode 100644
index 0000000000..5dd60f2cbb
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/CSS/Parser/CSSParser.h>
+#include <LibWeb/HTML/HTMLTableCellElement.h>
+
+namespace Web::HTML {
+
+HTMLTableCellElement::HTMLTableCellElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLTableCellElement::~HTMLTableCellElement()
+{
+}
+
+void HTMLTableCellElement::apply_presentational_hints(CSS::StyleProperties& style) const
+{
+ for_each_attribute([&](auto& name, auto& value) {
+ if (name == HTML::AttributeNames::bgcolor) {
+ auto color = Color::from_string(value);
+ if (color.has_value())
+ style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value()));
+ return;
+ }
+ if (name == HTML::AttributeNames::align) {
+ if (value.equals_ignoring_case("center") || value.equals_ignoring_case("middle"))
+ style.set_property(CSS::PropertyID::TextAlign, StringView("-libweb-center"));
+ else
+ style.set_property(CSS::PropertyID::TextAlign, value.view());
+ return;
+ }
+ if (name == HTML::AttributeNames::width) {
+ if (auto parsed_value = parse_html_length(document(), value))
+ style.set_property(CSS::PropertyID::Width, parsed_value.release_nonnull());
+ return;
+ }
+ });
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.h
new file mode 100644
index 0000000000..7a2b9e4f09
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLTableCellElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLTableCellElementWrapper;
+
+ HTMLTableCellElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLTableCellElement() override;
+
+private:
+ virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.idl
new file mode 100644
index 0000000000..bcf8f1a04a
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.idl
@@ -0,0 +1,18 @@
+interface HTMLTableCellElement : HTMLElement {
+
+ [Reflect] attribute DOMString headers;
+ [Reflect] attribute DOMString abbr;
+
+ [Reflect] attribute DOMString align;
+ [Reflect] attribute DOMString axis;
+ [Reflect] attribute DOMString height;
+ [Reflect] attribute DOMString width;
+
+ [Reflect=char] attribute DOMString ch;
+ [Reflect=charoff] attribute DOMString chOff;
+ [Reflect=nowrap] attribute boolean noWrap;
+ [Reflect=valign] attribute DOMString vAlign;
+
+ [LegacyNullToEmptyString, Reflect=bgcolor] attribute DOMString bgColor;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.cpp
new file mode 100644
index 0000000000..17a3e494c8
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLTableColElement.h>
+
+namespace Web::HTML {
+
+HTMLTableColElement::HTMLTableColElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLTableColElement::~HTMLTableColElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.h
new file mode 100644
index 0000000000..c6b8e706ff
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLTableColElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLTableColElementWrapper;
+
+ HTMLTableColElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLTableColElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.idl
new file mode 100644
index 0000000000..d76f0da76b
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.idl
@@ -0,0 +1,9 @@
+interface HTMLTableColElement : HTMLElement {
+
+ [Reflect] attribute DOMString align;
+ [Reflect=char] attribute DOMString ch;
+ [Reflect=charoff] attribute DOMString chOff;
+ [Reflect=valign] attribute DOMString vAlign;
+ [Reflect] attribute DOMString width;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp
new file mode 100644
index 0000000000..d31641af42
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/CSS/Parser/CSSParser.h>
+#include <LibWeb/HTML/HTMLTableElement.h>
+
+namespace Web::HTML {
+
+HTMLTableElement::HTMLTableElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLTableElement::~HTMLTableElement()
+{
+}
+
+void HTMLTableElement::apply_presentational_hints(CSS::StyleProperties& style) const
+{
+ for_each_attribute([&](auto& name, auto& value) {
+ if (name == HTML::AttributeNames::width) {
+ if (auto parsed_value = parse_html_length(document(), value))
+ style.set_property(CSS::PropertyID::Width, parsed_value.release_nonnull());
+ return;
+ }
+ if (name == HTML::AttributeNames::height) {
+ if (auto parsed_value = parse_html_length(document(), value))
+ style.set_property(CSS::PropertyID::Height, parsed_value.release_nonnull());
+ return;
+ }
+ if (name == HTML::AttributeNames::bgcolor) {
+ auto color = Color::from_string(value);
+ if (color.has_value())
+ style.set_property(CSS::PropertyID::BackgroundColor, CSS::ColorStyleValue::create(color.value()));
+ return;
+ }
+ });
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTableElement.h
new file mode 100644
index 0000000000..39d65833c6
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTableElement.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLTableElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLTableElementWrapper;
+
+ HTMLTableElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLTableElement() override;
+
+private:
+ virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLTableElement.idl
new file mode 100644
index 0000000000..0990efa4a1
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTableElement.idl
@@ -0,0 +1,14 @@
+interface HTMLTableElement : HTMLElement {
+
+ [Reflect] attribute DOMString align;
+ [Reflect] attribute DOMString border;
+ [Reflect] attribute DOMString frame;
+ [Reflect] attribute DOMString rules;
+ [Reflect] attribute DOMString summary;
+ [Reflect] attribute DOMString width;
+
+ [LegacyNullToEmptyString, Reflect=bgcolor] attribute DOMString bgColor;
+ [LegacyNullToEmptyString, Reflect=cellpadding] attribute DOMString cellPadding;
+ [LegacyNullToEmptyString, Reflect=cellspacing] attribute DOMString cellSpacing;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp
new file mode 100644
index 0000000000..28f0d6d910
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLTableRowElement.h>
+
+namespace Web::HTML {
+
+HTMLTableRowElement::HTMLTableRowElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLTableRowElement::~HTMLTableRowElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.h
new file mode 100644
index 0000000000..dc64d13322
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLTableRowElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLTableRowElementWrapper;
+
+ HTMLTableRowElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLTableRowElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.idl
new file mode 100644
index 0000000000..1b999948f4
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.idl
@@ -0,0 +1,10 @@
+interface HTMLTableRowElement : HTMLElement {
+
+ [Reflect] attribute DOMString align;
+ [Reflect=char] attribute DOMString ch;
+ [Reflect=charoff] attribute DOMString chOff;
+ [Reflect=valign] attribute DOMString vAlign;
+
+ [LegacyNullToEmptyString, Reflect=bgcolor] attribute DOMString bgColor;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.cpp
new file mode 100644
index 0000000000..2ce4394b94
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLTableSectionElement.h>
+
+namespace Web::HTML {
+
+HTMLTableSectionElement::HTMLTableSectionElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLTableSectionElement::~HTMLTableSectionElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.h
new file mode 100644
index 0000000000..dc58ea8a1b
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLTableSectionElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLTableSectionElementWrapper;
+
+ HTMLTableSectionElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLTableSectionElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.idl
new file mode 100644
index 0000000000..4201411b8c
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.idl
@@ -0,0 +1,8 @@
+interface HTMLTableSectionElement : HTMLElement {
+
+ [Reflect] attribute DOMString align;
+ [Reflect=char] attribute DOMString ch;
+ [Reflect=charoff] attribute DOMString chOff;
+ [Reflect=valign] attribute DOMString vAlign;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.cpp
new file mode 100644
index 0000000000..8a0209337b
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.cpp
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/DOM/Document.h>
+#include <LibWeb/HTML/HTMLTemplateElement.h>
+
+namespace Web::HTML {
+
+HTMLTemplateElement::HTMLTemplateElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+ m_content = adopt(*new DOM::DocumentFragment(appropriate_template_contents_owner_document(document)));
+ m_content->set_host(*this);
+}
+
+HTMLTemplateElement::~HTMLTemplateElement()
+{
+}
+
+DOM::Document& HTMLTemplateElement::appropriate_template_contents_owner_document(DOM::Document& document)
+{
+ if (!document.created_for_appropriate_template_contents()) {
+ if (!document.associated_inert_template_document()) {
+ auto new_document = DOM::Document::create();
+ new_document->set_created_for_appropriate_template_contents(true);
+
+ // FIXME: If doc is an HTML document, mark new doc as an HTML document also.
+
+ document.set_associated_inert_template_document(new_document);
+ }
+
+ return *document.associated_inert_template_document();
+ }
+
+ return document;
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.h
new file mode 100644
index 0000000000..8e26320684
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/DOM/DocumentFragment.h>
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLTemplateElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLTemplateElementWrapper;
+
+ HTMLTemplateElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLTemplateElement() override;
+
+ NonnullRefPtr<DOM::DocumentFragment> content() { return *m_content; }
+ const NonnullRefPtr<DOM::DocumentFragment> content() const { return *m_content; }
+
+private:
+ DOM::Document& appropriate_template_contents_owner_document(DOM::Document&);
+
+ RefPtr<DOM::DocumentFragment> m_content;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.idl
new file mode 100644
index 0000000000..efbbc57e02
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.idl
@@ -0,0 +1,5 @@
+interface HTMLTemplateElement : HTMLElement {
+
+ readonly attribute DocumentFragment content;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp
new file mode 100644
index 0000000000..29433042c4
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLTextAreaElement.h>
+
+namespace Web::HTML {
+
+HTMLTextAreaElement::HTMLTextAreaElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLTextAreaElement::~HTMLTextAreaElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h
new file mode 100644
index 0000000000..e09b95541a
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLTextAreaElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLTextAreaElementWrapper;
+
+ HTMLTextAreaElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLTextAreaElement() override;
+
+ const String& type() const
+ {
+ static String textarea = "textarea";
+ return textarea;
+ }
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.idl
new file mode 100644
index 0000000000..878cc67db0
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.idl
@@ -0,0 +1,12 @@
+interface HTMLTextAreaElement : HTMLElement {
+
+ [Reflect] attribute DOMString placeholder;
+ [Reflect] attribute DOMString name;
+ [Reflect] attribute DOMString wrap;
+ readonly attribute DOMString type;
+
+ [Reflect] attribute boolean disabled;
+ [Reflect=readonly] attribute boolean readOnly;
+ [Reflect] attribute boolean required;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.cpp
new file mode 100644
index 0000000000..613f8aadbe
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLTimeElement.h>
+
+namespace Web::HTML {
+
+HTMLTimeElement::HTMLTimeElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLTimeElement::~HTMLTimeElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.h
new file mode 100644
index 0000000000..aacef209a9
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLTimeElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLTimeElementWrapper;
+
+ HTMLTimeElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLTimeElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.idl
new file mode 100644
index 0000000000..f82d1e1aea
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.idl
@@ -0,0 +1,5 @@
+interface HTMLTimeElement : HTMLElement {
+
+ [Reflect=datetime] attribute DOMString dateTime;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.cpp
new file mode 100644
index 0000000000..a1404dfe9e
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.cpp
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/DOM/Document.h>
+#include <LibWeb/HTML/HTMLTitleElement.h>
+#include <LibWeb/Page/Page.h>
+
+namespace Web::HTML {
+
+HTMLTitleElement::HTMLTitleElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLTitleElement::~HTMLTitleElement()
+{
+}
+
+void HTMLTitleElement::children_changed()
+{
+ HTMLElement::children_changed();
+ if (auto* page = document().page())
+ page->client().page_did_change_title(document().title());
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.h
new file mode 100644
index 0000000000..42c28f467f
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLTitleElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLTitleElementWrapper;
+
+ HTMLTitleElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLTitleElement() override;
+
+private:
+ virtual void children_changed() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.idl
new file mode 100644
index 0000000000..6cfbc9ef29
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.idl
@@ -0,0 +1,5 @@
+interface HTMLTitleElement : HTMLElement {
+
+
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.cpp
new file mode 100644
index 0000000000..2f0cee7f28
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLTrackElement.h>
+
+namespace Web::HTML {
+
+HTMLTrackElement::HTMLTrackElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLTrackElement::~HTMLTrackElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.h
new file mode 100644
index 0000000000..6a0c78c176
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLTrackElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLTrackElementWrapper;
+
+ HTMLTrackElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLTrackElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.idl
new file mode 100644
index 0000000000..d58d662cb0
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.idl
@@ -0,0 +1,8 @@
+interface HTMLTrackElement : HTMLElement {
+
+ [Reflect] attribute DOMString src;
+ [Reflect] attribute DOMString srclang;
+ [Reflect] attribute DOMString label;
+ [Reflect] attribute boolean default;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLUListElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLUListElement.cpp
new file mode 100644
index 0000000000..d9cbcb9cd7
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLUListElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLUListElement.h>
+
+namespace Web::HTML {
+
+HTMLUListElement::HTMLUListElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLUListElement::~HTMLUListElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLUListElement.h b/Userland/Libraries/LibWeb/HTML/HTMLUListElement.h
new file mode 100644
index 0000000000..c4efa7949a
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLUListElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLUListElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLUListElementWrapper;
+
+ HTMLUListElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLUListElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLUListElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLUListElement.idl
new file mode 100644
index 0000000000..6490a6d5c8
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLUListElement.idl
@@ -0,0 +1,6 @@
+interface HTMLUListElement : HTMLElement {
+
+ [Reflect] attribute boolean compact;
+ [Reflect] attribute DOMString type;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.cpp
new file mode 100644
index 0000000000..3ef559692d
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLUnknownElement.h>
+
+namespace Web::HTML {
+
+HTMLUnknownElement::HTMLUnknownElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLElement(document, qualified_name)
+{
+}
+
+HTMLUnknownElement::~HTMLUnknownElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.h b/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.h
new file mode 100644
index 0000000000..896df0d064
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLElement.h>
+
+namespace Web::HTML {
+
+class HTMLUnknownElement final : public HTMLElement {
+public:
+ using WrapperType = Bindings::HTMLUnknownElementWrapper;
+
+ HTMLUnknownElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLUnknownElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.idl
new file mode 100644
index 0000000000..7a6672d4f4
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.idl
@@ -0,0 +1,5 @@
+interface HTMLUnknownElement : HTMLElement {
+
+
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.cpp
new file mode 100644
index 0000000000..cbd97199cf
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/HTMLVideoElement.h>
+
+namespace Web::HTML {
+
+HTMLVideoElement::HTMLVideoElement(DOM::Document& document, const QualifiedName& qualified_name)
+ : HTMLMediaElement(document, qualified_name)
+{
+}
+
+HTMLVideoElement::~HTMLVideoElement()
+{
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.h b/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.h
new file mode 100644
index 0000000000..9349f0feb6
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2020, The SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/HTML/HTMLMediaElement.h>
+
+namespace Web::HTML {
+
+class HTMLVideoElement final : public HTMLMediaElement {
+public:
+ using WrapperType = Bindings::HTMLVideoElementWrapper;
+
+ HTMLVideoElement(DOM::Document&, const QualifiedName& qualified_name);
+ virtual ~HTMLVideoElement() override;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.idl
new file mode 100644
index 0000000000..6fb6ba3a50
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.idl
@@ -0,0 +1,6 @@
+interface HTMLVideoElement : HTMLMediaElement {
+
+ [Reflect] attribute DOMString poster;
+ [Reflect=playsinline] attribute boolean playsInline;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/ImageData.cpp b/Userland/Libraries/LibWeb/HTML/ImageData.cpp
new file mode 100644
index 0000000000..085cc88728
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/ImageData.cpp
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibGfx/Bitmap.h>
+#include <LibJS/Runtime/Uint8ClampedArray.h>
+#include <LibWeb/HTML/ImageData.h>
+
+namespace Web::HTML {
+
+RefPtr<ImageData> ImageData::create_with_size(JS::GlobalObject& global_object, int width, int height)
+{
+ if (width <= 0 || height <= 0)
+ return nullptr;
+
+ if (width > 16384 || height > 16384)
+ return nullptr;
+
+ dbgln("Creating ImageData with {}x{}", width, height);
+
+ auto* data = JS::Uint8ClampedArray::create(global_object, width * height * 4);
+ if (!data)
+ return nullptr;
+
+ auto data_handle = JS::make_handle(data);
+
+ auto bitmap = Gfx::Bitmap::create_wrapper(Gfx::BitmapFormat::RGBA32, Gfx::IntSize(width, height), width * sizeof(u32), (u32*)data->data());
+ if (!bitmap)
+ return nullptr;
+ return adopt(*new ImageData(bitmap.release_nonnull(), move(data_handle)));
+}
+
+ImageData::ImageData(NonnullRefPtr<Gfx::Bitmap> bitmap, JS::Handle<JS::Uint8ClampedArray> data)
+ : m_bitmap(move(bitmap))
+ , m_data(move(data))
+{
+}
+
+ImageData::~ImageData()
+{
+}
+
+unsigned ImageData::width() const
+{
+ return m_bitmap->width();
+}
+
+unsigned ImageData::height() const
+{
+ return m_bitmap->height();
+}
+
+JS::Uint8ClampedArray* ImageData::data()
+{
+ return m_data.cell();
+}
+
+const JS::Uint8ClampedArray* ImageData::data() const
+{
+ return m_data.cell();
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/ImageData.h b/Userland/Libraries/LibWeb/HTML/ImageData.h
new file mode 100644
index 0000000000..810400d187
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/ImageData.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibGfx/Forward.h>
+#include <LibJS/Heap/Handle.h>
+#include <LibWeb/Bindings/Wrappable.h>
+
+namespace Web::HTML {
+
+class ImageData
+ : public RefCounted<ImageData>
+ , public Bindings::Wrappable {
+public:
+ using WrapperType = Bindings::ImageDataWrapper;
+
+ static RefPtr<ImageData> create_with_size(JS::GlobalObject&, int width, int height);
+
+ ~ImageData();
+
+ unsigned width() const;
+ unsigned height() const;
+
+ Gfx::Bitmap& bitmap() { return m_bitmap; }
+ const Gfx::Bitmap& bitmap() const { return m_bitmap; }
+
+ JS::Uint8ClampedArray* data();
+ const JS::Uint8ClampedArray* data() const;
+
+private:
+ explicit ImageData(NonnullRefPtr<Gfx::Bitmap>, JS::Handle<JS::Uint8ClampedArray>);
+
+ NonnullRefPtr<Gfx::Bitmap> m_bitmap;
+ JS::Handle<JS::Uint8ClampedArray> m_data;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/ImageData.idl b/Userland/Libraries/LibWeb/HTML/ImageData.idl
new file mode 100644
index 0000000000..29b683b547
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/ImageData.idl
@@ -0,0 +1,7 @@
+interface ImageData {
+
+ readonly attribute unsigned long width;
+ readonly attribute unsigned long height;
+ readonly attribute Uint8ClampedArray data;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/Parser/Entities.cpp b/Userland/Libraries/LibWeb/HTML/Parser/Entities.cpp
new file mode 100644
index 0000000000..edda468b0a
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/Parser/Entities.cpp
@@ -0,0 +1,2302 @@
+/*
+ * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <AK/LogStream.h>
+#include <AK/StringView.h>
+#include <LibWeb/HTML/Parser/Entities.h>
+
+namespace Web {
+namespace HTML {
+
+Optional<EntityMatch> code_points_from_entity(const StringView& entity)
+{
+ constexpr struct {
+ StringView entity;
+ u32 code_point;
+ } single_code_point_entities[] = {
+ { "AElig;", 0x000C6 },
+ { "AElig", 0x000C6 },
+ { "AMP;", 0x00026 },
+ { "AMP", 0x00026 },
+ { "Aacute;", 0x000C1 },
+ { "Aacute", 0x000C1 },
+ { "Abreve;", 0x00102 },
+ { "Acirc;", 0x000C2 },
+ { "Acirc", 0x000C2 },
+ { "Acy;", 0x00410 },
+ { "Afr;", 0x1D504 },
+ { "Agrave;", 0x000C0 },
+ { "Agrave", 0x000C0 },
+ { "Alpha;", 0x00391 },
+ { "Amacr;", 0x00100 },
+ { "And;", 0x02A53 },
+ { "Aogon;", 0x00104 },
+ { "Aopf;", 0x1D538 },
+ { "ApplyFunction;", 0x02061 },
+ { "Aring;", 0x000C5 },
+ { "Aring", 0x000C5 },
+ { "Ascr;", 0x1D49C },
+ { "Assign;", 0x02254 },
+ { "Atilde;", 0x000C3 },
+ { "Atilde", 0x000C3 },
+ { "Auml;", 0x000C4 },
+ { "Auml", 0x000C4 },
+ { "Backslash;", 0x02216 },
+ { "Barv;", 0x02AE7 },
+ { "Barwed;", 0x02306 },
+ { "Bcy;", 0x00411 },
+ { "Because;", 0x02235 },
+ { "Bernoullis;", 0x0212C },
+ { "Beta;", 0x00392 },
+ { "Bfr;", 0x1D505 },
+ { "Bopf;", 0x1D539 },
+ { "Breve;", 0x002D8 },
+ { "Bscr;", 0x0212C },
+ { "Bumpeq;", 0x0224E },
+ { "CHcy;", 0x00427 },
+ { "COPY;", 0x000A9 },
+ { "COPY", 0x000A9 },
+ { "Cacute;", 0x00106 },
+ { "Cap;", 0x022D2 },
+ { "CapitalDifferentialD;", 0x02145 },
+ { "Cayleys;", 0x0212D },
+ { "Ccaron;", 0x0010C },
+ { "Ccedil;", 0x000C7 },
+ { "Ccedil", 0x000C7 },
+ { "Ccirc;", 0x00108 },
+ { "Cconint;", 0x02230 },
+ { "Cdot;", 0x0010A },
+ { "Cedilla;", 0x000B8 },
+ { "CenterDot;", 0x000B7 },
+ { "Cfr;", 0x0212D },
+ { "Chi;", 0x003A7 },
+ { "CircleDot;", 0x02299 },
+ { "CircleMinus;", 0x02296 },
+ { "CirclePlus;", 0x02295 },
+ { "CircleTimes;", 0x02297 },
+ { "ClockwiseContourIntegral;", 0x02232 },
+ { "CloseCurlyDoubleQuote;", 0x0201D },
+ { "CloseCurlyQuote;", 0x02019 },
+ { "Colon;", 0x02237 },
+ { "Colone;", 0x02A74 },
+ { "Congruent;", 0x02261 },
+ { "Conint;", 0x0222F },
+ { "ContourIntegral;", 0x0222E },
+ { "Copf;", 0x02102 },
+ { "Coproduct;", 0x02210 },
+ { "CounterClockwiseContourIntegral;", 0x02233 },
+ { "Cross;", 0x02A2F },
+ { "Cscr;", 0x1D49E },
+ { "Cup;", 0x022D3 },
+ { "CupCap;", 0x0224D },
+ { "DD;", 0x02145 },
+ { "DDotrahd;", 0x02911 },
+ { "DJcy;", 0x00402 },
+ { "DScy;", 0x00405 },
+ { "DZcy;", 0x0040F },
+ { "Dagger;", 0x02021 },
+ { "Darr;", 0x021A1 },
+ { "Dashv;", 0x02AE4 },
+ { "Dcaron;", 0x0010E },
+ { "Dcy;", 0x00414 },
+ { "Del;", 0x02207 },
+ { "Delta;", 0x00394 },
+ { "Dfr;", 0x1D507 },
+ { "DiacriticalAcute;", 0x000B4 },
+ { "DiacriticalDot;", 0x002D9 },
+ { "DiacriticalDoubleAcute;", 0x002DD },
+ { "DiacriticalGrave;", 0x00060 },
+ { "DiacriticalTilde;", 0x002DC },
+ { "Diamond;", 0x022C4 },
+ { "DifferentialD;", 0x02146 },
+ { "Dopf;", 0x1D53B },
+ { "Dot;", 0x000A8 },
+ { "DotDot;", 0x020DC },
+ { "DotEqual;", 0x02250 },
+ { "DoubleContourIntegral;", 0x0222F },
+ { "DoubleDot;", 0x000A8 },
+ { "DoubleDownArrow;", 0x021D3 },
+ { "DoubleLeftArrow;", 0x021D0 },
+ { "DoubleLeftRightArrow;", 0x021D4 },
+ { "DoubleLeftTee;", 0x02AE4 },
+ { "DoubleLongLeftArrow;", 0x027F8 },
+ { "DoubleLongLeftRightArrow;", 0x027FA },
+ { "DoubleLongRightArrow;", 0x027F9 },
+ { "DoubleRightArrow;", 0x021D2 },
+ { "DoubleRightTee;", 0x022A8 },
+ { "DoubleUpArrow;", 0x021D1 },
+ { "DoubleUpDownArrow;", 0x021D5 },
+ { "DoubleVerticalBar;", 0x02225 },
+ { "DownArrow;", 0x02193 },
+ { "DownArrowBar;", 0x02913 },
+ { "DownArrowUpArrow;", 0x021F5 },
+ { "DownBreve;", 0x00311 },
+ { "DownLeftRightVector;", 0x02950 },
+ { "DownLeftTeeVector;", 0x0295E },
+ { "DownLeftVector;", 0x021BD },
+ { "DownLeftVectorBar;", 0x02956 },
+ { "DownRightTeeVector;", 0x0295F },
+ { "DownRightVector;", 0x021C1 },
+ { "DownRightVectorBar;", 0x02957 },
+ { "DownTee;", 0x022A4 },
+ { "DownTeeArrow;", 0x021A7 },
+ { "Downarrow;", 0x021D3 },
+ { "Dscr;", 0x1D49F },
+ { "Dstrok;", 0x00110 },
+ { "ENG;", 0x0014A },
+ { "ETH;", 0x000D0 },
+ { "ETH", 0x000D0 },
+ { "Eacute;", 0x000C9 },
+ { "Eacute", 0x000C9 },
+ { "Ecaron;", 0x0011A },
+ { "Ecirc;", 0x000CA },
+ { "Ecirc", 0x000CA },
+ { "Ecy;", 0x0042D },
+ { "Edot;", 0x00116 },
+ { "Efr;", 0x1D508 },
+ { "Egrave;", 0x000C8 },
+ { "Egrave", 0x000C8 },
+ { "Element;", 0x02208 },
+ { "Emacr;", 0x00112 },
+ { "EmptySmallSquare;", 0x025FB },
+ { "EmptyVerySmallSquare;", 0x025AB },
+ { "Eogon;", 0x00118 },
+ { "Eopf;", 0x1D53C },
+ { "Epsilon;", 0x00395 },
+ { "Equal;", 0x02A75 },
+ { "EqualTilde;", 0x02242 },
+ { "Equilibrium;", 0x021CC },
+ { "Escr;", 0x02130 },
+ { "Esim;", 0x02A73 },
+ { "Eta;", 0x00397 },
+ { "Euml;", 0x000CB },
+ { "Euml", 0x000CB },
+ { "Exists;", 0x02203 },
+ { "ExponentialE;", 0x02147 },
+ { "Fcy;", 0x00424 },
+ { "Ffr;", 0x1D509 },
+ { "FilledSmallSquare;", 0x025FC },
+ { "FilledVerySmallSquare;", 0x025AA },
+ { "Fopf;", 0x1D53D },
+ { "ForAll;", 0x02200 },
+ { "Fouriertrf;", 0x02131 },
+ { "Fscr;", 0x02131 },
+ { "GJcy;", 0x00403 },
+ { "GT;", 0x0003E },
+ { "GT", 0x0003E },
+ { "Gamma;", 0x00393 },
+ { "Gammad;", 0x003DC },
+ { "Gbreve;", 0x0011E },
+ { "Gcedil;", 0x00122 },
+ { "Gcirc;", 0x0011C },
+ { "Gcy;", 0x00413 },
+ { "Gdot;", 0x00120 },
+ { "Gfr;", 0x1D50A },
+ { "Gg;", 0x022D9 },
+ { "Gopf;", 0x1D53E },
+ { "GreaterEqual;", 0x02265 },
+ { "GreaterEqualLess;", 0x022DB },
+ { "GreaterFullEqual;", 0x02267 },
+ { "GreaterGreater;", 0x02AA2 },
+ { "GreaterLess;", 0x02277 },
+ { "GreaterSlantEqual;", 0x02A7E },
+ { "GreaterTilde;", 0x02273 },
+ { "Gscr;", 0x1D4A2 },
+ { "Gt;", 0x0226B },
+ { "HARDcy;", 0x0042A },
+ { "Hacek;", 0x002C7 },
+ { "Hat;", 0x0005E },
+ { "Hcirc;", 0x00124 },
+ { "Hfr;", 0x0210C },
+ { "HilbertSpace;", 0x0210B },
+ { "Hopf;", 0x0210D },
+ { "HorizontalLine;", 0x02500 },
+ { "Hscr;", 0x0210B },
+ { "Hstrok;", 0x00126 },
+ { "HumpDownHump;", 0x0224E },
+ { "HumpEqual;", 0x0224F },
+ { "IEcy;", 0x00415 },
+ { "IJlig;", 0x00132 },
+ { "IOcy;", 0x00401 },
+ { "Iacute;", 0x000CD },
+ { "Iacute", 0x000CD },
+ { "Icirc;", 0x000CE },
+ { "Icirc", 0x000CE },
+ { "Icy;", 0x00418 },
+ { "Idot;", 0x00130 },
+ { "Ifr;", 0x02111 },
+ { "Igrave;", 0x000CC },
+ { "Igrave", 0x000CC },
+ { "Im;", 0x02111 },
+ { "Imacr;", 0x0012A },
+ { "ImaginaryI;", 0x02148 },
+ { "Implies;", 0x021D2 },
+ { "Int;", 0x0222C },
+ { "Integral;", 0x0222B },
+ { "Intersection;", 0x022C2 },
+ { "InvisibleComma;", 0x02063 },
+ { "InvisibleTimes;", 0x02062 },
+ { "Iogon;", 0x0012E },
+ { "Iopf;", 0x1D540 },
+ { "Iota;", 0x00399 },
+ { "Iscr;", 0x02110 },
+ { "Itilde;", 0x00128 },
+ { "Iukcy;", 0x00406 },
+ { "Iuml;", 0x000CF },
+ { "Iuml", 0x000CF },
+ { "Jcirc;", 0x00134 },
+ { "Jcy;", 0x00419 },
+ { "Jfr;", 0x1D50D },
+ { "Jopf;", 0x1D541 },
+ { "Jscr;", 0x1D4A5 },
+ { "Jsercy;", 0x00408 },
+ { "Jukcy;", 0x00404 },
+ { "KHcy;", 0x00425 },
+ { "KJcy;", 0x0040C },
+ { "Kappa;", 0x0039A },
+ { "Kcedil;", 0x00136 },
+ { "Kcy;", 0x0041A },
+ { "Kfr;", 0x1D50E },
+ { "Kopf;", 0x1D542 },
+ { "Kscr;", 0x1D4A6 },
+ { "LJcy;", 0x00409 },
+ { "LT;", 0x0003C },
+ { "LT", 0x0003C },
+ { "Lacute;", 0x00139 },
+ { "Lambda;", 0x0039B },
+ { "Lang;", 0x027EA },
+ { "Laplacetrf;", 0x02112 },
+ { "Larr;", 0x0219E },
+ { "Lcaron;", 0x0013D },
+ { "Lcedil;", 0x0013B },
+ { "Lcy;", 0x0041B },
+ { "LeftAngleBracket;", 0x027E8 },
+ { "LeftArrow;", 0x02190 },
+ { "LeftArrowBar;", 0x021E4 },
+ { "LeftArrowRightArrow;", 0x021C6 },
+ { "LeftCeiling;", 0x02308 },
+ { "LeftDoubleBracket;", 0x027E6 },
+ { "LeftDownTeeVector;", 0x02961 },
+ { "LeftDownVector;", 0x021C3 },
+ { "LeftDownVectorBar;", 0x02959 },
+ { "LeftFloor;", 0x0230A },
+ { "LeftRightArrow;", 0x02194 },
+ { "LeftRightVector;", 0x0294E },
+ { "LeftTee;", 0x022A3 },
+ { "LeftTeeArrow;", 0x021A4 },
+ { "LeftTeeVector;", 0x0295A },
+ { "LeftTriangle;", 0x022B2 },
+ { "LeftTriangleBar;", 0x029CF },
+ { "LeftTriangleEqual;", 0x022B4 },
+ { "LeftUpDownVector;", 0x02951 },
+ { "LeftUpTeeVector;", 0x02960 },
+ { "LeftUpVector;", 0x021BF },
+ { "LeftUpVectorBar;", 0x02958 },
+ { "LeftVector;", 0x021BC },
+ { "LeftVectorBar;", 0x02952 },
+ { "Leftarrow;", 0x021D0 },
+ { "Leftrightarrow;", 0x021D4 },
+ { "LessEqualGreater;", 0x022DA },
+ { "LessFullEqual;", 0x02266 },
+ { "LessGreater;", 0x02276 },
+ { "LessLess;", 0x02AA1 },
+ { "LessSlantEqual;", 0x02A7D },
+ { "LessTilde;", 0x02272 },
+ { "Lfr;", 0x1D50F },
+ { "Ll;", 0x022D8 },
+ { "Lleftarrow;", 0x021DA },
+ { "Lmidot;", 0x0013F },
+ { "LongLeftArrow;", 0x027F5 },
+ { "LongLeftRightArrow;", 0x027F7 },
+ { "LongRightArrow;", 0x027F6 },
+ { "Longleftarrow;", 0x027F8 },
+ { "Longleftrightarrow;", 0x027FA },
+ { "Longrightarrow;", 0x027F9 },
+ { "Lopf;", 0x1D543 },
+ { "LowerLeftArrow;", 0x02199 },
+ { "LowerRightArrow;", 0x02198 },
+ { "Lscr;", 0x02112 },
+ { "Lsh;", 0x021B0 },
+ { "Lstrok;", 0x00141 },
+ { "Lt;", 0x0226A },
+ { "Map;", 0x02905 },
+ { "Mcy;", 0x0041C },
+ { "MediumSpace;", 0x0205F },
+ { "Mellintrf;", 0x02133 },
+ { "Mfr;", 0x1D510 },
+ { "MinusPlus;", 0x02213 },
+ { "Mopf;", 0x1D544 },
+ { "Mscr;", 0x02133 },
+ { "Mu;", 0x0039C },
+ { "NJcy;", 0x0040A },
+ { "Nacute;", 0x00143 },
+ { "Ncaron;", 0x00147 },
+ { "Ncedil;", 0x00145 },
+ { "Ncy;", 0x0041D },
+ { "NegativeMediumSpace;", 0x0200B },
+ { "NegativeThickSpace;", 0x0200B },
+ { "NegativeThinSpace;", 0x0200B },
+ { "NegativeVeryThinSpace;", 0x0200B },
+ { "NestedGreaterGreater;", 0x0226B },
+ { "NestedLessLess;", 0x0226A },
+ { "NewLine;", 0x0000A },
+ { "Nfr;", 0x1D511 },
+ { "NoBreak;", 0x02060 },
+ { "NonBreakingSpace;", 0x000A0 },
+ { "Nopf;", 0x02115 },
+ { "Not;", 0x02AEC },
+ { "NotCongruent;", 0x02262 },
+ { "NotCupCap;", 0x0226D },
+ { "NotDoubleVerticalBar;", 0x02226 },
+ { "NotElement;", 0x02209 },
+ { "NotEqual;", 0x02260 },
+ { "NotExists;", 0x02204 },
+ { "NotGreater;", 0x0226F },
+ { "NotGreaterEqual;", 0x02271 },
+ { "NotGreaterLess;", 0x02279 },
+ { "NotGreaterTilde;", 0x02275 },
+ { "NotLeftTriangle;", 0x022EA },
+ { "NotLeftTriangleEqual;", 0x022EC },
+ { "NotLess;", 0x0226E },
+ { "NotLessEqual;", 0x02270 },
+ { "NotLessGreater;", 0x02278 },
+ { "NotLessTilde;", 0x02274 },
+ { "NotPrecedes;", 0x02280 },
+ { "NotPrecedesSlantEqual;", 0x022E0 },
+ { "NotReverseElement;", 0x0220C },
+ { "NotRightTriangle;", 0x022EB },
+ { "NotRightTriangleEqual;", 0x022ED },
+ { "NotSquareSubsetEqual;", 0x022E2 },
+ { "NotSquareSupersetEqual;", 0x022E3 },
+ { "NotSubsetEqual;", 0x02288 },
+ { "NotSucceeds;", 0x02281 },
+ { "NotSucceedsSlantEqual;", 0x022E1 },
+ { "NotSupersetEqual;", 0x02289 },
+ { "NotTilde;", 0x02241 },
+ { "NotTildeEqual;", 0x02244 },
+ { "NotTildeFullEqual;", 0x02247 },
+ { "NotTildeTilde;", 0x02249 },
+ { "NotVerticalBar;", 0x02224 },
+ { "Nscr;", 0x1D4A9 },
+ { "Ntilde;", 0x000D1 },
+ { "Ntilde", 0x000D1 },
+ { "Nu;", 0x0039D },
+ { "OElig;", 0x00152 },
+ { "Oacute;", 0x000D3 },
+ { "Oacute", 0x000D3 },
+ { "Ocirc;", 0x000D4 },
+ { "Ocirc", 0x000D4 },
+ { "Ocy;", 0x0041E },
+ { "Odblac;", 0x00150 },
+ { "Ofr;", 0x1D512 },
+ { "Ograve;", 0x000D2 },
+ { "Ograve", 0x000D2 },
+ { "Omacr;", 0x0014C },
+ { "Omega;", 0x003A9 },
+ { "Omicron;", 0x0039F },
+ { "Oopf;", 0x1D546 },
+ { "OpenCurlyDoubleQuote;", 0x0201C },
+ { "OpenCurlyQuote;", 0x02018 },
+ { "Or;", 0x02A54 },
+ { "Oscr;", 0x1D4AA },
+ { "Oslash;", 0x000D8 },
+ { "Oslash", 0x000D8 },
+ { "Otilde;", 0x000D5 },
+ { "Otilde", 0x000D5 },
+ { "Otimes;", 0x02A37 },
+ { "Ouml;", 0x000D6 },
+ { "Ouml", 0x000D6 },
+ { "OverBar;", 0x0203E },
+ { "OverBrace;", 0x023DE },
+ { "OverBracket;", 0x023B4 },
+ { "OverParenthesis;", 0x023DC },
+ { "PartialD;", 0x02202 },
+ { "Pcy;", 0x0041F },
+ { "Pfr;", 0x1D513 },
+ { "Phi;", 0x003A6 },
+ { "Pi;", 0x003A0 },
+ { "PlusMinus;", 0x000B1 },
+ { "Poincareplane;", 0x0210C },
+ { "Popf;", 0x02119 },
+ { "Pr;", 0x02ABB },
+ { "Precedes;", 0x0227A },
+ { "PrecedesEqual;", 0x02AAF },
+ { "PrecedesSlantEqual;", 0x0227C },
+ { "PrecedesTilde;", 0x0227E },
+ { "Prime;", 0x02033 },
+ { "Product;", 0x0220F },
+ { "Proportion;", 0x02237 },
+ { "Proportional;", 0x0221D },
+ { "Pscr;", 0x1D4AB },
+ { "Psi;", 0x003A8 },
+ { "QUOT;", 0x00022 },
+ { "QUOT", 0x00022 },
+ { "Qfr;", 0x1D514 },
+ { "Qopf;", 0x0211A },
+ { "Qscr;", 0x1D4AC },
+ { "RBarr;", 0x02910 },
+ { "REG;", 0x000AE },
+ { "REG", 0x000AE },
+ { "Racute;", 0x00154 },
+ { "Rang;", 0x027EB },
+ { "Rarr;", 0x021A0 },
+ { "Rarrtl;", 0x02916 },
+ { "Rcaron;", 0x00158 },
+ { "Rcedil;", 0x00156 },
+ { "Rcy;", 0x00420 },
+ { "Re;", 0x0211C },
+ { "ReverseElement;", 0x0220B },
+ { "ReverseEquilibrium;", 0x021CB },
+ { "ReverseUpEquilibrium;", 0x0296F },
+ { "Rfr;", 0x0211C },
+ { "Rho;", 0x003A1 },
+ { "RightAngleBracket;", 0x027E9 },
+ { "RightArrow;", 0x02192 },
+ { "RightArrowBar;", 0x021E5 },
+ { "RightArrowLeftArrow;", 0x021C4 },
+ { "RightCeiling;", 0x02309 },
+ { "RightDoubleBracket;", 0x027E7 },
+ { "RightDownTeeVector;", 0x0295D },
+ { "RightDownVector;", 0x021C2 },
+ { "RightDownVectorBar;", 0x02955 },
+ { "RightFloor;", 0x0230B },
+ { "RightTee;", 0x022A2 },
+ { "RightTeeArrow;", 0x021A6 },
+ { "RightTeeVector;", 0x0295B },
+ { "RightTriangle;", 0x022B3 },
+ { "RightTriangleBar;", 0x029D0 },
+ { "RightTriangleEqual;", 0x022B5 },
+ { "RightUpDownVector;", 0x0294F },
+ { "RightUpTeeVector;", 0x0295C },
+ { "RightUpVector;", 0x021BE },
+ { "RightUpVectorBar;", 0x02954 },
+ { "RightVector;", 0x021C0 },
+ { "RightVectorBar;", 0x02953 },
+ { "Rightarrow;", 0x021D2 },
+ { "Ropf;", 0x0211D },
+ { "RoundImplies;", 0x02970 },
+ { "Rrightarrow;", 0x021DB },
+ { "Rscr;", 0x0211B },
+ { "Rsh;", 0x021B1 },
+ { "RuleDelayed;", 0x029F4 },
+ { "SHCHcy;", 0x00429 },
+ { "SHcy;", 0x00428 },
+ { "SOFTcy;", 0x0042C },
+ { "Sacute;", 0x0015A },
+ { "Sc;", 0x02ABC },
+ { "Scaron;", 0x00160 },
+ { "Scedil;", 0x0015E },
+ { "Scirc;", 0x0015C },
+ { "Scy;", 0x00421 },
+ { "Sfr;", 0x1D516 },
+ { "ShortDownArrow;", 0x02193 },
+ { "ShortLeftArrow;", 0x02190 },
+ { "ShortRightArrow;", 0x02192 },
+ { "ShortUpArrow;", 0x02191 },
+ { "Sigma;", 0x003A3 },
+ { "SmallCircle;", 0x02218 },
+ { "Sopf;", 0x1D54A },
+ { "Sqrt;", 0x0221A },
+ { "Square;", 0x025A1 },
+ { "SquareIntersection;", 0x02293 },
+ { "SquareSubset;", 0x0228F },
+ { "SquareSubsetEqual;", 0x02291 },
+ { "SquareSuperset;", 0x02290 },
+ { "SquareSupersetEqual;", 0x02292 },
+ { "SquareUnion;", 0x02294 },
+ { "Sscr;", 0x1D4AE },
+ { "Star;", 0x022C6 },
+ { "Sub;", 0x022D0 },
+ { "Subset;", 0x022D0 },
+ { "SubsetEqual;", 0x02286 },
+ { "Succeeds;", 0x0227B },
+ { "SucceedsEqual;", 0x02AB0 },
+ { "SucceedsSlantEqual;", 0x0227D },
+ { "SucceedsTilde;", 0x0227F },
+ { "SuchThat;", 0x0220B },
+ { "Sum;", 0x02211 },
+ { "Sup;", 0x022D1 },
+ { "Superset;", 0x02283 },
+ { "SupersetEqual;", 0x02287 },
+ { "Supset;", 0x022D1 },
+ { "THORN;", 0x000DE },
+ { "THORN", 0x000DE },
+ { "TRADE;", 0x02122 },
+ { "TSHcy;", 0x0040B },
+ { "TScy;", 0x00426 },
+ { "Tab;", 0x00009 },
+ { "Tau;", 0x003A4 },
+ { "Tcaron;", 0x00164 },
+ { "Tcedil;", 0x00162 },
+ { "Tcy;", 0x00422 },
+ { "Tfr;", 0x1D517 },
+ { "Therefore;", 0x02234 },
+ { "Theta;", 0x00398 },
+ { "ThinSpace;", 0x02009 },
+ { "Tilde;", 0x0223C },
+ { "TildeEqual;", 0x02243 },
+ { "TildeFullEqual;", 0x02245 },
+ { "TildeTilde;", 0x02248 },
+ { "Topf;", 0x1D54B },
+ { "TripleDot;", 0x020DB },
+ { "Tscr;", 0x1D4AF },
+ { "Tstrok;", 0x00166 },
+ { "Uacute;", 0x000DA },
+ { "Uacute", 0x000DA },
+ { "Uarr;", 0x0219F },
+ { "Uarrocir;", 0x02949 },
+ { "Ubrcy;", 0x0040E },
+ { "Ubreve;", 0x0016C },
+ { "Ucirc;", 0x000DB },
+ { "Ucirc", 0x000DB },
+ { "Ucy;", 0x00423 },
+ { "Udblac;", 0x00170 },
+ { "Ufr;", 0x1D518 },
+ { "Ugrave;", 0x000D9 },
+ { "Ugrave", 0x000D9 },
+ { "Umacr;", 0x0016A },
+ { "UnderBar;", 0x0005F },
+ { "UnderBrace;", 0x023DF },
+ { "UnderBracket;", 0x023B5 },
+ { "UnderParenthesis;", 0x023DD },
+ { "Union;", 0x022C3 },
+ { "UnionPlus;", 0x0228E },
+ { "Uogon;", 0x00172 },
+ { "Uopf;", 0x1D54C },
+ { "UpArrow;", 0x02191 },
+ { "UpArrowBar;", 0x02912 },
+ { "UpArrowDownArrow;", 0x021C5 },
+ { "UpDownArrow;", 0x02195 },
+ { "UpEquilibrium;", 0x0296E },
+ { "UpTee;", 0x022A5 },
+ { "UpTeeArrow;", 0x021A5 },
+ { "Uparrow;", 0x021D1 },
+ { "Updownarrow;", 0x021D5 },
+ { "UpperLeftArrow;", 0x02196 },
+ { "UpperRightArrow;", 0x02197 },
+ { "Upsi;", 0x003D2 },
+ { "Upsilon;", 0x003A5 },
+ { "Uring;", 0x0016E },
+ { "Uscr;", 0x1D4B0 },
+ { "Utilde;", 0x00168 },
+ { "Uuml;", 0x000DC },
+ { "Uuml", 0x000DC },
+ { "VDash;", 0x022AB },
+ { "Vbar;", 0x02AEB },
+ { "Vcy;", 0x00412 },
+ { "Vdash;", 0x022A9 },
+ { "Vdashl;", 0x02AE6 },
+ { "Vee;", 0x022C1 },
+ { "Verbar;", 0x02016 },
+ { "Vert;", 0x02016 },
+ { "VerticalBar;", 0x02223 },
+ { "VerticalLine;", 0x0007C },
+ { "VerticalSeparator;", 0x02758 },
+ { "VerticalTilde;", 0x02240 },
+ { "VeryThinSpace;", 0x0200A },
+ { "Vfr;", 0x1D519 },
+ { "Vopf;", 0x1D54D },
+ { "Vscr;", 0x1D4B1 },
+ { "Vvdash;", 0x022AA },
+ { "Wcirc;", 0x00174 },
+ { "Wedge;", 0x022C0 },
+ { "Wfr;", 0x1D51A },
+ { "Wopf;", 0x1D54E },
+ { "Wscr;", 0x1D4B2 },
+ { "Xfr;", 0x1D51B },
+ { "Xi;", 0x0039E },
+ { "Xopf;", 0x1D54F },
+ { "Xscr;", 0x1D4B3 },
+ { "YAcy;", 0x0042F },
+ { "YIcy;", 0x00407 },
+ { "YUcy;", 0x0042E },
+ { "Yacute;", 0x000DD },
+ { "Yacute", 0x000DD },
+ { "Ycirc;", 0x00176 },
+ { "Ycy;", 0x0042B },
+ { "Yfr;", 0x1D51C },
+ { "Yopf;", 0x1D550 },
+ { "Yscr;", 0x1D4B4 },
+ { "Yuml;", 0x00178 },
+ { "ZHcy;", 0x00416 },
+ { "Zacute;", 0x00179 },
+ { "Zcaron;", 0x0017D },
+ { "Zcy;", 0x00417 },
+ { "Zdot;", 0x0017B },
+ { "ZeroWidthSpace;", 0x0200B },
+ { "Zeta;", 0x00396 },
+ { "Zfr;", 0x02128 },
+ { "Zopf;", 0x02124 },
+ { "Zscr;", 0x1D4B5 },
+ { "aacute;", 0x000E1 },
+ { "aacute", 0x000E1 },
+ { "abreve;", 0x00103 },
+ { "ac;", 0x0223E },
+ { "acd;", 0x0223F },
+ { "acirc;", 0x000E2 },
+ { "acirc", 0x000E2 },
+ { "acute;", 0x000B4 },
+ { "acute", 0x000B4 },
+ { "acy;", 0x00430 },
+ { "aelig;", 0x000E6 },
+ { "aelig", 0x000E6 },
+ { "af;", 0x02061 },
+ { "afr;", 0x1D51E },
+ { "agrave;", 0x000E0 },
+ { "agrave", 0x000E0 },
+ { "alefsym;", 0x02135 },
+ { "aleph;", 0x02135 },
+ { "alpha;", 0x003B1 },
+ { "amacr;", 0x00101 },
+ { "amalg;", 0x02A3F },
+ { "amp;", 0x00026 },
+ { "amp", 0x00026 },
+ { "and;", 0x02227 },
+ { "andand;", 0x02A55 },
+ { "andd;", 0x02A5C },
+ { "andslope;", 0x02A58 },
+ { "andv;", 0x02A5A },
+ { "ang;", 0x02220 },
+ { "ange;", 0x029A4 },
+ { "angle;", 0x02220 },
+ { "angmsd;", 0x02221 },
+ { "angmsdaa;", 0x029A8 },
+ { "angmsdab;", 0x029A9 },
+ { "angmsdac;", 0x029AA },
+ { "angmsdad;", 0x029AB },
+ { "angmsdae;", 0x029AC },
+ { "angmsdaf;", 0x029AD },
+ { "angmsdag;", 0x029AE },
+ { "angmsdah;", 0x029AF },
+ { "angrt;", 0x0221F },
+ { "angrtvb;", 0x022BE },
+ { "angrtvbd;", 0x0299D },
+ { "angsph;", 0x02222 },
+ { "angst;", 0x000C5 },
+ { "angzarr;", 0x0237C },
+ { "aogon;", 0x00105 },
+ { "aopf;", 0x1D552 },
+ { "ap;", 0x02248 },
+ { "apE;", 0x02A70 },
+ { "apacir;", 0x02A6F },
+ { "ape;", 0x0224A },
+ { "apid;", 0x0224B },
+ { "apos;", 0x00027 },
+ { "approx;", 0x02248 },
+ { "approxeq;", 0x0224A },
+ { "aring;", 0x000E5 },
+ { "aring", 0x000E5 },
+ { "ascr;", 0x1D4B6 },
+ { "ast;", 0x0002A },
+ { "asymp;", 0x02248 },
+ { "asympeq;", 0x0224D },
+ { "atilde;", 0x000E3 },
+ { "atilde", 0x000E3 },
+ { "auml;", 0x000E4 },
+ { "auml", 0x000E4 },
+ { "awconint;", 0x02233 },
+ { "awint;", 0x02A11 },
+ { "bNot;", 0x02AED },
+ { "backcong;", 0x0224C },
+ { "backepsilon;", 0x003F6 },
+ { "backprime;", 0x02035 },
+ { "backsim;", 0x0223D },
+ { "backsimeq;", 0x022CD },
+ { "barvee;", 0x022BD },
+ { "barwed;", 0x02305 },
+ { "barwedge;", 0x02305 },
+ { "bbrk;", 0x023B5 },
+ { "bbrktbrk;", 0x023B6 },
+ { "bcong;", 0x0224C },
+ { "bcy;", 0x00431 },
+ { "bdquo;", 0x0201E },
+ { "becaus;", 0x02235 },
+ { "because;", 0x02235 },
+ { "bemptyv;", 0x029B0 },
+ { "bepsi;", 0x003F6 },
+ { "bernou;", 0x0212C },
+ { "beta;", 0x003B2 },
+ { "beth;", 0x02136 },
+ { "between;", 0x0226C },
+ { "bfr;", 0x1D51F },
+ { "bigcap;", 0x022C2 },
+ { "bigcirc;", 0x025EF },
+ { "bigcup;", 0x022C3 },
+ { "bigodot;", 0x02A00 },
+ { "bigoplus;", 0x02A01 },
+ { "bigotimes;", 0x02A02 },
+ { "bigsqcup;", 0x02A06 },
+ { "bigstar;", 0x02605 },
+ { "bigtriangledown;", 0x025BD },
+ { "bigtriangleup;", 0x025B3 },
+ { "biguplus;", 0x02A04 },
+ { "bigvee;", 0x022C1 },
+ { "bigwedge;", 0x022C0 },
+ { "bkarow;", 0x0290D },
+ { "blacklozenge;", 0x029EB },
+ { "blacksquare;", 0x025AA },
+ { "blacktriangle;", 0x025B4 },
+ { "blacktriangledown;", 0x025BE },
+ { "blacktriangleleft;", 0x025C2 },
+ { "blacktriangleright;", 0x025B8 },
+ { "blank;", 0x02423 },
+ { "blk12;", 0x02592 },
+ { "blk14;", 0x02591 },
+ { "blk34;", 0x02593 },
+ { "block;", 0x02588 },
+ { "bnot;", 0x02310 },
+ { "bopf;", 0x1D553 },
+ { "bot;", 0x022A5 },
+ { "bottom;", 0x022A5 },
+ { "bowtie;", 0x022C8 },
+ { "boxDL;", 0x02557 },
+ { "boxDR;", 0x02554 },
+ { "boxDl;", 0x02556 },
+ { "boxDr;", 0x02553 },
+ { "boxH;", 0x02550 },
+ { "boxHD;", 0x02566 },
+ { "boxHU;", 0x02569 },
+ { "boxHd;", 0x02564 },
+ { "boxHu;", 0x02567 },
+ { "boxUL;", 0x0255D },
+ { "boxUR;", 0x0255A },
+ { "boxUl;", 0x0255C },
+ { "boxUr;", 0x02559 },
+ { "boxV;", 0x02551 },
+ { "boxVH;", 0x0256C },
+ { "boxVL;", 0x02563 },
+ { "boxVR;", 0x02560 },
+ { "boxVh;", 0x0256B },
+ { "boxVl;", 0x02562 },
+ { "boxVr;", 0x0255F },
+ { "boxbox;", 0x029C9 },
+ { "boxdL;", 0x02555 },
+ { "boxdR;", 0x02552 },
+ { "boxdl;", 0x02510 },
+ { "boxdr;", 0x0250C },
+ { "boxh;", 0x02500 },
+ { "boxhD;", 0x02565 },
+ { "boxhU;", 0x02568 },
+ { "boxhd;", 0x0252C },
+ { "boxhu;", 0x02534 },
+ { "boxminus;", 0x0229F },
+ { "boxplus;", 0x0229E },
+ { "boxtimes;", 0x022A0 },
+ { "boxuL;", 0x0255B },
+ { "boxuR;", 0x02558 },
+ { "boxul;", 0x02518 },
+ { "boxur;", 0x02514 },
+ { "boxv;", 0x02502 },
+ { "boxvH;", 0x0256A },
+ { "boxvL;", 0x02561 },
+ { "boxvR;", 0x0255E },
+ { "boxvh;", 0x0253C },
+ { "boxvl;", 0x02524 },
+ { "boxvr;", 0x0251C },
+ { "bprime;", 0x02035 },
+ { "breve;", 0x002D8 },
+ { "brvbar;", 0x000A6 },
+ { "brvbar", 0x000A6 },
+ { "bscr;", 0x1D4B7 },
+ { "bsemi;", 0x0204F },
+ { "bsim;", 0x0223D },
+ { "bsime;", 0x022CD },
+ { "bsol;", 0x0005C },
+ { "bsolb;", 0x029C5 },
+ { "bsolhsub;", 0x027C8 },
+ { "bull;", 0x02022 },
+ { "bullet;", 0x02022 },
+ { "bump;", 0x0224E },
+ { "bumpE;", 0x02AAE },
+ { "bumpe;", 0x0224F },
+ { "bumpeq;", 0x0224F },
+ { "cacute;", 0x00107 },
+ { "cap;", 0x02229 },
+ { "capand;", 0x02A44 },
+ { "capbrcup;", 0x02A49 },
+ { "capcap;", 0x02A4B },
+ { "capcup;", 0x02A47 },
+ { "capdot;", 0x02A40 },
+ { "caret;", 0x02041 },
+ { "caron;", 0x002C7 },
+ { "ccaps;", 0x02A4D },
+ { "ccaron;", 0x0010D },
+ { "ccedil;", 0x000E7 },
+ { "ccedil", 0x000E7 },
+ { "ccirc;", 0x00109 },
+ { "ccups;", 0x02A4C },
+ { "ccupssm;", 0x02A50 },
+ { "cdot;", 0x0010B },
+ { "cedil;", 0x000B8 },
+ { "cedil", 0x000B8 },
+ { "cemptyv;", 0x029B2 },
+ { "cent;", 0x000A2 },
+ { "cent", 0x000A2 },
+ { "centerdot;", 0x000B7 },
+ { "cfr;", 0x1D520 },
+ { "chcy;", 0x00447 },
+ { "check;", 0x02713 },
+ { "checkmark;", 0x02713 },
+ { "chi;", 0x003C7 },
+ { "cir;", 0x025CB },
+ { "cirE;", 0x029C3 },
+ { "circ;", 0x002C6 },
+ { "circeq;", 0x02257 },
+ { "circlearrowleft;", 0x021BA },
+ { "circlearrowright;", 0x021BB },
+ { "circledR;", 0x000AE },
+ { "circledS;", 0x024C8 },
+ { "circledast;", 0x0229B },
+ { "circledcirc;", 0x0229A },
+ { "circleddash;", 0x0229D },
+ { "cire;", 0x02257 },
+ { "cirfnint;", 0x02A10 },
+ { "cirmid;", 0x02AEF },
+ { "cirscir;", 0x029C2 },
+ { "clubs;", 0x02663 },
+ { "clubsuit;", 0x02663 },
+ { "colon;", 0x0003A },
+ { "colone;", 0x02254 },
+ { "coloneq;", 0x02254 },
+ { "comma;", 0x0002C },
+ { "commat;", 0x00040 },
+ { "comp;", 0x02201 },
+ { "compfn;", 0x02218 },
+ { "complement;", 0x02201 },
+ { "complexes;", 0x02102 },
+ { "cong;", 0x02245 },
+ { "congdot;", 0x02A6D },
+ { "conint;", 0x0222E },
+ { "copf;", 0x1D554 },
+ { "coprod;", 0x02210 },
+ { "copy;", 0x000A9 },
+ { "copy", 0x000A9 },
+ { "copysr;", 0x02117 },
+ { "crarr;", 0x021B5 },
+ { "cross;", 0x02717 },
+ { "cscr;", 0x1D4B8 },
+ { "csub;", 0x02ACF },
+ { "csube;", 0x02AD1 },
+ { "csup;", 0x02AD0 },
+ { "csupe;", 0x02AD2 },
+ { "ctdot;", 0x022EF },
+ { "cudarrl;", 0x02938 },
+ { "cudarrr;", 0x02935 },
+ { "cuepr;", 0x022DE },
+ { "cuesc;", 0x022DF },
+ { "cularr;", 0x021B6 },
+ { "cularrp;", 0x0293D },
+ { "cup;", 0x0222A },
+ { "cupbrcap;", 0x02A48 },
+ { "cupcap;", 0x02A46 },
+ { "cupcup;", 0x02A4A },
+ { "cupdot;", 0x0228D },
+ { "cupor;", 0x02A45 },
+ { "curarr;", 0x021B7 },
+ { "curarrm;", 0x0293C },
+ { "curlyeqprec;", 0x022DE },
+ { "curlyeqsucc;", 0x022DF },
+ { "curlyvee;", 0x022CE },
+ { "curlywedge;", 0x022CF },
+ { "curren;", 0x000A4 },
+ { "curren", 0x000A4 },
+ { "curvearrowleft;", 0x021B6 },
+ { "curvearrowright;", 0x021B7 },
+ { "cuvee;", 0x022CE },
+ { "cuwed;", 0x022CF },
+ { "cwconint;", 0x02232 },
+ { "cwint;", 0x02231 },
+ { "cylcty;", 0x0232D },
+ { "dArr;", 0x021D3 },
+ { "dHar;", 0x02965 },
+ { "dagger;", 0x02020 },
+ { "daleth;", 0x02138 },
+ { "darr;", 0x02193 },
+ { "dash;", 0x02010 },
+ { "dashv;", 0x022A3 },
+ { "dbkarow;", 0x0290F },
+ { "dblac;", 0x002DD },
+ { "dcaron;", 0x0010F },
+ { "dcy;", 0x00434 },
+ { "dd;", 0x02146 },
+ { "ddagger;", 0x02021 },
+ { "ddarr;", 0x021CA },
+ { "ddotseq;", 0x02A77 },
+ { "deg;", 0x000B0 },
+ { "deg", 0x000B0 },
+ { "delta;", 0x003B4 },
+ { "demptyv;", 0x029B1 },
+ { "dfisht;", 0x0297F },
+ { "dfr;", 0x1D521 },
+ { "dharl;", 0x021C3 },
+ { "dharr;", 0x021C2 },
+ { "diam;", 0x022C4 },
+ { "diamond;", 0x022C4 },
+ { "diamondsuit;", 0x02666 },
+ { "diams;", 0x02666 },
+ { "die;", 0x000A8 },
+ { "digamma;", 0x003DD },
+ { "disin;", 0x022F2 },
+ { "div;", 0x000F7 },
+ { "divide;", 0x000F7 },
+ { "divide", 0x000F7 },
+ { "divideontimes;", 0x022C7 },
+ { "divonx;", 0x022C7 },
+ { "djcy;", 0x00452 },
+ { "dlcorn;", 0x0231E },
+ { "dlcrop;", 0x0230D },
+ { "dollar;", 0x00024 },
+ { "dopf;", 0x1D555 },
+ { "dot;", 0x002D9 },
+ { "doteq;", 0x02250 },
+ { "doteqdot;", 0x02251 },
+ { "dotminus;", 0x02238 },
+ { "dotplus;", 0x02214 },
+ { "dotsquare;", 0x022A1 },
+ { "doublebarwedge;", 0x02306 },
+ { "downarrow;", 0x02193 },
+ { "downdownarrows;", 0x021CA },
+ { "downharpoonleft;", 0x021C3 },
+ { "downharpoonright;", 0x021C2 },
+ { "drbkarow;", 0x02910 },
+ { "drcorn;", 0x0231F },
+ { "drcrop;", 0x0230C },
+ { "dscr;", 0x1D4B9 },
+ { "dscy;", 0x00455 },
+ { "dsol;", 0x029F6 },
+ { "dstrok;", 0x00111 },
+ { "dtdot;", 0x022F1 },
+ { "dtri;", 0x025BF },
+ { "dtrif;", 0x025BE },
+ { "duarr;", 0x021F5 },
+ { "duhar;", 0x0296F },
+ { "dwangle;", 0x029A6 },
+ { "dzcy;", 0x0045F },
+ { "dzigrarr;", 0x027FF },
+ { "eDDot;", 0x02A77 },
+ { "eDot;", 0x02251 },
+ { "eacute;", 0x000E9 },
+ { "eacute", 0x000E9 },
+ { "easter;", 0x02A6E },
+ { "ecaron;", 0x0011B },
+ { "ecir;", 0x02256 },
+ { "ecirc;", 0x000EA },
+ { "ecirc", 0x000EA },
+ { "ecolon;", 0x02255 },
+ { "ecy;", 0x0044D },
+ { "edot;", 0x00117 },
+ { "ee;", 0x02147 },
+ { "efDot;", 0x02252 },
+ { "efr;", 0x1D522 },
+ { "eg;", 0x02A9A },
+ { "egrave;", 0x000E8 },
+ { "egrave", 0x000E8 },
+ { "egs;", 0x02A96 },
+ { "egsdot;", 0x02A98 },
+ { "el;", 0x02A99 },
+ { "elinters;", 0x023E7 },
+ { "ell;", 0x02113 },
+ { "els;", 0x02A95 },
+ { "elsdot;", 0x02A97 },
+ { "emacr;", 0x00113 },
+ { "empty;", 0x02205 },
+ { "emptyset;", 0x02205 },
+ { "emptyv;", 0x02205 },
+ { "emsp13;", 0x02004 },
+ { "emsp14;", 0x02005 },
+ { "emsp;", 0x02003 },
+ { "eng;", 0x0014B },
+ { "ensp;", 0x02002 },
+ { "eogon;", 0x00119 },
+ { "eopf;", 0x1D556 },
+ { "epar;", 0x022D5 },
+ { "eparsl;", 0x029E3 },
+ { "eplus;", 0x02A71 },
+ { "epsi;", 0x003B5 },
+ { "epsilon;", 0x003B5 },
+ { "epsiv;", 0x003F5 },
+ { "eqcirc;", 0x02256 },
+ { "eqcolon;", 0x02255 },
+ { "eqsim;", 0x02242 },
+ { "eqslantgtr;", 0x02A96 },
+ { "eqslantless;", 0x02A95 },
+ { "equals;", 0x0003D },
+ { "equest;", 0x0225F },
+ { "equiv;", 0x02261 },
+ { "equivDD;", 0x02A78 },
+ { "eqvparsl;", 0x029E5 },
+ { "erDot;", 0x02253 },
+ { "erarr;", 0x02971 },
+ { "escr;", 0x0212F },
+ { "esdot;", 0x02250 },
+ { "esim;", 0x02242 },
+ { "eta;", 0x003B7 },
+ { "eth;", 0x000F0 },
+ { "eth", 0x000F0 },
+ { "euml;", 0x000EB },
+ { "euml", 0x000EB },
+ { "euro;", 0x020AC },
+ { "excl;", 0x00021 },
+ { "exist;", 0x02203 },
+ { "expectation;", 0x02130 },
+ { "exponentiale;", 0x02147 },
+ { "fallingdotseq;", 0x02252 },
+ { "fcy;", 0x00444 },
+ { "female;", 0x02640 },
+ { "ffilig;", 0x0FB03 },
+ { "fflig;", 0x0FB00 },
+ { "ffllig;", 0x0FB04 },
+ { "ffr;", 0x1D523 },
+ { "filig;", 0x0FB01 },
+ { "flat;", 0x0266D },
+ { "fllig;", 0x0FB02 },
+ { "fltns;", 0x025B1 },
+ { "fnof;", 0x00192 },
+ { "fopf;", 0x1D557 },
+ { "forall;", 0x02200 },
+ { "fork;", 0x022D4 },
+ { "forkv;", 0x02AD9 },
+ { "fpartint;", 0x02A0D },
+ { "frac12;", 0x000BD },
+ { "frac12", 0x000BD },
+ { "frac13;", 0x02153 },
+ { "frac14;", 0x000BC },
+ { "frac14", 0x000BC },
+ { "frac15;", 0x02155 },
+ { "frac16;", 0x02159 },
+ { "frac18;", 0x0215B },
+ { "frac23;", 0x02154 },
+ { "frac25;", 0x02156 },
+ { "frac34;", 0x000BE },
+ { "frac34", 0x000BE },
+ { "frac35;", 0x02157 },
+ { "frac38;", 0x0215C },
+ { "frac45;", 0x02158 },
+ { "frac56;", 0x0215A },
+ { "frac58;", 0x0215D },
+ { "frac78;", 0x0215E },
+ { "frasl;", 0x02044 },
+ { "frown;", 0x02322 },
+ { "fscr;", 0x1D4BB },
+ { "gE;", 0x02267 },
+ { "gEl;", 0x02A8C },
+ { "gacute;", 0x001F5 },
+ { "gamma;", 0x003B3 },
+ { "gammad;", 0x003DD },
+ { "gap;", 0x02A86 },
+ { "gbreve;", 0x0011F },
+ { "gcirc;", 0x0011D },
+ { "gcy;", 0x00433 },
+ { "gdot;", 0x00121 },
+ { "ge;", 0x02265 },
+ { "gel;", 0x022DB },
+ { "geq;", 0x02265 },
+ { "geqq;", 0x02267 },
+ { "geqslant;", 0x02A7E },
+ { "ges;", 0x02A7E },
+ { "gescc;", 0x02AA9 },
+ { "gesdot;", 0x02A80 },
+ { "gesdoto;", 0x02A82 },
+ { "gesdotol;", 0x02A84 },
+ { "gesles;", 0x02A94 },
+ { "gfr;", 0x1D524 },
+ { "gg;", 0x0226B },
+ { "ggg;", 0x022D9 },
+ { "gimel;", 0x02137 },
+ { "gjcy;", 0x00453 },
+ { "gl;", 0x02277 },
+ { "glE;", 0x02A92 },
+ { "gla;", 0x02AA5 },
+ { "glj;", 0x02AA4 },
+ { "gnE;", 0x02269 },
+ { "gnap;", 0x02A8A },
+ { "gnapprox;", 0x02A8A },
+ { "gne;", 0x02A88 },
+ { "gneq;", 0x02A88 },
+ { "gneqq;", 0x02269 },
+ { "gnsim;", 0x022E7 },
+ { "gopf;", 0x1D558 },
+ { "grave;", 0x00060 },
+ { "gscr;", 0x0210A },
+ { "gsim;", 0x02273 },
+ { "gsime;", 0x02A8E },
+ { "gsiml;", 0x02A90 },
+ { "gt;", 0x0003E },
+ { "gt", 0x0003E },
+ { "gtcc;", 0x02AA7 },
+ { "gtcir;", 0x02A7A },
+ { "gtdot;", 0x022D7 },
+ { "gtlPar;", 0x02995 },
+ { "gtquest;", 0x02A7C },
+ { "gtrapprox;", 0x02A86 },
+ { "gtrarr;", 0x02978 },
+ { "gtrdot;", 0x022D7 },
+ { "gtreqless;", 0x022DB },
+ { "gtreqqless;", 0x02A8C },
+ { "gtrless;", 0x02277 },
+ { "gtrsim;", 0x02273 },
+ { "hArr;", 0x021D4 },
+ { "hairsp;", 0x0200A },
+ { "half;", 0x000BD },
+ { "hamilt;", 0x0210B },
+ { "hardcy;", 0x0044A },
+ { "harr;", 0x02194 },
+ { "harrcir;", 0x02948 },
+ { "harrw;", 0x021AD },
+ { "hbar;", 0x0210F },
+ { "hcirc;", 0x00125 },
+ { "hearts;", 0x02665 },
+ { "heartsuit;", 0x02665 },
+ { "hellip;", 0x02026 },
+ { "hercon;", 0x022B9 },
+ { "hfr;", 0x1D525 },
+ { "hksearow;", 0x02925 },
+ { "hkswarow;", 0x02926 },
+ { "hoarr;", 0x021FF },
+ { "homtht;", 0x0223B },
+ { "hookleftarrow;", 0x021A9 },
+ { "hookrightarrow;", 0x021AA },
+ { "hopf;", 0x1D559 },
+ { "horbar;", 0x02015 },
+ { "hscr;", 0x1D4BD },
+ { "hslash;", 0x0210F },
+ { "hstrok;", 0x00127 },
+ { "hybull;", 0x02043 },
+ { "hyphen;", 0x02010 },
+ { "iacute;", 0x000ED },
+ { "iacute", 0x000ED },
+ { "ic;", 0x02063 },
+ { "icirc;", 0x000EE },
+ { "icirc", 0x000EE },
+ { "icy;", 0x00438 },
+ { "iecy;", 0x00435 },
+ { "iexcl;", 0x000A1 },
+ { "iexcl", 0x000A1 },
+ { "iff;", 0x021D4 },
+ { "ifr;", 0x1D526 },
+ { "igrave;", 0x000EC },
+ { "igrave", 0x000EC },
+ { "ii;", 0x02148 },
+ { "iiiint;", 0x02A0C },
+ { "iiint;", 0x0222D },
+ { "iinfin;", 0x029DC },
+ { "iiota;", 0x02129 },
+ { "ijlig;", 0x00133 },
+ { "imacr;", 0x0012B },
+ { "image;", 0x02111 },
+ { "imagline;", 0x02110 },
+ { "imagpart;", 0x02111 },
+ { "imath;", 0x00131 },
+ { "imof;", 0x022B7 },
+ { "imped;", 0x001B5 },
+ { "in;", 0x02208 },
+ { "incare;", 0x02105 },
+ { "infin;", 0x0221E },
+ { "infintie;", 0x029DD },
+ { "inodot;", 0x00131 },
+ { "int;", 0x0222B },
+ { "intcal;", 0x022BA },
+ { "integers;", 0x02124 },
+ { "intercal;", 0x022BA },
+ { "intlarhk;", 0x02A17 },
+ { "intprod;", 0x02A3C },
+ { "iocy;", 0x00451 },
+ { "iogon;", 0x0012F },
+ { "iopf;", 0x1D55A },
+ { "iota;", 0x003B9 },
+ { "iprod;", 0x02A3C },
+ { "iquest;", 0x000BF },
+ { "iquest", 0x000BF },
+ { "iscr;", 0x1D4BE },
+ { "isin;", 0x02208 },
+ { "isinE;", 0x022F9 },
+ { "isindot;", 0x022F5 },
+ { "isins;", 0x022F4 },
+ { "isinsv;", 0x022F3 },
+ { "isinv;", 0x02208 },
+ { "it;", 0x02062 },
+ { "itilde;", 0x00129 },
+ { "iukcy;", 0x00456 },
+ { "iuml;", 0x000EF },
+ { "iuml", 0x000EF },
+ { "jcirc;", 0x00135 },
+ { "jcy;", 0x00439 },
+ { "jfr;", 0x1D527 },
+ { "jmath;", 0x00237 },
+ { "jopf;", 0x1D55B },
+ { "jscr;", 0x1D4BF },
+ { "jsercy;", 0x00458 },
+ { "jukcy;", 0x00454 },
+ { "kappa;", 0x003BA },
+ { "kappav;", 0x003F0 },
+ { "kcedil;", 0x00137 },
+ { "kcy;", 0x0043A },
+ { "kfr;", 0x1D528 },
+ { "kgreen;", 0x00138 },
+ { "khcy;", 0x00445 },
+ { "kjcy;", 0x0045C },
+ { "kopf;", 0x1D55C },
+ { "kscr;", 0x1D4C0 },
+ { "lAarr;", 0x021DA },
+ { "lArr;", 0x021D0 },
+ { "lAtail;", 0x0291B },
+ { "lBarr;", 0x0290E },
+ { "lE;", 0x02266 },
+ { "lEg;", 0x02A8B },
+ { "lHar;", 0x02962 },
+ { "lacute;", 0x0013A },
+ { "laemptyv;", 0x029B4 },
+ { "lagran;", 0x02112 },
+ { "lambda;", 0x003BB },
+ { "lang;", 0x027E8 },
+ { "langd;", 0x02991 },
+ { "langle;", 0x027E8 },
+ { "lap;", 0x02A85 },
+ { "laquo;", 0x000AB },
+ { "laquo", 0x000AB },
+ { "larr;", 0x02190 },
+ { "larrb;", 0x021E4 },
+ { "larrbfs;", 0x0291F },
+ { "larrfs;", 0x0291D },
+ { "larrhk;", 0x021A9 },
+ { "larrlp;", 0x021AB },
+ { "larrpl;", 0x02939 },
+ { "larrsim;", 0x02973 },
+ { "larrtl;", 0x021A2 },
+ { "lat;", 0x02AAB },
+ { "latail;", 0x02919 },
+ { "late;", 0x02AAD },
+ { "lbarr;", 0x0290C },
+ { "lbbrk;", 0x02772 },
+ { "lbrace;", 0x0007B },
+ { "lbrack;", 0x0005B },
+ { "lbrke;", 0x0298B },
+ { "lbrksld;", 0x0298F },
+ { "lbrkslu;", 0x0298D },
+ { "lcaron;", 0x0013E },
+ { "lcedil;", 0x0013C },
+ { "lceil;", 0x02308 },
+ { "lcub;", 0x0007B },
+ { "lcy;", 0x0043B },
+ { "ldca;", 0x02936 },
+ { "ldquo;", 0x0201C },
+ { "ldquor;", 0x0201E },
+ { "ldrdhar;", 0x02967 },
+ { "ldrushar;", 0x0294B },
+ { "ldsh;", 0x021B2 },
+ { "le;", 0x02264 },
+ { "leftarrow;", 0x02190 },
+ { "leftarrowtail;", 0x021A2 },
+ { "leftharpoondown;", 0x021BD },
+ { "leftharpoonup;", 0x021BC },
+ { "leftleftarrows;", 0x021C7 },
+ { "leftrightarrow;", 0x02194 },
+ { "leftrightarrows;", 0x021C6 },
+ { "leftrightharpoons;", 0x021CB },
+ { "leftrightsquigarrow;", 0x021AD },
+ { "leftthreetimes;", 0x022CB },
+ { "leg;", 0x022DA },
+ { "leq;", 0x02264 },
+ { "leqq;", 0x02266 },
+ { "leqslant;", 0x02A7D },
+ { "les;", 0x02A7D },
+ { "lescc;", 0x02AA8 },
+ { "lesdot;", 0x02A7F },
+ { "lesdoto;", 0x02A81 },
+ { "lesdotor;", 0x02A83 },
+ { "lesges;", 0x02A93 },
+ { "lessapprox;", 0x02A85 },
+ { "lessdot;", 0x022D6 },
+ { "lesseqgtr;", 0x022DA },
+ { "lesseqqgtr;", 0x02A8B },
+ { "lessgtr;", 0x02276 },
+ { "lesssim;", 0x02272 },
+ { "lfisht;", 0x0297C },
+ { "lfloor;", 0x0230A },
+ { "lfr;", 0x1D529 },
+ { "lg;", 0x02276 },
+ { "lgE;", 0x02A91 },
+ { "lhard;", 0x021BD },
+ { "lharu;", 0x021BC },
+ { "lharul;", 0x0296A },
+ { "lhblk;", 0x02584 },
+ { "ljcy;", 0x00459 },
+ { "ll;", 0x0226A },
+ { "llarr;", 0x021C7 },
+ { "llcorner;", 0x0231E },
+ { "llhard;", 0x0296B },
+ { "lltri;", 0x025FA },
+ { "lmidot;", 0x00140 },
+ { "lmoust;", 0x023B0 },
+ { "lmoustache;", 0x023B0 },
+ { "lnE;", 0x02268 },
+ { "lnap;", 0x02A89 },
+ { "lnapprox;", 0x02A89 },
+ { "lne;", 0x02A87 },
+ { "lneq;", 0x02A87 },
+ { "lneqq;", 0x02268 },
+ { "lnsim;", 0x022E6 },
+ { "loang;", 0x027EC },
+ { "loarr;", 0x021FD },
+ { "lobrk;", 0x027E6 },
+ { "longleftarrow;", 0x027F5 },
+ { "longleftrightarrow;", 0x027F7 },
+ { "longmapsto;", 0x027FC },
+ { "longrightarrow;", 0x027F6 },
+ { "looparrowleft;", 0x021AB },
+ { "looparrowright;", 0x021AC },
+ { "lopar;", 0x02985 },
+ { "lopf;", 0x1D55D },
+ { "loplus;", 0x02A2D },
+ { "lotimes;", 0x02A34 },
+ { "lowast;", 0x02217 },
+ { "lowbar;", 0x0005F },
+ { "loz;", 0x025CA },
+ { "lozenge;", 0x025CA },
+ { "lozf;", 0x029EB },
+ { "lpar;", 0x00028 },
+ { "lparlt;", 0x02993 },
+ { "lrarr;", 0x021C6 },
+ { "lrcorner;", 0x0231F },
+ { "lrhar;", 0x021CB },
+ { "lrhard;", 0x0296D },
+ { "lrm;", 0x0200E },
+ { "lrtri;", 0x022BF },
+ { "lsaquo;", 0x02039 },
+ { "lscr;", 0x1D4C1 },
+ { "lsh;", 0x021B0 },
+ { "lsim;", 0x02272 },
+ { "lsime;", 0x02A8D },
+ { "lsimg;", 0x02A8F },
+ { "lsqb;", 0x0005B },
+ { "lsquo;", 0x02018 },
+ { "lsquor;", 0x0201A },
+ { "lstrok;", 0x00142 },
+ { "lt;", 0x0003C },
+ { "lt", 0x0003C },
+ { "ltcc;", 0x02AA6 },
+ { "ltcir;", 0x02A79 },
+ { "ltdot;", 0x022D6 },
+ { "lthree;", 0x022CB },
+ { "ltimes;", 0x022C9 },
+ { "ltlarr;", 0x02976 },
+ { "ltquest;", 0x02A7B },
+ { "ltrPar;", 0x02996 },
+ { "ltri;", 0x025C3 },
+ { "ltrie;", 0x022B4 },
+ { "ltrif;", 0x025C2 },
+ { "lurdshar;", 0x0294A },
+ { "luruhar;", 0x02966 },
+ { "mDDot;", 0x0223A },
+ { "macr;", 0x000AF },
+ { "macr", 0x000AF },
+ { "male;", 0x02642 },
+ { "malt;", 0x02720 },
+ { "maltese;", 0x02720 },
+ { "map;", 0x021A6 },
+ { "mapsto;", 0x021A6 },
+ { "mapstodown;", 0x021A7 },
+ { "mapstoleft;", 0x021A4 },
+ { "mapstoup;", 0x021A5 },
+ { "marker;", 0x025AE },
+ { "mcomma;", 0x02A29 },
+ { "mcy;", 0x0043C },
+ { "mdash;", 0x02014 },
+ { "measuredangle;", 0x02221 },
+ { "mfr;", 0x1D52A },
+ { "mho;", 0x02127 },
+ { "micro;", 0x000B5 },
+ { "micro", 0x000B5 },
+ { "mid;", 0x02223 },
+ { "midast;", 0x0002A },
+ { "midcir;", 0x02AF0 },
+ { "middot;", 0x000B7 },
+ { "middot", 0x000B7 },
+ { "minus;", 0x02212 },
+ { "minusb;", 0x0229F },
+ { "minusd;", 0x02238 },
+ { "minusdu;", 0x02A2A },
+ { "mlcp;", 0x02ADB },
+ { "mldr;", 0x02026 },
+ { "mnplus;", 0x02213 },
+ { "models;", 0x022A7 },
+ { "mopf;", 0x1D55E },
+ { "mp;", 0x02213 },
+ { "mscr;", 0x1D4C2 },
+ { "mstpos;", 0x0223E },
+ { "mu;", 0x003BC },
+ { "multimap;", 0x022B8 },
+ { "mumap;", 0x022B8 },
+ { "nLeftarrow;", 0x021CD },
+ { "nLeftrightarrow;", 0x021CE },
+ { "nRightarrow;", 0x021CF },
+ { "nVDash;", 0x022AF },
+ { "nVdash;", 0x022AE },
+ { "nabla;", 0x02207 },
+ { "nacute;", 0x00144 },
+ { "nap;", 0x02249 },
+ { "napos;", 0x00149 },
+ { "napprox;", 0x02249 },
+ { "natur;", 0x0266E },
+ { "natural;", 0x0266E },
+ { "naturals;", 0x02115 },
+ { "nbsp;", 0x000A0 },
+ { "nbsp", 0x000A0 },
+ { "ncap;", 0x02A43 },
+ { "ncaron;", 0x00148 },
+ { "ncedil;", 0x00146 },
+ { "ncong;", 0x02247 },
+ { "ncup;", 0x02A42 },
+ { "ncy;", 0x0043D },
+ { "ndash;", 0x02013 },
+ { "ne;", 0x02260 },
+ { "neArr;", 0x021D7 },
+ { "nearhk;", 0x02924 },
+ { "nearr;", 0x02197 },
+ { "nearrow;", 0x02197 },
+ { "nequiv;", 0x02262 },
+ { "nesear;", 0x02928 },
+ { "nexist;", 0x02204 },
+ { "nexists;", 0x02204 },
+ { "nfr;", 0x1D52B },
+ { "nge;", 0x02271 },
+ { "ngeq;", 0x02271 },
+ { "ngsim;", 0x02275 },
+ { "ngt;", 0x0226F },
+ { "ngtr;", 0x0226F },
+ { "nhArr;", 0x021CE },
+ { "nharr;", 0x021AE },
+ { "nhpar;", 0x02AF2 },
+ { "ni;", 0x0220B },
+ { "nis;", 0x022FC },
+ { "nisd;", 0x022FA },
+ { "niv;", 0x0220B },
+ { "njcy;", 0x0045A },
+ { "nlArr;", 0x021CD },
+ { "nlarr;", 0x0219A },
+ { "nldr;", 0x02025 },
+ { "nle;", 0x02270 },
+ { "nleftarrow;", 0x0219A },
+ { "nleftrightarrow;", 0x021AE },
+ { "nleq;", 0x02270 },
+ { "nless;", 0x0226E },
+ { "nlsim;", 0x02274 },
+ { "nlt;", 0x0226E },
+ { "nltri;", 0x022EA },
+ { "nltrie;", 0x022EC },
+ { "nmid;", 0x02224 },
+ { "nopf;", 0x1D55F },
+ { "not;", 0x000AC },
+ { "not", 0x000AC },
+ { "notin;", 0x02209 },
+ { "notinva;", 0x02209 },
+ { "notinvb;", 0x022F7 },
+ { "notinvc;", 0x022F6 },
+ { "notni;", 0x0220C },
+ { "notniva;", 0x0220C },
+ { "notnivb;", 0x022FE },
+ { "notnivc;", 0x022FD },
+ { "npar;", 0x02226 },
+ { "nparallel;", 0x02226 },
+ { "npolint;", 0x02A14 },
+ { "npr;", 0x02280 },
+ { "nprcue;", 0x022E0 },
+ { "nprec;", 0x02280 },
+ { "nrArr;", 0x021CF },
+ { "nrarr;", 0x0219B },
+ { "nrightarrow;", 0x0219B },
+ { "nrtri;", 0x022EB },
+ { "nrtrie;", 0x022ED },
+ { "nsc;", 0x02281 },
+ { "nsccue;", 0x022E1 },
+ { "nscr;", 0x1D4C3 },
+ { "nshortmid;", 0x02224 },
+ { "nshortparallel;", 0x02226 },
+ { "nsim;", 0x02241 },
+ { "nsime;", 0x02244 },
+ { "nsimeq;", 0x02244 },
+ { "nsmid;", 0x02224 },
+ { "nspar;", 0x02226 },
+ { "nsqsube;", 0x022E2 },
+ { "nsqsupe;", 0x022E3 },
+ { "nsub;", 0x02284 },
+ { "nsube;", 0x02288 },
+ { "nsubseteq;", 0x02288 },
+ { "nsucc;", 0x02281 },
+ { "nsup;", 0x02285 },
+ { "nsupe;", 0x02289 },
+ { "nsupseteq;", 0x02289 },
+ { "ntgl;", 0x02279 },
+ { "ntilde;", 0x000F1 },
+ { "ntilde", 0x000F1 },
+ { "ntlg;", 0x02278 },
+ { "ntriangleleft;", 0x022EA },
+ { "ntrianglelefteq;", 0x022EC },
+ { "ntriangleright;", 0x022EB },
+ { "ntrianglerighteq;", 0x022ED },
+ { "nu;", 0x003BD },
+ { "num;", 0x00023 },
+ { "numero;", 0x02116 },
+ { "numsp;", 0x02007 },
+ { "nvDash;", 0x022AD },
+ { "nvHarr;", 0x02904 },
+ { "nvdash;", 0x022AC },
+ { "nvinfin;", 0x029DE },
+ { "nvlArr;", 0x02902 },
+ { "nvrArr;", 0x02903 },
+ { "nwArr;", 0x021D6 },
+ { "nwarhk;", 0x02923 },
+ { "nwarr;", 0x02196 },
+ { "nwarrow;", 0x02196 },
+ { "nwnear;", 0x02927 },
+ { "oS;", 0x024C8 },
+ { "oacute;", 0x000F3 },
+ { "oacute", 0x000F3 },
+ { "oast;", 0x0229B },
+ { "ocir;", 0x0229A },
+ { "ocirc;", 0x000F4 },
+ { "ocirc", 0x000F4 },
+ { "ocy;", 0x0043E },
+ { "odash;", 0x0229D },
+ { "odblac;", 0x00151 },
+ { "odiv;", 0x02A38 },
+ { "odot;", 0x02299 },
+ { "odsold;", 0x029BC },
+ { "oelig;", 0x00153 },
+ { "ofcir;", 0x029BF },
+ { "ofr;", 0x1D52C },
+ { "ogon;", 0x002DB },
+ { "ograve;", 0x000F2 },
+ { "ograve", 0x000F2 },
+ { "ogt;", 0x029C1 },
+ { "ohbar;", 0x029B5 },
+ { "ohm;", 0x003A9 },
+ { "oint;", 0x0222E },
+ { "olarr;", 0x021BA },
+ { "olcir;", 0x029BE },
+ { "olcross;", 0x029BB },
+ { "oline;", 0x0203E },
+ { "olt;", 0x029C0 },
+ { "omacr;", 0x0014D },
+ { "omega;", 0x003C9 },
+ { "omicron;", 0x003BF },
+ { "omid;", 0x029B6 },
+ { "ominus;", 0x02296 },
+ { "oopf;", 0x1D560 },
+ { "opar;", 0x029B7 },
+ { "operp;", 0x029B9 },
+ { "oplus;", 0x02295 },
+ { "or;", 0x02228 },
+ { "orarr;", 0x021BB },
+ { "ord;", 0x02A5D },
+ { "order;", 0x02134 },
+ { "orderof;", 0x02134 },
+ { "ordf;", 0x000AA },
+ { "ordf", 0x000AA },
+ { "ordm;", 0x000BA },
+ { "ordm", 0x000BA },
+ { "origof;", 0x022B6 },
+ { "oror;", 0x02A56 },
+ { "orslope;", 0x02A57 },
+ { "orv;", 0x02A5B },
+ { "oscr;", 0x02134 },
+ { "oslash;", 0x000F8 },
+ { "oslash", 0x000F8 },
+ { "osol;", 0x02298 },
+ { "otilde;", 0x000F5 },
+ { "otilde", 0x000F5 },
+ { "otimes;", 0x02297 },
+ { "otimesas;", 0x02A36 },
+ { "ouml;", 0x000F6 },
+ { "ouml", 0x000F6 },
+ { "ovbar;", 0x0233D },
+ { "par;", 0x02225 },
+ { "para;", 0x000B6 },
+ { "para", 0x000B6 },
+ { "parallel;", 0x02225 },
+ { "parsim;", 0x02AF3 },
+ { "parsl;", 0x02AFD },
+ { "part;", 0x02202 },
+ { "pcy;", 0x0043F },
+ { "percnt;", 0x00025 },
+ { "period;", 0x0002E },
+ { "permil;", 0x02030 },
+ { "perp;", 0x022A5 },
+ { "pertenk;", 0x02031 },
+ { "pfr;", 0x1D52D },
+ { "phi;", 0x003C6 },
+ { "phiv;", 0x003D5 },
+ { "phmmat;", 0x02133 },
+ { "phone;", 0x0260E },
+ { "pi;", 0x003C0 },
+ { "pitchfork;", 0x022D4 },
+ { "piv;", 0x003D6 },
+ { "planck;", 0x0210F },
+ { "planckh;", 0x0210E },
+ { "plankv;", 0x0210F },
+ { "plus;", 0x0002B },
+ { "plusacir;", 0x02A23 },
+ { "plusb;", 0x0229E },
+ { "pluscir;", 0x02A22 },
+ { "plusdo;", 0x02214 },
+ { "plusdu;", 0x02A25 },
+ { "pluse;", 0x02A72 },
+ { "plusmn;", 0x000B1 },
+ { "plusmn", 0x000B1 },
+ { "plussim;", 0x02A26 },
+ { "plustwo;", 0x02A27 },
+ { "pm;", 0x000B1 },
+ { "pointint;", 0x02A15 },
+ { "popf;", 0x1D561 },
+ { "pound;", 0x000A3 },
+ { "pound", 0x000A3 },
+ { "pr;", 0x0227A },
+ { "prE;", 0x02AB3 },
+ { "prap;", 0x02AB7 },
+ { "prcue;", 0x0227C },
+ { "pre;", 0x02AAF },
+ { "prec;", 0x0227A },
+ { "precapprox;", 0x02AB7 },
+ { "preccurlyeq;", 0x0227C },
+ { "preceq;", 0x02AAF },
+ { "precnapprox;", 0x02AB9 },
+ { "precneqq;", 0x02AB5 },
+ { "precnsim;", 0x022E8 },
+ { "precsim;", 0x0227E },
+ { "prime;", 0x02032 },
+ { "primes;", 0x02119 },
+ { "prnE;", 0x02AB5 },
+ { "prnap;", 0x02AB9 },
+ { "prnsim;", 0x022E8 },
+ { "prod;", 0x0220F },
+ { "profalar;", 0x0232E },
+ { "profline;", 0x02312 },
+ { "profsurf;", 0x02313 },
+ { "prop;", 0x0221D },
+ { "propto;", 0x0221D },
+ { "prsim;", 0x0227E },
+ { "prurel;", 0x022B0 },
+ { "pscr;", 0x1D4C5 },
+ { "psi;", 0x003C8 },
+ { "puncsp;", 0x02008 },
+ { "qfr;", 0x1D52E },
+ { "qint;", 0x02A0C },
+ { "qopf;", 0x1D562 },
+ { "qprime;", 0x02057 },
+ { "qscr;", 0x1D4C6 },
+ { "quaternions;", 0x0210D },
+ { "quatint;", 0x02A16 },
+ { "quest;", 0x0003F },
+ { "questeq;", 0x0225F },
+ { "quot;", 0x00022 },
+ { "quot", 0x00022 },
+ { "rAarr;", 0x021DB },
+ { "rArr;", 0x021D2 },
+ { "rAtail;", 0x0291C },
+ { "rBarr;", 0x0290F },
+ { "rHar;", 0x02964 },
+ { "racute;", 0x00155 },
+ { "radic;", 0x0221A },
+ { "raemptyv;", 0x029B3 },
+ { "rang;", 0x027E9 },
+ { "rangd;", 0x02992 },
+ { "range;", 0x029A5 },
+ { "rangle;", 0x027E9 },
+ { "raquo;", 0x000BB },
+ { "raquo", 0x000BB },
+ { "rarr;", 0x02192 },
+ { "rarrap;", 0x02975 },
+ { "rarrb;", 0x021E5 },
+ { "rarrbfs;", 0x02920 },
+ { "rarrc;", 0x02933 },
+ { "rarrfs;", 0x0291E },
+ { "rarrhk;", 0x021AA },
+ { "rarrlp;", 0x021AC },
+ { "rarrpl;", 0x02945 },
+ { "rarrsim;", 0x02974 },
+ { "rarrtl;", 0x021A3 },
+ { "rarrw;", 0x0219D },
+ { "ratail;", 0x0291A },
+ { "ratio;", 0x02236 },
+ { "rationals;", 0x0211A },
+ { "rbarr;", 0x0290D },
+ { "rbbrk;", 0x02773 },
+ { "rbrace;", 0x0007D },
+ { "rbrack;", 0x0005D },
+ { "rbrke;", 0x0298C },
+ { "rbrksld;", 0x0298E },
+ { "rbrkslu;", 0x02990 },
+ { "rcaron;", 0x00159 },
+ { "rcedil;", 0x00157 },
+ { "rceil;", 0x02309 },
+ { "rcub;", 0x0007D },
+ { "rcy;", 0x00440 },
+ { "rdca;", 0x02937 },
+ { "rdldhar;", 0x02969 },
+ { "rdquo;", 0x0201D },
+ { "rdquor;", 0x0201D },
+ { "rdsh;", 0x021B3 },
+ { "real;", 0x0211C },
+ { "realine;", 0x0211B },
+ { "realpart;", 0x0211C },
+ { "reals;", 0x0211D },
+ { "rect;", 0x025AD },
+ { "reg;", 0x000AE },
+ { "reg", 0x000AE },
+ { "rfisht;", 0x0297D },
+ { "rfloor;", 0x0230B },
+ { "rfr;", 0x1D52F },
+ { "rhard;", 0x021C1 },
+ { "rharu;", 0x021C0 },
+ { "rharul;", 0x0296C },
+ { "rho;", 0x003C1 },
+ { "rhov;", 0x003F1 },
+ { "rightarrow;", 0x02192 },
+ { "rightarrowtail;", 0x021A3 },
+ { "rightharpoondown;", 0x021C1 },
+ { "rightharpoonup;", 0x021C0 },
+ { "rightleftarrows;", 0x021C4 },
+ { "rightleftharpoons;", 0x021CC },
+ { "rightrightarrows;", 0x021C9 },
+ { "rightsquigarrow;", 0x0219D },
+ { "rightthreetimes;", 0x022CC },
+ { "ring;", 0x002DA },
+ { "risingdotseq;", 0x02253 },
+ { "rlarr;", 0x021C4 },
+ { "rlhar;", 0x021CC },
+ { "rlm;", 0x0200F },
+ { "rmoust;", 0x023B1 },
+ { "rmoustache;", 0x023B1 },
+ { "rnmid;", 0x02AEE },
+ { "roang;", 0x027ED },
+ { "roarr;", 0x021FE },
+ { "robrk;", 0x027E7 },
+ { "ropar;", 0x02986 },
+ { "ropf;", 0x1D563 },
+ { "roplus;", 0x02A2E },
+ { "rotimes;", 0x02A35 },
+ { "rpar;", 0x00029 },
+ { "rpargt;", 0x02994 },
+ { "rppolint;", 0x02A12 },
+ { "rrarr;", 0x021C9 },
+ { "rsaquo;", 0x0203A },
+ { "rscr;", 0x1D4C7 },
+ { "rsh;", 0x021B1 },
+ { "rsqb;", 0x0005D },
+ { "rsquo;", 0x02019 },
+ { "rsquor;", 0x02019 },
+ { "rthree;", 0x022CC },
+ { "rtimes;", 0x022CA },
+ { "rtri;", 0x025B9 },
+ { "rtrie;", 0x022B5 },
+ { "rtrif;", 0x025B8 },
+ { "rtriltri;", 0x029CE },
+ { "ruluhar;", 0x02968 },
+ { "rx;", 0x0211E },
+ { "sacute;", 0x0015B },
+ { "sbquo;", 0x0201A },
+ { "sc;", 0x0227B },
+ { "scE;", 0x02AB4 },
+ { "scap;", 0x02AB8 },
+ { "scaron;", 0x00161 },
+ { "sccue;", 0x0227D },
+ { "sce;", 0x02AB0 },
+ { "scedil;", 0x0015F },
+ { "scirc;", 0x0015D },
+ { "scnE;", 0x02AB6 },
+ { "scnap;", 0x02ABA },
+ { "scnsim;", 0x022E9 },
+ { "scpolint;", 0x02A13 },
+ { "scsim;", 0x0227F },
+ { "scy;", 0x00441 },
+ { "sdot;", 0x022C5 },
+ { "sdotb;", 0x022A1 },
+ { "sdote;", 0x02A66 },
+ { "seArr;", 0x021D8 },
+ { "searhk;", 0x02925 },
+ { "searr;", 0x02198 },
+ { "searrow;", 0x02198 },
+ { "sect;", 0x000A7 },
+ { "sect", 0x000A7 },
+ { "semi;", 0x0003B },
+ { "seswar;", 0x02929 },
+ { "setminus;", 0x02216 },
+ { "setmn;", 0x02216 },
+ { "sext;", 0x02736 },
+ { "sfr;", 0x1D530 },
+ { "sfrown;", 0x02322 },
+ { "sharp;", 0x0266F },
+ { "shchcy;", 0x00449 },
+ { "shcy;", 0x00448 },
+ { "shortmid;", 0x02223 },
+ { "shortparallel;", 0x02225 },
+ { "shy;", 0x000AD },
+ { "shy", 0x000AD },
+ { "sigma;", 0x003C3 },
+ { "sigmaf;", 0x003C2 },
+ { "sigmav;", 0x003C2 },
+ { "sim;", 0x0223C },
+ { "simdot;", 0x02A6A },
+ { "sime;", 0x02243 },
+ { "simeq;", 0x02243 },
+ { "simg;", 0x02A9E },
+ { "simgE;", 0x02AA0 },
+ { "siml;", 0x02A9D },
+ { "simlE;", 0x02A9F },
+ { "simne;", 0x02246 },
+ { "simplus;", 0x02A24 },
+ { "simrarr;", 0x02972 },
+ { "slarr;", 0x02190 },
+ { "smallsetminus;", 0x02216 },
+ { "smashp;", 0x02A33 },
+ { "smeparsl;", 0x029E4 },
+ { "smid;", 0x02223 },
+ { "smile;", 0x02323 },
+ { "smt;", 0x02AAA },
+ { "smte;", 0x02AAC },
+ { "softcy;", 0x0044C },
+ { "sol;", 0x0002F },
+ { "solb;", 0x029C4 },
+ { "solbar;", 0x0233F },
+ { "sopf;", 0x1D564 },
+ { "spades;", 0x02660 },
+ { "spadesuit;", 0x02660 },
+ { "spar;", 0x02225 },
+ { "sqcap;", 0x02293 },
+ { "sqcup;", 0x02294 },
+ { "sqsub;", 0x0228F },
+ { "sqsube;", 0x02291 },
+ { "sqsubset;", 0x0228F },
+ { "sqsubseteq;", 0x02291 },
+ { "sqsup;", 0x02290 },
+ { "sqsupe;", 0x02292 },
+ { "sqsupset;", 0x02290 },
+ { "sqsupseteq;", 0x02292 },
+ { "squ;", 0x025A1 },
+ { "square;", 0x025A1 },
+ { "squarf;", 0x025AA },
+ { "squf;", 0x025AA },
+ { "srarr;", 0x02192 },
+ { "sscr;", 0x1D4C8 },
+ { "ssetmn;", 0x02216 },
+ { "ssmile;", 0x02323 },
+ { "sstarf;", 0x022C6 },
+ { "star;", 0x02606 },
+ { "starf;", 0x02605 },
+ { "straightepsilon;", 0x003F5 },
+ { "straightphi;", 0x003D5 },
+ { "strns;", 0x000AF },
+ { "sub;", 0x02282 },
+ { "subE;", 0x02AC5 },
+ { "subdot;", 0x02ABD },
+ { "sube;", 0x02286 },
+ { "subedot;", 0x02AC3 },
+ { "submult;", 0x02AC1 },
+ { "subnE;", 0x02ACB },
+ { "subne;", 0x0228A },
+ { "subplus;", 0x02ABF },
+ { "subrarr;", 0x02979 },
+ { "subset;", 0x02282 },
+ { "subseteq;", 0x02286 },
+ { "subseteqq;", 0x02AC5 },
+ { "subsetneq;", 0x0228A },
+ { "subsetneqq;", 0x02ACB },
+ { "subsim;", 0x02AC7 },
+ { "subsub;", 0x02AD5 },
+ { "subsup;", 0x02AD3 },
+ { "succ;", 0x0227B },
+ { "succapprox;", 0x02AB8 },
+ { "succcurlyeq;", 0x0227D },
+ { "succeq;", 0x02AB0 },
+ { "succnapprox;", 0x02ABA },
+ { "succneqq;", 0x02AB6 },
+ { "succnsim;", 0x022E9 },
+ { "succsim;", 0x0227F },
+ { "sum;", 0x02211 },
+ { "sung;", 0x0266A },
+ { "sup1;", 0x000B9 },
+ { "sup1", 0x000B9 },
+ { "sup2;", 0x000B2 },
+ { "sup2", 0x000B2 },
+ { "sup3;", 0x000B3 },
+ { "sup3", 0x000B3 },
+ { "sup;", 0x02283 },
+ { "supE;", 0x02AC6 },
+ { "supdot;", 0x02ABE },
+ { "supdsub;", 0x02AD8 },
+ { "supe;", 0x02287 },
+ { "supedot;", 0x02AC4 },
+ { "suphsol;", 0x027C9 },
+ { "suphsub;", 0x02AD7 },
+ { "suplarr;", 0x0297B },
+ { "supmult;", 0x02AC2 },
+ { "supnE;", 0x02ACC },
+ { "supne;", 0x0228B },
+ { "supplus;", 0x02AC0 },
+ { "supset;", 0x02283 },
+ { "supseteq;", 0x02287 },
+ { "supseteqq;", 0x02AC6 },
+ { "supsetneq;", 0x0228B },
+ { "supsetneqq;", 0x02ACC },
+ { "supsim;", 0x02AC8 },
+ { "supsub;", 0x02AD4 },
+ { "supsup;", 0x02AD6 },
+ { "swArr;", 0x021D9 },
+ { "swarhk;", 0x02926 },
+ { "swarr;", 0x02199 },
+ { "swarrow;", 0x02199 },
+ { "swnwar;", 0x0292A },
+ { "szlig;", 0x000DF },
+ { "szlig", 0x000DF },
+ { "target;", 0x02316 },
+ { "tau;", 0x003C4 },
+ { "tbrk;", 0x023B4 },
+ { "tcaron;", 0x00165 },
+ { "tcedil;", 0x00163 },
+ { "tcy;", 0x00442 },
+ { "tdot;", 0x020DB },
+ { "telrec;", 0x02315 },
+ { "tfr;", 0x1D531 },
+ { "there4;", 0x02234 },
+ { "therefore;", 0x02234 },
+ { "theta;", 0x003B8 },
+ { "thetasym;", 0x003D1 },
+ { "thetav;", 0x003D1 },
+ { "thickapprox;", 0x02248 },
+ { "thicksim;", 0x0223C },
+ { "thinsp;", 0x02009 },
+ { "thkap;", 0x02248 },
+ { "thksim;", 0x0223C },
+ { "thorn;", 0x000FE },
+ { "thorn", 0x000FE },
+ { "tilde;", 0x002DC },
+ { "times;", 0x000D7 },
+ { "times", 0x000D7 },
+ { "timesb;", 0x022A0 },
+ { "timesbar;", 0x02A31 },
+ { "timesd;", 0x02A30 },
+ { "tint;", 0x0222D },
+ { "toea;", 0x02928 },
+ { "top;", 0x022A4 },
+ { "topbot;", 0x02336 },
+ { "topcir;", 0x02AF1 },
+ { "topf;", 0x1D565 },
+ { "topfork;", 0x02ADA },
+ { "tosa;", 0x02929 },
+ { "tprime;", 0x02034 },
+ { "trade;", 0x02122 },
+ { "triangle;", 0x025B5 },
+ { "triangledown;", 0x025BF },
+ { "triangleleft;", 0x025C3 },
+ { "trianglelefteq;", 0x022B4 },
+ { "triangleq;", 0x0225C },
+ { "triangleright;", 0x025B9 },
+ { "trianglerighteq;", 0x022B5 },
+ { "tridot;", 0x025EC },
+ { "trie;", 0x0225C },
+ { "triminus;", 0x02A3A },
+ { "triplus;", 0x02A39 },
+ { "trisb;", 0x029CD },
+ { "tritime;", 0x02A3B },
+ { "trpezium;", 0x023E2 },
+ { "tscr;", 0x1D4C9 },
+ { "tscy;", 0x00446 },
+ { "tshcy;", 0x0045B },
+ { "tstrok;", 0x00167 },
+ { "twixt;", 0x0226C },
+ { "twoheadleftarrow;", 0x0219E },
+ { "twoheadrightarrow;", 0x021A0 },
+ { "uArr;", 0x021D1 },
+ { "uHar;", 0x02963 },
+ { "uacute;", 0x000FA },
+ { "uacute", 0x000FA },
+ { "uarr;", 0x02191 },
+ { "ubrcy;", 0x0045E },
+ { "ubreve;", 0x0016D },
+ { "ucirc;", 0x000FB },
+ { "ucirc", 0x000FB },
+ { "ucy;", 0x00443 },
+ { "udarr;", 0x021C5 },
+ { "udblac;", 0x00171 },
+ { "udhar;", 0x0296E },
+ { "ufisht;", 0x0297E },
+ { "ufr;", 0x1D532 },
+ { "ugrave;", 0x000F9 },
+ { "ugrave", 0x000F9 },
+ { "uharl;", 0x021BF },
+ { "uharr;", 0x021BE },
+ { "uhblk;", 0x02580 },
+ { "ulcorn;", 0x0231C },
+ { "ulcorner;", 0x0231C },
+ { "ulcrop;", 0x0230F },
+ { "ultri;", 0x025F8 },
+ { "umacr;", 0x0016B },
+ { "uml;", 0x000A8 },
+ { "uml", 0x000A8 },
+ { "uogon;", 0x00173 },
+ { "uopf;", 0x1D566 },
+ { "uparrow;", 0x02191 },
+ { "updownarrow;", 0x02195 },
+ { "upharpoonleft;", 0x021BF },
+ { "upharpoonright;", 0x021BE },
+ { "uplus;", 0x0228E },
+ { "upsi;", 0x003C5 },
+ { "upsih;", 0x003D2 },
+ { "upsilon;", 0x003C5 },
+ { "upuparrows;", 0x021C8 },
+ { "urcorn;", 0x0231D },
+ { "urcorner;", 0x0231D },
+ { "urcrop;", 0x0230E },
+ { "uring;", 0x0016F },
+ { "urtri;", 0x025F9 },
+ { "uscr;", 0x1D4CA },
+ { "utdot;", 0x022F0 },
+ { "utilde;", 0x00169 },
+ { "utri;", 0x025B5 },
+ { "utrif;", 0x025B4 },
+ { "uuarr;", 0x021C8 },
+ { "uuml;", 0x000FC },
+ { "uuml", 0x000FC },
+ { "uwangle;", 0x029A7 },
+ { "vArr;", 0x021D5 },
+ { "vBar;", 0x02AE8 },
+ { "vBarv;", 0x02AE9 },
+ { "vDash;", 0x022A8 },
+ { "vangrt;", 0x0299C },
+ { "varepsilon;", 0x003F5 },
+ { "varkappa;", 0x003F0 },
+ { "varnothing;", 0x02205 },
+ { "varphi;", 0x003D5 },
+ { "varpi;", 0x003D6 },
+ { "varpropto;", 0x0221D },
+ { "varr;", 0x02195 },
+ { "varrho;", 0x003F1 },
+ { "varsigma;", 0x003C2 },
+ { "vartheta;", 0x003D1 },
+ { "vartriangleleft;", 0x022B2 },
+ { "vartriangleright;", 0x022B3 },
+ { "vcy;", 0x00432 },
+ { "vdash;", 0x022A2 },
+ { "vee;", 0x02228 },
+ { "veebar;", 0x022BB },
+ { "veeeq;", 0x0225A },
+ { "vellip;", 0x022EE },
+ { "verbar;", 0x0007C },
+ { "vert;", 0x0007C },
+ { "vfr;", 0x1D533 },
+ { "vltri;", 0x022B2 },
+ { "vopf;", 0x1D567 },
+ { "vprop;", 0x0221D },
+ { "vrtri;", 0x022B3 },
+ { "vscr;", 0x1D4CB },
+ { "vzigzag;", 0x0299A },
+ { "wcirc;", 0x00175 },
+ { "wedbar;", 0x02A5F },
+ { "wedge;", 0x02227 },
+ { "wedgeq;", 0x02259 },
+ { "weierp;", 0x02118 },
+ { "wfr;", 0x1D534 },
+ { "wopf;", 0x1D568 },
+ { "wp;", 0x02118 },
+ { "wr;", 0x02240 },
+ { "wreath;", 0x02240 },
+ { "wscr;", 0x1D4CC },
+ { "xcap;", 0x022C2 },
+ { "xcirc;", 0x025EF },
+ { "xcup;", 0x022C3 },
+ { "xdtri;", 0x025BD },
+ { "xfr;", 0x1D535 },
+ { "xhArr;", 0x027FA },
+ { "xharr;", 0x027F7 },
+ { "xi;", 0x003BE },
+ { "xlArr;", 0x027F8 },
+ { "xlarr;", 0x027F5 },
+ { "xmap;", 0x027FC },
+ { "xnis;", 0x022FB },
+ { "xodot;", 0x02A00 },
+ { "xopf;", 0x1D569 },
+ { "xoplus;", 0x02A01 },
+ { "xotime;", 0x02A02 },
+ { "xrArr;", 0x027F9 },
+ { "xrarr;", 0x027F6 },
+ { "xscr;", 0x1D4CD },
+ { "xsqcup;", 0x02A06 },
+ { "xuplus;", 0x02A04 },
+ { "xutri;", 0x025B3 },
+ { "xvee;", 0x022C1 },
+ { "xwedge;", 0x022C0 },
+ { "yacute;", 0x000FD },
+ { "yacute", 0x000FD },
+ { "yacy;", 0x0044F },
+ { "ycirc;", 0x00177 },
+ { "ycy;", 0x0044B },
+ { "yen;", 0x000A5 },
+ { "yen", 0x000A5 },
+ { "yfr;", 0x1D536 },
+ { "yicy;", 0x00457 },
+ { "yopf;", 0x1D56A },
+ { "yscr;", 0x1D4CE },
+ { "yucy;", 0x0044E },
+ { "yuml;", 0x000FF },
+ { "yuml", 0x000FF },
+ { "zacute;", 0x0017A },
+ { "zcaron;", 0x0017E },
+ { "zcy;", 0x00437 },
+ { "zdot;", 0x0017C },
+ { "zeetrf;", 0x02128 },
+ { "zeta;", 0x003B6 },
+ { "zfr;", 0x1D537 },
+ { "zhcy;", 0x00436 },
+ { "zigrarr;", 0x021DD },
+ { "zopf;", 0x1D56B },
+ { "zscr;", 0x1D4CF },
+ { "zwj;", 0x0200D },
+ { "zwnj;", 0x0200C }
+ };
+
+ constexpr struct {
+ StringView entity;
+ u32 code_point1;
+ u32 code_point2;
+ } double_code_point_entities[] = {
+ { "NotEqualTilde;", 0x02242, 0x00338 },
+ { "NotGreaterFullEqual;", 0x02267, 0x00338 },
+ { "NotGreaterGreater;", 0x0226B, 0x00338 },
+ { "NotGreaterSlantEqual;", 0x02A7E, 0x00338 },
+ { "NotHumpDownHump;", 0x0224E, 0x00338 },
+ { "NotHumpEqual;", 0x0224F, 0x00338 },
+ { "NotLeftTriangleBar;", 0x029CF, 0x00338 },
+ { "NotLessLess;", 0x0226A, 0x00338 },
+ { "NotLessSlantEqual;", 0x02A7D, 0x00338 },
+ { "NotNestedGreaterGreater;", 0x02AA2, 0x00338 },
+ { "NotNestedLessLess;", 0x02AA1, 0x00338 },
+ { "NotPrecedesEqual;", 0x02AAF, 0x00338 },
+ { "NotRightTriangleBar;", 0x029D0, 0x00338 },
+ { "NotSquareSubset;", 0x0228F, 0x00338 },
+ { "NotSquareSuperset;", 0x02290, 0x00338 },
+ { "NotSubset;", 0x02282, 0x020D2 },
+ { "NotSucceedsEqual;", 0x02AB0, 0x00338 },
+ { "NotSucceedsTilde;", 0x0227F, 0x00338 },
+ { "NotSuperset;", 0x02283, 0x020D2 },
+ { "ThickSpace;", 0x0205F, 0x0200A },
+ { "acE;", 0x0223E, 0x00333 },
+ { "bne;", 0x0003D, 0x020E5 },
+ { "bnequiv;", 0x02261, 0x020E5 },
+ { "caps;", 0x02229, 0x0FE00 },
+ { "cups;", 0x0222A, 0x0FE00 },
+ { "fjlig;", 0x00066, 0x0006A },
+ { "gesl;", 0x022DB, 0x0FE00 },
+ { "gvertneqq;", 0x02269, 0x0FE00 },
+ { "gvnE;", 0x02269, 0x0FE00 },
+ { "lates;", 0x02AAD, 0x0FE00 },
+ { "lesg;", 0x022DA, 0x0FE00 },
+ { "lvertneqq;", 0x02268, 0x0FE00 },
+ { "lvnE;", 0x02268, 0x0FE00 },
+ { "nGg;", 0x022D9, 0x00338 },
+ { "nGt;", 0x0226B, 0x020D2 },
+ { "nGtv;", 0x0226B, 0x00338 },
+ { "nLl;", 0x022D8, 0x00338 },
+ { "nLt;", 0x0226A, 0x020D2 },
+ { "nLtv;", 0x0226A, 0x00338 },
+ { "nang;", 0x02220, 0x020D2 },
+ { "napE;", 0x02A70, 0x00338 },
+ { "napid;", 0x0224B, 0x00338 },
+ { "nbump;", 0x0224E, 0x00338 },
+ { "nbumpe;", 0x0224F, 0x00338 },
+ { "ncongdot;", 0x02A6D, 0x00338 },
+ { "nedot;", 0x02250, 0x00338 },
+ { "nesim;", 0x02242, 0x00338 },
+ { "ngE;", 0x02267, 0x00338 },
+ { "ngeqq;", 0x02267, 0x00338 },
+ { "ngeqslant;", 0x02A7E, 0x00338 },
+ { "nges;", 0x02A7E, 0x00338 },
+ { "nlE;", 0x02266, 0x00338 },
+ { "nleqq;", 0x02266, 0x00338 },
+ { "nleqslant;", 0x02A7D, 0x00338 },
+ { "nles;", 0x02A7D, 0x00338 },
+ { "notinE;", 0x022F9, 0x00338 },
+ { "notindot;", 0x022F5, 0x00338 },
+ { "nparsl;", 0x02AFD, 0x020E5 },
+ { "npart;", 0x02202, 0x00338 },
+ { "npre;", 0x02AAF, 0x00338 },
+ { "npreceq;", 0x02AAF, 0x00338 },
+ { "nrarrc;", 0x02933, 0x00338 },
+ { "nrarrw;", 0x0219D, 0x00338 },
+ { "nsce;", 0x02AB0, 0x00338 },
+ { "nsubE;", 0x02AC5, 0x00338 },
+ { "nsubset;", 0x02282, 0x020D2 },
+ { "nsubseteqq;", 0x02AC5, 0x00338 },
+ { "nsucceq;", 0x02AB0, 0x00338 },
+ { "nsupE;", 0x02AC6, 0x00338 },
+ { "nsupset;", 0x02283, 0x020D2 },
+ { "nsupseteqq;", 0x02AC6, 0x00338 },
+ { "nvap;", 0x0224D, 0x020D2 },
+ { "nvge;", 0x02265, 0x020D2 },
+ { "nvgt;", 0x0003E, 0x020D2 },
+ { "nvle;", 0x02264, 0x020D2 },
+ { "nvlt;", 0x0003C, 0x020D2 },
+ { "nvltrie;", 0x022B4, 0x020D2 },
+ { "nvrtrie;", 0x022B5, 0x020D2 },
+ { "nvsim;", 0x0223C, 0x020D2 },
+ { "race;", 0x0223D, 0x00331 },
+ { "smtes;", 0x02AAC, 0x0FE00 },
+ { "sqcaps;", 0x02293, 0x0FE00 },
+ { "sqcups;", 0x02294, 0x0FE00 },
+ { "varsubsetneq;", 0x0228A, 0x0FE00 },
+ { "varsubsetneqq;", 0x02ACB, 0x0FE00 },
+ { "varsupsetneq;", 0x0228B, 0x0FE00 },
+ { "varsupsetneqq;", 0x02ACC, 0x0FE00 },
+ { "vnsub;", 0x02282, 0x020D2 },
+ { "vnsup;", 0x02283, 0x020D2 },
+ { "vsubnE;", 0x02ACB, 0x0FE00 },
+ { "vsubne;", 0x0228A, 0x0FE00 },
+ { "vsupnE;", 0x02ACC, 0x0FE00 },
+ { "vsupne;", 0x0228B, 0x0FE00 },
+ };
+
+ EntityMatch match;
+
+ for (auto& single_code_point_entity : single_code_point_entities) {
+ if (entity.starts_with(single_code_point_entity.entity)) {
+ if (match.entity.is_null() || single_code_point_entity.entity.length() > match.entity.length())
+ match = { { single_code_point_entity.code_point }, single_code_point_entity.entity };
+ }
+ }
+
+ for (auto& double_code_point_entity : double_code_point_entities) {
+ if (entity.starts_with(double_code_point_entity.entity)) {
+ if (match.entity.is_null() || double_code_point_entity.entity.length() > match.entity.length())
+ match = EntityMatch { { double_code_point_entity.code_point1, double_code_point_entity.code_point2 }, StringView(double_code_point_entity.entity) };
+ }
+ }
+
+ if (match.entity.is_empty())
+ return {};
+ return match;
+}
+
+}
+}
diff --git a/Userland/Libraries/LibWeb/HTML/Parser/Entities.h b/Userland/Libraries/LibWeb/HTML/Parser/Entities.h
new file mode 100644
index 0000000000..0701f3be8d
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/Parser/Entities.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <AK/StringView.h>
+#include <AK/Vector.h>
+
+namespace Web {
+namespace HTML {
+
+struct EntityMatch {
+ Vector<u32, 2> code_points;
+ StringView entity;
+};
+
+Optional<EntityMatch> code_points_from_entity(const StringView&);
+
+}
+}
diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.cpp
new file mode 100644
index 0000000000..446888aeb3
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.cpp
@@ -0,0 +1,3027 @@
+/*
+ * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+//#define PARSER_DEBUG
+
+#include <AK/Utf32View.h>
+#include <LibTextCodec/Decoder.h>
+#include <LibWeb/DOM/Comment.h>
+#include <LibWeb/DOM/Document.h>
+#include <LibWeb/DOM/DocumentType.h>
+#include <LibWeb/DOM/ElementFactory.h>
+#include <LibWeb/DOM/Event.h>
+#include <LibWeb/DOM/Text.h>
+#include <LibWeb/DOM/Window.h>
+#include <LibWeb/HTML/EventNames.h>
+#include <LibWeb/HTML/HTMLFormElement.h>
+#include <LibWeb/HTML/HTMLHeadElement.h>
+#include <LibWeb/HTML/HTMLScriptElement.h>
+#include <LibWeb/HTML/HTMLTemplateElement.h>
+#include <LibWeb/HTML/Parser/HTMLDocumentParser.h>
+#include <LibWeb/HTML/Parser/HTMLToken.h>
+#include <LibWeb/Namespace.h>
+#include <LibWeb/SVG/TagNames.h>
+
+namespace Web::HTML {
+
+#define PARSE_ERROR() \
+ do { \
+ dbg() << "Parse error! " << __PRETTY_FUNCTION__ << " @ " << __LINE__; \
+ } while (0)
+
+static Vector<FlyString> s_quirks_public_ids = {
+ "+//Silmaril//dtd html Pro v0r11 19970101//",
+ "-//AS//DTD HTML 3.0 asWedit + extensions//",
+ "-//AdvaSoft Ltd//DTD HTML 3.0 asWedit + extensions//",
+ "-//IETF//DTD HTML 2.0 Level 1//",
+ "-//IETF//DTD HTML 2.0 Level 2//",
+ "-//IETF//DTD HTML 2.0 Strict Level 1//",
+ "-//IETF//DTD HTML 2.0 Strict Level 2//",
+ "-//IETF//DTD HTML 2.0 Strict//",
+ "-//IETF//DTD HTML 2.0//",
+ "-//IETF//DTD HTML 2.1E//",
+ "-//IETF//DTD HTML 3.0//",
+ "-//IETF//DTD HTML 3.2 Final//",
+ "-//IETF//DTD HTML 3.2//",
+ "-//IETF//DTD HTML 3//",
+ "-//IETF//DTD HTML Level 0//",
+ "-//IETF//DTD HTML Level 1//",
+ "-//IETF//DTD HTML Level 2//",
+ "-//IETF//DTD HTML Level 3//",
+ "-//IETF//DTD HTML Strict Level 0//",
+ "-//IETF//DTD HTML Strict Level 1//",
+ "-//IETF//DTD HTML Strict Level 2//",
+ "-//IETF//DTD HTML Strict Level 3//",
+ "-//IETF//DTD HTML Strict//",
+ "-//IETF//DTD HTML//",
+ "-//Metrius//DTD Metrius Presentational//",
+ "-//Microsoft//DTD Internet Explorer 2.0 HTML Strict//",
+ "-//Microsoft//DTD Internet Explorer 2.0 HTML//",
+ "-//Microsoft//DTD Internet Explorer 2.0 Tables//",
+ "-//Microsoft//DTD Internet Explorer 3.0 HTML Strict//",
+ "-//Microsoft//DTD Internet Explorer 3.0 HTML//",
+ "-//Microsoft//DTD Internet Explorer 3.0 Tables//",
+ "-//Netscape Comm. Corp.//DTD HTML//",
+ "-//Netscape Comm. Corp.//DTD Strict HTML//",
+ "-//O'Reilly and Associates//DTD HTML 2.0//",
+ "-//O'Reilly and Associates//DTD HTML Extended 1.0//",
+ "-//O'Reilly and Associates//DTD HTML Extended Relaxed 1.0//",
+ "-//SQ//DTD HTML 2.0 HoTMetaL + extensions//",
+ "-//SoftQuad Software//DTD HoTMetaL PRO 6.0::19990601::extensions to HTML 4.0//",
+ "-//SoftQuad//DTD HoTMetaL PRO 4.0::19971010::extensions to HTML 4.0//",
+ "-//Spyglass//DTD HTML 2.0 Extended//",
+ "-//Sun Microsystems Corp.//DTD HotJava HTML//",
+ "-//Sun Microsystems Corp.//DTD HotJava Strict HTML//",
+ "-//W3C//DTD HTML 3 1995-03-24//",
+ "-//W3C//DTD HTML 3.2 Draft//",
+ "-//W3C//DTD HTML 3.2 Final//",
+ "-//W3C//DTD HTML 3.2//",
+ "-//W3C//DTD HTML 3.2S Draft//",
+ "-//W3C//DTD HTML 4.0 Frameset//",
+ "-//W3C//DTD HTML 4.0 Transitional//",
+ "-//W3C//DTD HTML Experimental 19960712//",
+ "-//W3C//DTD HTML Experimental 970421//",
+ "-//W3C//DTD W3 HTML//",
+ "-//W3O//DTD W3 HTML 3.0//",
+ "-//WebTechs//DTD Mozilla HTML 2.0//",
+ "-//WebTechs//DTD Mozilla HTML//"
+};
+
+RefPtr<DOM::Document> parse_html_document(const StringView& data, const URL& url, const String& encoding)
+{
+ auto document = DOM::Document::create(url);
+ HTMLDocumentParser parser(document, data, encoding);
+ parser.run(url);
+ return document;
+}
+
+HTMLDocumentParser::HTMLDocumentParser(DOM::Document& document, const StringView& input, const String& encoding)
+ : m_tokenizer(input, encoding)
+ , m_document(document)
+{
+ m_document->set_should_invalidate_styles_on_attribute_changes(false);
+ m_document->set_encoding(TextCodec::get_standardized_encoding(encoding));
+}
+
+HTMLDocumentParser::~HTMLDocumentParser()
+{
+ m_document->set_should_invalidate_styles_on_attribute_changes(true);
+}
+
+void HTMLDocumentParser::run(const URL& url)
+{
+ m_document->set_url(url);
+ m_document->set_source(m_tokenizer.source());
+
+ for (;;) {
+ auto optional_token = m_tokenizer.next_token();
+ if (!optional_token.has_value())
+ break;
+ auto& token = optional_token.value();
+
+#ifdef PARSER_DEBUG
+ dbg() << "[" << insertion_mode_name() << "] " << token.to_string();
+#endif
+ // FIXME: If the adjusted current node is a MathML text integration point and the token is a start tag whose tag name is neither "mglyph" nor "malignmark"
+ // FIXME: If the adjusted current node is a MathML text integration point and the token is a character token
+ // FIXME: If the adjusted current node is a MathML annotation-xml element and the token is a start tag whose tag name is "svg"
+ // FIXME: If the adjusted current node is an HTML integration point and the token is a start tag
+ // FIXME: If the adjusted current node is an HTML integration point and the token is a character token
+ if (m_stack_of_open_elements.is_empty()
+ || adjusted_current_node().namespace_() == Namespace::HTML
+ || token.is_end_of_file()) {
+ process_using_the_rules_for(m_insertion_mode, token);
+ } else {
+ process_using_the_rules_for_foreign_content(token);
+ }
+
+ if (m_stop_parsing) {
+#ifdef PARSER_DEBUG
+ dbg() << "Stop parsing" << (m_parsing_fragment ? " fragment" : "") << "! :^)";
+#endif
+ break;
+ }
+ }
+
+ flush_character_insertions();
+
+ // "The end"
+
+ m_document->set_ready_state("interactive");
+
+ auto scripts_to_execute_when_parsing_has_finished = m_document->take_scripts_to_execute_when_parsing_has_finished({});
+ for (auto& script : scripts_to_execute_when_parsing_has_finished) {
+ script.execute_script();
+ }
+
+ auto content_loaded_event = DOM::Event::create(HTML::EventNames::DOMContentLoaded);
+ content_loaded_event->set_bubbles(true);
+ m_document->dispatch_event(content_loaded_event);
+
+ auto scripts_to_execute_as_soon_as_possible = m_document->take_scripts_to_execute_as_soon_as_possible({});
+ for (auto& script : scripts_to_execute_as_soon_as_possible) {
+ script.execute_script();
+ }
+
+ // FIXME: Spin the event loop until there is nothing that delays the load event in the Document.
+
+ m_document->set_ready_state("complete");
+ m_document->window().dispatch_event(DOM::Event::create(HTML::EventNames::load));
+
+ m_document->set_ready_for_post_load_tasks(true);
+ m_document->completely_finish_loading();
+}
+
+void HTMLDocumentParser::process_using_the_rules_for(InsertionMode mode, HTMLToken& token)
+{
+ switch (mode) {
+ case InsertionMode::Initial:
+ handle_initial(token);
+ break;
+ case InsertionMode::BeforeHTML:
+ handle_before_html(token);
+ break;
+ case InsertionMode::BeforeHead:
+ handle_before_head(token);
+ break;
+ case InsertionMode::InHead:
+ handle_in_head(token);
+ break;
+ case InsertionMode::InHeadNoscript:
+ handle_in_head_noscript(token);
+ break;
+ case InsertionMode::AfterHead:
+ handle_after_head(token);
+ break;
+ case InsertionMode::InBody:
+ handle_in_body(token);
+ break;
+ case InsertionMode::AfterBody:
+ handle_after_body(token);
+ break;
+ case InsertionMode::AfterAfterBody:
+ handle_after_after_body(token);
+ break;
+ case InsertionMode::Text:
+ handle_text(token);
+ break;
+ case InsertionMode::InTable:
+ handle_in_table(token);
+ break;
+ case InsertionMode::InTableBody:
+ handle_in_table_body(token);
+ break;
+ case InsertionMode::InRow:
+ handle_in_row(token);
+ break;
+ case InsertionMode::InCell:
+ handle_in_cell(token);
+ break;
+ case InsertionMode::InTableText:
+ handle_in_table_text(token);
+ break;
+ case InsertionMode::InSelectInTable:
+ handle_in_select_in_table(token);
+ break;
+ case InsertionMode::InSelect:
+ handle_in_select(token);
+ break;
+ case InsertionMode::InCaption:
+ handle_in_caption(token);
+ break;
+ case InsertionMode::InColumnGroup:
+ handle_in_column_group(token);
+ break;
+ case InsertionMode::InTemplate:
+ handle_in_template(token);
+ break;
+ case InsertionMode::InFrameset:
+ handle_in_frameset(token);
+ break;
+ case InsertionMode::AfterFrameset:
+ handle_after_frameset(token);
+ break;
+ case InsertionMode::AfterAfterFrameset:
+ handle_after_after_frameset(token);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+}
+
+DOM::QuirksMode HTMLDocumentParser::which_quirks_mode(const HTMLToken& doctype_token) const
+{
+ if (doctype_token.m_doctype.force_quirks)
+ return DOM::QuirksMode::Yes;
+
+ // NOTE: The tokenizer puts the name into lower case for us.
+ if (doctype_token.m_doctype.name.to_string() != "html")
+ return DOM::QuirksMode::Yes;
+
+ auto public_identifier = doctype_token.m_doctype.public_identifier.to_string();
+ auto system_identifier = doctype_token.m_doctype.system_identifier.to_string();
+
+ if (public_identifier.equals_ignoring_case("-//W3O//DTD W3 HTML Strict 3.0//EN//"))
+ return DOM::QuirksMode::Yes;
+
+ if (public_identifier.equals_ignoring_case("-/W3C/DTD HTML 4.0 Transitional/EN"))
+ return DOM::QuirksMode::Yes;
+
+ if (public_identifier.equals_ignoring_case("HTML"))
+ return DOM::QuirksMode::Yes;
+
+ if (system_identifier.equals_ignoring_case("http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"))
+ return DOM::QuirksMode::Yes;
+
+ for (auto& public_id : s_quirks_public_ids) {
+ if (public_identifier.starts_with(public_id, CaseSensitivity::CaseInsensitive))
+ return DOM::QuirksMode::Yes;
+ }
+
+ if (doctype_token.m_doctype.missing_system_identifier) {
+ if (public_identifier.starts_with("-//W3C//DTD HTML 4.01 Frameset//", CaseSensitivity::CaseInsensitive))
+ return DOM::QuirksMode::Yes;
+
+ if (public_identifier.starts_with("-//W3C//DTD HTML 4.01 Transitional//", CaseSensitivity::CaseInsensitive))
+ return DOM::QuirksMode::Yes;
+ }
+
+ if (public_identifier.starts_with("-//W3C//DTD XHTML 1.0 Frameset//", CaseSensitivity::CaseInsensitive))
+ return DOM::QuirksMode::Limited;
+
+ if (public_identifier.starts_with("-//W3C//DTD XHTML 1.0 Transitional//", CaseSensitivity::CaseInsensitive))
+ return DOM::QuirksMode::Limited;
+
+ if (!doctype_token.m_doctype.missing_system_identifier) {
+ if (public_identifier.starts_with("-//W3C//DTD HTML 4.01 Frameset//", CaseSensitivity::CaseInsensitive))
+ return DOM::QuirksMode::Limited;
+
+ if (public_identifier.starts_with("-//W3C//DTD HTML 4.01 Transitional//", CaseSensitivity::CaseInsensitive))
+ return DOM::QuirksMode::Limited;
+ }
+
+ return DOM::QuirksMode::No;
+}
+
+void HTMLDocumentParser::handle_initial(HTMLToken& token)
+{
+ if (token.is_character() && token.is_parser_whitespace()) {
+ return;
+ }
+
+ if (token.is_comment()) {
+ auto comment = adopt(*new DOM::Comment(document(), token.m_comment_or_character.data.to_string()));
+ document().append_child(move(comment));
+ return;
+ }
+
+ if (token.is_doctype()) {
+ auto doctype = adopt(*new DOM::DocumentType(document()));
+ doctype->set_name(token.m_doctype.name.to_string());
+ doctype->set_public_id(token.m_doctype.public_identifier.to_string());
+ doctype->set_system_id(token.m_doctype.system_identifier.to_string());
+ document().append_child(move(doctype));
+ document().set_quirks_mode(which_quirks_mode(token));
+ m_insertion_mode = InsertionMode::BeforeHTML;
+ return;
+ }
+
+ PARSE_ERROR();
+ document().set_quirks_mode(DOM::QuirksMode::Yes);
+ m_insertion_mode = InsertionMode::BeforeHTML;
+ process_using_the_rules_for(InsertionMode::BeforeHTML, token);
+}
+
+void HTMLDocumentParser::handle_before_html(HTMLToken& token)
+{
+ if (token.is_doctype()) {
+ PARSE_ERROR();
+ return;
+ }
+
+ if (token.is_comment()) {
+ auto comment = adopt(*new DOM::Comment(document(), token.m_comment_or_character.data.to_string()));
+ document().append_child(move(comment));
+ return;
+ }
+
+ if (token.is_character() && token.is_parser_whitespace()) {
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::html) {
+ auto element = create_element_for(token, Namespace::HTML);
+ document().append_child(element);
+ m_stack_of_open_elements.push(move(element));
+ m_insertion_mode = InsertionMode::BeforeHead;
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name().is_one_of(HTML::TagNames::head, HTML::TagNames::body, HTML::TagNames::html, HTML::TagNames::br)) {
+ goto AnythingElse;
+ }
+
+ if (token.is_end_tag()) {
+ PARSE_ERROR();
+ return;
+ }
+
+AnythingElse:
+ auto element = create_element(document(), HTML::TagNames::html, Namespace::HTML);
+ document().append_child(element);
+ m_stack_of_open_elements.push(element);
+ // FIXME: If the Document is being loaded as part of navigation of a browsing context, then: run the application cache selection algorithm with no manifest, passing it the Document object.
+ m_insertion_mode = InsertionMode::BeforeHead;
+ process_using_the_rules_for(InsertionMode::BeforeHead, token);
+ return;
+}
+
+DOM::Element& HTMLDocumentParser::current_node()
+{
+ return m_stack_of_open_elements.current_node();
+}
+
+DOM::Element& HTMLDocumentParser::adjusted_current_node()
+{
+ if (m_parsing_fragment && m_stack_of_open_elements.elements().size() == 1)
+ return *m_context_element;
+
+ return current_node();
+}
+
+DOM::Element& HTMLDocumentParser::node_before_current_node()
+{
+ return m_stack_of_open_elements.elements().at(m_stack_of_open_elements.elements().size() - 2);
+}
+
+HTMLDocumentParser::AdjustedInsertionLocation HTMLDocumentParser::find_appropriate_place_for_inserting_node()
+{
+ auto& target = current_node();
+ HTMLDocumentParser::AdjustedInsertionLocation adjusted_insertion_location;
+
+ if (m_foster_parenting && target.local_name().is_one_of(HTML::TagNames::table, HTML::TagNames::tbody, HTML::TagNames::tfoot, HTML::TagNames::thead, HTML::TagNames::tr)) {
+ auto last_template = m_stack_of_open_elements.last_element_with_tag_name(HTML::TagNames::template_);
+ auto last_table = m_stack_of_open_elements.last_element_with_tag_name(HTML::TagNames::table);
+ if (last_template.element && (!last_table.element || last_template.index > last_table.index)) {
+ // This returns the template content, so no need to check the parent is a template.
+ return { downcast<HTMLTemplateElement>(last_template.element)->content(), nullptr };
+ }
+ if (!last_table.element) {
+ ASSERT(m_parsing_fragment);
+ // Guaranteed not to be a template element (it will be the html element),
+ // so no need to check the parent is a template.
+ return { m_stack_of_open_elements.elements().first(), nullptr };
+ }
+ if (last_table.element->parent_node())
+ adjusted_insertion_location = { last_table.element->parent_node(), last_table.element };
+ else
+ adjusted_insertion_location = { m_stack_of_open_elements.element_before(*last_table.element), nullptr };
+ } else {
+ adjusted_insertion_location = { target, nullptr };
+ }
+
+ if (is<HTMLTemplateElement>(*adjusted_insertion_location.parent))
+ return { downcast<HTMLTemplateElement>(*adjusted_insertion_location.parent).content(), nullptr };
+
+ return adjusted_insertion_location;
+}
+
+NonnullRefPtr<DOM::Element> HTMLDocumentParser::create_element_for(const HTMLToken& token, const FlyString& namespace_)
+{
+ auto element = create_element(document(), token.tag_name(), namespace_);
+ for (auto& attribute : token.m_tag.attributes) {
+ element->set_attribute(attribute.local_name_builder.to_string(), attribute.value_builder.to_string());
+ }
+ return element;
+}
+
+RefPtr<DOM::Element> HTMLDocumentParser::insert_foreign_element(const HTMLToken& token, const FlyString& namespace_)
+{
+ auto adjusted_insertion_location = find_appropriate_place_for_inserting_node();
+ auto element = create_element_for(token, namespace_);
+ // FIXME: Check if it's possible to insert `element` at `adjusted_insertion_location`
+ adjusted_insertion_location.parent->insert_before(element, adjusted_insertion_location.insert_before_sibling);
+ m_stack_of_open_elements.push(element);
+ return element;
+}
+
+RefPtr<DOM::Element> HTMLDocumentParser::insert_html_element(const HTMLToken& token)
+{
+ return insert_foreign_element(token, Namespace::HTML);
+}
+
+void HTMLDocumentParser::handle_before_head(HTMLToken& token)
+{
+ if (token.is_character() && token.is_parser_whitespace()) {
+ return;
+ }
+
+ if (token.is_comment()) {
+ insert_comment(token);
+ return;
+ }
+
+ if (token.is_doctype()) {
+ PARSE_ERROR();
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::html) {
+ process_using_the_rules_for(InsertionMode::InBody, token);
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::head) {
+ auto element = insert_html_element(token);
+ m_head_element = downcast<HTMLHeadElement>(*element);
+ m_insertion_mode = InsertionMode::InHead;
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name().is_one_of(HTML::TagNames::head, HTML::TagNames::body, HTML::TagNames::html, HTML::TagNames::br)) {
+ goto AnythingElse;
+ }
+
+ if (token.is_end_tag()) {
+ PARSE_ERROR();
+ return;
+ }
+
+AnythingElse:
+ m_head_element = downcast<HTMLHeadElement>(*insert_html_element(HTMLToken::make_start_tag(HTML::TagNames::head)));
+ m_insertion_mode = InsertionMode::InHead;
+ process_using_the_rules_for(InsertionMode::InHead, token);
+ return;
+}
+
+void HTMLDocumentParser::insert_comment(HTMLToken& token)
+{
+ auto data = token.m_comment_or_character.data.to_string();
+ auto adjusted_insertion_location = find_appropriate_place_for_inserting_node();
+ adjusted_insertion_location.parent->insert_before(adopt(*new DOM::Comment(document(), data)), adjusted_insertion_location.insert_before_sibling);
+}
+
+void HTMLDocumentParser::handle_in_head(HTMLToken& token)
+{
+ if (token.is_parser_whitespace()) {
+ insert_character(token.code_point());
+ return;
+ }
+
+ if (token.is_comment()) {
+ insert_comment(token);
+ return;
+ }
+
+ if (token.is_doctype()) {
+ PARSE_ERROR();
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::html) {
+ process_using_the_rules_for(InsertionMode::InBody, token);
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::base, HTML::TagNames::basefont, HTML::TagNames::bgsound, HTML::TagNames::link)) {
+ insert_html_element(token);
+ m_stack_of_open_elements.pop();
+ token.acknowledge_self_closing_flag_if_set();
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::meta) {
+ auto element = insert_html_element(token);
+ m_stack_of_open_elements.pop();
+ token.acknowledge_self_closing_flag_if_set();
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::title) {
+ insert_html_element(token);
+ m_tokenizer.switch_to({}, HTMLTokenizer::State::RCDATA);
+ m_original_insertion_mode = m_insertion_mode;
+ m_insertion_mode = InsertionMode::Text;
+ return;
+ }
+
+ if (token.is_start_tag() && ((token.tag_name() == HTML::TagNames::noscript && m_scripting_enabled) || token.tag_name() == HTML::TagNames::noframes || token.tag_name() == HTML::TagNames::style)) {
+ parse_generic_raw_text_element(token);
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::noscript && !m_scripting_enabled) {
+ insert_html_element(token);
+ m_insertion_mode = InsertionMode::InHeadNoscript;
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::script) {
+ auto adjusted_insertion_location = find_appropriate_place_for_inserting_node();
+ auto element = create_element_for(token, Namespace::HTML);
+ auto& script_element = downcast<HTMLScriptElement>(*element);
+ script_element.set_parser_document({}, document());
+ script_element.set_non_blocking({}, false);
+
+ if (m_parsing_fragment) {
+ TODO();
+ }
+
+ if (m_invoked_via_document_write) {
+ TODO();
+ }
+
+ adjusted_insertion_location.parent->insert_before(element, adjusted_insertion_location.insert_before_sibling, false);
+ m_stack_of_open_elements.push(element);
+ m_tokenizer.switch_to({}, HTMLTokenizer::State::ScriptData);
+ m_original_insertion_mode = m_insertion_mode;
+ m_insertion_mode = InsertionMode::Text;
+ return;
+ }
+ if (token.is_end_tag() && token.tag_name() == HTML::TagNames::head) {
+ m_stack_of_open_elements.pop();
+ m_insertion_mode = InsertionMode::AfterHead;
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name().is_one_of(HTML::TagNames::body, HTML::TagNames::html, HTML::TagNames::br)) {
+ goto AnythingElse;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::template_) {
+ insert_html_element(token);
+ m_list_of_active_formatting_elements.add_marker();
+ m_frameset_ok = false;
+ m_insertion_mode = InsertionMode::InTemplate;
+ m_stack_of_template_insertion_modes.append(InsertionMode::InTemplate);
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name() == HTML::TagNames::template_) {
+ if (!m_stack_of_open_elements.contains(HTML::TagNames::template_)) {
+ PARSE_ERROR();
+ return;
+ }
+
+ generate_all_implied_end_tags_thoroughly();
+
+ if (current_node().local_name() != HTML::TagNames::template_)
+ PARSE_ERROR();
+
+ m_stack_of_open_elements.pop_until_an_element_with_tag_name_has_been_popped(HTML::TagNames::template_);
+ m_list_of_active_formatting_elements.clear_up_to_the_last_marker();
+ m_stack_of_template_insertion_modes.take_last();
+ reset_the_insertion_mode_appropriately();
+ return;
+ }
+
+ if ((token.is_start_tag() && token.tag_name() == HTML::TagNames::head) || token.is_end_tag()) {
+ PARSE_ERROR();
+ return;
+ }
+
+AnythingElse:
+ m_stack_of_open_elements.pop();
+ m_insertion_mode = InsertionMode::AfterHead;
+ process_using_the_rules_for(m_insertion_mode, token);
+}
+
+void HTMLDocumentParser::handle_in_head_noscript(HTMLToken& token)
+{
+ if (token.is_doctype()) {
+ PARSE_ERROR();
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::html) {
+ process_using_the_rules_for(InsertionMode::InBody, token);
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name() == HTML::TagNames::noscript) {
+ m_stack_of_open_elements.pop();
+ m_insertion_mode = InsertionMode::InHead;
+ return;
+ }
+
+ if (token.is_parser_whitespace() || token.is_comment() || (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::basefont, HTML::TagNames::bgsound, HTML::TagNames::link, HTML::TagNames::meta, HTML::TagNames::noframes, HTML::TagNames::style))) {
+ process_using_the_rules_for(InsertionMode::InHead, token);
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name() == HTML::TagNames::br) {
+ goto AnythingElse;
+ }
+
+ if (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::head, HTML::TagNames::noscript)) {
+ PARSE_ERROR();
+ return;
+ }
+
+AnythingElse:
+ PARSE_ERROR();
+ m_stack_of_open_elements.pop();
+ m_insertion_mode = InsertionMode::InHead;
+ process_using_the_rules_for(m_insertion_mode, token);
+}
+
+void HTMLDocumentParser::parse_generic_raw_text_element(HTMLToken& token)
+{
+ insert_html_element(token);
+ m_tokenizer.switch_to({}, HTMLTokenizer::State::RAWTEXT);
+ m_original_insertion_mode = m_insertion_mode;
+ m_insertion_mode = InsertionMode::Text;
+}
+
+DOM::Text* HTMLDocumentParser::find_character_insertion_node()
+{
+ auto adjusted_insertion_location = find_appropriate_place_for_inserting_node();
+ if (adjusted_insertion_location.insert_before_sibling) {
+ TODO();
+ }
+ if (adjusted_insertion_location.parent->is_document())
+ return nullptr;
+ if (adjusted_insertion_location.parent->last_child() && adjusted_insertion_location.parent->last_child()->is_text())
+ return downcast<DOM::Text>(adjusted_insertion_location.parent->last_child());
+ auto new_text_node = adopt(*new DOM::Text(document(), ""));
+ adjusted_insertion_location.parent->append_child(new_text_node);
+ return new_text_node;
+}
+
+void HTMLDocumentParser::flush_character_insertions()
+{
+ if (m_character_insertion_builder.is_empty())
+ return;
+ m_character_insertion_node->set_data(m_character_insertion_builder.to_string());
+ m_character_insertion_node->parent()->children_changed();
+ m_character_insertion_builder.clear();
+}
+
+void HTMLDocumentParser::insert_character(u32 data)
+{
+ auto node = find_character_insertion_node();
+ if (node == m_character_insertion_node) {
+ m_character_insertion_builder.append(Utf32View { &data, 1 });
+ return;
+ }
+ if (!m_character_insertion_node) {
+ m_character_insertion_node = node;
+ m_character_insertion_builder.append(Utf32View { &data, 1 });
+ return;
+ }
+ flush_character_insertions();
+ m_character_insertion_node = node;
+ m_character_insertion_builder.append(Utf32View { &data, 1 });
+}
+
+void HTMLDocumentParser::handle_after_head(HTMLToken& token)
+{
+ if (token.is_character() && token.is_parser_whitespace()) {
+ insert_character(token.code_point());
+ return;
+ }
+
+ if (token.is_comment()) {
+ insert_comment(token);
+ return;
+ }
+
+ if (token.is_doctype()) {
+ PARSE_ERROR();
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::html) {
+ process_using_the_rules_for(InsertionMode::InBody, token);
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::body) {
+ insert_html_element(token);
+ m_frameset_ok = false;
+ m_insertion_mode = InsertionMode::InBody;
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::frameset) {
+ insert_html_element(token);
+ m_insertion_mode = InsertionMode::InFrameset;
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::base, HTML::TagNames::basefont, HTML::TagNames::bgsound, HTML::TagNames::link, HTML::TagNames::meta, HTML::TagNames::noframes, HTML::TagNames::script, HTML::TagNames::style, HTML::TagNames::template_, HTML::TagNames::title)) {
+ PARSE_ERROR();
+ m_stack_of_open_elements.push(*m_head_element);
+ process_using_the_rules_for(InsertionMode::InHead, token);
+ m_stack_of_open_elements.elements().remove_first_matching([&](auto& entry) {
+ return entry.ptr() == m_head_element;
+ });
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name() == HTML::TagNames::template_) {
+ process_using_the_rules_for(InsertionMode::InHead, token);
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name().is_one_of(HTML::TagNames::body, HTML::TagNames::html, HTML::TagNames::br)) {
+ goto AnythingElse;
+ }
+
+ if ((token.is_start_tag() && token.tag_name() == HTML::TagNames::head) || token.is_end_tag()) {
+ PARSE_ERROR();
+ return;
+ }
+
+AnythingElse:
+ insert_html_element(HTMLToken::make_start_tag(HTML::TagNames::body));
+ m_insertion_mode = InsertionMode::InBody;
+ process_using_the_rules_for(m_insertion_mode, token);
+}
+
+void HTMLDocumentParser::generate_implied_end_tags(const FlyString& exception)
+{
+ while (current_node().local_name() != exception && current_node().local_name().is_one_of(HTML::TagNames::dd, HTML::TagNames::dt, HTML::TagNames::li, HTML::TagNames::optgroup, HTML::TagNames::option, HTML::TagNames::p, HTML::TagNames::rb, HTML::TagNames::rp, HTML::TagNames::rt, HTML::TagNames::rtc))
+ m_stack_of_open_elements.pop();
+}
+
+void HTMLDocumentParser::generate_all_implied_end_tags_thoroughly()
+{
+ while (current_node().local_name().is_one_of(HTML::TagNames::caption, HTML::TagNames::colgroup, HTML::TagNames::dd, HTML::TagNames::dt, HTML::TagNames::li, HTML::TagNames::optgroup, HTML::TagNames::option, HTML::TagNames::p, HTML::TagNames::rb, HTML::TagNames::rp, HTML::TagNames::rt, HTML::TagNames::rtc, HTML::TagNames::tbody, HTML::TagNames::td, HTML::TagNames::tfoot, HTML::TagNames::th, HTML::TagNames::thead, HTML::TagNames::tr))
+ m_stack_of_open_elements.pop();
+}
+
+void HTMLDocumentParser::close_a_p_element()
+{
+ generate_implied_end_tags(HTML::TagNames::p);
+ if (current_node().local_name() != HTML::TagNames::p) {
+ PARSE_ERROR();
+ }
+ m_stack_of_open_elements.pop_until_an_element_with_tag_name_has_been_popped(HTML::TagNames::p);
+}
+
+void HTMLDocumentParser::handle_after_body(HTMLToken& token)
+{
+ if (token.is_character() && token.is_parser_whitespace()) {
+ process_using_the_rules_for(InsertionMode::InBody, token);
+ return;
+ }
+
+ if (token.is_comment()) {
+ auto data = token.m_comment_or_character.data.to_string();
+ auto& insertion_location = m_stack_of_open_elements.first();
+ insertion_location.append_child(adopt(*new DOM::Comment(document(), data)));
+ return;
+ }
+
+ if (token.is_doctype()) {
+ PARSE_ERROR();
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::html) {
+ process_using_the_rules_for(InsertionMode::InBody, token);
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name() == HTML::TagNames::html) {
+ if (m_parsing_fragment) {
+ PARSE_ERROR();
+ return;
+ }
+ m_insertion_mode = InsertionMode::AfterAfterBody;
+ return;
+ }
+
+ if (token.is_end_of_file()) {
+ stop_parsing();
+ return;
+ }
+
+ PARSE_ERROR();
+ m_insertion_mode = InsertionMode::InBody;
+ process_using_the_rules_for(InsertionMode::InBody, token);
+}
+
+void HTMLDocumentParser::handle_after_after_body(HTMLToken& token)
+{
+ if (token.is_comment()) {
+ auto comment = adopt(*new DOM::Comment(document(), token.m_comment_or_character.data.to_string()));
+ document().append_child(move(comment));
+ return;
+ }
+
+ if (token.is_doctype() || token.is_parser_whitespace() || (token.is_start_tag() && token.tag_name() == HTML::TagNames::html)) {
+ process_using_the_rules_for(InsertionMode::InBody, token);
+ return;
+ }
+
+ if (token.is_end_of_file()) {
+ stop_parsing();
+ return;
+ }
+
+ PARSE_ERROR();
+ m_insertion_mode = InsertionMode::InBody;
+ process_using_the_rules_for(m_insertion_mode, token);
+}
+
+void HTMLDocumentParser::reconstruct_the_active_formatting_elements()
+{
+ // FIXME: This needs to care about "markers"
+
+ if (m_list_of_active_formatting_elements.is_empty())
+ return;
+
+ if (m_list_of_active_formatting_elements.entries().last().is_marker())
+ return;
+
+ if (m_stack_of_open_elements.contains(*m_list_of_active_formatting_elements.entries().last().element))
+ return;
+
+ ssize_t index = m_list_of_active_formatting_elements.entries().size() - 1;
+ RefPtr<DOM::Element> entry = m_list_of_active_formatting_elements.entries().at(index).element;
+ ASSERT(entry);
+
+Rewind:
+ if (index == 0) {
+ goto Create;
+ }
+
+ --index;
+ entry = m_list_of_active_formatting_elements.entries().at(index).element;
+ ASSERT(entry);
+
+ if (!m_stack_of_open_elements.contains(*entry))
+ goto Rewind;
+
+Advance:
+ ++index;
+ entry = m_list_of_active_formatting_elements.entries().at(index).element;
+ ASSERT(entry);
+
+Create:
+ // FIXME: Hold on to the real token!
+ auto new_element = insert_html_element(HTMLToken::make_start_tag(entry->local_name()));
+
+ m_list_of_active_formatting_elements.entries().at(index).element = *new_element;
+
+ if (index != (ssize_t)m_list_of_active_formatting_elements.entries().size() - 1)
+ goto Advance;
+}
+
+HTMLDocumentParser::AdoptionAgencyAlgorithmOutcome HTMLDocumentParser::run_the_adoption_agency_algorithm(HTMLToken& token)
+{
+ auto subject = token.tag_name();
+
+ // If the current node is an HTML element whose tag name is subject,
+ // and the current node is not in the list of active formatting elements,
+ // then pop the current node off the stack of open elements, and return.
+ if (current_node().local_name() == subject && !m_list_of_active_formatting_elements.contains(current_node())) {
+ m_stack_of_open_elements.pop();
+ return AdoptionAgencyAlgorithmOutcome::DoNothing;
+ }
+
+ size_t outer_loop_counter = 0;
+
+ //OuterLoop:
+ if (outer_loop_counter >= 8)
+ return AdoptionAgencyAlgorithmOutcome::DoNothing;
+
+ ++outer_loop_counter;
+
+ auto formatting_element = m_list_of_active_formatting_elements.last_element_with_tag_name_before_marker(subject);
+ if (!formatting_element)
+ return AdoptionAgencyAlgorithmOutcome::RunAnyOtherEndTagSteps;
+
+ if (!m_stack_of_open_elements.contains(*formatting_element)) {
+ PARSE_ERROR();
+ // FIXME: If formatting element is not in the stack of open elements,
+ // then this is a parse error; remove the element from the list, and return.
+ TODO();
+ }
+
+ if (!m_stack_of_open_elements.has_in_scope(*formatting_element)) {
+ PARSE_ERROR();
+ return AdoptionAgencyAlgorithmOutcome::DoNothing;
+ }
+
+ if (formatting_element != &current_node()) {
+ PARSE_ERROR();
+ }
+
+ RefPtr<DOM::Element> furthest_block = m_stack_of_open_elements.topmost_special_node_below(*formatting_element);
+
+ if (!furthest_block) {
+ while (&current_node() != formatting_element)
+ m_stack_of_open_elements.pop();
+ m_stack_of_open_elements.pop();
+
+ m_list_of_active_formatting_elements.remove(*formatting_element);
+ return AdoptionAgencyAlgorithmOutcome::DoNothing;
+ }
+
+ // FIXME: Implement the rest of the AAA :^)
+
+ TODO();
+}
+
+bool HTMLDocumentParser::is_special_tag(const FlyString& tag_name, const FlyString& namespace_)
+{
+ if (namespace_ == Namespace::HTML) {
+ return tag_name.is_one_of(
+ HTML::TagNames::address,
+ HTML::TagNames::applet,
+ HTML::TagNames::area,
+ HTML::TagNames::article,
+ HTML::TagNames::aside,
+ HTML::TagNames::base,
+ HTML::TagNames::basefont,
+ HTML::TagNames::bgsound,
+ HTML::TagNames::blockquote,
+ HTML::TagNames::body,
+ HTML::TagNames::br,
+ HTML::TagNames::button,
+ HTML::TagNames::caption,
+ HTML::TagNames::center,
+ HTML::TagNames::col,
+ HTML::TagNames::colgroup,
+ HTML::TagNames::dd,
+ HTML::TagNames::details,
+ HTML::TagNames::dir,
+ HTML::TagNames::div,
+ HTML::TagNames::dl,
+ HTML::TagNames::dt,
+ HTML::TagNames::embed,
+ HTML::TagNames::fieldset,
+ HTML::TagNames::figcaption,
+ HTML::TagNames::figure,
+ HTML::TagNames::footer,
+ HTML::TagNames::form,
+ HTML::TagNames::frame,
+ HTML::TagNames::frameset,
+ HTML::TagNames::h1,
+ HTML::TagNames::h2,
+ HTML::TagNames::h3,
+ HTML::TagNames::h4,
+ HTML::TagNames::h5,
+ HTML::TagNames::h6,
+ HTML::TagNames::head,
+ HTML::TagNames::header,
+ HTML::TagNames::hgroup,
+ HTML::TagNames::hr,
+ HTML::TagNames::html,
+ HTML::TagNames::iframe,
+ HTML::TagNames::img,
+ HTML::TagNames::input,
+ HTML::TagNames::keygen,
+ HTML::TagNames::li,
+ HTML::TagNames::link,
+ HTML::TagNames::listing,
+ HTML::TagNames::main,
+ HTML::TagNames::marquee,
+ HTML::TagNames::menu,
+ HTML::TagNames::meta,
+ HTML::TagNames::nav,
+ HTML::TagNames::noembed,
+ HTML::TagNames::noframes,
+ HTML::TagNames::noscript,
+ HTML::TagNames::object,
+ HTML::TagNames::ol,
+ HTML::TagNames::p,
+ HTML::TagNames::param,
+ HTML::TagNames::plaintext,
+ HTML::TagNames::pre,
+ HTML::TagNames::script,
+ HTML::TagNames::section,
+ HTML::TagNames::select,
+ HTML::TagNames::source,
+ HTML::TagNames::style,
+ HTML::TagNames::summary,
+ HTML::TagNames::table,
+ HTML::TagNames::tbody,
+ HTML::TagNames::td,
+ HTML::TagNames::template_,
+ HTML::TagNames::textarea,
+ HTML::TagNames::tfoot,
+ HTML::TagNames::th,
+ HTML::TagNames::thead,
+ HTML::TagNames::title,
+ HTML::TagNames::tr,
+ HTML::TagNames::track,
+ HTML::TagNames::ul,
+ HTML::TagNames::wbr,
+ HTML::TagNames::xmp);
+ } else if (namespace_ == Namespace::SVG) {
+ return tag_name.is_one_of(
+ SVG::TagNames::desc,
+ SVG::TagNames::foreignObject,
+ SVG::TagNames::title);
+ } else if (namespace_ == Namespace::MathML) {
+ TODO();
+ }
+
+ return false;
+}
+
+void HTMLDocumentParser::handle_in_body(HTMLToken& token)
+{
+ if (token.is_character()) {
+ if (token.code_point() == 0) {
+ PARSE_ERROR();
+ return;
+ }
+ if (token.is_parser_whitespace()) {
+ reconstruct_the_active_formatting_elements();
+ insert_character(token.code_point());
+ return;
+ }
+ reconstruct_the_active_formatting_elements();
+ insert_character(token.code_point());
+ m_frameset_ok = false;
+ return;
+ }
+
+ if (token.is_comment()) {
+ insert_comment(token);
+ return;
+ }
+
+ if (token.is_doctype()) {
+ PARSE_ERROR();
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::html) {
+ PARSE_ERROR();
+ if (m_stack_of_open_elements.contains(HTML::TagNames::template_))
+ return;
+ for (auto& attribute : token.m_tag.attributes) {
+ if (current_node().has_attribute(attribute.local_name_builder.string_view()))
+ continue;
+ current_node().set_attribute(attribute.local_name_builder.to_string(), attribute.value_builder.to_string());
+ }
+ return;
+ }
+ if (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::base, HTML::TagNames::basefont, HTML::TagNames::bgsound, HTML::TagNames::link, HTML::TagNames::meta, HTML::TagNames::noframes, HTML::TagNames::script, HTML::TagNames::style, HTML::TagNames::template_, HTML::TagNames::title)) {
+ process_using_the_rules_for(InsertionMode::InHead, token);
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name() == HTML::TagNames::template_) {
+ process_using_the_rules_for(InsertionMode::InHead, token);
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::body) {
+ PARSE_ERROR();
+ if (m_stack_of_open_elements.elements().size() == 1
+ || m_stack_of_open_elements.elements().at(1).local_name() != HTML::TagNames::body
+ || m_stack_of_open_elements.contains(HTML::TagNames::template_)) {
+ ASSERT(m_parsing_fragment);
+ return;
+ }
+ m_frameset_ok = false;
+ auto& body_element = m_stack_of_open_elements.elements().at(1);
+ for (auto& attribute : token.m_tag.attributes) {
+ if (body_element.has_attribute(attribute.local_name_builder.string_view()))
+ continue;
+ body_element.set_attribute(attribute.local_name_builder.to_string(), attribute.value_builder.to_string());
+ }
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::frameset) {
+ PARSE_ERROR();
+
+ if (m_stack_of_open_elements.elements().size() == 1
+ || m_stack_of_open_elements.elements().at(1).local_name() != HTML::TagNames::body) {
+ ASSERT(m_parsing_fragment);
+ return;
+ }
+
+ if (!m_frameset_ok)
+ return;
+
+ TODO();
+ }
+
+ if (token.is_end_of_file()) {
+ if (!m_stack_of_template_insertion_modes.is_empty()) {
+ process_using_the_rules_for(InsertionMode::InTemplate, token);
+ return;
+ }
+
+ for (auto& node : m_stack_of_open_elements.elements()) {
+ if (!node.local_name().is_one_of(HTML::TagNames::dd, HTML::TagNames::dt, HTML::TagNames::li, HTML::TagNames::optgroup, HTML::TagNames::option, HTML::TagNames::p, HTML::TagNames::rb, HTML::TagNames::rp, HTML::TagNames::rt, HTML::TagNames::rtc, HTML::TagNames::tbody, HTML::TagNames::td, HTML::TagNames::tfoot, HTML::TagNames::th, HTML::TagNames::thead, HTML::TagNames::tr, HTML::TagNames::body, HTML::TagNames::html)) {
+ PARSE_ERROR();
+ break;
+ }
+ }
+
+ stop_parsing();
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name() == HTML::TagNames::body) {
+ if (!m_stack_of_open_elements.has_in_scope(HTML::TagNames::body)) {
+ PARSE_ERROR();
+ return;
+ }
+
+ for (auto& node : m_stack_of_open_elements.elements()) {
+ if (!node.local_name().is_one_of(HTML::TagNames::dd, HTML::TagNames::dt, HTML::TagNames::li, HTML::TagNames::optgroup, HTML::TagNames::option, HTML::TagNames::p, HTML::TagNames::rb, HTML::TagNames::rp, HTML::TagNames::rt, HTML::TagNames::rtc, HTML::TagNames::tbody, HTML::TagNames::td, HTML::TagNames::tfoot, HTML::TagNames::th, HTML::TagNames::thead, HTML::TagNames::tr, HTML::TagNames::body, HTML::TagNames::html)) {
+ PARSE_ERROR();
+ break;
+ }
+ }
+
+ m_insertion_mode = InsertionMode::AfterBody;
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name() == HTML::TagNames::html) {
+ if (!m_stack_of_open_elements.has_in_scope(HTML::TagNames::body)) {
+ PARSE_ERROR();
+ return;
+ }
+
+ for (auto& node : m_stack_of_open_elements.elements()) {
+ if (!node.local_name().is_one_of(HTML::TagNames::dd, HTML::TagNames::dt, HTML::TagNames::li, HTML::TagNames::optgroup, HTML::TagNames::option, HTML::TagNames::p, HTML::TagNames::rb, HTML::TagNames::rp, HTML::TagNames::rt, HTML::TagNames::rtc, HTML::TagNames::tbody, HTML::TagNames::td, HTML::TagNames::tfoot, HTML::TagNames::th, HTML::TagNames::thead, HTML::TagNames::tr, HTML::TagNames::body, HTML::TagNames::html)) {
+ PARSE_ERROR();
+ break;
+ }
+ }
+
+ m_insertion_mode = InsertionMode::AfterBody;
+ process_using_the_rules_for(m_insertion_mode, token);
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::address, HTML::TagNames::article, HTML::TagNames::aside, HTML::TagNames::blockquote, HTML::TagNames::center, HTML::TagNames::details, HTML::TagNames::dialog, HTML::TagNames::dir, HTML::TagNames::div, HTML::TagNames::dl, HTML::TagNames::fieldset, HTML::TagNames::figcaption, HTML::TagNames::figure, HTML::TagNames::footer, HTML::TagNames::header, HTML::TagNames::hgroup, HTML::TagNames::main, HTML::TagNames::menu, HTML::TagNames::nav, HTML::TagNames::ol, HTML::TagNames::p, HTML::TagNames::section, HTML::TagNames::summary, HTML::TagNames::ul)) {
+ if (m_stack_of_open_elements.has_in_button_scope(HTML::TagNames::p))
+ close_a_p_element();
+ insert_html_element(token);
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::h1, HTML::TagNames::h2, HTML::TagNames::h3, HTML::TagNames::h4, HTML::TagNames::h5, HTML::TagNames::h6)) {
+ if (m_stack_of_open_elements.has_in_button_scope(HTML::TagNames::p))
+ close_a_p_element();
+ if (current_node().local_name().is_one_of(HTML::TagNames::h1, HTML::TagNames::h2, HTML::TagNames::h3, HTML::TagNames::h4, HTML::TagNames::h5, HTML::TagNames::h6)) {
+ PARSE_ERROR();
+ m_stack_of_open_elements.pop();
+ }
+ insert_html_element(token);
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::pre, HTML::TagNames::listing)) {
+ if (m_stack_of_open_elements.has_in_button_scope(HTML::TagNames::p))
+ close_a_p_element();
+
+ insert_html_element(token);
+
+ m_frameset_ok = false;
+
+ // If the next token is a U+000A LINE FEED (LF) character token,
+ // then ignore that token and move on to the next one.
+ // (Newlines at the start of pre blocks are ignored as an authoring convenience.)
+ auto next_token = m_tokenizer.next_token();
+ if (next_token.has_value() && next_token.value().is_character() && next_token.value().code_point() == '\n') {
+ // Ignore it.
+ } else {
+ process_using_the_rules_for(m_insertion_mode, next_token.value());
+ }
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::form) {
+ if (m_form_element && !m_stack_of_open_elements.contains(HTML::TagNames::template_)) {
+ PARSE_ERROR();
+ return;
+ }
+ if (m_stack_of_open_elements.has_in_button_scope(HTML::TagNames::p))
+ close_a_p_element();
+ auto element = insert_html_element(token);
+ if (!m_stack_of_open_elements.contains(HTML::TagNames::template_))
+ m_form_element = downcast<HTMLFormElement>(*element);
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::li) {
+ m_frameset_ok = false;
+
+ for (ssize_t i = m_stack_of_open_elements.elements().size() - 1; i >= 0; --i) {
+ RefPtr<DOM::Element> node = m_stack_of_open_elements.elements()[i];
+
+ if (node->local_name() == HTML::TagNames::li) {
+ generate_implied_end_tags(HTML::TagNames::li);
+ if (current_node().local_name() != HTML::TagNames::li) {
+ PARSE_ERROR();
+ }
+ m_stack_of_open_elements.pop_until_an_element_with_tag_name_has_been_popped(HTML::TagNames::li);
+ break;
+ }
+
+ if (is_special_tag(node->local_name(), node->namespace_()) && !node->local_name().is_one_of(HTML::TagNames::address, HTML::TagNames::div, HTML::TagNames::p))
+ break;
+ }
+
+ if (m_stack_of_open_elements.has_in_button_scope(HTML::TagNames::p))
+ close_a_p_element();
+
+ insert_html_element(token);
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::dd, HTML::TagNames::dt)) {
+ m_frameset_ok = false;
+ for (ssize_t i = m_stack_of_open_elements.elements().size() - 1; i >= 0; --i) {
+ RefPtr<DOM::Element> node = m_stack_of_open_elements.elements()[i];
+ if (node->local_name() == HTML::TagNames::dd) {
+ generate_implied_end_tags(HTML::TagNames::dd);
+ if (current_node().local_name() != HTML::TagNames::dd) {
+ PARSE_ERROR();
+ }
+ m_stack_of_open_elements.pop_until_an_element_with_tag_name_has_been_popped(HTML::TagNames::dd);
+ break;
+ }
+ if (node->local_name() == HTML::TagNames::dt) {
+ generate_implied_end_tags(HTML::TagNames::dt);
+ if (current_node().local_name() != HTML::TagNames::dt) {
+ PARSE_ERROR();
+ }
+ m_stack_of_open_elements.pop_until_an_element_with_tag_name_has_been_popped(HTML::TagNames::dt);
+ break;
+ }
+ if (is_special_tag(node->local_name(), node->namespace_()) && !node->local_name().is_one_of(HTML::TagNames::address, HTML::TagNames::div, HTML::TagNames::p))
+ break;
+ }
+ if (m_stack_of_open_elements.has_in_button_scope(HTML::TagNames::p))
+ close_a_p_element();
+ insert_html_element(token);
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::plaintext) {
+ if (m_stack_of_open_elements.has_in_button_scope(HTML::TagNames::p))
+ close_a_p_element();
+ insert_html_element(token);
+ m_tokenizer.switch_to({}, HTMLTokenizer::State::PLAINTEXT);
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::button) {
+ if (m_stack_of_open_elements.has_in_button_scope(HTML::TagNames::button)) {
+ PARSE_ERROR();
+ generate_implied_end_tags();
+ m_stack_of_open_elements.pop_until_an_element_with_tag_name_has_been_popped(HTML::TagNames::button);
+ }
+ reconstruct_the_active_formatting_elements();
+ insert_html_element(token);
+ m_frameset_ok = false;
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name().is_one_of(HTML::TagNames::address, HTML::TagNames::article, HTML::TagNames::aside, HTML::TagNames::blockquote, HTML::TagNames::button, HTML::TagNames::center, HTML::TagNames::details, HTML::TagNames::dialog, HTML::TagNames::dir, HTML::TagNames::div, HTML::TagNames::dl, HTML::TagNames::fieldset, HTML::TagNames::figcaption, HTML::TagNames::figure, HTML::TagNames::footer, HTML::TagNames::header, HTML::TagNames::hgroup, HTML::TagNames::listing, HTML::TagNames::main, HTML::TagNames::menu, HTML::TagNames::nav, HTML::TagNames::ol, HTML::TagNames::pre, HTML::TagNames::section, HTML::TagNames::summary, HTML::TagNames::ul)) {
+ if (!m_stack_of_open_elements.has_in_scope(token.tag_name())) {
+ PARSE_ERROR();
+ return;
+ }
+
+ generate_implied_end_tags();
+
+ if (current_node().local_name() != token.tag_name()) {
+ PARSE_ERROR();
+ }
+
+ m_stack_of_open_elements.pop_until_an_element_with_tag_name_has_been_popped(token.tag_name());
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name() == HTML::TagNames::form) {
+ if (!m_stack_of_open_elements.contains(HTML::TagNames::template_)) {
+ auto node = m_form_element;
+ m_form_element = nullptr;
+ if (!node || !m_stack_of_open_elements.has_in_scope(*node)) {
+ PARSE_ERROR();
+ return;
+ }
+ generate_implied_end_tags();
+ if (&current_node() != node) {
+ PARSE_ERROR();
+ }
+ m_stack_of_open_elements.elements().remove_first_matching([&](auto& entry) { return entry.ptr() == node.ptr(); });
+ } else {
+ if (!m_stack_of_open_elements.has_in_scope(HTML::TagNames::form)) {
+ PARSE_ERROR();
+ return;
+ }
+ generate_implied_end_tags();
+ if (current_node().local_name() != HTML::TagNames::form) {
+ PARSE_ERROR();
+ }
+ m_stack_of_open_elements.pop_until_an_element_with_tag_name_has_been_popped(HTML::TagNames::form);
+ }
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name() == HTML::TagNames::p) {
+ if (!m_stack_of_open_elements.has_in_button_scope(HTML::TagNames::p)) {
+ PARSE_ERROR();
+ insert_html_element(HTMLToken::make_start_tag(HTML::TagNames::p));
+ }
+ close_a_p_element();
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name() == HTML::TagNames::li) {
+ if (!m_stack_of_open_elements.has_in_list_item_scope(HTML::TagNames::li)) {
+ PARSE_ERROR();
+ return;
+ }
+ generate_implied_end_tags(HTML::TagNames::li);
+ if (current_node().local_name() != HTML::TagNames::li) {
+ PARSE_ERROR();
+ dbg() << "Expected <li> current node, but had <" << current_node().local_name() << ">";
+ }
+ m_stack_of_open_elements.pop_until_an_element_with_tag_name_has_been_popped(HTML::TagNames::li);
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name().is_one_of(HTML::TagNames::dd, HTML::TagNames::dt)) {
+ if (!m_stack_of_open_elements.has_in_scope(token.tag_name())) {
+ PARSE_ERROR();
+ return;
+ }
+ generate_implied_end_tags(token.tag_name());
+ if (current_node().local_name() != token.tag_name()) {
+ PARSE_ERROR();
+ }
+ m_stack_of_open_elements.pop_until_an_element_with_tag_name_has_been_popped(token.tag_name());
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name().is_one_of(HTML::TagNames::h1, HTML::TagNames::h2, HTML::TagNames::h3, HTML::TagNames::h4, HTML::TagNames::h5, HTML::TagNames::h6)) {
+ if (!m_stack_of_open_elements.has_in_scope(HTML::TagNames::h1)
+ && !m_stack_of_open_elements.has_in_scope(HTML::TagNames::h2)
+ && !m_stack_of_open_elements.has_in_scope(HTML::TagNames::h3)
+ && !m_stack_of_open_elements.has_in_scope(HTML::TagNames::h4)
+ && !m_stack_of_open_elements.has_in_scope(HTML::TagNames::h5)
+ && !m_stack_of_open_elements.has_in_scope(HTML::TagNames::h6)) {
+ PARSE_ERROR();
+ return;
+ }
+
+ generate_implied_end_tags();
+ if (current_node().local_name() != token.tag_name()) {
+ PARSE_ERROR();
+ }
+
+ for (;;) {
+ auto popped_element = m_stack_of_open_elements.pop();
+ if (popped_element->local_name().is_one_of(HTML::TagNames::h1, HTML::TagNames::h2, HTML::TagNames::h3, HTML::TagNames::h4, HTML::TagNames::h5, HTML::TagNames::h6))
+ break;
+ }
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::a) {
+ if (auto* element = m_list_of_active_formatting_elements.last_element_with_tag_name_before_marker(HTML::TagNames::a)) {
+ PARSE_ERROR();
+ if (run_the_adoption_agency_algorithm(token) == AdoptionAgencyAlgorithmOutcome::RunAnyOtherEndTagSteps)
+ goto AnyOtherEndTag;
+ m_list_of_active_formatting_elements.remove(*element);
+ m_stack_of_open_elements.elements().remove_first_matching([&](auto& entry) {
+ return entry.ptr() == element;
+ });
+ }
+ reconstruct_the_active_formatting_elements();
+ auto element = insert_html_element(token);
+ m_list_of_active_formatting_elements.add(*element);
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::b, HTML::TagNames::big, HTML::TagNames::code, HTML::TagNames::em, HTML::TagNames::font, HTML::TagNames::i, HTML::TagNames::s, HTML::TagNames::small, HTML::TagNames::strike, HTML::TagNames::strong, HTML::TagNames::tt, HTML::TagNames::u)) {
+ reconstruct_the_active_formatting_elements();
+ auto element = insert_html_element(token);
+ m_list_of_active_formatting_elements.add(*element);
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::nobr) {
+ reconstruct_the_active_formatting_elements();
+ if (m_stack_of_open_elements.has_in_scope(HTML::TagNames::nobr)) {
+ PARSE_ERROR();
+ run_the_adoption_agency_algorithm(token);
+ reconstruct_the_active_formatting_elements();
+ }
+ auto element = insert_html_element(token);
+ m_list_of_active_formatting_elements.add(*element);
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name().is_one_of(HTML::TagNames::a, HTML::TagNames::b, HTML::TagNames::big, HTML::TagNames::code, HTML::TagNames::em, HTML::TagNames::font, HTML::TagNames::i, HTML::TagNames::nobr, HTML::TagNames::s, HTML::TagNames::small, HTML::TagNames::strike, HTML::TagNames::strong, HTML::TagNames::tt, HTML::TagNames::u)) {
+ if (run_the_adoption_agency_algorithm(token) == AdoptionAgencyAlgorithmOutcome::RunAnyOtherEndTagSteps)
+ goto AnyOtherEndTag;
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::applet, HTML::TagNames::marquee, HTML::TagNames::object)) {
+ reconstruct_the_active_formatting_elements();
+ insert_html_element(token);
+ m_list_of_active_formatting_elements.add_marker();
+ m_frameset_ok = false;
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name().is_one_of(HTML::TagNames::applet, HTML::TagNames::marquee, HTML::TagNames::object)) {
+ if (!m_stack_of_open_elements.has_in_scope(token.tag_name())) {
+ PARSE_ERROR();
+ return;
+ }
+
+ generate_implied_end_tags();
+ if (current_node().local_name() != token.tag_name()) {
+ PARSE_ERROR();
+ }
+ m_stack_of_open_elements.pop_until_an_element_with_tag_name_has_been_popped(token.tag_name());
+ m_list_of_active_formatting_elements.clear_up_to_the_last_marker();
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::table) {
+ if (!document().in_quirks_mode()) {
+ if (m_stack_of_open_elements.has_in_button_scope(HTML::TagNames::p))
+ close_a_p_element();
+ }
+ insert_html_element(token);
+ m_frameset_ok = false;
+ m_insertion_mode = InsertionMode::InTable;
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name() == HTML::TagNames::br) {
+ token.drop_attributes();
+ goto BRStartTag;
+ }
+
+ if (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::area, HTML::TagNames::br, HTML::TagNames::embed, HTML::TagNames::img, HTML::TagNames::keygen, HTML::TagNames::wbr)) {
+ BRStartTag:
+ reconstruct_the_active_formatting_elements();
+ insert_html_element(token);
+ m_stack_of_open_elements.pop();
+ token.acknowledge_self_closing_flag_if_set();
+ m_frameset_ok = false;
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::input) {
+ reconstruct_the_active_formatting_elements();
+ insert_html_element(token);
+ m_stack_of_open_elements.pop();
+ token.acknowledge_self_closing_flag_if_set();
+ auto type_attribute = token.attribute(HTML::AttributeNames::type);
+ if (type_attribute.is_null() || !type_attribute.equals_ignoring_case("hidden")) {
+ m_frameset_ok = false;
+ }
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::param, HTML::TagNames::source, HTML::TagNames::track)) {
+ insert_html_element(token);
+ m_stack_of_open_elements.pop();
+ token.acknowledge_self_closing_flag_if_set();
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::hr) {
+ if (m_stack_of_open_elements.has_in_button_scope(HTML::TagNames::p))
+ close_a_p_element();
+ insert_html_element(token);
+ m_stack_of_open_elements.pop();
+ token.acknowledge_self_closing_flag_if_set();
+ m_frameset_ok = false;
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::image) {
+ // Parse error. Change the token's tag name to HTML::TagNames::img and reprocess it. (Don't ask.)
+ PARSE_ERROR();
+ token.m_tag.tag_name.clear();
+ token.m_tag.tag_name.append(HTML::TagNames::img);
+ process_using_the_rules_for(m_insertion_mode, token);
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::textarea) {
+ insert_html_element(token);
+
+ m_tokenizer.switch_to({}, HTMLTokenizer::State::RCDATA);
+
+ // If the next token is a U+000A LINE FEED (LF) character token,
+ // then ignore that token and move on to the next one.
+ // (Newlines at the start of pre blocks are ignored as an authoring convenience.)
+ auto next_token = m_tokenizer.next_token();
+
+ m_original_insertion_mode = m_insertion_mode;
+ m_frameset_ok = false;
+ m_insertion_mode = InsertionMode::Text;
+
+ if (next_token.has_value() && next_token.value().is_character() && next_token.value().code_point() == '\n') {
+ // Ignore it.
+ } else {
+ process_using_the_rules_for(m_insertion_mode, next_token.value());
+ }
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::xmp) {
+ if (m_stack_of_open_elements.has_in_button_scope(HTML::TagNames::p)) {
+ close_a_p_element();
+ }
+ reconstruct_the_active_formatting_elements();
+ m_frameset_ok = false;
+ parse_generic_raw_text_element(token);
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::iframe) {
+ m_frameset_ok = false;
+ parse_generic_raw_text_element(token);
+ return;
+ }
+
+ if (token.is_start_tag() && ((token.tag_name() == HTML::TagNames::noembed) || (token.tag_name() == HTML::TagNames::noscript && m_scripting_enabled))) {
+ parse_generic_raw_text_element(token);
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::select) {
+ reconstruct_the_active_formatting_elements();
+ insert_html_element(token);
+ m_frameset_ok = false;
+ switch (m_insertion_mode) {
+ case InsertionMode::InTable:
+ case InsertionMode::InCaption:
+ case InsertionMode::InTableBody:
+ case InsertionMode::InRow:
+ case InsertionMode::InCell:
+ m_insertion_mode = InsertionMode::InSelectInTable;
+ break;
+ default:
+ m_insertion_mode = InsertionMode::InSelect;
+ break;
+ }
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::optgroup, HTML::TagNames::option)) {
+ if (current_node().local_name() == HTML::TagNames::option)
+ m_stack_of_open_elements.pop();
+ reconstruct_the_active_formatting_elements();
+ insert_html_element(token);
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::rb, HTML::TagNames::rtc)) {
+ if (m_stack_of_open_elements.has_in_scope(HTML::TagNames::ruby))
+ generate_implied_end_tags();
+
+ if (current_node().local_name() != HTML::TagNames::ruby)
+ PARSE_ERROR();
+
+ insert_html_element(token);
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::rp, HTML::TagNames::rt)) {
+ if (m_stack_of_open_elements.has_in_scope(HTML::TagNames::ruby))
+ generate_implied_end_tags(HTML::TagNames::rtc);
+
+ if (current_node().local_name() != HTML::TagNames::rtc || current_node().local_name() != HTML::TagNames::ruby)
+ PARSE_ERROR();
+
+ insert_html_element(token);
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::math) {
+ reconstruct_the_active_formatting_elements();
+ adjust_mathml_attributes(token);
+ adjust_foreign_attributes(token);
+
+ insert_foreign_element(token, Namespace::MathML);
+
+ if (token.is_self_closing()) {
+ m_stack_of_open_elements.pop();
+ token.acknowledge_self_closing_flag_if_set();
+ }
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::svg) {
+ reconstruct_the_active_formatting_elements();
+ adjust_svg_attributes(token);
+ adjust_foreign_attributes(token);
+
+ insert_foreign_element(token, Namespace::SVG);
+
+ if (token.is_self_closing()) {
+ m_stack_of_open_elements.pop();
+ token.acknowledge_self_closing_flag_if_set();
+ }
+ return;
+ }
+
+ if ((token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::caption, HTML::TagNames::col, HTML::TagNames::colgroup, HTML::TagNames::frame, HTML::TagNames::head, HTML::TagNames::tbody, HTML::TagNames::td, HTML::TagNames::tfoot, HTML::TagNames::th, HTML::TagNames::thead, HTML::TagNames::tr))) {
+ PARSE_ERROR();
+ return;
+ }
+
+ // Any other start tag
+ if (token.is_start_tag()) {
+ reconstruct_the_active_formatting_elements();
+ insert_html_element(token);
+ return;
+ }
+
+ if (token.is_end_tag()) {
+ AnyOtherEndTag:
+ RefPtr<DOM::Element> node;
+ for (ssize_t i = m_stack_of_open_elements.elements().size() - 1; i >= 0; --i) {
+ node = m_stack_of_open_elements.elements()[i];
+ if (node->local_name() == token.tag_name()) {
+ generate_implied_end_tags(token.tag_name());
+ if (node != current_node()) {
+ PARSE_ERROR();
+ }
+ while (&current_node() != node) {
+ m_stack_of_open_elements.pop();
+ }
+ m_stack_of_open_elements.pop();
+ break;
+ }
+ if (is_special_tag(node->local_name(), node->namespace_())) {
+ PARSE_ERROR();
+ return;
+ }
+ }
+ return;
+ }
+}
+
+void HTMLDocumentParser::adjust_mathml_attributes(HTMLToken& token)
+{
+ token.adjust_attribute_name("definitionurl", "definitionURL");
+}
+
+void HTMLDocumentParser::adjust_svg_tag_names(HTMLToken& token)
+{
+ token.adjust_tag_name("altglyph", "altGlyph");
+ token.adjust_tag_name("altglyphdef", "altGlyphDef");
+ token.adjust_tag_name("altglyphitem", "altGlyphItem");
+ token.adjust_tag_name("animatecolor", "animateColor");
+ token.adjust_tag_name("animatemotion", "animateMotion");
+ token.adjust_tag_name("animatetransform", "animateTransform");
+ token.adjust_tag_name("clippath", "clipPath");
+ token.adjust_tag_name("feblend", "feBlend");
+ token.adjust_tag_name("fecolormatrix", "feColorMatrix");
+ token.adjust_tag_name("fecomponenttransfer", "feComponentTransfer");
+ token.adjust_tag_name("fecomposite", "feComposite");
+ token.adjust_tag_name("feconvolvematrix", "feConvolveMatrix");
+ token.adjust_tag_name("fediffuselighting", "feDiffuseLighting");
+ token.adjust_tag_name("fedisplacementmap", "feDisplacementMap");
+ token.adjust_tag_name("fedistantlight", "feDistantLight");
+ token.adjust_tag_name("fedropshadow", "feDropShadow");
+ token.adjust_tag_name("feflood", "feFlood");
+ token.adjust_tag_name("fefunca", "feFuncA");
+ token.adjust_tag_name("fefuncb", "feFuncB");
+ token.adjust_tag_name("fefuncg", "feFuncG");
+ token.adjust_tag_name("fefuncr", "feFuncR");
+ token.adjust_tag_name("fegaussianblur", "feGaussianBlur");
+ token.adjust_tag_name("feimage", "feImage");
+ token.adjust_tag_name("femerge", "feMerge");
+ token.adjust_tag_name("femergenode", "feMergeNode");
+ token.adjust_tag_name("femorphology", "feMorphology");
+ token.adjust_tag_name("feoffset", "feOffset");
+ token.adjust_tag_name("fepointlight", "fePointLight");
+ token.adjust_tag_name("fespecularlighting", "feSpecularLighting");
+ token.adjust_tag_name("fespotlight", "feSpotlight");
+ token.adjust_tag_name("glyphref", "glyphRef");
+ token.adjust_tag_name("lineargradient", "linearGradient");
+ token.adjust_tag_name("radialgradient", "radialGradient");
+ token.adjust_tag_name("textpath", "textPath");
+}
+
+void HTMLDocumentParser::adjust_svg_attributes(HTMLToken& token)
+{
+ token.adjust_attribute_name("attributename", "attributeName");
+ token.adjust_attribute_name("attributetype", "attributeType");
+ token.adjust_attribute_name("basefrequency", "baseFrequency");
+ token.adjust_attribute_name("baseprofile", "baseProfile");
+ token.adjust_attribute_name("calcmode", "calcMode");
+ token.adjust_attribute_name("clippathunits", "clipPathUnits");
+ token.adjust_attribute_name("diffuseconstant", "diffuseConstant");
+ token.adjust_attribute_name("edgemode", "edgeMode");
+ token.adjust_attribute_name("filterunits", "filterUnits");
+ token.adjust_attribute_name("glyphref", "glyphRef");
+ token.adjust_attribute_name("gradienttransform", "gradientTransform");
+ token.adjust_attribute_name("gradientunits", "gradientUnits");
+ token.adjust_attribute_name("kernelmatrix", "kernelMatrix");
+ token.adjust_attribute_name("kernelunitlength", "kernelUnitLength");
+ token.adjust_attribute_name("keypoints", "keyPoints");
+ token.adjust_attribute_name("keysplines", "keySplines");
+ token.adjust_attribute_name("keytimes", "keyTimes");
+ token.adjust_attribute_name("lengthadjust", "lengthAdjust");
+ token.adjust_attribute_name("limitingconeangle", "limitingConeAngle");
+ token.adjust_attribute_name("markerheight", "markerHeight");
+ token.adjust_attribute_name("markerunits", "markerUnits");
+ token.adjust_attribute_name("markerwidth", "markerWidth");
+ token.adjust_attribute_name("maskcontentunits", "maskContentUnits");
+ token.adjust_attribute_name("maskunits", "maskUnits");
+ token.adjust_attribute_name("numoctaves", "numOctaves");
+ token.adjust_attribute_name("pathlength", "pathLength");
+ token.adjust_attribute_name("patterncontentunits", "patternContentUnits");
+ token.adjust_attribute_name("patterntransform", "patternTransform");
+ token.adjust_attribute_name("patternunits", "patternUnits");
+ token.adjust_attribute_name("pointsatx", "pointsAtX");
+ token.adjust_attribute_name("pointsaty", "pointsAtY");
+ token.adjust_attribute_name("pointsatz", "pointsAtZ");
+ token.adjust_attribute_name("preservealpha", "preserveAlpha");
+ token.adjust_attribute_name("preserveaspectratio", "preserveAspectRatio");
+ token.adjust_attribute_name("primitiveunits", "primitiveUnits");
+ token.adjust_attribute_name("refx", "refX");
+ token.adjust_attribute_name("refy", "refY");
+ token.adjust_attribute_name("repeatcount", "repeatCount");
+ token.adjust_attribute_name("repeatdur", "repeatDur");
+ token.adjust_attribute_name("requiredextensions", "requiredExtensions");
+ token.adjust_attribute_name("requiredfeatures", "requiredFeatures");
+ token.adjust_attribute_name("specularconstant", "specularConstant");
+ token.adjust_attribute_name("specularexponent", "specularExponent");
+ token.adjust_attribute_name("spreadmethod", "spreadMethod");
+ token.adjust_attribute_name("startoffset", "startOffset");
+ token.adjust_attribute_name("stddeviation", "stdDeviation");
+ token.adjust_attribute_name("stitchtiles", "stitchTiles");
+ token.adjust_attribute_name("surfacescale", "surfaceScale");
+ token.adjust_attribute_name("systemlanguage", "systemLanguage");
+ token.adjust_attribute_name("tablevalues", "tableValues");
+ token.adjust_attribute_name("targetx", "targetX");
+ token.adjust_attribute_name("targety", "targetY");
+ token.adjust_attribute_name("textlength", "textLength");
+ token.adjust_attribute_name("viewbox", "viewBox");
+ token.adjust_attribute_name("viewtarget", "viewTarget");
+ token.adjust_attribute_name("xchannelselector", "xChannelSelector");
+ token.adjust_attribute_name("ychannelselector", "yChannelSelector");
+ token.adjust_attribute_name("zoomandpan", "zoomAndPan");
+}
+
+void HTMLDocumentParser::adjust_foreign_attributes(HTMLToken& token)
+{
+ token.adjust_foreign_attribute("xlink:actuate", "xlink", "actuate", Namespace::XLink);
+ token.adjust_foreign_attribute("xlink:arcrole", "xlink", "arcrole", Namespace::XLink);
+ token.adjust_foreign_attribute("xlink:href", "xlink", "href", Namespace::XLink);
+ token.adjust_foreign_attribute("xlink:role", "xlink", "role", Namespace::XLink);
+ token.adjust_foreign_attribute("xlink:show", "xlink", "show", Namespace::XLink);
+ token.adjust_foreign_attribute("xlink:title", "xlink", "title", Namespace::XLink);
+ token.adjust_foreign_attribute("xlink:type", "xlink", "type", Namespace::XLink);
+
+ token.adjust_foreign_attribute("xml:lang", "xml", "lang", Namespace::XML);
+ token.adjust_foreign_attribute("xml:space", "xml", "space", Namespace::XML);
+
+ token.adjust_foreign_attribute("xmlns", "", "xmlns", Namespace::XMLNS);
+ token.adjust_foreign_attribute("xmlns:xlink", "xmlns", "xlink", Namespace::XMLNS);
+}
+
+void HTMLDocumentParser::increment_script_nesting_level()
+{
+ ++m_script_nesting_level;
+}
+
+void HTMLDocumentParser::decrement_script_nesting_level()
+{
+ ASSERT(m_script_nesting_level);
+ --m_script_nesting_level;
+}
+
+void HTMLDocumentParser::handle_text(HTMLToken& token)
+{
+ if (token.is_character()) {
+ insert_character(token.code_point());
+ return;
+ }
+ if (token.is_end_of_file()) {
+ PARSE_ERROR();
+ if (current_node().local_name() == HTML::TagNames::script)
+ downcast<HTMLScriptElement>(current_node()).set_already_started({}, true);
+ m_stack_of_open_elements.pop();
+ m_insertion_mode = m_original_insertion_mode;
+ process_using_the_rules_for(m_insertion_mode, token);
+ return;
+ }
+ if (token.is_end_tag() && token.tag_name() == HTML::TagNames::script) {
+ // Make sure the <script> element has up-to-date text content before preparing the script.
+ flush_character_insertions();
+
+ NonnullRefPtr<HTMLScriptElement> script = downcast<HTMLScriptElement>(current_node());
+ m_stack_of_open_elements.pop();
+ m_insertion_mode = m_original_insertion_mode;
+ // FIXME: Handle tokenizer insertion point stuff here.
+ increment_script_nesting_level();
+ script->prepare_script({});
+ decrement_script_nesting_level();
+ if (script_nesting_level() == 0)
+ m_parser_pause_flag = false;
+ // FIXME: Handle tokenizer insertion point stuff here too.
+
+ while (document().pending_parsing_blocking_script()) {
+ if (script_nesting_level() != 0) {
+ m_parser_pause_flag = true;
+ // FIXME: Abort the processing of any nested invocations of the tokenizer,
+ // yielding control back to the caller. (Tokenization will resume when
+ // the caller returns to the "outer" tree construction stage.)
+ TODO();
+ } else {
+ auto the_script = document().take_pending_parsing_blocking_script({});
+ m_tokenizer.set_blocked(true);
+
+ // FIXME: If the parser's Document has a style sheet that is blocking scripts
+ // or the script's "ready to be parser-executed" flag is not set:
+ // spin the event loop until the parser's Document has no style sheet
+ // that is blocking scripts and the script's "ready to be parser-executed"
+ // flag is set.
+
+ if (the_script->failed_to_load())
+ return;
+
+ ASSERT(the_script->is_ready_to_be_parser_executed());
+
+ if (m_aborted)
+ return;
+
+ m_tokenizer.set_blocked(false);
+
+ // FIXME: Handle tokenizer insertion point stuff here too.
+
+ ASSERT(script_nesting_level() == 0);
+ increment_script_nesting_level();
+
+ the_script->execute_script();
+
+ decrement_script_nesting_level();
+ ASSERT(script_nesting_level() == 0);
+ m_parser_pause_flag = false;
+
+ // FIXME: Handle tokenizer insertion point stuff here too.
+ }
+ }
+ return;
+ }
+
+ if (token.is_end_tag()) {
+ m_stack_of_open_elements.pop();
+ m_insertion_mode = m_original_insertion_mode;
+ return;
+ }
+ TODO();
+}
+
+void HTMLDocumentParser::clear_the_stack_back_to_a_table_context()
+{
+ while (!current_node().local_name().is_one_of(HTML::TagNames::table, HTML::TagNames::template_, HTML::TagNames::html))
+ m_stack_of_open_elements.pop();
+
+ if (current_node().local_name() == HTML::TagNames::html)
+ ASSERT(m_parsing_fragment);
+}
+
+void HTMLDocumentParser::clear_the_stack_back_to_a_table_row_context()
+{
+ while (!current_node().local_name().is_one_of(HTML::TagNames::tr, HTML::TagNames::template_, HTML::TagNames::html))
+ m_stack_of_open_elements.pop();
+
+ if (current_node().local_name() == HTML::TagNames::html)
+ ASSERT(m_parsing_fragment);
+}
+
+void HTMLDocumentParser::clear_the_stack_back_to_a_table_body_context()
+{
+ while (!current_node().local_name().is_one_of(HTML::TagNames::tbody, HTML::TagNames::tfoot, HTML::TagNames::thead, HTML::TagNames::template_, HTML::TagNames::html))
+ m_stack_of_open_elements.pop();
+
+ if (current_node().local_name() == HTML::TagNames::html)
+ ASSERT(m_parsing_fragment);
+}
+
+void HTMLDocumentParser::handle_in_row(HTMLToken& token)
+{
+ if (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::th, HTML::TagNames::td)) {
+ clear_the_stack_back_to_a_table_row_context();
+ insert_html_element(token);
+ m_insertion_mode = InsertionMode::InCell;
+ m_list_of_active_formatting_elements.add_marker();
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name() == HTML::TagNames::tr) {
+ if (!m_stack_of_open_elements.has_in_table_scope(HTML::TagNames::tr)) {
+ PARSE_ERROR();
+ return;
+ }
+ clear_the_stack_back_to_a_table_row_context();
+ m_stack_of_open_elements.pop();
+ m_insertion_mode = InsertionMode::InTableBody;
+ return;
+ }
+
+ if ((token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::caption, HTML::TagNames::col, HTML::TagNames::colgroup, HTML::TagNames::tbody, HTML::TagNames::tfoot, HTML::TagNames::thead, HTML::TagNames::tr))
+ || (token.is_end_tag() && token.tag_name() == HTML::TagNames::table)) {
+ if (!m_stack_of_open_elements.has_in_table_scope(HTML::TagNames::tr)) {
+ PARSE_ERROR();
+ return;
+ }
+ clear_the_stack_back_to_a_table_row_context();
+ m_stack_of_open_elements.pop();
+ m_insertion_mode = InsertionMode::InTableBody;
+ process_using_the_rules_for(m_insertion_mode, token);
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name().is_one_of(HTML::TagNames::tbody, HTML::TagNames::tfoot, HTML::TagNames::thead)) {
+ if (!m_stack_of_open_elements.has_in_table_scope(token.tag_name())) {
+ PARSE_ERROR();
+ return;
+ }
+ if (!m_stack_of_open_elements.has_in_table_scope(HTML::TagNames::tr)) {
+ return;
+ }
+ clear_the_stack_back_to_a_table_row_context();
+ m_stack_of_open_elements.pop();
+ m_insertion_mode = InsertionMode::InTableBody;
+ process_using_the_rules_for(m_insertion_mode, token);
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name().is_one_of(HTML::TagNames::body, HTML::TagNames::caption, HTML::TagNames::col, HTML::TagNames::colgroup, HTML::TagNames::html, HTML::TagNames::td, HTML::TagNames::th)) {
+ PARSE_ERROR();
+ return;
+ }
+
+ process_using_the_rules_for(InsertionMode::InTable, token);
+}
+
+void HTMLDocumentParser::close_the_cell()
+{
+ generate_implied_end_tags();
+ if (!current_node().local_name().is_one_of(HTML::TagNames::td, HTML::TagNames::th)) {
+ PARSE_ERROR();
+ }
+ while (!current_node().local_name().is_one_of(HTML::TagNames::td, HTML::TagNames::th))
+ m_stack_of_open_elements.pop();
+ m_stack_of_open_elements.pop();
+ m_list_of_active_formatting_elements.clear_up_to_the_last_marker();
+ m_insertion_mode = InsertionMode::InRow;
+}
+
+void HTMLDocumentParser::handle_in_cell(HTMLToken& token)
+{
+ if (token.is_end_tag() && token.tag_name().is_one_of(HTML::TagNames::td, HTML::TagNames::th)) {
+ if (!m_stack_of_open_elements.has_in_table_scope(token.tag_name())) {
+ PARSE_ERROR();
+ return;
+ }
+ generate_implied_end_tags();
+
+ if (current_node().local_name() != token.tag_name()) {
+ PARSE_ERROR();
+ }
+
+ m_stack_of_open_elements.pop_until_an_element_with_tag_name_has_been_popped(token.tag_name());
+
+ m_list_of_active_formatting_elements.clear_up_to_the_last_marker();
+
+ m_insertion_mode = InsertionMode::InRow;
+ return;
+ }
+ if (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::caption, HTML::TagNames::col, HTML::TagNames::colgroup, HTML::TagNames::tbody, HTML::TagNames::td, HTML::TagNames::tfoot, HTML::TagNames::th, HTML::TagNames::thead, HTML::TagNames::tr)) {
+ if (!m_stack_of_open_elements.has_in_table_scope(HTML::TagNames::td) && !m_stack_of_open_elements.has_in_table_scope(HTML::TagNames::th)) {
+ ASSERT(m_parsing_fragment);
+ PARSE_ERROR();
+ return;
+ }
+ close_the_cell();
+ process_using_the_rules_for(m_insertion_mode, token);
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name().is_one_of(HTML::TagNames::body, HTML::TagNames::caption, HTML::TagNames::col, HTML::TagNames::colgroup, HTML::TagNames::html)) {
+ PARSE_ERROR();
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name().is_one_of(HTML::TagNames::table, HTML::TagNames::tbody, HTML::TagNames::tfoot, HTML::TagNames::thead, HTML::TagNames::tr)) {
+ if (!m_stack_of_open_elements.has_in_table_scope(token.tag_name())) {
+ PARSE_ERROR();
+ return;
+ }
+ close_the_cell();
+ // Reprocess the token.
+ process_using_the_rules_for(m_insertion_mode, token);
+ return;
+ }
+
+ process_using_the_rules_for(InsertionMode::InBody, token);
+}
+
+void HTMLDocumentParser::handle_in_table_text(HTMLToken& token)
+{
+ if (token.is_character()) {
+ if (token.code_point() == 0) {
+ PARSE_ERROR();
+ return;
+ }
+
+ m_pending_table_character_tokens.append(token);
+ return;
+ }
+
+ for (auto& pending_token : m_pending_table_character_tokens) {
+ ASSERT(pending_token.is_character());
+ if (!pending_token.is_parser_whitespace()) {
+ // If any of the tokens in the pending table character tokens list
+ // are character tokens that are not ASCII whitespace, then this is a parse error:
+ // reprocess the character tokens in the pending table character tokens list using
+ // the rules given in the "anything else" entry in the "in table" insertion mode.
+ PARSE_ERROR();
+ m_foster_parenting = true;
+ process_using_the_rules_for(InsertionMode::InBody, token);
+ m_foster_parenting = false;
+ return;
+ }
+ }
+
+ for (auto& pending_token : m_pending_table_character_tokens) {
+ insert_character(pending_token.code_point());
+ }
+
+ m_insertion_mode = m_original_insertion_mode;
+ process_using_the_rules_for(m_insertion_mode, token);
+}
+
+void HTMLDocumentParser::handle_in_table_body(HTMLToken& token)
+{
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::tr) {
+ clear_the_stack_back_to_a_table_body_context();
+ insert_html_element(token);
+ m_insertion_mode = InsertionMode::InRow;
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::th, HTML::TagNames::td)) {
+ PARSE_ERROR();
+ clear_the_stack_back_to_a_table_body_context();
+ insert_html_element(HTMLToken::make_start_tag(HTML::TagNames::tr));
+ m_insertion_mode = InsertionMode::InRow;
+ process_using_the_rules_for(m_insertion_mode, token);
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name().is_one_of(HTML::TagNames::tbody, HTML::TagNames::tfoot, HTML::TagNames::thead)) {
+ if (!m_stack_of_open_elements.has_in_table_scope(token.tag_name())) {
+ PARSE_ERROR();
+ return;
+ }
+ clear_the_stack_back_to_a_table_body_context();
+ m_stack_of_open_elements.pop();
+ m_insertion_mode = InsertionMode::InTable;
+ return;
+ }
+
+ if ((token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::caption, HTML::TagNames::col, HTML::TagNames::colgroup, HTML::TagNames::tbody, HTML::TagNames::tfoot, HTML::TagNames::thead))
+ || (token.is_end_tag() && token.tag_name() == HTML::TagNames::table)) {
+
+ if (!m_stack_of_open_elements.has_in_table_scope(HTML::TagNames::tbody)
+ && !m_stack_of_open_elements.has_in_table_scope(HTML::TagNames::thead)
+ && !m_stack_of_open_elements.has_in_table_scope(HTML::TagNames::tfoot)) {
+ PARSE_ERROR();
+ return;
+ }
+
+ clear_the_stack_back_to_a_table_body_context();
+ m_stack_of_open_elements.pop();
+ m_insertion_mode = InsertionMode::InTable;
+ process_using_the_rules_for(InsertionMode::InTable, token);
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name().is_one_of(HTML::TagNames::body, HTML::TagNames::caption, HTML::TagNames::col, HTML::TagNames::colgroup, HTML::TagNames::html, HTML::TagNames::td, HTML::TagNames::th, HTML::TagNames::tr)) {
+ PARSE_ERROR();
+ return;
+ }
+
+ process_using_the_rules_for(InsertionMode::InTable, token);
+}
+
+void HTMLDocumentParser::handle_in_table(HTMLToken& token)
+{
+ if (token.is_character() && current_node().local_name().is_one_of(HTML::TagNames::table, HTML::TagNames::tbody, HTML::TagNames::tfoot, HTML::TagNames::thead, HTML::TagNames::tr)) {
+ m_pending_table_character_tokens.clear();
+ m_original_insertion_mode = m_insertion_mode;
+ m_insertion_mode = InsertionMode::InTableText;
+ process_using_the_rules_for(InsertionMode::InTableText, token);
+ return;
+ }
+ if (token.is_comment()) {
+ insert_comment(token);
+ return;
+ }
+ if (token.is_doctype()) {
+ PARSE_ERROR();
+ return;
+ }
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::caption) {
+ clear_the_stack_back_to_a_table_context();
+ m_list_of_active_formatting_elements.add_marker();
+ insert_html_element(token);
+ m_insertion_mode = InsertionMode::InCaption;
+ return;
+ }
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::colgroup) {
+ clear_the_stack_back_to_a_table_context();
+ insert_html_element(token);
+ m_insertion_mode = InsertionMode::InColumnGroup;
+ return;
+ }
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::col) {
+ clear_the_stack_back_to_a_table_context();
+ insert_html_element(HTMLToken::make_start_tag(HTML::TagNames::colgroup));
+ m_insertion_mode = InsertionMode::InColumnGroup;
+ process_using_the_rules_for(m_insertion_mode, token);
+ return;
+ }
+ if (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::tbody, HTML::TagNames::tfoot, HTML::TagNames::thead)) {
+ clear_the_stack_back_to_a_table_context();
+ insert_html_element(token);
+ m_insertion_mode = InsertionMode::InTableBody;
+ return;
+ }
+ if (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::td, HTML::TagNames::th, HTML::TagNames::tr)) {
+ clear_the_stack_back_to_a_table_context();
+ insert_html_element(HTMLToken::make_start_tag(HTML::TagNames::tbody));
+ m_insertion_mode = InsertionMode::InTableBody;
+ process_using_the_rules_for(m_insertion_mode, token);
+ return;
+ }
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::table) {
+ PARSE_ERROR();
+ if (!m_stack_of_open_elements.has_in_table_scope(HTML::TagNames::table))
+ return;
+
+ m_stack_of_open_elements.pop_until_an_element_with_tag_name_has_been_popped(HTML::TagNames::table);
+
+ reset_the_insertion_mode_appropriately();
+ process_using_the_rules_for(m_insertion_mode, token);
+ return;
+ }
+ if (token.is_end_tag() && token.tag_name() == HTML::TagNames::table) {
+ if (!m_stack_of_open_elements.has_in_table_scope(HTML::TagNames::table)) {
+ PARSE_ERROR();
+ return;
+ }
+
+ m_stack_of_open_elements.pop_until_an_element_with_tag_name_has_been_popped(HTML::TagNames::table);
+
+ reset_the_insertion_mode_appropriately();
+ return;
+ }
+ if (token.is_end_tag() && token.tag_name().is_one_of(HTML::TagNames::body, HTML::TagNames::caption, HTML::TagNames::col, HTML::TagNames::colgroup, HTML::TagNames::html, HTML::TagNames::tbody, HTML::TagNames::td, HTML::TagNames::tfoot, HTML::TagNames::th, HTML::TagNames::thead, HTML::TagNames::tr)) {
+ PARSE_ERROR();
+ return;
+ }
+ if ((token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::style, HTML::TagNames::script, HTML::TagNames::template_))
+ || (token.is_end_tag() && token.tag_name() == HTML::TagNames::template_)) {
+ process_using_the_rules_for(InsertionMode::InHead, token);
+ return;
+ }
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::input) {
+ auto type_attribute = token.attribute(HTML::AttributeNames::type);
+ if (type_attribute.is_null() || !type_attribute.equals_ignoring_case("hidden")) {
+ goto AnythingElse;
+ }
+
+ PARSE_ERROR();
+ insert_html_element(token);
+
+ // FIXME: Is this the correct interpretation of "Pop that input element off the stack of open elements."?
+ // Because this wording is the first time it's seen in the spec.
+ // Other times it's worded as: "Immediately pop the current node off the stack of open elements."
+ m_stack_of_open_elements.pop();
+ token.acknowledge_self_closing_flag_if_set();
+ return;
+ }
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::form) {
+ PARSE_ERROR();
+ if (m_form_element || m_stack_of_open_elements.contains(HTML::TagNames::template_)) {
+ return;
+ }
+
+ m_form_element = downcast<HTMLFormElement>(*insert_html_element(token));
+
+ // FIXME: See previous FIXME, as this is the same situation but for form.
+ m_stack_of_open_elements.pop();
+ return;
+ }
+ if (token.is_end_of_file()) {
+ process_using_the_rules_for(InsertionMode::InBody, token);
+ return;
+ }
+
+AnythingElse:
+ PARSE_ERROR();
+ m_foster_parenting = true;
+ process_using_the_rules_for(InsertionMode::InBody, token);
+ m_foster_parenting = false;
+}
+
+void HTMLDocumentParser::handle_in_select_in_table(HTMLToken& token)
+{
+ if (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::caption, HTML::TagNames::table, HTML::TagNames::tbody, HTML::TagNames::tfoot, HTML::TagNames::thead, HTML::TagNames::tr, HTML::TagNames::td, HTML::TagNames::th)) {
+ PARSE_ERROR();
+ m_stack_of_open_elements.pop_until_an_element_with_tag_name_has_been_popped(HTML::TagNames::select);
+ reset_the_insertion_mode_appropriately();
+ process_using_the_rules_for(m_insertion_mode, token);
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name().is_one_of(HTML::TagNames::caption, HTML::TagNames::table, HTML::TagNames::tbody, HTML::TagNames::tfoot, HTML::TagNames::thead, HTML::TagNames::tr, HTML::TagNames::td, HTML::TagNames::th)) {
+ PARSE_ERROR();
+
+ if (!m_stack_of_open_elements.has_in_table_scope(token.tag_name()))
+ return;
+
+ m_stack_of_open_elements.pop_until_an_element_with_tag_name_has_been_popped(HTML::TagNames::select);
+ reset_the_insertion_mode_appropriately();
+ process_using_the_rules_for(m_insertion_mode, token);
+ return;
+ }
+
+ process_using_the_rules_for(InsertionMode::InSelect, token);
+}
+
+void HTMLDocumentParser::handle_in_select(HTMLToken& token)
+{
+ if (token.is_character()) {
+ if (token.code_point() == 0) {
+ PARSE_ERROR();
+ return;
+ }
+ insert_character(token.code_point());
+ return;
+ }
+
+ if (token.is_comment()) {
+ insert_comment(token);
+ return;
+ }
+
+ if (token.is_doctype()) {
+ PARSE_ERROR();
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::html) {
+ process_using_the_rules_for(InsertionMode::InBody, token);
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::option) {
+ if (current_node().local_name() == HTML::TagNames::option) {
+ m_stack_of_open_elements.pop();
+ }
+ insert_html_element(token);
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::optgroup) {
+ if (current_node().local_name() == HTML::TagNames::option) {
+ m_stack_of_open_elements.pop();
+ }
+ if (current_node().local_name() == HTML::TagNames::optgroup) {
+ m_stack_of_open_elements.pop();
+ }
+ insert_html_element(token);
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name() == HTML::TagNames::optgroup) {
+ if (current_node().local_name() == HTML::TagNames::option && node_before_current_node().local_name() == HTML::TagNames::optgroup)
+ m_stack_of_open_elements.pop();
+
+ if (current_node().local_name() == HTML::TagNames::optgroup) {
+ m_stack_of_open_elements.pop();
+ } else {
+ PARSE_ERROR();
+ return;
+ }
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name() == HTML::TagNames::option) {
+ if (current_node().local_name() == HTML::TagNames::option) {
+ m_stack_of_open_elements.pop();
+ } else {
+ PARSE_ERROR();
+ return;
+ }
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name() == HTML::TagNames::select) {
+ if (!m_stack_of_open_elements.has_in_select_scope(HTML::TagNames::select)) {
+ ASSERT(m_parsing_fragment);
+ PARSE_ERROR();
+ return;
+ }
+ m_stack_of_open_elements.pop_until_an_element_with_tag_name_has_been_popped(HTML::TagNames::select);
+ reset_the_insertion_mode_appropriately();
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::select) {
+ PARSE_ERROR();
+
+ if (!m_stack_of_open_elements.has_in_select_scope(HTML::TagNames::select)) {
+ ASSERT(m_parsing_fragment);
+ return;
+ }
+
+ m_stack_of_open_elements.pop_until_an_element_with_tag_name_has_been_popped(HTML::TagNames::select);
+ reset_the_insertion_mode_appropriately();
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::input, HTML::TagNames::keygen, HTML::TagNames::textarea)) {
+ PARSE_ERROR();
+
+ if (!m_stack_of_open_elements.has_in_select_scope(HTML::TagNames::select)) {
+ ASSERT(m_parsing_fragment);
+ return;
+ }
+
+ m_stack_of_open_elements.pop_until_an_element_with_tag_name_has_been_popped(HTML::TagNames::select);
+ reset_the_insertion_mode_appropriately();
+ process_using_the_rules_for(m_insertion_mode, token);
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::script, HTML::TagNames::template_)) {
+ process_using_the_rules_for(InsertionMode::InHead, token);
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name() == HTML::TagNames::template_) {
+ process_using_the_rules_for(InsertionMode::InHead, token);
+ return;
+ }
+
+ if (token.is_end_of_file()) {
+ process_using_the_rules_for(InsertionMode::InBody, token);
+ return;
+ }
+
+ PARSE_ERROR();
+}
+
+void HTMLDocumentParser::handle_in_caption(HTMLToken& token)
+{
+ if (token.is_end_tag() && token.tag_name() == HTML::TagNames::caption) {
+ if (!m_stack_of_open_elements.has_in_table_scope(HTML::TagNames::caption)) {
+ ASSERT(m_parsing_fragment);
+ PARSE_ERROR();
+ return;
+ }
+
+ generate_implied_end_tags();
+
+ if (current_node().local_name() != HTML::TagNames::caption)
+ PARSE_ERROR();
+
+ m_stack_of_open_elements.pop_until_an_element_with_tag_name_has_been_popped(HTML::TagNames::caption);
+ m_list_of_active_formatting_elements.clear_up_to_the_last_marker();
+
+ m_insertion_mode = InsertionMode::InTable;
+ return;
+ }
+
+ if ((token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::caption, HTML::TagNames::col, HTML::TagNames::colgroup, HTML::TagNames::tbody, HTML::TagNames::td, HTML::TagNames::tfoot, HTML::TagNames::th, HTML::TagNames::thead, HTML::TagNames::tr))
+ || (token.is_end_tag() && token.tag_name() == HTML::TagNames::table)) {
+ if (!m_stack_of_open_elements.has_in_table_scope(HTML::TagNames::caption)) {
+ ASSERT(m_parsing_fragment);
+ PARSE_ERROR();
+ return;
+ }
+
+ generate_implied_end_tags();
+
+ if (current_node().local_name() != HTML::TagNames::caption)
+ PARSE_ERROR();
+
+ m_stack_of_open_elements.pop_until_an_element_with_tag_name_has_been_popped(HTML::TagNames::caption);
+ m_list_of_active_formatting_elements.clear_up_to_the_last_marker();
+
+ m_insertion_mode = InsertionMode::InTable;
+ process_using_the_rules_for(m_insertion_mode, token);
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name().is_one_of(HTML::TagNames::body, HTML::TagNames::col, HTML::TagNames::colgroup, HTML::TagNames::html, HTML::TagNames::tbody, HTML::TagNames::td, HTML::TagNames::tfoot, HTML::TagNames::th, HTML::TagNames::thead, HTML::TagNames::tr)) {
+ PARSE_ERROR();
+ return;
+ }
+
+ process_using_the_rules_for(InsertionMode::InBody, token);
+}
+
+void HTMLDocumentParser::handle_in_column_group(HTMLToken& token)
+{
+ if (token.is_character() && token.is_parser_whitespace()) {
+ insert_character(token.code_point());
+ return;
+ }
+
+ if (token.is_comment()) {
+ insert_comment(token);
+ return;
+ }
+
+ if (token.is_doctype()) {
+ PARSE_ERROR();
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::html) {
+ process_using_the_rules_for(InsertionMode::InBody, token);
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::col) {
+ insert_html_element(token);
+ m_stack_of_open_elements.pop();
+ token.acknowledge_self_closing_flag_if_set();
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name() == HTML::TagNames::colgroup) {
+ if (current_node().local_name() != HTML::TagNames::colgroup) {
+ PARSE_ERROR();
+ return;
+ }
+
+ m_stack_of_open_elements.pop();
+ m_insertion_mode = InsertionMode::InTable;
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name() == HTML::TagNames::col) {
+ PARSE_ERROR();
+ return;
+ }
+
+ if ((token.is_start_tag() || token.is_end_tag()) && token.tag_name() == HTML::TagNames::template_) {
+ process_using_the_rules_for(InsertionMode::InHead, token);
+ return;
+ }
+
+ if (token.is_end_of_file()) {
+ process_using_the_rules_for(InsertionMode::InBody, token);
+ return;
+ }
+
+ if (current_node().local_name() != HTML::TagNames::colgroup) {
+ PARSE_ERROR();
+ return;
+ }
+
+ m_stack_of_open_elements.pop();
+ m_insertion_mode = InsertionMode::InTable;
+ process_using_the_rules_for(m_insertion_mode, token);
+}
+
+void HTMLDocumentParser::handle_in_template(HTMLToken& token)
+{
+ if (token.is_character() || token.is_comment() || token.is_doctype()) {
+ process_using_the_rules_for(InsertionMode::InBody, token);
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::base, HTML::TagNames::basefont, HTML::TagNames::bgsound, HTML::TagNames::link, HTML::TagNames::meta, HTML::TagNames::noframes, HTML::TagNames::script, HTML::TagNames::style, HTML::TagNames::template_, HTML::TagNames::title)) {
+ process_using_the_rules_for(InsertionMode::InHead, token);
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name() == HTML::TagNames::template_) {
+ process_using_the_rules_for(InsertionMode::InHead, token);
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::caption, HTML::TagNames::colgroup, HTML::TagNames::tbody, HTML::TagNames::tfoot, HTML::TagNames::thead)) {
+ m_stack_of_template_insertion_modes.take_last();
+ m_stack_of_template_insertion_modes.append(InsertionMode::InTable);
+ m_insertion_mode = InsertionMode::InTable;
+ process_using_the_rules_for(m_insertion_mode, token);
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::col) {
+ m_stack_of_template_insertion_modes.take_last();
+ m_stack_of_template_insertion_modes.append(InsertionMode::InColumnGroup);
+ m_insertion_mode = InsertionMode::InColumnGroup;
+ process_using_the_rules_for(m_insertion_mode, token);
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::tr) {
+ m_stack_of_template_insertion_modes.take_last();
+ m_stack_of_template_insertion_modes.append(InsertionMode::InTableBody);
+ m_insertion_mode = InsertionMode::InTableBody;
+ process_using_the_rules_for(m_insertion_mode, token);
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::td, HTML::TagNames::th)) {
+ m_stack_of_template_insertion_modes.take_last();
+ m_stack_of_template_insertion_modes.append(InsertionMode::InRow);
+ m_insertion_mode = InsertionMode::InRow;
+ process_using_the_rules_for(m_insertion_mode, token);
+ return;
+ }
+
+ if (token.is_start_tag()) {
+ m_stack_of_template_insertion_modes.take_last();
+ m_stack_of_template_insertion_modes.append(InsertionMode::InBody);
+ m_insertion_mode = InsertionMode::InBody;
+ process_using_the_rules_for(m_insertion_mode, token);
+ return;
+ }
+
+ if (token.is_end_tag()) {
+ PARSE_ERROR();
+ return;
+ }
+
+ if (token.is_end_of_file()) {
+ if (!m_stack_of_open_elements.contains(HTML::TagNames::template_)) {
+ ASSERT(m_parsing_fragment);
+ stop_parsing();
+ return;
+ }
+
+ PARSE_ERROR();
+ m_stack_of_open_elements.pop_until_an_element_with_tag_name_has_been_popped(HTML::TagNames::template_);
+ m_list_of_active_formatting_elements.clear_up_to_the_last_marker();
+ m_stack_of_template_insertion_modes.take_last();
+ reset_the_insertion_mode_appropriately();
+ process_using_the_rules_for(m_insertion_mode, token);
+ }
+}
+
+void HTMLDocumentParser::handle_in_frameset(HTMLToken& token)
+{
+ if (token.is_character() && token.is_parser_whitespace()) {
+ insert_character(token.code_point());
+ return;
+ }
+
+ if (token.is_comment()) {
+ insert_comment(token);
+ return;
+ }
+
+ if (token.is_doctype()) {
+ PARSE_ERROR();
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::html) {
+ process_using_the_rules_for(InsertionMode::InBody, token);
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::frameset) {
+ insert_html_element(token);
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name() == HTML::TagNames::frameset) {
+ // FIXME: If the current node is the root html element, then this is a parse error; ignore the token. (fragment case)
+
+ m_stack_of_open_elements.pop();
+
+ if (!m_parsing_fragment && current_node().local_name() != HTML::TagNames::frameset) {
+ m_insertion_mode = InsertionMode::AfterFrameset;
+ }
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::frame) {
+ insert_html_element(token);
+ m_stack_of_open_elements.pop();
+ token.acknowledge_self_closing_flag_if_set();
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::noframes) {
+ process_using_the_rules_for(InsertionMode::InHead, token);
+ return;
+ }
+
+ if (token.is_end_of_file()) {
+ //FIXME: If the current node is not the root html element, then this is a parse error.
+
+ stop_parsing();
+ return;
+ }
+
+ PARSE_ERROR();
+}
+
+void HTMLDocumentParser::handle_after_frameset(HTMLToken& token)
+{
+ if (token.is_character() && token.is_parser_whitespace()) {
+ insert_character(token.code_point());
+ return;
+ }
+
+ if (token.is_comment()) {
+ insert_comment(token);
+ return;
+ }
+
+ if (token.is_doctype()) {
+ PARSE_ERROR();
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::html) {
+ process_using_the_rules_for(InsertionMode::InBody, token);
+ return;
+ }
+
+ if (token.is_end_tag() && token.tag_name() == HTML::TagNames::html) {
+ m_insertion_mode = InsertionMode::AfterAfterFrameset;
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::noframes) {
+ process_using_the_rules_for(InsertionMode::InHead, token);
+ return;
+ }
+
+ if (token.is_end_of_file()) {
+ stop_parsing();
+ return;
+ }
+
+ PARSE_ERROR();
+}
+
+void HTMLDocumentParser::handle_after_after_frameset(HTMLToken& token)
+{
+ if (token.is_comment()) {
+ auto comment = adopt(*new DOM::Comment(document(), token.m_comment_or_character.data.to_string()));
+ document().append_child(move(comment));
+ return;
+ }
+
+ if (token.is_doctype() || token.is_parser_whitespace() || (token.is_start_tag() && token.tag_name() == HTML::TagNames::html)) {
+ process_using_the_rules_for(InsertionMode::InBody, token);
+ return;
+ }
+
+ if (token.is_end_of_file()) {
+ stop_parsing();
+ return;
+ }
+
+ if (token.is_start_tag() && token.tag_name() == HTML::TagNames::noframes) {
+ process_using_the_rules_for(InsertionMode::InHead, token);
+ return;
+ }
+
+ PARSE_ERROR();
+}
+
+void HTMLDocumentParser::process_using_the_rules_for_foreign_content(HTMLToken& token)
+{
+ if (token.is_character()) {
+ if (token.code_point() == 0) {
+ PARSE_ERROR();
+ insert_character(0xFFFD);
+ return;
+ }
+ if (token.is_parser_whitespace()) {
+ insert_character(token.code_point());
+ return;
+ }
+ insert_character(token.code_point());
+ m_frameset_ok = false;
+ return;
+ }
+
+ if (token.is_comment()) {
+ insert_comment(token);
+ return;
+ }
+
+ if (token.is_doctype()) {
+ PARSE_ERROR();
+ return;
+ }
+
+ if ((token.is_start_tag() && token.tag_name().is_one_of(HTML::TagNames::b, HTML::TagNames::big, HTML::TagNames::blockquote, HTML::TagNames::body, HTML::TagNames::br, HTML::TagNames::center, HTML::TagNames::code, HTML::TagNames::dd, HTML::TagNames::div, HTML::TagNames::dl, HTML::TagNames::dt, HTML::TagNames::em, HTML::TagNames::embed, HTML::TagNames::h1, HTML::TagNames::h2, HTML::TagNames::h3, HTML::TagNames::h4, HTML::TagNames::h5, HTML::TagNames::h6, HTML::TagNames::head, HTML::TagNames::hr, HTML::TagNames::i, HTML::TagNames::img, HTML::TagNames::li, HTML::TagNames::listing, HTML::TagNames::menu, HTML::TagNames::meta, HTML::TagNames::nobr, HTML::TagNames::ol, HTML::TagNames::p, HTML::TagNames::pre, HTML::TagNames::ruby, HTML::TagNames::s, HTML::TagNames::small, HTML::TagNames::span, HTML::TagNames::strong, HTML::TagNames::strike, HTML::TagNames::sub, HTML::TagNames::sup, HTML::TagNames::table, HTML::TagNames::tt, HTML::TagNames::u, HTML::TagNames::ul, HTML::TagNames::var))
+ || (token.is_start_tag() && token.tag_name() == HTML::TagNames::font && (token.has_attribute(HTML::AttributeNames::color) || token.has_attribute(HTML::AttributeNames::face) || token.has_attribute(HTML::AttributeNames::size)))) {
+ PARSE_ERROR();
+ if (m_parsing_fragment) {
+ goto AnyOtherStartTag;
+ }
+
+ TODO();
+ }
+
+ if (token.is_start_tag()) {
+ AnyOtherStartTag:
+ if (adjusted_current_node().namespace_() == Namespace::MathML) {
+ adjust_mathml_attributes(token);
+ } else if (adjusted_current_node().namespace_() == Namespace::SVG) {
+ adjust_svg_tag_names(token);
+ adjust_svg_attributes(token);
+ }
+
+ adjust_foreign_attributes(token);
+ insert_foreign_element(token, adjusted_current_node().namespace_());
+
+ if (token.is_self_closing()) {
+ if (token.tag_name() == SVG::TagNames::script && current_node().namespace_() == Namespace::SVG) {
+ token.acknowledge_self_closing_flag_if_set();
+ goto ScriptEndTag;
+ }
+
+ m_stack_of_open_elements.pop();
+ token.acknowledge_self_closing_flag_if_set();
+ }
+
+ return;
+ }
+
+ if (token.is_end_tag() && current_node().namespace_() == Namespace::SVG && current_node().tag_name() == SVG::TagNames::script) {
+ ScriptEndTag:
+ m_stack_of_open_elements.pop();
+ TODO();
+ }
+
+ if (token.is_end_tag()) {
+ RefPtr<DOM::Element> node = current_node();
+ // FIXME: Not sure if this is the correct to_lowercase, as the specification says "to ASCII lowercase"
+ if (node->tag_name().to_lowercase() != token.tag_name())
+ PARSE_ERROR();
+ for (ssize_t i = m_stack_of_open_elements.elements().size() - 1; i >= 0; --i) {
+ if (node == m_stack_of_open_elements.first()) {
+ ASSERT(m_parsing_fragment);
+ return;
+ }
+ // FIXME: See the above FIXME
+ if (node->tag_name().to_lowercase() == token.tag_name()) {
+ while (current_node() != node)
+ m_stack_of_open_elements.pop();
+ m_stack_of_open_elements.pop();
+ return;
+ }
+
+ node = m_stack_of_open_elements.elements().at(i - 1);
+
+ if (node->namespace_() != Namespace::HTML)
+ continue;
+
+ process_using_the_rules_for(m_insertion_mode, token);
+ return;
+ }
+ }
+
+ ASSERT_NOT_REACHED();
+}
+
+void HTMLDocumentParser::reset_the_insertion_mode_appropriately()
+{
+ for (ssize_t i = m_stack_of_open_elements.elements().size() - 1; i >= 0; --i) {
+ bool last = i == 0;
+ // NOTE: When parsing fragments, we substitute the context element for the root of the stack of open elements.
+ RefPtr<DOM::Element> node;
+ if (last && m_parsing_fragment) {
+ node = m_context_element;
+ } else {
+ node = m_stack_of_open_elements.elements().at(i);
+ }
+
+ if (node->local_name() == HTML::TagNames::select) {
+ TODO();
+ }
+
+ if (!last && node->local_name().is_one_of(HTML::TagNames::td, HTML::TagNames::th)) {
+ m_insertion_mode = InsertionMode::InCell;
+ return;
+ }
+
+ if (node->local_name() == HTML::TagNames::tr) {
+ m_insertion_mode = InsertionMode::InRow;
+ return;
+ }
+
+ if (node->local_name().is_one_of(HTML::TagNames::tbody, HTML::TagNames::thead, HTML::TagNames::tfoot)) {
+ m_insertion_mode = InsertionMode::InTableBody;
+ return;
+ }
+
+ if (node->local_name() == HTML::TagNames::caption) {
+ m_insertion_mode = InsertionMode::InCaption;
+ return;
+ }
+
+ if (node->local_name() == HTML::TagNames::colgroup) {
+ m_insertion_mode = InsertionMode::InColumnGroup;
+ return;
+ }
+
+ if (node->local_name() == HTML::TagNames::table) {
+ m_insertion_mode = InsertionMode::InTable;
+ return;
+ }
+
+ if (node->local_name() == HTML::TagNames::template_) {
+ m_insertion_mode = m_stack_of_template_insertion_modes.last();
+ return;
+ }
+
+ if (!last && node->local_name() == HTML::TagNames::head) {
+ m_insertion_mode = InsertionMode::InHead;
+ return;
+ }
+
+ if (node->local_name() == HTML::TagNames::body) {
+ m_insertion_mode = InsertionMode::InBody;
+ return;
+ }
+
+ if (node->local_name() == HTML::TagNames::frameset) {
+ ASSERT(m_parsing_fragment);
+ m_insertion_mode = InsertionMode::InFrameset;
+ return;
+ }
+
+ if (node->local_name() == HTML::TagNames::html) {
+ if (!m_head_element) {
+ ASSERT(m_parsing_fragment);
+ m_insertion_mode = InsertionMode::BeforeHead;
+ return;
+ }
+
+ m_insertion_mode = InsertionMode::AfterHead;
+ return;
+ }
+ }
+
+ ASSERT(m_parsing_fragment);
+ m_insertion_mode = InsertionMode::InBody;
+}
+
+const char* HTMLDocumentParser::insertion_mode_name() const
+{
+ switch (m_insertion_mode) {
+#define __ENUMERATE_INSERTION_MODE(mode) \
+ case InsertionMode::mode: \
+ return #mode;
+ ENUMERATE_INSERTION_MODES
+#undef __ENUMERATE_INSERTION_MODE
+ }
+ ASSERT_NOT_REACHED();
+}
+
+DOM::Document& HTMLDocumentParser::document()
+{
+ return *m_document;
+}
+
+NonnullRefPtrVector<DOM::Node> HTMLDocumentParser::parse_html_fragment(DOM::Element& context_element, const StringView& markup)
+{
+ auto temp_document = DOM::Document::create();
+ HTMLDocumentParser parser(*temp_document, markup, "utf-8");
+ parser.m_context_element = context_element;
+ parser.m_parsing_fragment = true;
+ parser.document().set_quirks_mode(context_element.document().mode());
+
+ if (context_element.local_name().is_one_of(HTML::TagNames::title, HTML::TagNames::textarea)) {
+ parser.m_tokenizer.switch_to({}, HTMLTokenizer::State::RCDATA);
+ } else if (context_element.local_name().is_one_of(HTML::TagNames::style, HTML::TagNames::xmp, HTML::TagNames::iframe, HTML::TagNames::noembed, HTML::TagNames::noframes)) {
+ parser.m_tokenizer.switch_to({}, HTMLTokenizer::State::RAWTEXT);
+ } else if (context_element.local_name().is_one_of(HTML::TagNames::script)) {
+ parser.m_tokenizer.switch_to({}, HTMLTokenizer::State::ScriptData);
+ } else if (context_element.local_name().is_one_of(HTML::TagNames::noscript)) {
+ if (context_element.document().is_scripting_enabled())
+ parser.m_tokenizer.switch_to({}, HTMLTokenizer::State::RAWTEXT);
+ } else if (context_element.local_name().is_one_of(HTML::TagNames::plaintext)) {
+ parser.m_tokenizer.switch_to({}, HTMLTokenizer::State::PLAINTEXT);
+ }
+
+ auto root = create_element(context_element.document(), HTML::TagNames::html, Namespace::HTML);
+ parser.document().append_child(root);
+ parser.m_stack_of_open_elements.push(root);
+
+ if (context_element.local_name() == HTML::TagNames::template_) {
+ parser.m_stack_of_template_insertion_modes.append(InsertionMode::InTemplate);
+ }
+
+ // FIXME: Create a start tag token whose name is the local name of context and whose attributes are the attributes of context.
+
+ parser.reset_the_insertion_mode_appropriately();
+
+ for (auto* form_candidate = &context_element; form_candidate; form_candidate = form_candidate->parent_element()) {
+ if (is<HTMLFormElement>(*form_candidate)) {
+ parser.m_form_element = downcast<HTMLFormElement>(*form_candidate);
+ break;
+ }
+ }
+
+ parser.run(context_element.document().url());
+
+ NonnullRefPtrVector<DOM::Node> children;
+ while (RefPtr<DOM::Node> child = root->first_child()) {
+ root->remove_child(*child);
+ context_element.document().adopt_node(*child);
+ children.append(*child);
+ }
+ return children;
+}
+}
diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.h b/Userland/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.h
new file mode 100644
index 0000000000..4abbb74b72
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLDocumentParser.h
@@ -0,0 +1,193 @@
+/*
+ * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <AK/NonnullRefPtrVector.h>
+#include <LibWeb/DOM/Node.h>
+#include <LibWeb/HTML/Parser/HTMLTokenizer.h>
+#include <LibWeb/HTML/Parser/ListOfActiveFormattingElements.h>
+#include <LibWeb/HTML/Parser/StackOfOpenElements.h>
+
+namespace Web::HTML {
+
+#define ENUMERATE_INSERTION_MODES \
+ __ENUMERATE_INSERTION_MODE(Initial) \
+ __ENUMERATE_INSERTION_MODE(BeforeHTML) \
+ __ENUMERATE_INSERTION_MODE(BeforeHead) \
+ __ENUMERATE_INSERTION_MODE(InHead) \
+ __ENUMERATE_INSERTION_MODE(InHeadNoscript) \
+ __ENUMERATE_INSERTION_MODE(AfterHead) \
+ __ENUMERATE_INSERTION_MODE(InBody) \
+ __ENUMERATE_INSERTION_MODE(Text) \
+ __ENUMERATE_INSERTION_MODE(InTable) \
+ __ENUMERATE_INSERTION_MODE(InTableText) \
+ __ENUMERATE_INSERTION_MODE(InCaption) \
+ __ENUMERATE_INSERTION_MODE(InColumnGroup) \
+ __ENUMERATE_INSERTION_MODE(InTableBody) \
+ __ENUMERATE_INSERTION_MODE(InRow) \
+ __ENUMERATE_INSERTION_MODE(InCell) \
+ __ENUMERATE_INSERTION_MODE(InSelect) \
+ __ENUMERATE_INSERTION_MODE(InSelectInTable) \
+ __ENUMERATE_INSERTION_MODE(InTemplate) \
+ __ENUMERATE_INSERTION_MODE(AfterBody) \
+ __ENUMERATE_INSERTION_MODE(InFrameset) \
+ __ENUMERATE_INSERTION_MODE(AfterFrameset) \
+ __ENUMERATE_INSERTION_MODE(AfterAfterBody) \
+ __ENUMERATE_INSERTION_MODE(AfterAfterFrameset)
+
+RefPtr<DOM::Document> parse_html_document(const StringView&, const URL&, const String& encoding);
+
+class HTMLDocumentParser {
+public:
+ HTMLDocumentParser(DOM::Document&, const StringView& input, const String& encoding);
+ ~HTMLDocumentParser();
+
+ void run(const URL&);
+
+ DOM::Document& document();
+
+ static NonnullRefPtrVector<DOM::Node> parse_html_fragment(DOM::Element& context_element, const StringView&);
+
+ enum class InsertionMode {
+#define __ENUMERATE_INSERTION_MODE(mode) mode,
+ ENUMERATE_INSERTION_MODES
+#undef __ENUMERATE_INSERTION_MODE
+ };
+
+ InsertionMode insertion_mode() const { return m_insertion_mode; }
+
+ static bool is_special_tag(const FlyString& tag_name, const FlyString& namespace_);
+
+private:
+ const char* insertion_mode_name() const;
+
+ DOM::QuirksMode which_quirks_mode(const HTMLToken&) const;
+
+ void handle_initial(HTMLToken&);
+ void handle_before_html(HTMLToken&);
+ void handle_before_head(HTMLToken&);
+ void handle_in_head(HTMLToken&);
+ void handle_in_head_noscript(HTMLToken&);
+ void handle_after_head(HTMLToken&);
+ void handle_in_body(HTMLToken&);
+ void handle_after_body(HTMLToken&);
+ void handle_after_after_body(HTMLToken&);
+ void handle_text(HTMLToken&);
+ void handle_in_table(HTMLToken&);
+ void handle_in_table_body(HTMLToken&);
+ void handle_in_row(HTMLToken&);
+ void handle_in_cell(HTMLToken&);
+ void handle_in_table_text(HTMLToken&);
+ void handle_in_select_in_table(HTMLToken&);
+ void handle_in_select(HTMLToken&);
+ void handle_in_caption(HTMLToken&);
+ void handle_in_column_group(HTMLToken&);
+ void handle_in_template(HTMLToken&);
+ void handle_in_frameset(HTMLToken&);
+ void handle_after_frameset(HTMLToken&);
+ void handle_after_after_frameset(HTMLToken&);
+
+ void stop_parsing() { m_stop_parsing = true; }
+
+ void generate_implied_end_tags(const FlyString& exception = {});
+ void generate_all_implied_end_tags_thoroughly();
+ bool stack_of_open_elements_has_element_with_tag_name_in_scope(const FlyString& tag_name);
+ NonnullRefPtr<DOM::Element> create_element_for(const HTMLToken&, const FlyString& namespace_);
+
+ struct AdjustedInsertionLocation {
+ RefPtr<DOM::Node> parent;
+ RefPtr<DOM::Node> insert_before_sibling;
+ };
+
+ AdjustedInsertionLocation find_appropriate_place_for_inserting_node();
+
+ DOM::Text* find_character_insertion_node();
+ void flush_character_insertions();
+ RefPtr<DOM::Element> insert_foreign_element(const HTMLToken&, const FlyString&);
+ RefPtr<DOM::Element> insert_html_element(const HTMLToken&);
+ DOM::Element& current_node();
+ DOM::Element& adjusted_current_node();
+ DOM::Element& node_before_current_node();
+ void insert_character(u32 data);
+ void insert_comment(HTMLToken&);
+ void reconstruct_the_active_formatting_elements();
+ void close_a_p_element();
+ void process_using_the_rules_for(InsertionMode, HTMLToken&);
+ void process_using_the_rules_for_foreign_content(HTMLToken&);
+ void parse_generic_raw_text_element(HTMLToken&);
+ void increment_script_nesting_level();
+ void decrement_script_nesting_level();
+ size_t script_nesting_level() const { return m_script_nesting_level; }
+ void reset_the_insertion_mode_appropriately();
+
+ void adjust_mathml_attributes(HTMLToken&);
+ void adjust_svg_tag_names(HTMLToken&);
+ void adjust_svg_attributes(HTMLToken&);
+ void adjust_foreign_attributes(HTMLToken&);
+
+ enum AdoptionAgencyAlgorithmOutcome {
+ DoNothing,
+ RunAnyOtherEndTagSteps,
+ };
+
+ AdoptionAgencyAlgorithmOutcome run_the_adoption_agency_algorithm(HTMLToken&);
+ void clear_the_stack_back_to_a_table_context();
+ void clear_the_stack_back_to_a_table_body_context();
+ void clear_the_stack_back_to_a_table_row_context();
+ void close_the_cell();
+
+ InsertionMode m_insertion_mode { InsertionMode::Initial };
+ InsertionMode m_original_insertion_mode { InsertionMode::Initial };
+
+ StackOfOpenElements m_stack_of_open_elements;
+ Vector<InsertionMode> m_stack_of_template_insertion_modes;
+ ListOfActiveFormattingElements m_list_of_active_formatting_elements;
+
+ HTMLTokenizer m_tokenizer;
+
+ bool m_foster_parenting { false };
+ bool m_frameset_ok { true };
+ bool m_parsing_fragment { false };
+ bool m_scripting_enabled { true };
+ bool m_invoked_via_document_write { false };
+ bool m_aborted { false };
+ bool m_parser_pause_flag { false };
+ bool m_stop_parsing { false };
+ size_t m_script_nesting_level { 0 };
+
+ NonnullRefPtr<DOM::Document> m_document;
+ RefPtr<HTMLHeadElement> m_head_element;
+ RefPtr<HTMLFormElement> m_form_element;
+ RefPtr<DOM::Element> m_context_element;
+
+ Vector<HTMLToken> m_pending_table_character_tokens;
+
+ RefPtr<DOM::Text> m_character_insertion_node;
+ StringBuilder m_character_insertion_builder;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLToken.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLToken.cpp
new file mode 100644
index 0000000000..53a2357be5
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLToken.cpp
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/Parser/HTMLToken.h>
+
+namespace Web::HTML {
+
+String HTMLToken::to_string() const
+{
+ StringBuilder builder;
+
+ switch (type()) {
+ case HTMLToken::Type::DOCTYPE:
+ builder.append("DOCTYPE");
+ builder.append(" { name: '");
+ builder.append(m_doctype.name.to_string());
+ builder.append("' }");
+ break;
+ case HTMLToken::Type::StartTag:
+ builder.append("StartTag");
+ break;
+ case HTMLToken::Type::EndTag:
+ builder.append("EndTag");
+ break;
+ case HTMLToken::Type::Comment:
+ builder.append("Comment");
+ break;
+ case HTMLToken::Type::Character:
+ builder.append("Character");
+ break;
+ case HTMLToken::Type::EndOfFile:
+ builder.append("EndOfFile");
+ break;
+ case HTMLToken::Type::Invalid:
+ ASSERT_NOT_REACHED();
+ }
+
+ if (type() == HTMLToken::Type::StartTag || type() == HTMLToken::Type::EndTag) {
+ builder.append(" { name: '");
+ builder.append(m_tag.tag_name.to_string());
+ builder.append("', { ");
+ for (auto& attribute : m_tag.attributes) {
+ builder.append(attribute.local_name_builder.to_string());
+ builder.append("=\"");
+ builder.append(attribute.value_builder.to_string());
+ builder.append("\" ");
+ }
+ builder.append("} }");
+ }
+
+ if (type() == HTMLToken::Type::Comment || type() == HTMLToken::Type::Character) {
+ builder.append(" { data: '");
+ builder.append(m_comment_or_character.data.to_string());
+ builder.append("' }");
+ }
+
+ return builder.to_string();
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLToken.h b/Userland/Libraries/LibWeb/HTML/Parser/HTMLToken.h
new file mode 100644
index 0000000000..c2246229c6
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLToken.h
@@ -0,0 +1,226 @@
+/*
+ * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <AK/FlyString.h>
+#include <AK/String.h>
+#include <AK/StringBuilder.h>
+#include <AK/Types.h>
+#include <AK/Utf8View.h>
+#include <AK/Vector.h>
+
+namespace Web::HTML {
+
+class HTMLToken {
+ friend class HTMLDocumentParser;
+ friend class HTMLTokenizer;
+
+public:
+ enum class Type {
+ Invalid,
+ DOCTYPE,
+ StartTag,
+ EndTag,
+ Comment,
+ Character,
+ EndOfFile,
+ };
+
+ static HTMLToken make_character(u32 code_point)
+ {
+ HTMLToken token;
+ token.m_type = Type::Character;
+ token.m_comment_or_character.data.append(code_point);
+ return token;
+ }
+
+ static HTMLToken make_start_tag(const FlyString& tag_name)
+ {
+ HTMLToken token;
+ token.m_type = Type::StartTag;
+ token.m_tag.tag_name.append(tag_name);
+ return token;
+ }
+
+ bool is_doctype() const { return m_type == Type::DOCTYPE; }
+ bool is_start_tag() const { return m_type == Type::StartTag; }
+ bool is_end_tag() const { return m_type == Type::EndTag; }
+ bool is_comment() const { return m_type == Type::Comment; }
+ bool is_character() const { return m_type == Type::Character; }
+ bool is_end_of_file() const { return m_type == Type::EndOfFile; }
+
+ u32 code_point() const
+ {
+ ASSERT(is_character());
+ Utf8View view(m_comment_or_character.data.string_view());
+ ASSERT(view.length() == 1);
+ return *view.begin();
+ }
+
+ bool is_parser_whitespace() const
+ {
+ // NOTE: The parser considers '\r' to be whitespace, while the tokenizer does not.
+ if (!is_character())
+ return false;
+ switch (code_point()) {
+ case '\t':
+ case '\n':
+ case '\f':
+ case '\r':
+ case ' ':
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ String tag_name() const
+ {
+ ASSERT(is_start_tag() || is_end_tag());
+ return m_tag.tag_name.to_string();
+ }
+
+ bool is_self_closing() const
+ {
+ ASSERT(is_start_tag() || is_end_tag());
+ return m_tag.self_closing;
+ }
+
+ bool has_acknowledged_self_closing_flag() const
+ {
+ ASSERT(is_self_closing());
+ return m_tag.self_closing_acknowledged;
+ }
+
+ void acknowledge_self_closing_flag_if_set()
+ {
+ if (is_self_closing())
+ m_tag.self_closing_acknowledged = true;
+ }
+
+ StringView attribute(const FlyString& attribute_name)
+ {
+ ASSERT(is_start_tag() || is_end_tag());
+ for (auto& attribute : m_tag.attributes) {
+ if (attribute_name == attribute.local_name_builder.string_view())
+ return attribute.value_builder.string_view();
+ }
+ return {};
+ }
+
+ bool has_attribute(const FlyString& attribute_name)
+ {
+ return !attribute(attribute_name).is_null();
+ }
+
+ void adjust_tag_name(const FlyString& old_name, const FlyString& new_name)
+ {
+ ASSERT(is_start_tag() || is_end_tag());
+ if (old_name == m_tag.tag_name.string_view()) {
+ m_tag.tag_name.clear();
+ m_tag.tag_name.append(new_name);
+ }
+ }
+
+ void adjust_attribute_name(const FlyString& old_name, const FlyString& new_name)
+ {
+ ASSERT(is_start_tag() || is_end_tag());
+ for (auto& attribute : m_tag.attributes) {
+ if (old_name == attribute.local_name_builder.string_view()) {
+ attribute.local_name_builder.clear();
+ attribute.local_name_builder.append(new_name);
+ }
+ }
+ }
+
+ void adjust_foreign_attribute(const FlyString& old_name, const FlyString& prefix, const FlyString& local_name, const FlyString& namespace_)
+ {
+ ASSERT(is_start_tag() || is_end_tag());
+ for (auto& attribute : m_tag.attributes) {
+ if (old_name == attribute.local_name_builder.string_view()) {
+ attribute.prefix_builder.clear();
+ attribute.prefix_builder.append(prefix);
+
+ attribute.local_name_builder.clear();
+ attribute.local_name_builder.append(local_name);
+
+ attribute.namespace_builder.clear();
+ attribute.namespace_builder.append(namespace_);
+ }
+ }
+ }
+
+ void drop_attributes()
+ {
+ ASSERT(is_start_tag() || is_end_tag());
+ m_tag.attributes.clear();
+ }
+
+ Type type() const { return m_type; }
+
+ String to_string() const;
+
+private:
+ struct AttributeBuilder {
+ StringBuilder prefix_builder;
+ StringBuilder local_name_builder;
+ StringBuilder namespace_builder;
+ StringBuilder value_builder;
+ };
+
+ Type m_type { Type::Invalid };
+
+ // Type::DOCTYPE
+ struct {
+ // NOTE: "Missing" is a distinct state from the empty string.
+
+ StringBuilder name;
+ bool missing_name { true };
+ StringBuilder public_identifier;
+ bool missing_public_identifier { true };
+ StringBuilder system_identifier;
+ bool missing_system_identifier { true };
+ bool force_quirks { false };
+ } m_doctype;
+
+ // Type::StartTag
+ // Type::EndTag
+ struct {
+ StringBuilder tag_name;
+ bool self_closing { false };
+ bool self_closing_acknowledged { false };
+ Vector<AttributeBuilder> attributes;
+ } m_tag;
+
+ // Type::Comment
+ // Type::Character
+ struct {
+ StringBuilder data;
+ } m_comment_or_character;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp
new file mode 100644
index 0000000000..1bf1dab3c3
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.cpp
@@ -0,0 +1,2663 @@
+/*
+ * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibTextCodec/Decoder.h>
+#include <LibWeb/HTML/Parser/Entities.h>
+#include <LibWeb/HTML/Parser/HTMLToken.h>
+#include <LibWeb/HTML/Parser/HTMLTokenizer.h>
+#include <ctype.h>
+#include <string.h>
+
+namespace Web::HTML {
+
+#pragma GCC diagnostic ignored "-Wunused-label"
+
+//#define TOKENIZER_TRACE
+
+#ifdef TOKENIZER_TRACE
+# define PARSE_ERROR() \
+ do { \
+ dbg() << "Parse error (tokenization)" << __PRETTY_FUNCTION__ << " @ " << __LINE__; \
+ } while (0)
+#else
+# define PARSE_ERROR()
+#endif
+
+#define CONSUME_NEXT_INPUT_CHARACTER \
+ current_input_character = next_code_point();
+
+#define SWITCH_TO(new_state) \
+ do { \
+ will_switch_to(State::new_state); \
+ m_state = State::new_state; \
+ CONSUME_NEXT_INPUT_CHARACTER; \
+ goto new_state; \
+ } while (0)
+
+#define RECONSUME_IN(new_state) \
+ do { \
+ will_reconsume_in(State::new_state); \
+ m_state = State::new_state; \
+ goto new_state; \
+ } while (0)
+
+#define SWITCH_TO_RETURN_STATE \
+ do { \
+ will_switch_to(m_return_state); \
+ m_state = m_return_state; \
+ goto _StartOfFunction; \
+ } while (0)
+
+#define RECONSUME_IN_RETURN_STATE \
+ do { \
+ will_reconsume_in(m_return_state); \
+ m_state = m_return_state; \
+ if (current_input_character.has_value()) \
+ m_utf8_iterator = m_prev_utf8_iterator; \
+ goto _StartOfFunction; \
+ } while (0)
+
+#define SWITCH_TO_AND_EMIT_CURRENT_TOKEN(new_state) \
+ do { \
+ will_switch_to(State::new_state); \
+ m_state = State::new_state; \
+ will_emit(m_current_token); \
+ m_queued_tokens.enqueue(m_current_token); \
+ return m_queued_tokens.dequeue(); \
+ } while (0)
+
+#define EMIT_CHARACTER_AND_RECONSUME_IN(code_point, new_state) \
+ do { \
+ m_queued_tokens.enqueue(HTMLToken::make_character(code_point)); \
+ will_reconsume_in(State::new_state); \
+ m_state = State::new_state; \
+ goto new_state; \
+ } while (0)
+
+#define FLUSH_CODEPOINTS_CONSUMED_AS_A_CHARACTER_REFERENCE \
+ do { \
+ for (auto code_point : m_temporary_buffer) { \
+ if (consumed_as_part_of_an_attribute()) { \
+ m_current_token.m_tag.attributes.last().value_builder.append_code_point(code_point); \
+ } else { \
+ create_new_token(HTMLToken::Type::Character); \
+ m_current_token.m_comment_or_character.data.append_code_point(code_point); \
+ m_queued_tokens.enqueue(m_current_token); \
+ } \
+ } \
+ } while (0)
+
+#define DONT_CONSUME_NEXT_INPUT_CHARACTER \
+ do { \
+ m_utf8_iterator = m_prev_utf8_iterator; \
+ } while (0)
+
+#define ON(code_point) \
+ if (current_input_character.has_value() && current_input_character.value() == code_point)
+
+#define ON_EOF \
+ if (!current_input_character.has_value())
+
+#define ON_ASCII_ALPHA \
+ if (current_input_character.has_value() && isalpha(current_input_character.value()))
+
+#define ON_ASCII_ALPHANUMERIC \
+ if (current_input_character.has_value() && isalnum(current_input_character.value()))
+
+#define ON_ASCII_UPPER_ALPHA \
+ if (current_input_character.has_value() && current_input_character.value() >= 'A' && current_input_character.value() <= 'Z')
+
+#define ON_ASCII_LOWER_ALPHA \
+ if (current_input_character.has_value() && current_input_character.value() >= 'a' && current_input_character.value() <= 'z')
+
+#define ON_ASCII_DIGIT \
+ if (current_input_character.has_value() && isdigit(current_input_character.value()))
+
+#define ON_ASCII_HEX_DIGIT \
+ if (current_input_character.has_value() && isxdigit(current_input_character.value()))
+
+#define ON_WHITESPACE \
+ if (current_input_character.has_value() && strchr("\t\n\f ", current_input_character.value()))
+
+#define ANYTHING_ELSE if (1)
+
+#define EMIT_EOF \
+ do { \
+ if (m_has_emitted_eof) \
+ return {}; \
+ m_has_emitted_eof = true; \
+ create_new_token(HTMLToken::Type::EndOfFile); \
+ will_emit(m_current_token); \
+ m_queued_tokens.enqueue(m_current_token); \
+ return m_queued_tokens.dequeue(); \
+ } while (0)
+
+#define EMIT_CURRENT_TOKEN \
+ do { \
+ will_emit(m_current_token); \
+ m_queued_tokens.enqueue(m_current_token); \
+ return m_queued_tokens.dequeue(); \
+ } while (0)
+
+#define EMIT_CHARACTER(code_point) \
+ do { \
+ create_new_token(HTMLToken::Type::Character); \
+ m_current_token.m_comment_or_character.data.append_code_point(code_point); \
+ m_queued_tokens.enqueue(m_current_token); \
+ return m_queued_tokens.dequeue(); \
+ } while (0)
+
+#define EMIT_CURRENT_CHARACTER \
+ EMIT_CHARACTER(current_input_character.value());
+
+#define SWITCH_TO_AND_EMIT_CHARACTER(code_point, new_state) \
+ do { \
+ will_switch_to(State::new_state); \
+ m_state = State::new_state; \
+ EMIT_CHARACTER(code_point); \
+ } while (0)
+
+#define SWITCH_TO_AND_EMIT_CURRENT_CHARACTER(new_state) \
+ SWITCH_TO_AND_EMIT_CHARACTER(current_input_character.value(), new_state)
+
+#define BEGIN_STATE(state) \
+ state: \
+ case State::state: { \
+ { \
+ {
+
+#define END_STATE \
+ ASSERT_NOT_REACHED(); \
+ break; \
+ } \
+ } \
+ }
+
+static inline bool is_surrogate(u32 code_point)
+{
+ return (code_point & 0xfffff800) == 0xd800;
+}
+
+static inline bool is_noncharacter(u32 code_point)
+{
+ return code_point >= 0xfdd0 && (code_point <= 0xfdef || (code_point & 0xfffe) == 0xfffe) && code_point <= 0x10ffff;
+}
+
+static inline bool is_c0_control(u32 code_point)
+{
+ return code_point <= 0x1f;
+}
+
+static inline bool is_control(u32 code_point)
+{
+ return is_c0_control(code_point) || (code_point >= 0x7f && code_point <= 0x9f);
+}
+
+Optional<u32> HTMLTokenizer::next_code_point()
+{
+ if (m_utf8_iterator == m_utf8_view.end())
+ return {};
+ m_prev_utf8_iterator = m_utf8_iterator;
+ ++m_utf8_iterator;
+#ifdef TOKENIZER_TRACE
+ dbg() << "(Tokenizer) Next code_point: " << (char)*m_prev_utf8_iterator;
+#endif
+ return *m_prev_utf8_iterator;
+}
+
+Optional<u32> HTMLTokenizer::peek_code_point(size_t offset) const
+{
+ auto it = m_utf8_iterator;
+ for (size_t i = 0; i < offset && it != m_utf8_view.end(); ++i)
+ ++it;
+ if (it == m_utf8_view.end())
+ return {};
+ return *it;
+}
+
+Optional<HTMLToken> HTMLTokenizer::next_token()
+{
+_StartOfFunction:
+ if (!m_queued_tokens.is_empty())
+ return m_queued_tokens.dequeue();
+
+ for (;;) {
+ auto current_input_character = next_code_point();
+ switch (m_state) {
+ BEGIN_STATE(Data)
+ {
+ ON('&')
+ {
+ m_return_state = State::Data;
+ SWITCH_TO(CharacterReference);
+ }
+ ON('<')
+ {
+ SWITCH_TO(TagOpen);
+ }
+ ON(0)
+ {
+ PARSE_ERROR();
+ EMIT_CURRENT_CHARACTER;
+ }
+ ON_EOF
+ {
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ EMIT_CURRENT_CHARACTER;
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(TagOpen)
+ {
+ ON('!')
+ {
+ SWITCH_TO(MarkupDeclarationOpen);
+ }
+ ON('/')
+ {
+ SWITCH_TO(EndTagOpen);
+ }
+ ON_ASCII_ALPHA
+ {
+ create_new_token(HTMLToken::Type::StartTag);
+ RECONSUME_IN(TagName);
+ }
+ ON('?')
+ {
+ PARSE_ERROR();
+ create_new_token(HTMLToken::Type::Comment);
+ RECONSUME_IN(BogusComment);
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ m_queued_tokens.enqueue(HTMLToken::make_character('<'));
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ PARSE_ERROR();
+ EMIT_CHARACTER_AND_RECONSUME_IN('<', Data);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(TagName)
+ {
+ ON_WHITESPACE
+ {
+ SWITCH_TO(BeforeAttributeName);
+ }
+ ON('/')
+ {
+ SWITCH_TO(SelfClosingStartTag);
+ }
+ ON('>')
+ {
+ SWITCH_TO_AND_EMIT_CURRENT_TOKEN(Data);
+ }
+ ON_ASCII_UPPER_ALPHA
+ {
+ m_current_token.m_tag.tag_name.append(tolower(current_input_character.value()));
+ continue;
+ }
+ ON(0)
+ {
+ PARSE_ERROR();
+ m_current_token.m_tag.tag_name.append_code_point(0xFFFD);
+ continue;
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ m_current_token.m_tag.tag_name.append_code_point(current_input_character.value());
+ continue;
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(EndTagOpen)
+ {
+ ON_ASCII_ALPHA
+ {
+ create_new_token(HTMLToken::Type::EndTag);
+ RECONSUME_IN(TagName);
+ }
+ ON('>')
+ {
+ PARSE_ERROR();
+ SWITCH_TO(Data);
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ m_queued_tokens.enqueue(HTMLToken::make_character('<'));
+ m_queued_tokens.enqueue(HTMLToken::make_character('/'));
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ PARSE_ERROR();
+ create_new_token(HTMLToken::Type::Comment);
+ RECONSUME_IN(BogusComment);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(MarkupDeclarationOpen)
+ {
+ DONT_CONSUME_NEXT_INPUT_CHARACTER;
+ if (consume_next_if_match("--")) {
+ create_new_token(HTMLToken::Type::Comment);
+ SWITCH_TO(CommentStart);
+ }
+ if (consume_next_if_match("DOCTYPE", CaseSensitivity::CaseInsensitive)) {
+ SWITCH_TO(DOCTYPE);
+ }
+ if (consume_next_if_match("[CDATA[")) {
+ TODO();
+ }
+ ANYTHING_ELSE
+ {
+ PARSE_ERROR();
+ create_new_token(HTMLToken::Type::Comment);
+ SWITCH_TO(BogusComment);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(BogusComment)
+ {
+ ON('>')
+ {
+ SWITCH_TO_AND_EMIT_CURRENT_TOKEN(Data);
+ }
+ ON_EOF
+ {
+ m_queued_tokens.enqueue(m_current_token);
+ EMIT_EOF;
+ }
+ ON(0)
+ {
+ PARSE_ERROR();
+ m_current_token.m_comment_or_character.data.append_code_point(0xFFFD);
+ continue;
+ }
+ ANYTHING_ELSE
+ {
+ m_current_token.m_comment_or_character.data.append_code_point(current_input_character.value());
+ continue;
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(DOCTYPE)
+ {
+ ON_WHITESPACE
+ {
+ SWITCH_TO(BeforeDOCTYPEName);
+ }
+ ON('>')
+ {
+ RECONSUME_IN(BeforeDOCTYPEName);
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ create_new_token(HTMLToken::Type::DOCTYPE);
+ m_current_token.m_doctype.force_quirks = true;
+ m_queued_tokens.enqueue(m_current_token);
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ PARSE_ERROR();
+ RECONSUME_IN(BeforeDOCTYPEName);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(BeforeDOCTYPEName)
+ {
+ ON_WHITESPACE
+ {
+ continue;
+ }
+ ON_ASCII_UPPER_ALPHA
+ {
+ create_new_token(HTMLToken::Type::DOCTYPE);
+ m_current_token.m_doctype.name.append(tolower(current_input_character.value()));
+ m_current_token.m_doctype.missing_name = false;
+ SWITCH_TO(DOCTYPEName);
+ }
+ ON(0)
+ {
+ PARSE_ERROR();
+ create_new_token(HTMLToken::Type::DOCTYPE);
+ m_current_token.m_doctype.name.append_code_point(0xFFFD);
+ m_current_token.m_doctype.missing_name = false;
+ SWITCH_TO(DOCTYPEName);
+ }
+ ON('>')
+ {
+ PARSE_ERROR();
+ create_new_token(HTMLToken::Type::DOCTYPE);
+ m_current_token.m_doctype.force_quirks = true;
+ SWITCH_TO_AND_EMIT_CURRENT_TOKEN(Data);
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ create_new_token(HTMLToken::Type::DOCTYPE);
+ m_current_token.m_doctype.force_quirks = true;
+ m_queued_tokens.enqueue(m_current_token);
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ create_new_token(HTMLToken::Type::DOCTYPE);
+ m_current_token.m_doctype.name.append_code_point(current_input_character.value());
+ m_current_token.m_doctype.missing_name = false;
+ SWITCH_TO(DOCTYPEName);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(DOCTYPEName)
+ {
+ ON_WHITESPACE
+ {
+ SWITCH_TO(AfterDOCTYPEName);
+ }
+ ON('>')
+ {
+ SWITCH_TO_AND_EMIT_CURRENT_TOKEN(Data);
+ }
+ ON_ASCII_UPPER_ALPHA
+ {
+ m_current_token.m_doctype.name.append(tolower(current_input_character.value()));
+ continue;
+ }
+ ON(0)
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.name.append_code_point(0xFFFD);
+ continue;
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.force_quirks = true;
+ m_queued_tokens.enqueue(m_current_token);
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ m_current_token.m_doctype.name.append_code_point(current_input_character.value());
+ continue;
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(AfterDOCTYPEName)
+ {
+ ON_WHITESPACE
+ {
+ continue;
+ }
+ ON('>')
+ {
+ SWITCH_TO_AND_EMIT_CURRENT_TOKEN(Data);
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.force_quirks = true;
+ m_queued_tokens.enqueue(m_current_token);
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ if (toupper(current_input_character.value()) == 'P' && consume_next_if_match("UBLIC", CaseSensitivity::CaseInsensitive)) {
+ SWITCH_TO(AfterDOCTYPEPublicKeyword);
+ }
+ if (toupper(current_input_character.value()) == 'S' && consume_next_if_match("YSTEM", CaseSensitivity::CaseInsensitive)) {
+ SWITCH_TO(AfterDOCTYPESystemKeyword);
+ }
+ PARSE_ERROR();
+ m_current_token.m_doctype.force_quirks = true;
+ RECONSUME_IN(BogusDOCTYPE);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(AfterDOCTYPEPublicKeyword)
+ {
+ ON_WHITESPACE
+ {
+ SWITCH_TO(BeforeDOCTYPEPublicIdentifier);
+ }
+ ON('"')
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.public_identifier.clear();
+ m_current_token.m_doctype.missing_public_identifier = false;
+ SWITCH_TO(DOCTYPEPublicIdentifierDoubleQuoted);
+ }
+ ON('\'')
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.public_identifier.clear();
+ m_current_token.m_doctype.missing_public_identifier = false;
+ SWITCH_TO(DOCTYPEPublicIdentifierSingleQuoted);
+ }
+ ON('>')
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.force_quirks = true;
+ SWITCH_TO_AND_EMIT_CURRENT_TOKEN(Data);
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.force_quirks = true;
+ m_queued_tokens.enqueue(m_current_token);
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.force_quirks = true;
+ RECONSUME_IN(BogusDOCTYPE);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(AfterDOCTYPESystemKeyword)
+ {
+ ON_WHITESPACE
+ {
+ SWITCH_TO(BeforeDOCTYPESystemIdentifier);
+ }
+ ON('"')
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.system_identifier.clear();
+ m_current_token.m_doctype.missing_system_identifier = false;
+ SWITCH_TO(DOCTYPESystemIdentifierDoubleQuoted);
+ }
+ ON('\'')
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.system_identifier.clear();
+ m_current_token.m_doctype.missing_system_identifier = false;
+ SWITCH_TO(DOCTYPESystemIdentifierSingleQuoted);
+ }
+ ON('>')
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.force_quirks = true;
+ SWITCH_TO_AND_EMIT_CURRENT_TOKEN(Data);
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.force_quirks = true;
+ m_queued_tokens.enqueue(m_current_token);
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.force_quirks = true;
+ RECONSUME_IN(BogusDOCTYPE);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(BeforeDOCTYPEPublicIdentifier)
+ {
+ ON_WHITESPACE
+ {
+ continue;
+ }
+ ON('"')
+ {
+ m_current_token.m_doctype.public_identifier.clear();
+ m_current_token.m_doctype.missing_public_identifier = false;
+ SWITCH_TO(DOCTYPEPublicIdentifierDoubleQuoted);
+ }
+ ON('\'')
+ {
+ m_current_token.m_doctype.public_identifier.clear();
+ m_current_token.m_doctype.missing_public_identifier = false;
+ SWITCH_TO(DOCTYPEPublicIdentifierSingleQuoted);
+ }
+ ON('>')
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.force_quirks = true;
+ SWITCH_TO_AND_EMIT_CURRENT_TOKEN(Data);
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.force_quirks = true;
+ m_queued_tokens.enqueue(m_current_token);
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.force_quirks = true;
+ RECONSUME_IN(BogusDOCTYPE);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(BeforeDOCTYPESystemIdentifier)
+ {
+ ON_WHITESPACE
+ {
+ continue;
+ }
+ ON('"')
+ {
+ m_current_token.m_doctype.system_identifier.clear();
+ m_current_token.m_doctype.missing_system_identifier = false;
+ SWITCH_TO(DOCTYPESystemIdentifierDoubleQuoted);
+ }
+ ON('\'')
+ {
+ m_current_token.m_doctype.system_identifier.clear();
+ m_current_token.m_doctype.missing_system_identifier = false;
+ SWITCH_TO(DOCTYPESystemIdentifierSingleQuoted);
+ }
+ ON('>')
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.force_quirks = true;
+ SWITCH_TO_AND_EMIT_CURRENT_TOKEN(Data);
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.force_quirks = true;
+ m_queued_tokens.enqueue(m_current_token);
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.force_quirks = true;
+ RECONSUME_IN(BogusDOCTYPE);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(DOCTYPEPublicIdentifierDoubleQuoted)
+ {
+ ON('"')
+ {
+ SWITCH_TO(AfterDOCTYPEPublicIdentifier);
+ }
+ ON(0)
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.public_identifier.append_code_point(0xFFFD);
+ continue;
+ }
+ ON('>')
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.force_quirks = true;
+ SWITCH_TO_AND_EMIT_CURRENT_TOKEN(Data);
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.force_quirks = true;
+ m_queued_tokens.enqueue(m_current_token);
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ m_current_token.m_doctype.public_identifier.append_code_point(current_input_character.value());
+ continue;
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(DOCTYPEPublicIdentifierSingleQuoted)
+ {
+ ON('\'')
+ {
+ SWITCH_TO(AfterDOCTYPEPublicIdentifier);
+ }
+ ON(0)
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.public_identifier.append_code_point(0xFFFD);
+ continue;
+ }
+ ON('>')
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.force_quirks = true;
+ SWITCH_TO_AND_EMIT_CURRENT_TOKEN(Data);
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.force_quirks = true;
+ m_queued_tokens.enqueue(m_current_token);
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ m_current_token.m_doctype.public_identifier.append_code_point(current_input_character.value());
+ continue;
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(DOCTYPESystemIdentifierDoubleQuoted)
+ {
+ ON('"')
+ {
+ SWITCH_TO(AfterDOCTYPESystemIdentifier);
+ }
+ ON(0)
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.system_identifier.append_code_point(0xFFFD);
+ continue;
+ }
+ ON('>')
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.force_quirks = true;
+ SWITCH_TO_AND_EMIT_CURRENT_TOKEN(Data);
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.force_quirks = true;
+ m_queued_tokens.enqueue(m_current_token);
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ m_current_token.m_doctype.system_identifier.append_code_point(current_input_character.value());
+ continue;
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(DOCTYPESystemIdentifierSingleQuoted)
+ {
+ ON('\'')
+ {
+ SWITCH_TO(AfterDOCTYPESystemIdentifier);
+ }
+ ON(0)
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.system_identifier.append_code_point(0xFFFD);
+ continue;
+ }
+ ON('>')
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.force_quirks = true;
+ SWITCH_TO_AND_EMIT_CURRENT_TOKEN(Data);
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.force_quirks = true;
+ m_queued_tokens.enqueue(m_current_token);
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ m_current_token.m_doctype.system_identifier.append_code_point(current_input_character.value());
+ continue;
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(AfterDOCTYPEPublicIdentifier)
+ {
+ ON_WHITESPACE
+ {
+ SWITCH_TO(BetweenDOCTYPEPublicAndSystemIdentifiers);
+ }
+ ON('>')
+ {
+ SWITCH_TO_AND_EMIT_CURRENT_TOKEN(Data);
+ }
+ ON('"')
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.system_identifier.clear();
+ m_current_token.m_doctype.missing_system_identifier = false;
+ SWITCH_TO(DOCTYPESystemIdentifierDoubleQuoted);
+ }
+ ON('\'')
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.system_identifier.clear();
+ m_current_token.m_doctype.missing_system_identifier = false;
+ SWITCH_TO(DOCTYPESystemIdentifierSingleQuoted);
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.force_quirks = true;
+ m_queued_tokens.enqueue(m_current_token);
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.force_quirks = true;
+ RECONSUME_IN(BogusDOCTYPE);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(BetweenDOCTYPEPublicAndSystemIdentifiers)
+ {
+ ON_WHITESPACE
+ {
+ continue;
+ }
+ ON('>')
+ {
+ SWITCH_TO_AND_EMIT_CURRENT_TOKEN(Data);
+ }
+ ON('"')
+ {
+ m_current_token.m_doctype.system_identifier.clear();
+ m_current_token.m_doctype.missing_system_identifier = false;
+ SWITCH_TO(DOCTYPESystemIdentifierDoubleQuoted);
+ }
+ ON('\'')
+ {
+ m_current_token.m_doctype.system_identifier.clear();
+ m_current_token.m_doctype.missing_system_identifier = false;
+ SWITCH_TO(DOCTYPESystemIdentifierSingleQuoted);
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.force_quirks = true;
+ m_queued_tokens.enqueue(m_current_token);
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.force_quirks = true;
+ RECONSUME_IN(BogusDOCTYPE);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(AfterDOCTYPESystemIdentifier)
+ {
+ ON_WHITESPACE
+ {
+ continue;
+ }
+ ON('>')
+ {
+ SWITCH_TO_AND_EMIT_CURRENT_TOKEN(Data);
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ m_current_token.m_doctype.force_quirks = true;
+ m_queued_tokens.enqueue(m_current_token);
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ PARSE_ERROR();
+ RECONSUME_IN(BogusDOCTYPE);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(BogusDOCTYPE)
+ {
+ ON('>')
+ {
+ SWITCH_TO_AND_EMIT_CURRENT_TOKEN(Data);
+ }
+ ON(0)
+ {
+ PARSE_ERROR();
+ continue;
+ }
+ ON_EOF
+ {
+ m_queued_tokens.enqueue(m_current_token);
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ continue;
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(BeforeAttributeName)
+ {
+ ON_WHITESPACE
+ {
+ continue;
+ }
+ ON('/')
+ {
+ RECONSUME_IN(AfterAttributeName);
+ }
+ ON('>')
+ {
+ RECONSUME_IN(AfterAttributeName);
+ }
+ ON_EOF
+ {
+ RECONSUME_IN(AfterAttributeName);
+ }
+ ON('=')
+ {
+ PARSE_ERROR();
+ auto new_attribute = HTMLToken::AttributeBuilder();
+ new_attribute.local_name_builder.append_code_point(current_input_character.value());
+ m_current_token.m_tag.attributes.append(new_attribute);
+ SWITCH_TO(AttributeName);
+ }
+ ANYTHING_ELSE
+ {
+ m_current_token.m_tag.attributes.append(HTMLToken::AttributeBuilder());
+ RECONSUME_IN(AttributeName);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(SelfClosingStartTag)
+ {
+ ON('>')
+ {
+ m_current_token.m_tag.self_closing = true;
+ SWITCH_TO_AND_EMIT_CURRENT_TOKEN(Data);
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ PARSE_ERROR();
+ RECONSUME_IN(BeforeAttributeName);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(AttributeName)
+ {
+ ON_WHITESPACE
+ {
+ RECONSUME_IN(AfterAttributeName);
+ }
+ ON('/')
+ {
+ RECONSUME_IN(AfterAttributeName);
+ }
+ ON('>')
+ {
+ RECONSUME_IN(AfterAttributeName);
+ }
+ ON_EOF
+ {
+ RECONSUME_IN(AfterAttributeName);
+ }
+ ON('=')
+ {
+ SWITCH_TO(BeforeAttributeValue);
+ }
+ ON_ASCII_UPPER_ALPHA
+ {
+ m_current_token.m_tag.attributes.last().local_name_builder.append_code_point(tolower(current_input_character.value()));
+ continue;
+ }
+ ON(0)
+ {
+ PARSE_ERROR();
+ m_current_token.m_tag.attributes.last().local_name_builder.append_code_point(0xFFFD);
+ continue;
+ }
+ ON('"')
+ {
+ PARSE_ERROR();
+ goto AnythingElseAttributeName;
+ }
+ ON('\'')
+ {
+ PARSE_ERROR();
+ goto AnythingElseAttributeName;
+ }
+ ON('<')
+ {
+ PARSE_ERROR();
+ goto AnythingElseAttributeName;
+ }
+ ANYTHING_ELSE
+ {
+ AnythingElseAttributeName:
+ m_current_token.m_tag.attributes.last().local_name_builder.append_code_point(current_input_character.value());
+ continue;
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(AfterAttributeName)
+ {
+ ON_WHITESPACE
+ {
+ continue;
+ }
+ ON('/')
+ {
+ SWITCH_TO(SelfClosingStartTag);
+ }
+ ON('=')
+ {
+ SWITCH_TO(BeforeAttributeValue);
+ }
+ ON('>')
+ {
+ SWITCH_TO_AND_EMIT_CURRENT_TOKEN(Data);
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ m_current_token.m_tag.attributes.append(HTMLToken::AttributeBuilder());
+ RECONSUME_IN(AttributeName);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(BeforeAttributeValue)
+ {
+ ON_WHITESPACE
+ {
+ continue;
+ }
+ ON('"')
+ {
+ SWITCH_TO(AttributeValueDoubleQuoted);
+ }
+ ON('\'')
+ {
+ SWITCH_TO(AttributeValueSingleQuoted);
+ }
+ ON('>')
+ {
+ PARSE_ERROR();
+ SWITCH_TO_AND_EMIT_CURRENT_TOKEN(Data);
+ }
+ ANYTHING_ELSE
+ {
+ RECONSUME_IN(AttributeValueUnquoted);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(AttributeValueDoubleQuoted)
+ {
+ ON('"')
+ {
+ SWITCH_TO(AfterAttributeValueQuoted);
+ }
+ ON('&')
+ {
+ m_return_state = State::AttributeValueDoubleQuoted;
+ SWITCH_TO(CharacterReference);
+ }
+ ON(0)
+ {
+ PARSE_ERROR();
+ m_current_token.m_tag.attributes.last().value_builder.append_code_point(0xFFFD);
+ continue;
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ m_current_token.m_tag.attributes.last().value_builder.append_code_point(current_input_character.value());
+ continue;
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(AttributeValueSingleQuoted)
+ {
+ ON('\'')
+ {
+ SWITCH_TO(AfterAttributeValueQuoted);
+ }
+ ON('&')
+ {
+ m_return_state = State::AttributeValueSingleQuoted;
+ SWITCH_TO(CharacterReference);
+ }
+ ON(0)
+ {
+ PARSE_ERROR();
+ m_current_token.m_tag.attributes.last().value_builder.append_code_point(0xFFFD);
+ continue;
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ m_current_token.m_tag.attributes.last().value_builder.append_code_point(current_input_character.value());
+ continue;
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(AttributeValueUnquoted)
+ {
+ ON_WHITESPACE
+ {
+ SWITCH_TO(BeforeAttributeName);
+ }
+ ON('&')
+ {
+ m_return_state = State::AttributeValueUnquoted;
+ SWITCH_TO(CharacterReference);
+ }
+ ON('>')
+ {
+ SWITCH_TO_AND_EMIT_CURRENT_TOKEN(Data);
+ }
+ ON(0)
+ {
+ PARSE_ERROR();
+ m_current_token.m_tag.attributes.last().value_builder.append_code_point(0xFFFD);
+ continue;
+ }
+ ON('"')
+ {
+ PARSE_ERROR();
+ goto AnythingElseAttributeValueUnquoted;
+ }
+ ON('\'')
+ {
+ PARSE_ERROR();
+ goto AnythingElseAttributeValueUnquoted;
+ }
+ ON('<')
+ {
+ PARSE_ERROR();
+ goto AnythingElseAttributeValueUnquoted;
+ }
+ ON('=')
+ {
+ PARSE_ERROR();
+ goto AnythingElseAttributeValueUnquoted;
+ }
+ ON('`')
+ {
+ PARSE_ERROR();
+ goto AnythingElseAttributeValueUnquoted;
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ AnythingElseAttributeValueUnquoted:
+ m_current_token.m_tag.attributes.last().value_builder.append_code_point(current_input_character.value());
+ continue;
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(AfterAttributeValueQuoted)
+ {
+ ON_WHITESPACE
+ {
+ SWITCH_TO(BeforeAttributeName);
+ }
+ ON('/')
+ {
+ SWITCH_TO(SelfClosingStartTag);
+ }
+ ON('>')
+ {
+ SWITCH_TO_AND_EMIT_CURRENT_TOKEN(Data);
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ PARSE_ERROR();
+ RECONSUME_IN(BeforeAttributeName);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(CommentStart)
+ {
+ ON('-')
+ {
+ SWITCH_TO(CommentStartDash);
+ }
+ ON('>')
+ {
+ PARSE_ERROR();
+ SWITCH_TO_AND_EMIT_CURRENT_TOKEN(Data);
+ }
+ ANYTHING_ELSE
+ {
+ RECONSUME_IN(Comment);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(CommentStartDash)
+ {
+ ON('-')
+ {
+ SWITCH_TO(CommentEnd);
+ }
+ ON('>')
+ {
+ PARSE_ERROR();
+ SWITCH_TO_AND_EMIT_CURRENT_TOKEN(Data);
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ m_queued_tokens.enqueue(m_current_token);
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ m_current_token.m_comment_or_character.data.append('-');
+ RECONSUME_IN(Comment);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(Comment)
+ {
+ ON('<')
+ {
+ m_current_token.m_comment_or_character.data.append_code_point(current_input_character.value());
+ SWITCH_TO(CommentLessThanSign);
+ }
+ ON('-')
+ {
+ SWITCH_TO(CommentEndDash);
+ }
+ ON(0)
+ {
+ PARSE_ERROR();
+ m_current_token.m_comment_or_character.data.append_code_point(0xFFFD);
+ continue;
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ m_queued_tokens.enqueue(m_current_token);
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ m_current_token.m_comment_or_character.data.append_code_point(current_input_character.value());
+ continue;
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(CommentEnd)
+ {
+ ON('>')
+ {
+ SWITCH_TO_AND_EMIT_CURRENT_TOKEN(Data);
+ }
+ ON('!')
+ {
+ SWITCH_TO(CommentEndBang);
+ }
+ ON('-')
+ {
+ m_current_token.m_comment_or_character.data.append('-');
+ continue;
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ m_queued_tokens.enqueue(m_current_token);
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ m_current_token.m_comment_or_character.data.append('-');
+ RECONSUME_IN(Comment);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(CommentEndBang)
+ {
+ ON('-')
+ {
+ m_current_token.m_comment_or_character.data.append("--!");
+ SWITCH_TO(CommentEndDash);
+ }
+ ON('>')
+ {
+ PARSE_ERROR();
+ SWITCH_TO_AND_EMIT_CURRENT_TOKEN(Data);
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ m_queued_tokens.enqueue(m_current_token);
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ m_current_token.m_comment_or_character.data.append("--!");
+ RECONSUME_IN(Comment);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(CommentEndDash)
+ {
+ ON('-')
+ {
+ SWITCH_TO(CommentEnd);
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ m_queued_tokens.enqueue(m_current_token);
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ m_current_token.m_comment_or_character.data.append('-');
+ RECONSUME_IN(Comment);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(CommentLessThanSign)
+ {
+ ON('!')
+ {
+ m_current_token.m_comment_or_character.data.append_code_point(current_input_character.value());
+ SWITCH_TO(CommentLessThanSignBang);
+ }
+ ON('<')
+ {
+ m_current_token.m_comment_or_character.data.append_code_point(current_input_character.value());
+ continue;
+ }
+ ANYTHING_ELSE
+ {
+ RECONSUME_IN(Comment);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(CommentLessThanSignBang)
+ {
+ ON('-')
+ {
+ SWITCH_TO(CommentLessThanSignBangDash);
+ }
+ ANYTHING_ELSE
+ {
+ RECONSUME_IN(Comment);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(CommentLessThanSignBangDash)
+ {
+ ON('-')
+ {
+ SWITCH_TO(CommentLessThanSignBangDashDash);
+ }
+ ANYTHING_ELSE
+ {
+ RECONSUME_IN(CommentEndDash);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(CommentLessThanSignBangDashDash)
+ {
+ ON('>')
+ {
+ RECONSUME_IN(CommentEnd);
+ }
+ ON_EOF
+ {
+ RECONSUME_IN(CommentEnd);
+ }
+ ANYTHING_ELSE
+ {
+ PARSE_ERROR();
+ RECONSUME_IN(CommentEnd);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(CharacterReference)
+ {
+ m_temporary_buffer.clear();
+ m_temporary_buffer.append('&');
+
+ ON_ASCII_ALPHANUMERIC
+ {
+ RECONSUME_IN(NamedCharacterReference);
+ }
+ ON('#')
+ {
+ m_temporary_buffer.append(current_input_character.value());
+ SWITCH_TO(NumericCharacterReference);
+ }
+ ANYTHING_ELSE
+ {
+ FLUSH_CODEPOINTS_CONSUMED_AS_A_CHARACTER_REFERENCE;
+ RECONSUME_IN_RETURN_STATE;
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(NamedCharacterReference)
+ {
+ size_t byte_offset = m_utf8_view.byte_offset_of(m_prev_utf8_iterator);
+
+ auto match = HTML::code_points_from_entity(m_decoded_input.substring_view(byte_offset, m_decoded_input.length() - byte_offset - 1));
+
+ if (match.has_value()) {
+ for (size_t i = 0; i < match.value().entity.length() - 1; ++i) {
+ m_prev_utf8_iterator = m_utf8_iterator;
+ ++m_utf8_iterator;
+ }
+ for (auto ch : match.value().entity)
+ m_temporary_buffer.append(ch);
+
+ if (consumed_as_part_of_an_attribute() && !match.value().entity.ends_with(';')) {
+ auto next_code_point = peek_code_point(0);
+ if (next_code_point.has_value() && (next_code_point.value() == '=' || isalnum(next_code_point.value()))) {
+ FLUSH_CODEPOINTS_CONSUMED_AS_A_CHARACTER_REFERENCE;
+ SWITCH_TO_RETURN_STATE;
+ }
+ }
+
+ if (!match.value().entity.ends_with(';')) {
+ PARSE_ERROR();
+ }
+
+ m_temporary_buffer.clear();
+ m_temporary_buffer.append(match.value().code_points);
+
+ FLUSH_CODEPOINTS_CONSUMED_AS_A_CHARACTER_REFERENCE;
+ SWITCH_TO_RETURN_STATE;
+ } else {
+ FLUSH_CODEPOINTS_CONSUMED_AS_A_CHARACTER_REFERENCE;
+ // FIXME: This should be SWITCH_TO, but we always lose the first character on this path, so just reconsume it.
+ // I can't wrap my head around how to do it as the spec says.
+ RECONSUME_IN(AmbiguousAmpersand);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(AmbiguousAmpersand)
+ {
+ ON_ASCII_ALPHANUMERIC
+ {
+ if (consumed_as_part_of_an_attribute()) {
+ m_current_token.m_tag.attributes.last().value_builder.append_code_point(current_input_character.value());
+ continue;
+ } else {
+ EMIT_CURRENT_CHARACTER;
+ }
+ }
+ ON(';')
+ {
+ PARSE_ERROR();
+ RECONSUME_IN_RETURN_STATE;
+ }
+ ANYTHING_ELSE
+ {
+ RECONSUME_IN_RETURN_STATE;
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(NumericCharacterReference)
+ {
+ m_character_reference_code = 0;
+
+ ON('X')
+ {
+ m_temporary_buffer.append(current_input_character.value());
+ SWITCH_TO(HexadecimalCharacterReferenceStart);
+ }
+ ON('x')
+ {
+ m_temporary_buffer.append(current_input_character.value());
+ SWITCH_TO(HexadecimalCharacterReferenceStart);
+ }
+ ANYTHING_ELSE
+ {
+ RECONSUME_IN(DecimalCharacterReferenceStart);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(HexadecimalCharacterReferenceStart)
+ {
+ ON_ASCII_HEX_DIGIT
+ {
+ RECONSUME_IN(HexadecimalCharacterReference);
+ }
+ ANYTHING_ELSE
+ {
+ PARSE_ERROR();
+ FLUSH_CODEPOINTS_CONSUMED_AS_A_CHARACTER_REFERENCE;
+ RECONSUME_IN_RETURN_STATE;
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(DecimalCharacterReferenceStart)
+ {
+ ON_ASCII_DIGIT
+ {
+ RECONSUME_IN(DecimalCharacterReference);
+ }
+ ANYTHING_ELSE
+ {
+ PARSE_ERROR();
+ FLUSH_CODEPOINTS_CONSUMED_AS_A_CHARACTER_REFERENCE;
+ RECONSUME_IN_RETURN_STATE;
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(HexadecimalCharacterReference)
+ {
+ ON_ASCII_DIGIT
+ {
+ m_character_reference_code *= 16;
+ m_character_reference_code += current_input_character.value() - 0x30;
+ continue;
+ }
+ ON_ASCII_UPPER_ALPHA
+ {
+ m_character_reference_code *= 16;
+ m_character_reference_code += current_input_character.value() - 0x37;
+ continue;
+ }
+ ON_ASCII_LOWER_ALPHA
+ {
+ m_character_reference_code *= 16;
+ m_character_reference_code += current_input_character.value() - 0x57;
+ continue;
+ }
+ ON(';')
+ {
+ SWITCH_TO(NumericCharacterReferenceEnd);
+ }
+ ANYTHING_ELSE
+ {
+ PARSE_ERROR();
+ RECONSUME_IN(NumericCharacterReferenceEnd);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(DecimalCharacterReference)
+ {
+ ON_ASCII_DIGIT
+ {
+ m_character_reference_code *= 10;
+ m_character_reference_code += current_input_character.value() - 0x30;
+ continue;
+ }
+ ON(';')
+ {
+ SWITCH_TO(NumericCharacterReferenceEnd);
+ }
+ ANYTHING_ELSE
+ {
+ PARSE_ERROR();
+ RECONSUME_IN(NumericCharacterReferenceEnd);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(NumericCharacterReferenceEnd)
+ {
+ DONT_CONSUME_NEXT_INPUT_CHARACTER;
+
+ if (m_character_reference_code == 0) {
+ PARSE_ERROR();
+ m_character_reference_code = 0xFFFD;
+ }
+ if (m_character_reference_code > 0x10ffff) {
+ PARSE_ERROR();
+ m_character_reference_code = 0xFFFD;
+ }
+ if (is_surrogate(m_character_reference_code)) {
+ PARSE_ERROR();
+ m_character_reference_code = 0xFFFD;
+ }
+ if (is_noncharacter(m_character_reference_code)) {
+ PARSE_ERROR();
+ }
+ if (m_character_reference_code == 0xd || (is_control(m_character_reference_code) && !isspace(m_character_reference_code))) {
+ PARSE_ERROR();
+ constexpr struct {
+ u32 number;
+ u32 code_point;
+ } conversion_table[] = {
+ { 0x80, 0x20AC },
+ { 0x82, 0x201A },
+ { 0x83, 0x0192 },
+ { 0x84, 0x201E },
+ { 0x85, 0x2026 },
+ { 0x86, 0x2020 },
+ { 0x87, 0x2021 },
+ { 0x88, 0x02C6 },
+ { 0x89, 0x2030 },
+ { 0x8A, 0x0160 },
+ { 0x8B, 0x2039 },
+ { 0x8C, 0x0152 },
+ { 0x8E, 0x017D },
+ { 0x91, 0x2018 },
+ { 0x92, 0x2019 },
+ { 0x93, 0x201C },
+ { 0x94, 0x201D },
+ { 0x95, 0x2022 },
+ { 0x96, 0x2013 },
+ { 0x97, 0x2014 },
+ { 0x98, 0x02DC },
+ { 0x99, 0x2122 },
+ { 0x9A, 0x0161 },
+ { 0x9B, 0x203A },
+ { 0x9C, 0x0153 },
+ { 0x9E, 0x017E },
+ { 0x9F, 0x0178 },
+ };
+ for (auto& entry : conversion_table) {
+ if (m_character_reference_code == entry.number) {
+ m_character_reference_code = entry.code_point;
+ break;
+ }
+ }
+ }
+
+ m_temporary_buffer.clear();
+ m_temporary_buffer.append(m_character_reference_code);
+ FLUSH_CODEPOINTS_CONSUMED_AS_A_CHARACTER_REFERENCE;
+ SWITCH_TO_RETURN_STATE;
+ }
+ END_STATE
+
+ BEGIN_STATE(RCDATA)
+ {
+ ON('&')
+ {
+ m_return_state = State::RCDATA;
+ SWITCH_TO(CharacterReference);
+ }
+ ON('<')
+ {
+ SWITCH_TO(RCDATALessThanSign);
+ }
+ ON(0)
+ {
+ PARSE_ERROR();
+ EMIT_CHARACTER(0xFFFD);
+ }
+ ON_EOF
+ {
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ EMIT_CURRENT_CHARACTER;
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(RCDATALessThanSign)
+ {
+ ON('/')
+ {
+ m_temporary_buffer.clear();
+ SWITCH_TO(RCDATAEndTagOpen);
+ }
+ ANYTHING_ELSE
+ {
+ EMIT_CHARACTER_AND_RECONSUME_IN('<', RCDATA);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(RCDATAEndTagOpen)
+ {
+ ON_ASCII_ALPHA
+ {
+ create_new_token(HTMLToken::Type::EndTag);
+ RECONSUME_IN(RCDATAEndTagName);
+ }
+ ANYTHING_ELSE
+ {
+ m_queued_tokens.enqueue(HTMLToken::make_character('<'));
+ m_queued_tokens.enqueue(HTMLToken::make_character('/'));
+ RECONSUME_IN(RCDATA);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(RCDATAEndTagName)
+ {
+ ON_WHITESPACE
+ {
+ if (!current_end_tag_token_is_appropriate()) {
+ m_queued_tokens.enqueue(HTMLToken::make_character('<'));
+ m_queued_tokens.enqueue(HTMLToken::make_character('/'));
+ for (auto code_point : m_temporary_buffer)
+ m_queued_tokens.enqueue(HTMLToken::make_character(code_point));
+ RECONSUME_IN(RCDATA);
+ }
+ SWITCH_TO(BeforeAttributeName);
+ }
+ ON('/')
+ {
+ if (!current_end_tag_token_is_appropriate()) {
+ m_queued_tokens.enqueue(HTMLToken::make_character('<'));
+ m_queued_tokens.enqueue(HTMLToken::make_character('/'));
+ for (auto code_point : m_temporary_buffer)
+ m_queued_tokens.enqueue(HTMLToken::make_character(code_point));
+ RECONSUME_IN(RCDATA);
+ }
+ SWITCH_TO(SelfClosingStartTag);
+ }
+ ON('>')
+ {
+ if (!current_end_tag_token_is_appropriate()) {
+ m_queued_tokens.enqueue(HTMLToken::make_character('<'));
+ m_queued_tokens.enqueue(HTMLToken::make_character('/'));
+ for (auto code_point : m_temporary_buffer)
+ m_queued_tokens.enqueue(HTMLToken::make_character(code_point));
+ RECONSUME_IN(RCDATA);
+ }
+ SWITCH_TO_AND_EMIT_CURRENT_TOKEN(Data);
+ }
+ ON_ASCII_UPPER_ALPHA
+ {
+ m_current_token.m_tag.tag_name.append(tolower(current_input_character.value()));
+ m_temporary_buffer.append(current_input_character.value());
+ continue;
+ }
+ ON_ASCII_LOWER_ALPHA
+ {
+ m_current_token.m_tag.tag_name.append_code_point(current_input_character.value());
+ m_temporary_buffer.append(current_input_character.value());
+ continue;
+ }
+ ANYTHING_ELSE
+ {
+ m_queued_tokens.enqueue(HTMLToken::make_character('<'));
+ m_queued_tokens.enqueue(HTMLToken::make_character('/'));
+ for (auto code_point : m_temporary_buffer)
+ m_queued_tokens.enqueue(HTMLToken::make_character(code_point));
+ RECONSUME_IN(RCDATA);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(RAWTEXT)
+ {
+ ON('<')
+ {
+ SWITCH_TO(RAWTEXTLessThanSign);
+ }
+ ON(0)
+ {
+ PARSE_ERROR();
+ EMIT_CHARACTER(0xFFFD);
+ }
+ ON_EOF
+ {
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ EMIT_CURRENT_CHARACTER;
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(RAWTEXTLessThanSign)
+ {
+ ON('/')
+ {
+ m_temporary_buffer.clear();
+ SWITCH_TO(RAWTEXTEndTagOpen);
+ }
+ ANYTHING_ELSE
+ {
+ EMIT_CHARACTER_AND_RECONSUME_IN('<', RAWTEXT);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(RAWTEXTEndTagOpen)
+ {
+ ON_ASCII_ALPHA
+ {
+ create_new_token(HTMLToken::Type::EndTag);
+ RECONSUME_IN(RAWTEXTEndTagName);
+ }
+ ANYTHING_ELSE
+ {
+ m_queued_tokens.enqueue(HTMLToken::make_character('<'));
+ m_queued_tokens.enqueue(HTMLToken::make_character('/'));
+ RECONSUME_IN(RAWTEXT);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(RAWTEXTEndTagName)
+ {
+ ON_WHITESPACE
+ {
+ if (!current_end_tag_token_is_appropriate()) {
+ m_queued_tokens.enqueue(HTMLToken::make_character('<'));
+ m_queued_tokens.enqueue(HTMLToken::make_character('/'));
+ for (auto code_point : m_temporary_buffer)
+ m_queued_tokens.enqueue(HTMLToken::make_character(code_point));
+ RECONSUME_IN(RAWTEXT);
+ }
+ SWITCH_TO(BeforeAttributeName);
+ }
+ ON('/')
+ {
+ if (!current_end_tag_token_is_appropriate()) {
+ m_queued_tokens.enqueue(HTMLToken::make_character('<'));
+ m_queued_tokens.enqueue(HTMLToken::make_character('/'));
+ for (auto code_point : m_temporary_buffer)
+ m_queued_tokens.enqueue(HTMLToken::make_character(code_point));
+ RECONSUME_IN(RAWTEXT);
+ }
+ SWITCH_TO(SelfClosingStartTag);
+ }
+ ON('>')
+ {
+ if (!current_end_tag_token_is_appropriate()) {
+ m_queued_tokens.enqueue(HTMLToken::make_character('<'));
+ m_queued_tokens.enqueue(HTMLToken::make_character('/'));
+ for (auto code_point : m_temporary_buffer)
+ m_queued_tokens.enqueue(HTMLToken::make_character(code_point));
+ RECONSUME_IN(RAWTEXT);
+ }
+ SWITCH_TO_AND_EMIT_CURRENT_TOKEN(Data);
+ }
+ ON_ASCII_UPPER_ALPHA
+ {
+ m_current_token.m_tag.tag_name.append(tolower(current_input_character.value()));
+ m_temporary_buffer.append(current_input_character.value());
+ continue;
+ }
+ ON_ASCII_LOWER_ALPHA
+ {
+ m_current_token.m_tag.tag_name.append(current_input_character.value());
+ m_temporary_buffer.append(current_input_character.value());
+ continue;
+ }
+ ANYTHING_ELSE
+ {
+ m_queued_tokens.enqueue(HTMLToken::make_character('<'));
+ m_queued_tokens.enqueue(HTMLToken::make_character('/'));
+ for (auto code_point : m_temporary_buffer)
+ m_queued_tokens.enqueue(HTMLToken::make_character(code_point));
+ RECONSUME_IN(RAWTEXT);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(ScriptData)
+ {
+ ON('<')
+ {
+ SWITCH_TO(ScriptDataLessThanSign);
+ }
+ ON(0)
+ {
+ PARSE_ERROR();
+ EMIT_CHARACTER(0xFFFD);
+ }
+ ON_EOF
+ {
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ EMIT_CURRENT_CHARACTER;
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(PLAINTEXT)
+ {
+ ON(0)
+ {
+ PARSE_ERROR();
+ EMIT_CHARACTER(0xFFFD);
+ }
+ ON_EOF
+ {
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ EMIT_CURRENT_CHARACTER;
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(ScriptDataLessThanSign)
+ {
+ ON('/')
+ {
+ m_temporary_buffer.clear();
+ SWITCH_TO(ScriptDataEndTagOpen);
+ }
+ ON('!')
+ {
+ m_queued_tokens.enqueue(HTMLToken::make_character('<'));
+ m_queued_tokens.enqueue(HTMLToken::make_character('!'));
+ SWITCH_TO(ScriptDataEscapeStart);
+ }
+ ANYTHING_ELSE
+ {
+ EMIT_CHARACTER_AND_RECONSUME_IN('<', ScriptData);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(ScriptDataEscapeStart)
+ {
+ ON('-')
+ {
+ SWITCH_TO_AND_EMIT_CHARACTER('-', ScriptDataEscapeStartDash);
+ }
+ ANYTHING_ELSE
+ {
+ RECONSUME_IN(ScriptData);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(ScriptDataEscapeStartDash)
+ {
+ ON('-')
+ {
+ SWITCH_TO_AND_EMIT_CHARACTER('-', ScriptDataEscapedDashDash);
+ }
+ ANYTHING_ELSE
+ {
+ RECONSUME_IN(ScriptData);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(ScriptDataEscapedDashDash)
+ {
+ ON('-')
+ {
+ EMIT_CHARACTER('-');
+ }
+ ON('<')
+ {
+ SWITCH_TO(ScriptDataEscapedLessThanSign);
+ }
+ ON('>')
+ {
+ SWITCH_TO_AND_EMIT_CHARACTER('>', ScriptData);
+ }
+ ON(0)
+ {
+ PARSE_ERROR();
+ SWITCH_TO_AND_EMIT_CHARACTER(0xFFFD, ScriptDataEscaped);
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ SWITCH_TO_AND_EMIT_CURRENT_CHARACTER(ScriptDataEscaped);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(ScriptDataEscapedLessThanSign)
+ {
+ ON('/')
+ {
+ m_temporary_buffer.clear();
+ SWITCH_TO(ScriptDataEscapedEndTagOpen);
+ }
+ ON_ASCII_ALPHA
+ {
+ m_temporary_buffer.clear();
+ EMIT_CHARACTER_AND_RECONSUME_IN('<', ScriptDataDoubleEscapeStart);
+ }
+ ANYTHING_ELSE
+ {
+ EMIT_CHARACTER_AND_RECONSUME_IN('<', ScriptDataEscaped);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(ScriptDataEscapedEndTagOpen)
+ {
+ ON_ASCII_ALPHA
+ {
+ create_new_token(HTMLToken::Type::EndTag);
+ RECONSUME_IN(ScriptDataEscapedEndTagName);
+ }
+ ANYTHING_ELSE
+ {
+ m_queued_tokens.enqueue(HTMLToken::make_character('<'));
+ m_queued_tokens.enqueue(HTMLToken::make_character('/'));
+ RECONSUME_IN(ScriptDataEscaped);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(ScriptDataEscapedEndTagName)
+ {
+ ON_WHITESPACE
+ {
+ if (current_end_tag_token_is_appropriate())
+ SWITCH_TO(BeforeAttributeName);
+
+ m_queued_tokens.enqueue(HTMLToken::make_character('<'));
+ m_queued_tokens.enqueue(HTMLToken::make_character('/'));
+ for (auto code_point : m_temporary_buffer) {
+ m_queued_tokens.enqueue(HTMLToken::make_character(code_point));
+ }
+ RECONSUME_IN(ScriptDataEscaped);
+ }
+ ON('/')
+ {
+ if (current_end_tag_token_is_appropriate())
+ SWITCH_TO(SelfClosingStartTag);
+
+ m_queued_tokens.enqueue(HTMLToken::make_character('<'));
+ m_queued_tokens.enqueue(HTMLToken::make_character('/'));
+ for (auto code_point : m_temporary_buffer) {
+ m_queued_tokens.enqueue(HTMLToken::make_character(code_point));
+ }
+ RECONSUME_IN(ScriptDataEscaped);
+ }
+ ON('>')
+ {
+ if (current_end_tag_token_is_appropriate())
+ SWITCH_TO_AND_EMIT_CURRENT_TOKEN(Data);
+
+ m_queued_tokens.enqueue(HTMLToken::make_character('<'));
+ m_queued_tokens.enqueue(HTMLToken::make_character('/'));
+ for (auto code_point : m_temporary_buffer) {
+ m_queued_tokens.enqueue(HTMLToken::make_character(code_point));
+ }
+ RECONSUME_IN(ScriptDataEscaped);
+ }
+ ON_ASCII_UPPER_ALPHA
+ {
+ m_current_token.m_tag.tag_name.append(tolower(current_input_character.value()));
+ m_temporary_buffer.append(current_input_character.value());
+ continue;
+ }
+ ON_ASCII_LOWER_ALPHA
+ {
+ m_current_token.m_tag.tag_name.append(current_input_character.value());
+ m_temporary_buffer.append(current_input_character.value());
+ continue;
+ }
+ ANYTHING_ELSE
+ {
+ m_queued_tokens.enqueue(HTMLToken::make_character('<'));
+ m_queued_tokens.enqueue(HTMLToken::make_character('/'));
+ for (auto code_point : m_temporary_buffer) {
+ m_queued_tokens.enqueue(HTMLToken::make_character(code_point));
+ }
+ RECONSUME_IN(ScriptDataEscaped);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(ScriptDataDoubleEscapeStart)
+ {
+ auto temporary_buffer_equal_to_script = [this]() -> bool {
+ if (m_temporary_buffer.size() != 6)
+ return false;
+
+ // FIXME: Is there a better way of doing this?
+ return m_temporary_buffer[0] == 's' && m_temporary_buffer[1] == 'c' && m_temporary_buffer[2] == 'r' && m_temporary_buffer[3] == 'i' && m_temporary_buffer[4] == 'p' && m_temporary_buffer[5] == 't';
+ };
+ ON_WHITESPACE
+ {
+ if (temporary_buffer_equal_to_script())
+ SWITCH_TO_AND_EMIT_CURRENT_CHARACTER(ScriptDataDoubleEscaped);
+ else
+ SWITCH_TO_AND_EMIT_CURRENT_CHARACTER(ScriptDataEscaped);
+ }
+ ON('/')
+ {
+ if (temporary_buffer_equal_to_script())
+ SWITCH_TO_AND_EMIT_CURRENT_CHARACTER(ScriptDataDoubleEscaped);
+ else
+ SWITCH_TO_AND_EMIT_CURRENT_CHARACTER(ScriptDataEscaped);
+ }
+ ON('>')
+ {
+ if (temporary_buffer_equal_to_script())
+ SWITCH_TO_AND_EMIT_CURRENT_CHARACTER(ScriptDataDoubleEscaped);
+ else
+ SWITCH_TO_AND_EMIT_CURRENT_CHARACTER(ScriptDataEscaped);
+ }
+ ON_ASCII_UPPER_ALPHA
+ {
+ m_temporary_buffer.append(tolower(current_input_character.value()));
+ EMIT_CURRENT_CHARACTER;
+ }
+ ON_ASCII_LOWER_ALPHA
+ {
+ m_temporary_buffer.append(current_input_character.value());
+ EMIT_CURRENT_CHARACTER;
+ }
+ ANYTHING_ELSE
+ {
+ RECONSUME_IN(ScriptDataEscaped);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(ScriptDataDoubleEscaped)
+ {
+ ON('-')
+ {
+ SWITCH_TO_AND_EMIT_CHARACTER('-', ScriptDataDoubleEscapedDash);
+ }
+ ON('<')
+ {
+ SWITCH_TO_AND_EMIT_CHARACTER('<', ScriptDataDoubleEscapedLessThanSign);
+ }
+ ON(0)
+ {
+ PARSE_ERROR();
+ EMIT_CHARACTER(0xFFFD);
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ EMIT_CURRENT_CHARACTER;
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(ScriptDataDoubleEscapedDash)
+ {
+ ON('-')
+ {
+ SWITCH_TO_AND_EMIT_CHARACTER('-', ScriptDataDoubleEscapedDashDash);
+ }
+ ON('<')
+ {
+ SWITCH_TO_AND_EMIT_CHARACTER('<', ScriptDataDoubleEscapedLessThanSign);
+ }
+ ON(0)
+ {
+ PARSE_ERROR();
+ SWITCH_TO_AND_EMIT_CHARACTER(0xFFFD, ScriptDataDoubleEscaped);
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ SWITCH_TO_AND_EMIT_CURRENT_CHARACTER(ScriptDataDoubleEscaped);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(ScriptDataDoubleEscapedDashDash)
+ {
+ ON('-')
+ {
+ EMIT_CHARACTER('-');
+ }
+ ON('<')
+ {
+ SWITCH_TO_AND_EMIT_CHARACTER('<', ScriptDataDoubleEscapedLessThanSign);
+ }
+ ON('>')
+ {
+ SWITCH_TO_AND_EMIT_CHARACTER('>', ScriptData);
+ }
+ ON(0)
+ {
+ PARSE_ERROR();
+ SWITCH_TO_AND_EMIT_CHARACTER(0xFFFD, ScriptDataDoubleEscaped);
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ SWITCH_TO_AND_EMIT_CURRENT_CHARACTER(ScriptDataDoubleEscaped);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(ScriptDataDoubleEscapedLessThanSign)
+ {
+ ON('/')
+ {
+ m_temporary_buffer.clear();
+ SWITCH_TO_AND_EMIT_CHARACTER('/', ScriptDataDoubleEscapeEnd);
+ }
+ ANYTHING_ELSE
+ {
+ RECONSUME_IN(ScriptDataDoubleEscaped);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(ScriptDataDoubleEscapeEnd)
+ {
+ auto temporary_buffer_equal_to_script = [this]() -> bool {
+ if (m_temporary_buffer.size() != 6)
+ return false;
+
+ // FIXME: Is there a better way of doing this?
+ return m_temporary_buffer[0] == 's' && m_temporary_buffer[1] == 'c' && m_temporary_buffer[2] == 'r' && m_temporary_buffer[3] == 'i' && m_temporary_buffer[4] == 'p' && m_temporary_buffer[5] == 't';
+ };
+ ON_WHITESPACE
+ {
+ if (temporary_buffer_equal_to_script())
+ SWITCH_TO_AND_EMIT_CURRENT_CHARACTER(ScriptDataEscaped);
+ else
+ SWITCH_TO_AND_EMIT_CURRENT_CHARACTER(ScriptDataDoubleEscaped);
+ }
+ ON('/')
+ {
+ if (temporary_buffer_equal_to_script())
+ SWITCH_TO_AND_EMIT_CURRENT_CHARACTER(ScriptDataEscaped);
+ else
+ SWITCH_TO_AND_EMIT_CURRENT_CHARACTER(ScriptDataDoubleEscaped);
+ }
+ ON('>')
+ {
+ if (temporary_buffer_equal_to_script())
+ SWITCH_TO_AND_EMIT_CURRENT_CHARACTER(ScriptDataEscaped);
+ else
+ SWITCH_TO_AND_EMIT_CURRENT_CHARACTER(ScriptDataDoubleEscaped);
+ }
+ ON_ASCII_UPPER_ALPHA
+ {
+ m_temporary_buffer.append(tolower(current_input_character.value()));
+ EMIT_CURRENT_CHARACTER;
+ }
+ ON_ASCII_LOWER_ALPHA
+ {
+ m_temporary_buffer.append(current_input_character.value());
+ EMIT_CURRENT_CHARACTER;
+ }
+ ANYTHING_ELSE
+ {
+ RECONSUME_IN(ScriptDataDoubleEscaped);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(ScriptDataEscapedDash)
+ {
+ ON('-')
+ {
+ SWITCH_TO_AND_EMIT_CHARACTER('-', ScriptDataEscapedDashDash);
+ }
+ ON('<')
+ {
+ SWITCH_TO(ScriptDataEscapedLessThanSign);
+ }
+ ON(0)
+ {
+ PARSE_ERROR();
+ SWITCH_TO_AND_EMIT_CHARACTER(0xFFFD, ScriptDataEscaped);
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ SWITCH_TO_AND_EMIT_CURRENT_CHARACTER(ScriptDataEscaped);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(ScriptDataEscaped)
+ {
+ ON('-')
+ {
+ SWITCH_TO_AND_EMIT_CHARACTER('-', ScriptDataEscapedDash);
+ }
+ ON('<')
+ {
+ SWITCH_TO(ScriptDataEscapedLessThanSign);
+ }
+ ON(0)
+ {
+ PARSE_ERROR();
+ EMIT_CHARACTER(0xFFFD);
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ EMIT_CURRENT_CHARACTER;
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(ScriptDataEndTagOpen)
+ {
+ ON_ASCII_ALPHA
+ {
+ create_new_token(HTMLToken::Type::EndTag);
+ RECONSUME_IN(ScriptDataEndTagName);
+ }
+ ANYTHING_ELSE
+ {
+ m_queued_tokens.enqueue(HTMLToken::make_character('<'));
+ m_queued_tokens.enqueue(HTMLToken::make_character('/'));
+ RECONSUME_IN(ScriptData);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(ScriptDataEndTagName)
+ {
+ ON_WHITESPACE
+ {
+ if (current_end_tag_token_is_appropriate())
+ SWITCH_TO(BeforeAttributeName);
+ m_queued_tokens.enqueue(HTMLToken::make_character('<'));
+ m_queued_tokens.enqueue(HTMLToken::make_character('/'));
+ for (auto code_point : m_temporary_buffer)
+ m_queued_tokens.enqueue(HTMLToken::make_character(code_point));
+ RECONSUME_IN(ScriptData);
+ }
+ ON('/')
+ {
+ if (current_end_tag_token_is_appropriate())
+ SWITCH_TO(SelfClosingStartTag);
+ m_queued_tokens.enqueue(HTMLToken::make_character('<'));
+ m_queued_tokens.enqueue(HTMLToken::make_character('/'));
+ for (auto code_point : m_temporary_buffer)
+ m_queued_tokens.enqueue(HTMLToken::make_character(code_point));
+ RECONSUME_IN(ScriptData);
+ }
+ ON('>')
+ {
+ if (current_end_tag_token_is_appropriate())
+ SWITCH_TO_AND_EMIT_CURRENT_TOKEN(Data);
+ m_queued_tokens.enqueue(HTMLToken::make_character('<'));
+ m_queued_tokens.enqueue(HTMLToken::make_character('/'));
+ for (auto code_point : m_temporary_buffer)
+ m_queued_tokens.enqueue(HTMLToken::make_character(code_point));
+ RECONSUME_IN(ScriptData);
+ }
+ ON_ASCII_UPPER_ALPHA
+ {
+ m_current_token.m_tag.tag_name.append(tolower(current_input_character.value()));
+ m_temporary_buffer.append(current_input_character.value());
+ continue;
+ }
+ ON_ASCII_LOWER_ALPHA
+ {
+ m_current_token.m_tag.tag_name.append(current_input_character.value());
+ m_temporary_buffer.append(current_input_character.value());
+ continue;
+ }
+ ANYTHING_ELSE
+ {
+ m_queued_tokens.enqueue(HTMLToken::make_character('<'));
+ m_queued_tokens.enqueue(HTMLToken::make_character('/'));
+ for (auto code_point : m_temporary_buffer)
+ m_queued_tokens.enqueue(HTMLToken::make_character(code_point));
+ RECONSUME_IN(ScriptData);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(CDATASection)
+ {
+ ON(']')
+ {
+ SWITCH_TO(CDATASectionBracket);
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ EMIT_CURRENT_CHARACTER;
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(CDATASectionBracket)
+ {
+ ON(']')
+ {
+ SWITCH_TO(CDATASectionEnd);
+ }
+ ANYTHING_ELSE
+ {
+ EMIT_CHARACTER_AND_RECONSUME_IN(']', CDATASection);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(CDATASectionEnd)
+ {
+ ON(']')
+ {
+ EMIT_CHARACTER(']');
+ }
+ ON('>')
+ {
+ SWITCH_TO(Data);
+ }
+ ANYTHING_ELSE
+ {
+ m_queued_tokens.enqueue(HTMLToken::make_character(']'));
+ m_queued_tokens.enqueue(HTMLToken::make_character(']'));
+ RECONSUME_IN(CDATASection);
+ }
+ }
+ END_STATE
+
+ default:
+ TODO();
+ }
+ }
+}
+
+bool HTMLTokenizer::consume_next_if_match(const StringView& string, CaseSensitivity case_sensitivity)
+{
+ for (size_t i = 0; i < string.length(); ++i) {
+ auto code_point = peek_code_point(i);
+ if (!code_point.has_value())
+ return false;
+ // FIXME: This should be more Unicode-aware.
+ if (case_sensitivity == CaseSensitivity::CaseInsensitive) {
+ if (code_point.value() < 0x80) {
+ if (tolower(code_point.value()) != tolower(string[i]))
+ return false;
+ continue;
+ }
+ }
+ if (code_point.value() != (u32)string[i])
+ return false;
+ }
+ for (size_t i = 0; i < string.length(); ++i) {
+ m_prev_utf8_iterator = m_utf8_iterator;
+ ++m_utf8_iterator;
+ }
+ return true;
+}
+
+void HTMLTokenizer::create_new_token(HTMLToken::Type type)
+{
+ m_current_token = {};
+ m_current_token.m_type = type;
+}
+
+HTMLTokenizer::HTMLTokenizer(const StringView& input, const String& encoding)
+{
+ auto* decoder = TextCodec::decoder_for(encoding);
+ ASSERT(decoder);
+ m_decoded_input = decoder->to_utf8(input);
+ m_utf8_view = Utf8View(m_decoded_input);
+ m_utf8_iterator = m_utf8_view.begin();
+}
+
+void HTMLTokenizer::will_switch_to([[maybe_unused]] State new_state)
+{
+#ifdef TOKENIZER_TRACE
+ dbg() << "[" << state_name(m_state) << "] Switch to " << state_name(new_state);
+#endif
+}
+
+void HTMLTokenizer::will_reconsume_in([[maybe_unused]] State new_state)
+{
+#ifdef TOKENIZER_TRACE
+ dbg() << "[" << state_name(m_state) << "] Reconsume in " << state_name(new_state);
+#endif
+}
+
+void HTMLTokenizer::switch_to(Badge<HTMLDocumentParser>, State new_state)
+{
+#ifdef TOKENIZER_TRACE
+ dbg() << "[" << state_name(m_state) << "] Parser switches tokenizer state to " << state_name(new_state);
+#endif
+ m_state = new_state;
+}
+
+void HTMLTokenizer::will_emit(HTMLToken& token)
+{
+ if (token.is_start_tag())
+ m_last_emitted_start_tag = token;
+}
+
+bool HTMLTokenizer::current_end_tag_token_is_appropriate() const
+{
+ ASSERT(m_current_token.is_end_tag());
+ if (!m_last_emitted_start_tag.is_start_tag())
+ return false;
+ return m_current_token.tag_name() == m_last_emitted_start_tag.tag_name();
+}
+
+bool HTMLTokenizer::consumed_as_part_of_an_attribute() const
+{
+ return m_return_state == State::AttributeValueUnquoted || m_return_state == State::AttributeValueSingleQuoted || m_return_state == State::AttributeValueDoubleQuoted;
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.h b/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.h
new file mode 100644
index 0000000000..787bc12b46
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLTokenizer.h
@@ -0,0 +1,190 @@
+/*
+ * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <AK/Queue.h>
+#include <AK/StringView.h>
+#include <AK/Types.h>
+#include <AK/Utf8View.h>
+#include <LibWeb/Forward.h>
+#include <LibWeb/HTML/Parser/HTMLToken.h>
+
+namespace Web::HTML {
+
+#define ENUMERATE_TOKENIZER_STATES \
+ __ENUMERATE_TOKENIZER_STATE(Data) \
+ __ENUMERATE_TOKENIZER_STATE(RCDATA) \
+ __ENUMERATE_TOKENIZER_STATE(RAWTEXT) \
+ __ENUMERATE_TOKENIZER_STATE(ScriptData) \
+ __ENUMERATE_TOKENIZER_STATE(PLAINTEXT) \
+ __ENUMERATE_TOKENIZER_STATE(TagOpen) \
+ __ENUMERATE_TOKENIZER_STATE(EndTagOpen) \
+ __ENUMERATE_TOKENIZER_STATE(TagName) \
+ __ENUMERATE_TOKENIZER_STATE(RCDATALessThanSign) \
+ __ENUMERATE_TOKENIZER_STATE(RCDATAEndTagOpen) \
+ __ENUMERATE_TOKENIZER_STATE(RCDATAEndTagName) \
+ __ENUMERATE_TOKENIZER_STATE(RAWTEXTLessThanSign) \
+ __ENUMERATE_TOKENIZER_STATE(RAWTEXTEndTagOpen) \
+ __ENUMERATE_TOKENIZER_STATE(RAWTEXTEndTagName) \
+ __ENUMERATE_TOKENIZER_STATE(ScriptDataLessThanSign) \
+ __ENUMERATE_TOKENIZER_STATE(ScriptDataEndTagOpen) \
+ __ENUMERATE_TOKENIZER_STATE(ScriptDataEndTagName) \
+ __ENUMERATE_TOKENIZER_STATE(ScriptDataEscapeStart) \
+ __ENUMERATE_TOKENIZER_STATE(ScriptDataEscapeStartDash) \
+ __ENUMERATE_TOKENIZER_STATE(ScriptDataEscaped) \
+ __ENUMERATE_TOKENIZER_STATE(ScriptDataEscapedDash) \
+ __ENUMERATE_TOKENIZER_STATE(ScriptDataEscapedDashDash) \
+ __ENUMERATE_TOKENIZER_STATE(ScriptDataEscapedLessThanSign) \
+ __ENUMERATE_TOKENIZER_STATE(ScriptDataEscapedEndTagOpen) \
+ __ENUMERATE_TOKENIZER_STATE(ScriptDataEscapedEndTagName) \
+ __ENUMERATE_TOKENIZER_STATE(ScriptDataDoubleEscapeStart) \
+ __ENUMERATE_TOKENIZER_STATE(ScriptDataDoubleEscaped) \
+ __ENUMERATE_TOKENIZER_STATE(ScriptDataDoubleEscapedDash) \
+ __ENUMERATE_TOKENIZER_STATE(ScriptDataDoubleEscapedDashDash) \
+ __ENUMERATE_TOKENIZER_STATE(ScriptDataDoubleEscapedLessThanSign) \
+ __ENUMERATE_TOKENIZER_STATE(ScriptDataDoubleEscapeEnd) \
+ __ENUMERATE_TOKENIZER_STATE(BeforeAttributeName) \
+ __ENUMERATE_TOKENIZER_STATE(AttributeName) \
+ __ENUMERATE_TOKENIZER_STATE(AfterAttributeName) \
+ __ENUMERATE_TOKENIZER_STATE(BeforeAttributeValue) \
+ __ENUMERATE_TOKENIZER_STATE(AttributeValueDoubleQuoted) \
+ __ENUMERATE_TOKENIZER_STATE(AttributeValueSingleQuoted) \
+ __ENUMERATE_TOKENIZER_STATE(AttributeValueUnquoted) \
+ __ENUMERATE_TOKENIZER_STATE(AfterAttributeValueQuoted) \
+ __ENUMERATE_TOKENIZER_STATE(SelfClosingStartTag) \
+ __ENUMERATE_TOKENIZER_STATE(BogusComment) \
+ __ENUMERATE_TOKENIZER_STATE(MarkupDeclarationOpen) \
+ __ENUMERATE_TOKENIZER_STATE(CommentStart) \
+ __ENUMERATE_TOKENIZER_STATE(CommentStartDash) \
+ __ENUMERATE_TOKENIZER_STATE(Comment) \
+ __ENUMERATE_TOKENIZER_STATE(CommentLessThanSign) \
+ __ENUMERATE_TOKENIZER_STATE(CommentLessThanSignBang) \
+ __ENUMERATE_TOKENIZER_STATE(CommentLessThanSignBangDash) \
+ __ENUMERATE_TOKENIZER_STATE(CommentLessThanSignBangDashDash) \
+ __ENUMERATE_TOKENIZER_STATE(CommentEndDash) \
+ __ENUMERATE_TOKENIZER_STATE(CommentEnd) \
+ __ENUMERATE_TOKENIZER_STATE(CommentEndBang) \
+ __ENUMERATE_TOKENIZER_STATE(DOCTYPE) \
+ __ENUMERATE_TOKENIZER_STATE(BeforeDOCTYPEName) \
+ __ENUMERATE_TOKENIZER_STATE(DOCTYPEName) \
+ __ENUMERATE_TOKENIZER_STATE(AfterDOCTYPEName) \
+ __ENUMERATE_TOKENIZER_STATE(AfterDOCTYPEPublicKeyword) \
+ __ENUMERATE_TOKENIZER_STATE(BeforeDOCTYPEPublicIdentifier) \
+ __ENUMERATE_TOKENIZER_STATE(DOCTYPEPublicIdentifierDoubleQuoted) \
+ __ENUMERATE_TOKENIZER_STATE(DOCTYPEPublicIdentifierSingleQuoted) \
+ __ENUMERATE_TOKENIZER_STATE(AfterDOCTYPEPublicIdentifier) \
+ __ENUMERATE_TOKENIZER_STATE(BetweenDOCTYPEPublicAndSystemIdentifiers) \
+ __ENUMERATE_TOKENIZER_STATE(AfterDOCTYPESystemKeyword) \
+ __ENUMERATE_TOKENIZER_STATE(BeforeDOCTYPESystemIdentifier) \
+ __ENUMERATE_TOKENIZER_STATE(DOCTYPESystemIdentifierDoubleQuoted) \
+ __ENUMERATE_TOKENIZER_STATE(DOCTYPESystemIdentifierSingleQuoted) \
+ __ENUMERATE_TOKENIZER_STATE(AfterDOCTYPESystemIdentifier) \
+ __ENUMERATE_TOKENIZER_STATE(BogusDOCTYPE) \
+ __ENUMERATE_TOKENIZER_STATE(CDATASection) \
+ __ENUMERATE_TOKENIZER_STATE(CDATASectionBracket) \
+ __ENUMERATE_TOKENIZER_STATE(CDATASectionEnd) \
+ __ENUMERATE_TOKENIZER_STATE(CharacterReference) \
+ __ENUMERATE_TOKENIZER_STATE(NamedCharacterReference) \
+ __ENUMERATE_TOKENIZER_STATE(AmbiguousAmpersand) \
+ __ENUMERATE_TOKENIZER_STATE(NumericCharacterReference) \
+ __ENUMERATE_TOKENIZER_STATE(HexadecimalCharacterReferenceStart) \
+ __ENUMERATE_TOKENIZER_STATE(DecimalCharacterReferenceStart) \
+ __ENUMERATE_TOKENIZER_STATE(HexadecimalCharacterReference) \
+ __ENUMERATE_TOKENIZER_STATE(DecimalCharacterReference) \
+ __ENUMERATE_TOKENIZER_STATE(NumericCharacterReferenceEnd)
+
+class HTMLTokenizer {
+public:
+ explicit HTMLTokenizer(const StringView& input, const String& encoding);
+
+ enum class State {
+#define __ENUMERATE_TOKENIZER_STATE(state) state,
+ ENUMERATE_TOKENIZER_STATES
+#undef __ENUMERATE_TOKENIZER_STATE
+ };
+
+ Optional<HTMLToken> next_token();
+
+ void switch_to(Badge<HTMLDocumentParser>, State new_state);
+
+ void set_blocked(bool b) { m_blocked = b; }
+ bool is_blocked() const { return m_blocked; }
+
+ String source() const { return m_decoded_input; }
+
+private:
+ Optional<u32> next_code_point();
+ Optional<u32> peek_code_point(size_t offset) const;
+ bool consume_next_if_match(const StringView&, CaseSensitivity = CaseSensitivity::CaseSensitive);
+ void create_new_token(HTMLToken::Type);
+ bool current_end_tag_token_is_appropriate() const;
+
+ static const char* state_name(State state)
+ {
+ switch (state) {
+#define __ENUMERATE_TOKENIZER_STATE(state) \
+ case State::state: \
+ return #state;
+ ENUMERATE_TOKENIZER_STATES
+#undef __ENUMERATE_TOKENIZER_STATE
+ };
+ ASSERT_NOT_REACHED();
+ }
+
+ void will_emit(HTMLToken&);
+ void will_switch_to(State);
+ void will_reconsume_in(State);
+
+ bool consumed_as_part_of_an_attribute() const;
+
+ State m_state { State::Data };
+ State m_return_state { State::Data };
+
+ Vector<u32> m_temporary_buffer;
+
+ String m_decoded_input;
+
+ StringView m_input;
+
+ Utf8View m_utf8_view;
+ AK::Utf8CodepointIterator m_utf8_iterator;
+ AK::Utf8CodepointIterator m_prev_utf8_iterator;
+
+ HTMLToken m_current_token;
+
+ HTMLToken m_last_emitted_start_tag;
+
+ bool m_has_emitted_eof { false };
+
+ Queue<HTMLToken> m_queued_tokens;
+
+ u32 m_character_reference_code { 0 };
+
+ bool m_blocked { false };
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/Parser/ListOfActiveFormattingElements.cpp b/Userland/Libraries/LibWeb/HTML/Parser/ListOfActiveFormattingElements.cpp
new file mode 100644
index 0000000000..bad6140632
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/Parser/ListOfActiveFormattingElements.cpp
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/DOM/Element.h>
+#include <LibWeb/HTML/Parser/ListOfActiveFormattingElements.h>
+
+namespace Web::HTML {
+
+ListOfActiveFormattingElements::~ListOfActiveFormattingElements()
+{
+}
+
+void ListOfActiveFormattingElements::add(DOM::Element& element)
+{
+ // FIXME: Implement the Noah's Ark clause https://html.spec.whatwg.org/multipage/parsing.html#push-onto-the-list-of-active-formatting-elements
+ m_entries.append({ element });
+}
+
+void ListOfActiveFormattingElements::add_marker()
+{
+ m_entries.append({ nullptr });
+}
+
+bool ListOfActiveFormattingElements::contains(const DOM::Element& element) const
+{
+ for (auto& entry : m_entries) {
+ if (entry.element == &element)
+ return true;
+ }
+ return false;
+}
+
+DOM::Element* ListOfActiveFormattingElements::last_element_with_tag_name_before_marker(const FlyString& tag_name)
+{
+ for (ssize_t i = m_entries.size() - 1; i >= 0; --i) {
+ auto& entry = m_entries[i];
+ if (entry.is_marker())
+ return nullptr;
+ if (entry.element->local_name() == tag_name)
+ return entry.element;
+ }
+ return nullptr;
+}
+
+void ListOfActiveFormattingElements::remove(DOM::Element& element)
+{
+ m_entries.remove_first_matching([&](auto& entry) {
+ return entry.element == &element;
+ });
+}
+
+void ListOfActiveFormattingElements::clear_up_to_the_last_marker()
+{
+ while (!m_entries.is_empty()) {
+ auto entry = m_entries.take_last();
+ if (entry.is_marker())
+ break;
+ }
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/Parser/ListOfActiveFormattingElements.h b/Userland/Libraries/LibWeb/HTML/Parser/ListOfActiveFormattingElements.h
new file mode 100644
index 0000000000..65064be7e5
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/Parser/ListOfActiveFormattingElements.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <AK/NonnullRefPtrVector.h>
+#include <LibWeb/DOM/Element.h>
+#include <LibWeb/Forward.h>
+
+namespace Web::HTML {
+
+class ListOfActiveFormattingElements {
+public:
+ ListOfActiveFormattingElements() { }
+ ~ListOfActiveFormattingElements();
+
+ struct Entry {
+ bool is_marker() const { return !element; }
+
+ RefPtr<DOM::Element> element;
+ };
+
+ bool is_empty() const { return m_entries.is_empty(); }
+ bool contains(const DOM::Element&) const;
+
+ void add(DOM::Element& element);
+ void add_marker();
+
+ void remove(DOM::Element&);
+
+ const Vector<Entry>& entries() const { return m_entries; }
+ Vector<Entry>& entries() { return m_entries; }
+
+ DOM::Element* last_element_with_tag_name_before_marker(const FlyString& tag_name);
+
+ void clear_up_to_the_last_marker();
+
+private:
+ Vector<Entry> m_entries;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.cpp b/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.cpp
new file mode 100644
index 0000000000..2406711bff
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.cpp
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/DOM/Element.h>
+#include <LibWeb/HTML/Parser/HTMLDocumentParser.h>
+#include <LibWeb/HTML/Parser/StackOfOpenElements.h>
+
+namespace Web::HTML {
+
+static Vector<FlyString> s_base_list { "applet", "caption", "html", "table", "td", "th", "marquee", "object", "template" };
+
+StackOfOpenElements::~StackOfOpenElements()
+{
+}
+
+bool StackOfOpenElements::has_in_scope_impl(const FlyString& tag_name, const Vector<FlyString>& list) const
+{
+ for (ssize_t i = m_elements.size() - 1; i >= 0; --i) {
+ auto& node = m_elements.at(i);
+ if (node.local_name() == tag_name)
+ return true;
+ if (list.contains_slow(node.local_name()))
+ return false;
+ }
+ ASSERT_NOT_REACHED();
+}
+
+bool StackOfOpenElements::has_in_scope(const FlyString& tag_name) const
+{
+ return has_in_scope_impl(tag_name, s_base_list);
+}
+
+bool StackOfOpenElements::has_in_scope_impl(const DOM::Element& target_node, const Vector<FlyString>& list) const
+{
+ for (ssize_t i = m_elements.size() - 1; i >= 0; --i) {
+ auto& node = m_elements.at(i);
+ if (&node == &target_node)
+ return true;
+ if (list.contains_slow(node.local_name()))
+ return false;
+ }
+ ASSERT_NOT_REACHED();
+}
+
+bool StackOfOpenElements::has_in_scope(const DOM::Element& target_node) const
+{
+ return has_in_scope_impl(target_node, s_base_list);
+}
+
+bool StackOfOpenElements::has_in_button_scope(const FlyString& tag_name) const
+{
+ auto list = s_base_list;
+ list.append("button");
+ return has_in_scope_impl(tag_name, list);
+}
+
+bool StackOfOpenElements::has_in_table_scope(const FlyString& tag_name) const
+{
+ return has_in_scope_impl(tag_name, { "html", "table", "template" });
+}
+
+bool StackOfOpenElements::has_in_list_item_scope(const FlyString& tag_name) const
+{
+ auto list = s_base_list;
+ list.append("ol");
+ list.append("ul");
+ return has_in_scope_impl(tag_name, list);
+}
+
+bool StackOfOpenElements::has_in_select_scope(const FlyString& tag_name) const
+{
+ return has_in_scope_impl(tag_name, { "option", "optgroup" });
+}
+
+bool StackOfOpenElements::contains(const DOM::Element& element) const
+{
+ for (auto& element_on_stack : m_elements) {
+ if (&element == &element_on_stack)
+ return true;
+ }
+ return false;
+}
+
+bool StackOfOpenElements::contains(const FlyString& tag_name) const
+{
+ for (auto& element_on_stack : m_elements) {
+ if (element_on_stack.local_name() == tag_name)
+ return true;
+ }
+ return false;
+}
+
+void StackOfOpenElements::pop_until_an_element_with_tag_name_has_been_popped(const FlyString& tag_name)
+{
+ while (m_elements.last().local_name() != tag_name)
+ pop();
+ pop();
+}
+
+DOM::Element* StackOfOpenElements::topmost_special_node_below(const DOM::Element& formatting_element)
+{
+ DOM::Element* found_element = nullptr;
+ for (ssize_t i = m_elements.size() - 1; i >= 0; --i) {
+ auto& element = m_elements[i];
+ if (&element == &formatting_element)
+ break;
+ if (HTMLDocumentParser::is_special_tag(element.local_name(), element.namespace_()))
+ found_element = &element;
+ }
+ return found_element;
+}
+
+StackOfOpenElements::LastElementResult StackOfOpenElements::last_element_with_tag_name(const FlyString& tag_name)
+{
+ for (ssize_t i = m_elements.size() - 1; i >= 0; --i) {
+ auto& element = m_elements[i];
+ if (element.local_name() == tag_name)
+ return { &element, i };
+ }
+ return { nullptr, -1 };
+}
+
+DOM::Element* StackOfOpenElements::element_before(const DOM::Element& target)
+{
+ bool found_target = false;
+ for (ssize_t i = m_elements.size() - 1; i >= 0; --i) {
+ auto& element = m_elements[i];
+ if (&element == &target) {
+ found_target = true;
+ } else if (found_target)
+ return &element;
+ }
+ return nullptr;
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.h b/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.h
new file mode 100644
index 0000000000..2a62bbf53e
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/Parser/StackOfOpenElements.h
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <AK/NonnullRefPtrVector.h>
+#include <LibWeb/DOM/Element.h>
+#include <LibWeb/Forward.h>
+
+namespace Web::HTML {
+
+class StackOfOpenElements {
+public:
+ StackOfOpenElements() { }
+ ~StackOfOpenElements();
+
+ DOM::Element& first() { return m_elements.first(); }
+ DOM::Element& last() { return m_elements.last(); }
+
+ bool is_empty() const { return m_elements.is_empty(); }
+ void push(NonnullRefPtr<DOM::Element> element) { m_elements.append(move(element)); }
+ NonnullRefPtr<DOM::Element> pop() { return m_elements.take_last(); }
+
+ const DOM::Element& current_node() const { return m_elements.last(); }
+ DOM::Element& current_node() { return m_elements.last(); }
+
+ bool has_in_scope(const FlyString& tag_name) const;
+ bool has_in_button_scope(const FlyString& tag_name) const;
+ bool has_in_table_scope(const FlyString& tag_name) const;
+ bool has_in_list_item_scope(const FlyString& tag_name) const;
+ bool has_in_select_scope(const FlyString& tag_name) const;
+
+ bool has_in_scope(const DOM::Element&) const;
+
+ bool contains(const DOM::Element&) const;
+ bool contains(const FlyString& tag_name) const;
+
+ const NonnullRefPtrVector<DOM::Element>& elements() const { return m_elements; }
+ NonnullRefPtrVector<DOM::Element>& elements() { return m_elements; }
+
+ void pop_until_an_element_with_tag_name_has_been_popped(const FlyString&);
+
+ DOM::Element* topmost_special_node_below(const DOM::Element&);
+
+ struct LastElementResult {
+ DOM::Element* element;
+ ssize_t index;
+ };
+ LastElementResult last_element_with_tag_name(const FlyString&);
+ DOM::Element* element_before(const DOM::Element&);
+
+private:
+ bool has_in_scope_impl(const FlyString& tag_name, const Vector<FlyString>&) const;
+ bool has_in_scope_impl(const DOM::Element& target_node, const Vector<FlyString>&) const;
+
+ NonnullRefPtrVector<DOM::Element> m_elements;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/SubmitEvent.h b/Userland/Libraries/LibWeb/HTML/SubmitEvent.h
new file mode 100644
index 0000000000..06c4b6fb0b
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/SubmitEvent.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2020, the SerenityOS developers.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <LibWeb/DOM/Event.h>
+
+namespace Web::HTML {
+
+class SubmitEvent final : public DOM::Event {
+public:
+ using WrapperType = Bindings::SubmitEventWrapper;
+
+ static NonnullRefPtr<SubmitEvent> create(const FlyString& event_name, RefPtr<HTMLElement> submitter)
+ {
+ return adopt(*new SubmitEvent(event_name, submitter));
+ }
+
+ const RefPtr<HTMLElement> submitter() const { return m_submitter; }
+
+private:
+ SubmitEvent(const FlyString& event_name, RefPtr<HTMLElement> submitter)
+ : DOM::Event(event_name)
+ , m_submitter(submitter)
+ {
+ }
+
+ RefPtr<HTMLElement> m_submitter;
+};
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/SubmitEvent.idl b/Userland/Libraries/LibWeb/HTML/SubmitEvent.idl
new file mode 100644
index 0000000000..c816ae663f
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/SubmitEvent.idl
@@ -0,0 +1,5 @@
+interface SubmitEvent : Event {
+
+ readonly attribute HTMLElement? submitter;
+
+};
diff --git a/Userland/Libraries/LibWeb/HTML/TagNames.cpp b/Userland/Libraries/LibWeb/HTML/TagNames.cpp
new file mode 100644
index 0000000000..1ab76b7376
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/TagNames.cpp
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <LibWeb/HTML/TagNames.h>
+
+namespace Web::HTML::TagNames {
+
+#define __ENUMERATE_HTML_TAG(name) FlyString name;
+ENUMERATE_HTML_TAGS
+#undef __ENUMERATE_HTML_TAG
+
+[[gnu::constructor]] static void initialize()
+{
+ static bool s_initialized = false;
+ if (s_initialized)
+ return;
+
+#define __ENUMERATE_HTML_TAG(name) \
+ name = #name;
+ ENUMERATE_HTML_TAGS
+#undef __ENUMERATE_HTML_TAG
+
+ template_ = "template";
+
+ s_initialized = true;
+}
+
+}
diff --git a/Userland/Libraries/LibWeb/HTML/TagNames.h b/Userland/Libraries/LibWeb/HTML/TagNames.h
new file mode 100644
index 0000000000..9d7f924e2a
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/TagNames.h
@@ -0,0 +1,178 @@
+/*
+ * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <AK/FlyString.h>
+
+namespace Web::HTML::TagNames {
+
+#define ENUMERATE_HTML_TAGS \
+ __ENUMERATE_HTML_TAG(a) \
+ __ENUMERATE_HTML_TAG(abbr) \
+ __ENUMERATE_HTML_TAG(acronym) \
+ __ENUMERATE_HTML_TAG(address) \
+ __ENUMERATE_HTML_TAG(applet) \
+ __ENUMERATE_HTML_TAG(area) \
+ __ENUMERATE_HTML_TAG(article) \
+ __ENUMERATE_HTML_TAG(aside) \
+ __ENUMERATE_HTML_TAG(audio) \
+ __ENUMERATE_HTML_TAG(b) \
+ __ENUMERATE_HTML_TAG(base) \
+ __ENUMERATE_HTML_TAG(basefont) \
+ __ENUMERATE_HTML_TAG(bdi) \
+ __ENUMERATE_HTML_TAG(bdo) \
+ __ENUMERATE_HTML_TAG(bgsound) \
+ __ENUMERATE_HTML_TAG(big) \
+ __ENUMERATE_HTML_TAG(blink) \
+ __ENUMERATE_HTML_TAG(blockquote) \
+ __ENUMERATE_HTML_TAG(body) \
+ __ENUMERATE_HTML_TAG(br) \
+ __ENUMERATE_HTML_TAG(button) \
+ __ENUMERATE_HTML_TAG(canvas) \
+ __ENUMERATE_HTML_TAG(caption) \
+ __ENUMERATE_HTML_TAG(center) \
+ __ENUMERATE_HTML_TAG(cite) \
+ __ENUMERATE_HTML_TAG(code) \
+ __ENUMERATE_HTML_TAG(col) \
+ __ENUMERATE_HTML_TAG(colgroup) \
+ __ENUMERATE_HTML_TAG(data) \
+ __ENUMERATE_HTML_TAG(datalist) \
+ __ENUMERATE_HTML_TAG(dd) \
+ __ENUMERATE_HTML_TAG(del) \
+ __ENUMERATE_HTML_TAG(details) \
+ __ENUMERATE_HTML_TAG(dfn) \
+ __ENUMERATE_HTML_TAG(dialog) \
+ __ENUMERATE_HTML_TAG(dir) \
+ __ENUMERATE_HTML_TAG(div) \
+ __ENUMERATE_HTML_TAG(dl) \
+ __ENUMERATE_HTML_TAG(dt) \
+ __ENUMERATE_HTML_TAG(em) \
+ __ENUMERATE_HTML_TAG(embed) \
+ __ENUMERATE_HTML_TAG(fieldset) \
+ __ENUMERATE_HTML_TAG(figcaption) \
+ __ENUMERATE_HTML_TAG(figure) \
+ __ENUMERATE_HTML_TAG(font) \
+ __ENUMERATE_HTML_TAG(footer) \
+ __ENUMERATE_HTML_TAG(form) \
+ __ENUMERATE_HTML_TAG(frame) \
+ __ENUMERATE_HTML_TAG(frameset) \
+ __ENUMERATE_HTML_TAG(h1) \
+ __ENUMERATE_HTML_TAG(h2) \
+ __ENUMERATE_HTML_TAG(h3) \
+ __ENUMERATE_HTML_TAG(h4) \
+ __ENUMERATE_HTML_TAG(h5) \
+ __ENUMERATE_HTML_TAG(h6) \
+ __ENUMERATE_HTML_TAG(head) \
+ __ENUMERATE_HTML_TAG(header) \
+ __ENUMERATE_HTML_TAG(hgroup) \
+ __ENUMERATE_HTML_TAG(hr) \
+ __ENUMERATE_HTML_TAG(html) \
+ __ENUMERATE_HTML_TAG(i) \
+ __ENUMERATE_HTML_TAG(iframe) \
+ __ENUMERATE_HTML_TAG(image) \
+ __ENUMERATE_HTML_TAG(img) \
+ __ENUMERATE_HTML_TAG(input) \
+ __ENUMERATE_HTML_TAG(ins) \
+ __ENUMERATE_HTML_TAG(kbd) \
+ __ENUMERATE_HTML_TAG(keygen) \
+ __ENUMERATE_HTML_TAG(label) \
+ __ENUMERATE_HTML_TAG(legend) \
+ __ENUMERATE_HTML_TAG(li) \
+ __ENUMERATE_HTML_TAG(link) \
+ __ENUMERATE_HTML_TAG(listing) \
+ __ENUMERATE_HTML_TAG(main) \
+ __ENUMERATE_HTML_TAG(map) \
+ __ENUMERATE_HTML_TAG(mark) \
+ __ENUMERATE_HTML_TAG(marquee) \
+ __ENUMERATE_HTML_TAG(math) \
+ __ENUMERATE_HTML_TAG(menu) \
+ __ENUMERATE_HTML_TAG(meta) \
+ __ENUMERATE_HTML_TAG(meter) \
+ __ENUMERATE_HTML_TAG(nav) \
+ __ENUMERATE_HTML_TAG(nobr) \
+ __ENUMERATE_HTML_TAG(noembed) \
+ __ENUMERATE_HTML_TAG(noframes) \
+ __ENUMERATE_HTML_TAG(noscript) \
+ __ENUMERATE_HTML_TAG(object) \
+ __ENUMERATE_HTML_TAG(ol) \
+ __ENUMERATE_HTML_TAG(optgroup) \
+ __ENUMERATE_HTML_TAG(option) \
+ __ENUMERATE_HTML_TAG(output) \
+ __ENUMERATE_HTML_TAG(p) \
+ __ENUMERATE_HTML_TAG(param) \
+ __ENUMERATE_HTML_TAG(picture) \
+ __ENUMERATE_HTML_TAG(path) \
+ __ENUMERATE_HTML_TAG(plaintext) \
+ __ENUMERATE_HTML_TAG(pre) \
+ __ENUMERATE_HTML_TAG(progress) \
+ __ENUMERATE_HTML_TAG(q) \
+ __ENUMERATE_HTML_TAG(ruby) \
+ __ENUMERATE_HTML_TAG(rb) \
+ __ENUMERATE_HTML_TAG(rp) \
+ __ENUMERATE_HTML_TAG(rt) \
+ __ENUMERATE_HTML_TAG(rtc) \
+ __ENUMERATE_HTML_TAG(s) \
+ __ENUMERATE_HTML_TAG(samp) \
+ __ENUMERATE_HTML_TAG(script) \
+ __ENUMERATE_HTML_TAG(section) \
+ __ENUMERATE_HTML_TAG(select) \
+ __ENUMERATE_HTML_TAG(slot) \
+ __ENUMERATE_HTML_TAG(small) \
+ __ENUMERATE_HTML_TAG(source) \
+ __ENUMERATE_HTML_TAG(span) \
+ __ENUMERATE_HTML_TAG(strike) \
+ __ENUMERATE_HTML_TAG(strong) \
+ __ENUMERATE_HTML_TAG(style) \
+ __ENUMERATE_HTML_TAG(sub) \
+ __ENUMERATE_HTML_TAG(sup) \
+ __ENUMERATE_HTML_TAG(summary) \
+ __ENUMERATE_HTML_TAG(svg) \
+ __ENUMERATE_HTML_TAG(table) \
+ __ENUMERATE_HTML_TAG(tbody) \
+ __ENUMERATE_HTML_TAG(td) \
+ __ENUMERATE_HTML_TAG(template_) \
+ __ENUMERATE_HTML_TAG(textarea) \
+ __ENUMERATE_HTML_TAG(tfoot) \
+ __ENUMERATE_HTML_TAG(th) \
+ __ENUMERATE_HTML_TAG(thead) \
+ __ENUMERATE_HTML_TAG(time) \
+ __ENUMERATE_HTML_TAG(title) \
+ __ENUMERATE_HTML_TAG(tr) \
+ __ENUMERATE_HTML_TAG(track) \
+ __ENUMERATE_HTML_TAG(tt) \
+ __ENUMERATE_HTML_TAG(u) \
+ __ENUMERATE_HTML_TAG(ul) \
+ __ENUMERATE_HTML_TAG(var) \
+ __ENUMERATE_HTML_TAG(video) \
+ __ENUMERATE_HTML_TAG(wbr) \
+ __ENUMERATE_HTML_TAG(xmp)
+
+#define __ENUMERATE_HTML_TAG(name) extern FlyString name;
+ENUMERATE_HTML_TAGS
+#undef __ENUMERATE_HTML_TAG
+
+}