diff --git a/Libraries/LibWeb/Bindings/NodeWrapperFactory.cpp b/Libraries/LibWeb/Bindings/NodeWrapperFactory.cpp index 70bfd61bf8..4826e02d92 100644 --- a/Libraries/LibWeb/Bindings/NodeWrapperFactory.cpp +++ b/Libraries/LibWeb/Bindings/NodeWrapperFactory.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2020, Andreas Kling + * Copyright (c) 2020, Luke Wilde * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -28,53 +29,147 @@ #include #include #include -#include +#include +#include +#include #include +#include +#include #include +#include +#include +#include +#include +#include +#include +#include +#include #include #include -#include +#include +#include #include #include +#include #include #include #include #include +#include +#include +#include #include +#include +#include +#include +#include +#include +#include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include +#include +#include +#include +#include #include +#include +#include #include #include #include +#include +#include +#include +#include #include +#include +#include +#include +#include #include #include #include #include #include -#include +#include +#include +#include #include +#include +#include #include +#include +#include +#include +#include +#include +#include +#include +#include #include -#include +#include +#include #include #include +#include #include #include #include #include +#include +#include +#include #include +#include +#include +#include +#include +#include +#include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include +#include +#include +#include +#include #include +#include #include +#include #include #include +#include +#include +#include +#include #include +#include +#include +#include +#include +#include -namespace Web { -namespace Bindings { +namespace Web::Bindings { NodeWrapper* wrap(JS::GlobalObject& global_object, DOM::Node& node) { @@ -84,14 +179,42 @@ NodeWrapper* wrap(JS::GlobalObject& global_object, DOM::Node& node) return static_cast(wrap_impl(global_object, downcast(node))); if (is(node)) return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); if (is(node)) return static_cast(wrap_impl(global_object, downcast(node))); if (is(node)) return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); if (is(node)) return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); if (is(node)) return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); if (is(node)) return static_cast(wrap_impl(global_object, downcast(node))); if (is(node)) @@ -106,22 +229,88 @@ NodeWrapper* wrap(JS::GlobalObject& global_object, DOM::Node& node) return static_cast(wrap_impl(global_object, downcast(node))); if (is(node)) return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); if (is(node)) return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); if (is(node)) return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); if (is(node)) return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); if (is(node)) return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); if (is(node)) return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); if (is(node)) return static_cast(wrap_impl(global_object, downcast(node))); if (is(node)) return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); if (is(node)) return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); + if (is(node)) + return static_cast(wrap_impl(global_object, downcast(node))); if (is(node)) return static_cast(wrap_impl(global_object, downcast(node))); if (is(node)) @@ -134,4 +323,3 @@ NodeWrapper* wrap(JS::GlobalObject& global_object, DOM::Node& node) } } -} diff --git a/Libraries/LibWeb/CMakeLists.txt b/Libraries/LibWeb/CMakeLists.txt index 1bec9e2e92..83de29089b 100644 --- a/Libraries/LibWeb/CMakeLists.txt +++ b/Libraries/LibWeb/CMakeLists.txt @@ -47,13 +47,27 @@ set(SOURCES FontCache.cpp HTML/CanvasRenderingContext2D.cpp HTML/HTMLAnchorElement.cpp - HTML/HTMLBRElement.cpp + HTML/HTMLAreaElement.cpp + HTML/HTMLAudioElement.cpp + HTML/HTMLBaseElement.cpp HTML/HTMLBlinkElement.cpp HTML/HTMLBodyElement.cpp + HTML/HTMLBRElement.cpp + HTML/HTMLButtonElement.cpp HTML/HTMLCanvasElement.cpp + HTML/HTMLDataElement.cpp + HTML/HTMLDataListElement.cpp + HTML/HTMLDetailsElement.cpp + HTML/HTMLDialogElement.cpp + HTML/HTMLDivElement.cpp + HTML/HTMLDListElement.cpp HTML/HTMLElement.cpp + HTML/HTMLEmbedElement.cpp + HTML/HTMLFieldSetElement.cpp HTML/HTMLFontElement.cpp HTML/HTMLFormElement.cpp + HTML/HTMLFrameElement.cpp + HTML/HTMLFrameSetElement.cpp HTML/HTMLHRElement.cpp HTML/HTMLHeadElement.cpp HTML/HTMLHeadingElement.cpp @@ -61,14 +75,48 @@ set(SOURCES HTML/HTMLIFrameElement.cpp HTML/HTMLImageElement.cpp HTML/HTMLInputElement.cpp + HTML/HTMLLabelElement.cpp + HTML/HTMLLegendElement.cpp + HTML/HTMLLIElement.cpp HTML/HTMLLinkElement.cpp + HTML/HTMLMapElement.cpp + HTML/HTMLMarqueeElement.cpp + HTML/HTMLMediaElement.cpp + HTML/HTMLMenuElement.cpp + HTML/HTMLMetaElement.cpp + HTML/HTMLMeterElement.cpp + HTML/HTMLModElement.cpp HTML/HTMLObjectElement.cpp + HTML/HTMLOListElement.cpp + HTML/HTMLOptGroupElement.cpp + HTML/HTMLOptionElement.cpp + HTML/HTMLOutputElement.cpp + HTML/HTMLParagraphElement.cpp + HTML/HTMLParamElement.cpp + HTML/HTMLPictureElement.cpp + HTML/HTMLPreElement.cpp + HTML/HTMLProgressElement.cpp + HTML/HTMLQuoteElement.cpp HTML/HTMLScriptElement.cpp + HTML/HTMLSelectElement.cpp + HTML/HTMLSlotElement.cpp + HTML/HTMLSourceElement.cpp + HTML/HTMLSpanElement.cpp HTML/HTMLStyleElement.cpp + HTML/HTMLTableCaptionElement.cpp HTML/HTMLTableCellElement.cpp + HTML/HTMLTableColElement.cpp HTML/HTMLTableElement.cpp HTML/HTMLTableRowElement.cpp + HTML/HTMLTableSectionElement.cpp + HTML/HTMLTemplateElement.cpp + HTML/HTMLTextAreaElement.cpp + HTML/HTMLTimeElement.cpp HTML/HTMLTitleElement.cpp + HTML/HTMLTrackElement.cpp + HTML/HTMLUListElement.cpp + HTML/HTMLUnknownElement.cpp + HTML/HTMLVideoElement.cpp HTML/ImageData.cpp HTML/Parser/Entities.cpp HTML/Parser/HTMLDocumentParser.cpp @@ -172,11 +220,25 @@ libweb_js_wrapper(DOM/Node) libweb_js_wrapper(DOM/Text) libweb_js_wrapper(HTML/CanvasRenderingContext2D) libweb_js_wrapper(HTML/HTMLAnchorElement) +libweb_js_wrapper(HTML/HTMLAreaElement) +libweb_js_wrapper(HTML/HTMLAudioElement) +libweb_js_wrapper(HTML/HTMLBaseElement) libweb_js_wrapper(HTML/HTMLBodyElement) libweb_js_wrapper(HTML/HTMLBRElement) +libweb_js_wrapper(HTML/HTMLButtonElement) libweb_js_wrapper(HTML/HTMLCanvasElement) +libweb_js_wrapper(HTML/HTMLDataElement) +libweb_js_wrapper(HTML/HTMLDataListElement) +libweb_js_wrapper(HTML/HTMLDetailsElement) +libweb_js_wrapper(HTML/HTMLDialogElement) +libweb_js_wrapper(HTML/HTMLDivElement) +libweb_js_wrapper(HTML/HTMLDListElement) libweb_js_wrapper(HTML/HTMLElement) +libweb_js_wrapper(HTML/HTMLEmbedElement) +libweb_js_wrapper(HTML/HTMLFieldSetElement) libweb_js_wrapper(HTML/HTMLFormElement) +libweb_js_wrapper(HTML/HTMLFrameElement) +libweb_js_wrapper(HTML/HTMLFrameSetElement) libweb_js_wrapper(HTML/HTMLHeadElement) libweb_js_wrapper(HTML/HTMLHeadingElement) libweb_js_wrapper(HTML/HTMLHRElement) @@ -184,14 +246,48 @@ libweb_js_wrapper(HTML/HTMLHtmlElement) libweb_js_wrapper(HTML/HTMLIFrameElement) libweb_js_wrapper(HTML/HTMLImageElement) libweb_js_wrapper(HTML/HTMLInputElement) +libweb_js_wrapper(HTML/HTMLLabelElement) +libweb_js_wrapper(HTML/HTMLLegendElement) +libweb_js_wrapper(HTML/HTMLLIElement) libweb_js_wrapper(HTML/HTMLLinkElement) +libweb_js_wrapper(HTML/HTMLMapElement) +libweb_js_wrapper(HTML/HTMLMarqueeElement) +libweb_js_wrapper(HTML/HTMLMediaElement) +libweb_js_wrapper(HTML/HTMLMenuElement) +libweb_js_wrapper(HTML/HTMLMetaElement) +libweb_js_wrapper(HTML/HTMLMeterElement) +libweb_js_wrapper(HTML/HTMLModElement) libweb_js_wrapper(HTML/HTMLObjectElement) +libweb_js_wrapper(HTML/HTMLOListElement) +libweb_js_wrapper(HTML/HTMLOptGroupElement) +libweb_js_wrapper(HTML/HTMLOptionElement) +libweb_js_wrapper(HTML/HTMLOutputElement) +libweb_js_wrapper(HTML/HTMLParagraphElement) +libweb_js_wrapper(HTML/HTMLParamElement) +libweb_js_wrapper(HTML/HTMLPictureElement) +libweb_js_wrapper(HTML/HTMLPreElement) +libweb_js_wrapper(HTML/HTMLProgressElement) +libweb_js_wrapper(HTML/HTMLQuoteElement) libweb_js_wrapper(HTML/HTMLScriptElement) +libweb_js_wrapper(HTML/HTMLSelectElement) +libweb_js_wrapper(HTML/HTMLSlotElement) +libweb_js_wrapper(HTML/HTMLSourceElement) +libweb_js_wrapper(HTML/HTMLSpanElement) libweb_js_wrapper(HTML/HTMLStyleElement) +libweb_js_wrapper(HTML/HTMLTableCaptionElement) libweb_js_wrapper(HTML/HTMLTableCellElement) +libweb_js_wrapper(HTML/HTMLTableColElement) libweb_js_wrapper(HTML/HTMLTableElement) libweb_js_wrapper(HTML/HTMLTableRowElement) +libweb_js_wrapper(HTML/HTMLTableSectionElement) +libweb_js_wrapper(HTML/HTMLTemplateElement) +libweb_js_wrapper(HTML/HTMLTextAreaElement) +libweb_js_wrapper(HTML/HTMLTimeElement) libweb_js_wrapper(HTML/HTMLTitleElement) +libweb_js_wrapper(HTML/HTMLTrackElement) +libweb_js_wrapper(HTML/HTMLUListElement) +libweb_js_wrapper(HTML/HTMLUnknownElement) +libweb_js_wrapper(HTML/HTMLVideoElement) libweb_js_wrapper(HTML/ImageData) libweb_js_wrapper(UIEvents/MouseEvent) libweb_js_wrapper(UIEvents/UIEvent) diff --git a/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp b/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp index f9a50dccec..5670104a8c 100644 --- a/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp +++ b/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp @@ -51,15 +51,19 @@ static String snake_name(const StringView& title_name) return builder.to_string(); } -static String add_underscore_to_cpp_keywords(const String& input) +static String make_input_acceptable_cpp(const String& input) { - if (input == "class" || input == "template") { + if (input == "class" || input == "template" || input == "for") { StringBuilder builder; builder.append(input); builder.append('_'); return builder.to_string(); } - return input; + + String input_without_dashes = input; + input_without_dashes.replace("-", "_"); + + return input_without_dashes; } namespace IDL { @@ -638,7 +642,7 @@ void generate_implementation(const IDL::Interface& interface) auto attribute_name = attribute.extended_attributes.get("Reflect").value(); if (attribute_name.is_null()) attribute_name = attribute.name; - attribute_name = add_underscore_to_cpp_keywords(attribute_name); + attribute_name = make_input_acceptable_cpp(attribute_name); out() << " auto retval = impl->attribute(HTML::AttributeNames::" << attribute_name << ");"; } else { out() << " auto retval = impl->" << snake_name(attribute.name) << "();"; @@ -660,7 +664,7 @@ void generate_implementation(const IDL::Interface& interface) auto attribute_name = attribute.extended_attributes.get("Reflect").value(); if (attribute_name.is_null()) attribute_name = attribute.name; - attribute_name = add_underscore_to_cpp_keywords(attribute_name); + attribute_name = make_input_acceptable_cpp(attribute_name); out() << " impl->set_attribute(HTML::AttributeNames::" << attribute_name << ", cpp_value);"; } else { out() << " impl->set_" << snake_name(attribute.name) << "(cpp_value);"; diff --git a/Libraries/LibWeb/DOM/AttributeNames.cpp b/Libraries/LibWeb/DOM/AttributeNames.cpp index 5310670589..3a5b0de38a 100644 --- a/Libraries/LibWeb/DOM/AttributeNames.cpp +++ b/Libraries/LibWeb/DOM/AttributeNames.cpp @@ -45,8 +45,13 @@ void initialize() ENUMERATE_HTML_ATTRIBUTES #undef __ENUMERATE_HTML_ATTRIBUTE - // NOTE: Special case for the class attribute since it's a C++ keyword. + // NOTE: Special case for the class and for attributes since they're C++ keywords. class_ = "class"; + for_ = "for"; + + // NOTE: Special cases for attributes with dashes in them. + accept_charset = "accept-charset"; + http_equiv = "http-equiv"; s_initialized = true; } diff --git a/Libraries/LibWeb/DOM/AttributeNames.h b/Libraries/LibWeb/DOM/AttributeNames.h index 5a1b5fcdde..9ffa580416 100644 --- a/Libraries/LibWeb/DOM/AttributeNames.h +++ b/Libraries/LibWeb/DOM/AttributeNames.h @@ -37,28 +37,40 @@ void initialize(); #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(allow) \ __ENUMERATE_HTML_ATTRIBUTE(alt) \ __ENUMERATE_HTML_ATTRIBUTE(async) \ + __ENUMERATE_HTML_ATTRIBUTE(behaviour) \ __ENUMERATE_HTML_ATTRIBUTE(bgcolor) \ + __ENUMERATE_HTML_ATTRIBUTE(cite) \ __ENUMERATE_HTML_ATTRIBUTE(class_) \ + __ENUMERATE_HTML_ATTRIBUTE(cols) \ __ENUMERATE_HTML_ATTRIBUTE(colspan) \ + __ENUMERATE_HTML_ATTRIBUTE(content) \ __ENUMERATE_HTML_ATTRIBUTE(contenteditable) \ __ENUMERATE_HTML_ATTRIBUTE(data) \ + __ENUMERATE_HTML_ATTRIBUTE(datetime) \ __ENUMERATE_HTML_ATTRIBUTE(download) \ __ENUMERATE_HTML_ATTRIBUTE(defer) \ + __ENUMERATE_HTML_ATTRIBUTE(direction) \ __ENUMERATE_HTML_ATTRIBUTE(dirname) \ + __ENUMERATE_HTML_ATTRIBUTE(for_) \ + __ENUMERATE_HTML_ATTRIBUTE(frameborder) \ __ENUMERATE_HTML_ATTRIBUTE(headers) \ __ENUMERATE_HTML_ATTRIBUTE(height) \ __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(label) \ __ENUMERATE_HTML_ATTRIBUTE(lang) \ + __ENUMERATE_HTML_ATTRIBUTE(longdesc) \ __ENUMERATE_HTML_ATTRIBUTE(max) \ __ENUMERATE_HTML_ATTRIBUTE(media) \ __ENUMERATE_HTML_ATTRIBUTE(method) \ @@ -67,11 +79,15 @@ void initialize(); __ENUMERATE_HTML_ATTRIBUTE(pattern) \ __ENUMERATE_HTML_ATTRIBUTE(ping) \ __ENUMERATE_HTML_ATTRIBUTE(placeholder) \ + __ENUMERATE_HTML_ATTRIBUTE(poster) \ __ENUMERATE_HTML_ATTRIBUTE(rel) \ + __ENUMERATE_HTML_ATTRIBUTE(rows) \ + __ENUMERATE_HTML_ATTRIBUTE(scrolling) \ __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(step) \ __ENUMERATE_HTML_ATTRIBUTE(style) \ @@ -80,7 +96,8 @@ void initialize(); __ENUMERATE_HTML_ATTRIBUTE(type) \ __ENUMERATE_HTML_ATTRIBUTE(usemap) \ __ENUMERATE_HTML_ATTRIBUTE(value) \ - __ENUMERATE_HTML_ATTRIBUTE(width) + __ENUMERATE_HTML_ATTRIBUTE(width) \ + __ENUMERATE_HTML_ATTRIBUTE(wrap) #define __ENUMERATE_HTML_ATTRIBUTE(name) extern FlyString name; ENUMERATE_HTML_ATTRIBUTES diff --git a/Libraries/LibWeb/DOM/ElementFactory.cpp b/Libraries/LibWeb/DOM/ElementFactory.cpp index d75fb01715..a8081cf88d 100644 --- a/Libraries/LibWeb/DOM/ElementFactory.cpp +++ b/Libraries/LibWeb/DOM/ElementFactory.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2018-2020, Andreas Kling + * Copyright (c) 2020, Luke Wilde * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,12 +27,26 @@ #include #include -#include +#include +#include +#include #include #include +#include +#include #include +#include +#include +#include +#include +#include +#include +#include +#include #include #include +#include +#include #include #include #include @@ -39,14 +54,47 @@ #include #include #include +#include +#include +#include #include +#include +#include +#include +#include +#include +#include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include +#include +#include +#include +#include #include +#include #include +#include #include #include +#include +#include +#include +#include +#include #include +#include +#include +#include #include #include #include @@ -58,53 +106,155 @@ NonnullRefPtr create_element(Document& document, const FlyString& tag_n auto lowercase_tag_name = tag_name.to_lowercase(); if (lowercase_tag_name == HTML::TagNames::a) return adopt(*new HTML::HTMLAnchorElement(document, lowercase_tag_name)); - if (lowercase_tag_name == HTML::TagNames::html) - return adopt(*new HTML::HTMLHtmlElement(document, lowercase_tag_name)); - if (lowercase_tag_name == HTML::TagNames::head) - return adopt(*new HTML::HTMLHeadElement(document, lowercase_tag_name)); - if (lowercase_tag_name == HTML::TagNames::body) - return adopt(*new HTML::HTMLBodyElement(document, lowercase_tag_name)); - if (lowercase_tag_name == HTML::TagNames::font) - return adopt(*new HTML::HTMLFontElement(document, lowercase_tag_name)); - if (lowercase_tag_name == HTML::TagNames::hr) - return adopt(*new HTML::HTMLHRElement(document, lowercase_tag_name)); - if (lowercase_tag_name == HTML::TagNames::style) - return adopt(*new HTML::HTMLStyleElement(document, lowercase_tag_name)); - if (lowercase_tag_name == HTML::TagNames::title) - return adopt(*new HTML::HTMLTitleElement(document, lowercase_tag_name)); - if (lowercase_tag_name == HTML::TagNames::link) - return adopt(*new HTML::HTMLLinkElement(document, lowercase_tag_name)); - if (lowercase_tag_name == HTML::TagNames::img) - return adopt(*new HTML::HTMLImageElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::area) + return adopt(*new HTML::HTMLAreaElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::audio) + return adopt(*new HTML::HTMLAudioElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::base) + return adopt(*new HTML::HTMLBaseElement(document, lowercase_tag_name)); if (lowercase_tag_name == HTML::TagNames::blink) return adopt(*new HTML::HTMLBlinkElement(document, lowercase_tag_name)); - if (lowercase_tag_name == HTML::TagNames::form) - return adopt(*new HTML::HTMLFormElement(document, lowercase_tag_name)); - if (lowercase_tag_name == HTML::TagNames::input) - return adopt(*new HTML::HTMLInputElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::body) + return adopt(*new HTML::HTMLBodyElement(document, lowercase_tag_name)); if (lowercase_tag_name == HTML::TagNames::br) return adopt(*new HTML::HTMLBRElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::button) + return adopt(*new HTML::HTMLButtonElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::canvas) + return adopt(*new HTML::HTMLCanvasElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::data) + return adopt(*new HTML::HTMLDataElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::datalist) + return adopt(*new HTML::HTMLDataListElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::details) + return adopt(*new HTML::HTMLDetailsElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::dialog) + return adopt(*new HTML::HTMLDialogElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::div) + return adopt(*new HTML::HTMLDivElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::dl) + return adopt(*new HTML::HTMLDListElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::embed) + return adopt(*new HTML::HTMLEmbedElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::fieldset) + return adopt(*new HTML::HTMLFieldSetElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::font) + return adopt(*new HTML::HTMLFontElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::form) + return adopt(*new HTML::HTMLFormElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::frame) + return adopt(*new HTML::HTMLFrameElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::frameset) + return adopt(*new HTML::HTMLFrameSetElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::head) + return adopt(*new HTML::HTMLHeadElement(document, lowercase_tag_name)); + if (lowercase_tag_name.is_one_of(HTML::TagNames::h1, HTML::TagNames::h2, HTML::TagNames::h3, HTML::TagNames::h4, HTML::TagNames::h5, HTML::TagNames::h6)) + return adopt(*new HTML::HTMLHeadingElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::hr) + return adopt(*new HTML::HTMLHRElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::html) + return adopt(*new HTML::HTMLHtmlElement(document, lowercase_tag_name)); if (lowercase_tag_name == HTML::TagNames::iframe) return adopt(*new HTML::HTMLIFrameElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::img) + return adopt(*new HTML::HTMLImageElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::input) + return adopt(*new HTML::HTMLInputElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::label) + return adopt(*new HTML::HTMLLabelElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::legend) + return adopt(*new HTML::HTMLLegendElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::li) + return adopt(*new HTML::HTMLLIElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::link) + return adopt(*new HTML::HTMLLinkElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::map) + return adopt(*new HTML::HTMLMapElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::marquee) + return adopt(*new HTML::HTMLMarqueeElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::menu) + return adopt(*new HTML::HTMLMenuElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::meta) + return adopt(*new HTML::HTMLMetaElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::meter) + return adopt(*new HTML::HTMLMeterElement(document, lowercase_tag_name)); + if (lowercase_tag_name.is_one_of(HTML::TagNames::ins, HTML::TagNames::del)) + return adopt(*new HTML::HTMLModElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::object) + return adopt(*new HTML::HTMLObjectElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::ol) + return adopt(*new HTML::HTMLOListElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::optgroup) + return adopt(*new HTML::HTMLOptGroupElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::option) + return adopt(*new HTML::HTMLOptionElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::output) + return adopt(*new HTML::HTMLOutputElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::p) + return adopt(*new HTML::HTMLParagraphElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::param) + return adopt(*new HTML::HTMLParamElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::picture) + return adopt(*new HTML::HTMLPictureElement(document, lowercase_tag_name)); + // NOTE: The obsolete elements "listing" and "xmp" are explicitly mapped to HTMLPreElement in the specification. + if (lowercase_tag_name.is_one_of(HTML::TagNames::pre, HTML::TagNames::listing, HTML::TagNames::xmp)) + return adopt(*new HTML::HTMLPreElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::progress) + return adopt(*new HTML::HTMLProgressElement(document, lowercase_tag_name)); + if (lowercase_tag_name.is_one_of(HTML::TagNames::blockquote, HTML::TagNames::q)) + return adopt(*new HTML::HTMLQuoteElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::script) + return adopt(*new HTML::HTMLScriptElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::select) + return adopt(*new HTML::HTMLSelectElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::slot) + return adopt(*new HTML::HTMLSlotElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::source) + return adopt(*new HTML::HTMLSourceElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::span) + return adopt(*new HTML::HTMLSpanElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::style) + return adopt(*new HTML::HTMLStyleElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::caption) + return adopt(*new HTML::HTMLTableCaptionElement(document, lowercase_tag_name)); + if (lowercase_tag_name.is_one_of(Web::HTML::TagNames::td, Web::HTML::TagNames::th)) + return adopt(*new HTML::HTMLTableCellElement(document, lowercase_tag_name)); + if (lowercase_tag_name.is_one_of(HTML::TagNames::colgroup, HTML::TagNames::col)) + return adopt(*new HTML::HTMLTableColElement(document, lowercase_tag_name)); if (lowercase_tag_name == HTML::TagNames::table) return adopt(*new HTML::HTMLTableElement(document, lowercase_tag_name)); if (lowercase_tag_name == HTML::TagNames::tr) return adopt(*new HTML::HTMLTableRowElement(document, lowercase_tag_name)); - if (lowercase_tag_name == HTML::TagNames::td || lowercase_tag_name == HTML::TagNames::th) - return adopt(*new HTML::HTMLTableCellElement(document, lowercase_tag_name)); - if (lowercase_tag_name.is_one_of(HTML::TagNames::h1, HTML::TagNames::h2, HTML::TagNames::h3, HTML::TagNames::h4, HTML::TagNames::h5, HTML::TagNames::h6)) - return adopt(*new HTML::HTMLHeadingElement(document, lowercase_tag_name)); - if (lowercase_tag_name == HTML::TagNames::script) - return adopt(*new HTML::HTMLScriptElement(document, lowercase_tag_name)); - if (lowercase_tag_name == HTML::TagNames::canvas) - return adopt(*new HTML::HTMLCanvasElement(document, lowercase_tag_name)); - if (lowercase_tag_name == HTML::TagNames::object) - return adopt(*new HTML::HTMLObjectElement(document, lowercase_tag_name)); + if (lowercase_tag_name.is_one_of(HTML::TagNames::tbody, HTML::TagNames::thead, HTML::TagNames::tfoot)) + return adopt(*new HTML::HTMLTableSectionElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::template_) + return adopt(*new HTML::HTMLTemplateElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::textarea) + return adopt(*new HTML::HTMLTextAreaElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::time) + return adopt(*new HTML::HTMLTimeElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::title) + return adopt(*new HTML::HTMLTitleElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::track) + return adopt(*new HTML::HTMLTrackElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::ul) + return adopt(*new HTML::HTMLUListElement(document, lowercase_tag_name)); + if (lowercase_tag_name == HTML::TagNames::video) + return adopt(*new HTML::HTMLVideoElement(document, lowercase_tag_name)); + if (lowercase_tag_name.is_one_of( + HTML::TagNames::article, HTML::TagNames::section, HTML::TagNames::nav, HTML::TagNames::aside, HTML::TagNames::hgroup, HTML::TagNames::header, HTML::TagNames::footer, HTML::TagNames::address, HTML::TagNames::dt, HTML::TagNames::dd, HTML::TagNames::figure, HTML::TagNames::figcaption, HTML::TagNames::main, HTML::TagNames::em, HTML::TagNames::strong, HTML::TagNames::small, HTML::TagNames::s, HTML::TagNames::cite, HTML::TagNames::dfn, HTML::TagNames::abbr, HTML::TagNames::ruby, HTML::TagNames::rt, HTML::TagNames::rp, HTML::TagNames::code, HTML::TagNames::var, HTML::TagNames::samp, HTML::TagNames::kbd, HTML::TagNames::sub, HTML::TagNames::sup, HTML::TagNames::i, HTML::TagNames::b, HTML::TagNames::u, HTML::TagNames::mark, HTML::TagNames::bdi, HTML::TagNames::bdo, HTML::TagNames::wbr, HTML::TagNames::summary, HTML::TagNames::noscript, + // Obsolete + HTML::TagNames::acronym, HTML::TagNames::basefont, HTML::TagNames::big, HTML::TagNames::center, HTML::TagNames::nobr, HTML::TagNames::noembed, HTML::TagNames::noframes, HTML::TagNames::plaintext, HTML::TagNames::rb, HTML::TagNames::rtc, HTML::TagNames::strike, HTML::TagNames::tt) + ) + return adopt(*new HTML::HTMLElement(document, lowercase_tag_name)); if (lowercase_tag_name == SVG::TagNames::svg) return adopt(*new SVG::SVGSVGElement(document, lowercase_tag_name)); if (lowercase_tag_name == SVG::TagNames::path) return adopt(*new SVG::SVGPathElement(document, lowercase_tag_name)); - return adopt(*new Element(document, lowercase_tag_name)); + + // FIXME: If name is a valid custom element name, then return HTMLElement. + + return adopt(*new HTML::HTMLUnknownElement(document, lowercase_tag_name)); } } diff --git a/Libraries/LibWeb/DOM/Node.h b/Libraries/LibWeb/DOM/Node.h index 1e23180806..5fb56d2c11 100644 --- a/Libraries/LibWeb/DOM/Node.h +++ b/Libraries/LibWeb/DOM/Node.h @@ -95,6 +95,7 @@ public: String child_text_content() const; virtual bool is_html_element() const { return false; } + virtual bool is_unknown_html_element() const { return false; } const Node* root() const; bool is_connected() const; diff --git a/Libraries/LibWeb/DOM/TagNames.h b/Libraries/LibWeb/DOM/TagNames.h index ae5f632d1d..7db11b7107 100644 --- a/Libraries/LibWeb/DOM/TagNames.h +++ b/Libraries/LibWeb/DOM/TagNames.h @@ -36,14 +36,19 @@ void initialize(); #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) \ @@ -54,11 +59,16 @@ void initialize(); __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) \ @@ -90,15 +100,22 @@ void initialize(); __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) \ @@ -108,26 +125,34 @@ void initialize(); __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) \ @@ -138,12 +163,15 @@ void initialize(); __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) diff --git a/Libraries/LibWeb/Forward.h b/Libraries/LibWeb/Forward.h index c11dcfc033..3be40219b7 100644 --- a/Libraries/LibWeb/Forward.h +++ b/Libraries/LibWeb/Forward.h @@ -55,15 +55,77 @@ enum class QuirksMode; namespace Web::HTML { class CanvasRenderingContext2D; class HTMLAnchorElement; +class HTMLAreaElement; +class HTMLAudioElement; +class HTMLBaseElement; +class HTMLBlinkElement; class HTMLBodyElement; +class HTMLBRElement; +class HTMLButtonElement; class HTMLCanvasElement; +class HTMLDataElement; +class HTMLDataListElement; +class HTMLDetailsElement; +class HTMLDialogElement; +class HTMLDivElement; +class HTMLDListElement; class HTMLDocumentParser; class HTMLElement; +class HTMLEmbedElement; +class HTMLFieldSetElement; +class HTMLFontElement; class HTMLFormElement; +class HTMLFrameElement; +class HTMLFrameSetElement; class HTMLHeadElement; +class HTMLHeadingElement; +class HTMLHRElement; class HTMLHtmlElement; +class HTMLIFrameElement; class HTMLImageElement; +class HTMLInputElement; +class HTMLLabelElement; +class HTMLLegendElement; +class HTMLLIElement; +class HTMLLinkElement; +class HTMLMapElement; +class HTMLMarqueeElement; +class HTMLMediaElement; +class HTMLMenuElement; +class HTMLMetaElement; +class HTMLMeterElement; +class HTMLModElement; +class HTMLObjectElement; +class HTMLOListElement; +class HTMLOptGroupElement; +class HTMLOptionElement; +class HTMLOutputElement; +class HTMLParagraphElement; +class HTMLParamElement; +class HTMLPictureElement; +class HTMLPreElement; +class HTMLProgressElement; +class HTMLQuoteElement; class HTMLScriptElement; +class HTMLSelectElement; +class HTMLSlotElement; +class HTMLSourceElement; +class HTMLSpanElement; +class HTMLStyleElement; +class HTMLTableCaptionElement; +class HTMLTableCellElement; +class HTMLTableColElement; +class HTMLTableElement; +class HTMLTableRowElement; +class HTMLTableSectionElement; +class HTMLTemplateElement; +class HTMLTextAreaElement; +class HTMLTimeElement; +class HTMLTitleElement; +class HTMLTrackElement; +class HTMLUListElement; +class HTMLUnknownElement; +class HTMLVideoElement; class ImageData; } @@ -99,11 +161,25 @@ class EventListenerWrapper; class EventTargetWrapper; class EventWrapper; class HTMLAnchorElementWrapper; -class HTMLBRElementWrapper; +class HTMLAreaElementWrapper; +class HTMLAudioElementWrapper; +class HTMLBaseElementWrapper; class HTMLBodyElementWrapper; +class HTMLBRElementWrapper; +class HTMLButtonElementWrapper; class HTMLCanvasElementWrapper; +class HTMLDataElementWrapper; +class HTMLDataListElementWrapper; +class HTMLDetailsElementWrapper; +class HTMLDialogElementWrapper; +class HTMLDivElementWrapper; +class HTMLDListElementWrapper; class HTMLElementWrapper; +class HTMLEmbedElementWrapper; +class HTMLFieldSetElementWrapper; class HTMLFormElementWrapper; +class HTMLFrameElementWrapper; +class HTMLFrameSetElementWrapper; class HTMLHRElementWrapper; class HTMLHeadElementWrapper; class HTMLHeadingElementWrapper; @@ -111,14 +187,48 @@ class HTMLHtmlElementWrapper; class HTMLIFrameElementWrapper; class HTMLImageElementWrapper; class HTMLInputElementWrapper; +class HTMLLabelElementWrapper; +class HTMLLegendElementWrapper; +class HTMLLIElementWrapper; class HTMLLinkElementWrapper; +class HTMLMapElementWrapper; +class HTMLMarqueeElementWrapper; +class HTMLMediaElementWrapper; +class HTMLMenuElementWrapper; +class HTMLMetaElementWrapper; +class HTMLMeterElementWrapper; +class HTMLModElementWrapper; class HTMLObjectElementWrapper; +class HTMLOListElementWrapper; +class HTMLOptGroupElementWrapper; +class HTMLOptionElementWrapper; +class HTMLOutputElementWrapper; +class HTMLParagraphElementWrapper; +class HTMLParamElementWrapper; +class HTMLPictureElementWrapper; +class HTMLPreElementWrapper; +class HTMLProgressElementWrapper; +class HTMLQuoteElementWrapper; class HTMLScriptElementWrapper; +class HTMLSelectElementWrapper; +class HTMLSlotElementWrapper; +class HTMLSourceElementWrapper; +class HTMLSpanElementWrapper; class HTMLStyleElementWrapper; +class HTMLTableCaptionElementWrapper; class HTMLTableCellElementWrapper; +class HTMLTableColElementWrapper; class HTMLTableElementWrapper; class HTMLTableRowElementWrapper; +class HTMLTableSectionElementWrapper; +class HTMLTemplateElementWrapper; +class HTMLTextAreaElementWrapper; +class HTMLTimeElementWrapper; class HTMLTitleElementWrapper; +class HTMLTrackElementWrapper; +class HTMLUListElementWrapper; +class HTMLUnknownElementWrapper; +class HTMLVideoElementWrapper; class ImageDataWrapper; class LocationObject; class MouseEventWrapper; diff --git a/Libraries/LibWeb/HTML/HTMLFormElement.idl b/Libraries/LibWeb/HTML/HTMLFormElement.idl index fabc85f18b..810b167de1 100644 --- a/Libraries/LibWeb/HTML/HTMLFormElement.idl +++ b/Libraries/LibWeb/HTML/HTMLFormElement.idl @@ -2,5 +2,6 @@ interface HTMLFormElement : HTMLElement { [Reflect] attribute DOMString name; [Reflect] attribute DOMString rel; + [Reflect=accept-charset] attribute DOMString acceptCharset; } diff --git a/Libraries/LibWeb/HTML/HTMLMetaElement.idl b/Libraries/LibWeb/HTML/HTMLMetaElement.idl index 436dcf01ae..96ce93b65d 100644 --- a/Libraries/LibWeb/HTML/HTMLMetaElement.idl +++ b/Libraries/LibWeb/HTML/HTMLMetaElement.idl @@ -2,5 +2,6 @@ interface HTMLMetaElement : HTMLElement { [Reflect] attribute DOMString name; [Reflect] attribute DOMString content; + [Reflect=http-equiv] attribute DOMString httpEquiv; } diff --git a/Libraries/LibWeb/HTML/HTMLPreElement.h b/Libraries/LibWeb/HTML/HTMLPreElement.h index 2dfd4dad4b..d145a0ffec 100644 --- a/Libraries/LibWeb/HTML/HTMLPreElement.h +++ b/Libraries/LibWeb/HTML/HTMLPreElement.h @@ -41,5 +41,5 @@ public: } AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLPreElement) -static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast(node).local_name().is_one_of(Web::HTML::TagNames::pre, Web::HTML::TagNames::listing, Web::HTML::TagNames::xmp); } +static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast(node).local_name() == Web::HTML::TagNames::pre; } AK_END_TYPE_TRAITS() diff --git a/Libraries/LibWeb/HTML/HTMLUnknownElement.h b/Libraries/LibWeb/HTML/HTMLUnknownElement.h index cf338027af..5dd7cfdc50 100644 --- a/Libraries/LibWeb/HTML/HTMLUnknownElement.h +++ b/Libraries/LibWeb/HTML/HTMLUnknownElement.h @@ -36,12 +36,13 @@ public: HTMLUnknownElement(DOM::Document&, const FlyString& local_name); virtual ~HTMLUnknownElement() override; + +private: + virtual bool is_unknown_html_element() const final { return true; } }; } AK_BEGIN_TYPE_TRAITS(Web::HTML::HTMLUnknownElement) -// FIXME: I'm not sure what the check for this should be. -// There are some elements which are explicitly mapped to HTMLUnknownElement, but other than that, it's for, well, unknown elements. -static bool is_type(const Web::DOM::Node& node) { return node.is_html_element(); } +static bool is_type(const Web::DOM::Node& node) { return node.is_unknown_html_element(); } AK_END_TYPE_TRAITS()