LibWeb: Add a whole bunch of HTML DOM bindings

Note that these aren't full implementations of the bindings. This
mostly implements the low hanging fruit (namely, basic reflections)

There are some attributes that should be USVString instead of
DOMString. However, USVString is a slightly different definition
of DOMString, so it should suffice for now.
This commit is contained in:
Luke 2020-07-27 05:04:26 +01:00 committed by Andreas Kling
parent db1b67e88a
commit a2b40de0cc
Notes: sideshowbarker 2024-07-19 04:33:26 +09:00
44 changed files with 327 additions and 29 deletions

View file

@ -26,13 +26,49 @@
#include <LibWeb/Bindings/DocumentWrapper.h>
#include <LibWeb/Bindings/DocumentTypeWrapper.h>
#include <LibWeb/Bindings/HTMLAnchorElementWrapper.h>
#include <LibWeb/Bindings/HTMLBodyElementWrapper.h>
#include <LibWeb/Bindings/HTMLBRElementWrapper.h>
#include <LibWeb/Bindings/HTMLCanvasElementWrapper.h>
#include <LibWeb/Bindings/HTMLImageElementWrapper.h>
#include <LibWeb/Bindings/HTMLElementWrapper.h>
#include <LibWeb/Bindings/HTMLFormElementWrapper.h>
#include <LibWeb/Bindings/HTMLHeadElementWrapper.h>
#include <LibWeb/Bindings/HTMLHeadingElementWrapper.h>
#include <LibWeb/Bindings/HTMLHRElementWrapper.h>
#include <LibWeb/Bindings/HTMLHtmlElementWrapper.h>
#include <LibWeb/Bindings/HTMLIFrameElementWrapper.h>
#include <LibWeb/Bindings/HTMLImageElementWrapper.h>
#include <LibWeb/Bindings/HTMLInputElementWrapper.h>
#include <LibWeb/Bindings/HTMLLinkElementWrapper.h>
#include <LibWeb/Bindings/HTMLObjectElementWrapper.h>
#include <LibWeb/Bindings/HTMLScriptElementWrapper.h>
#include <LibWeb/Bindings/HTMLStyleElementWrapper.h>
#include <LibWeb/Bindings/HTMLTableCellElementWrapper.h>
#include <LibWeb/Bindings/HTMLTableElementWrapper.h>
#include <LibWeb/Bindings/HTMLTableRowElementWrapper.h>
#include <LibWeb/Bindings/HTMLTitleElementWrapper.h>
#include <LibWeb/Bindings/NodeWrapper.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/HTML/HTMLAnchorElement.h>
#include <LibWeb/HTML/HTMLBodyElement.h>
#include <LibWeb/HTML/HTMLBRElement.h>
#include <LibWeb/HTML/HTMLCanvasElement.h>
#include <LibWeb/HTML/HTMLFormElement.h>
#include <LibWeb/HTML/HTMLHeadElement.h>
#include <LibWeb/HTML/HTMLHeadingElement.h>
#include <LibWeb/HTML/HTMLHRElement.h>
#include <LibWeb/HTML/HTMLHtmlElement.h>
#include <LibWeb/HTML/HTMLIFrameElement.h>
#include <LibWeb/HTML/HTMLImageElement.h>
#include <LibWeb/HTML/HTMLInputElement.h>
#include <LibWeb/HTML/HTMLLinkElement.h>
#include <LibWeb/HTML/HTMLObjectElement.h>
#include <LibWeb/HTML/HTMLScriptElement.h>
#include <LibWeb/HTML/HTMLStyleElement.h>
#include <LibWeb/HTML/HTMLTableCellElement.h>
#include <LibWeb/HTML/HTMLTableElement.h>
#include <LibWeb/HTML/HTMLTableRowElement.h>
#include <LibWeb/HTML/HTMLTitleElement.h>
#include <LibWeb/DOM/Node.h>
namespace Web {
@ -44,10 +80,46 @@ NodeWrapper* wrap(JS::GlobalObject& global_object, DOM::Node& node)
return static_cast<NodeWrapper*>(wrap_impl(global_object, downcast<DOM::Document>(node)));
if (is<DOM::DocumentType>(node))
return static_cast<NodeWrapper*>(wrap_impl(global_object, downcast<DOM::DocumentType>(node)));
if (is<HTMLAnchorElement>(node))
return static_cast<NodeWrapper*>(wrap_impl(global_object, downcast<HTMLAnchorElement>(node)));
if (is<HTMLBodyElement>(node))
return static_cast<NodeWrapper*>(wrap_impl(global_object, downcast<HTMLBodyElement>(node)));
if (is<HTMLBRElement>(node))
return static_cast<NodeWrapper*>(wrap_impl(global_object, downcast<HTMLBRElement>(node)));
if (is<HTMLCanvasElement>(node))
return static_cast<NodeWrapper*>(wrap_impl(global_object, downcast<HTMLCanvasElement>(node)));
if (is<HTMLFormElement>(node))
return static_cast<NodeWrapper*>(wrap_impl(global_object, downcast<HTMLFormElement>(node)));
if (is<HTMLHeadElement>(node))
return static_cast<NodeWrapper*>(wrap_impl(global_object, downcast<HTMLHeadElement>(node)));
if (is<HTMLHeadingElement>(node))
return static_cast<NodeWrapper*>(wrap_impl(global_object, downcast<HTMLHeadingElement>(node)));
if (is<HTMLHRElement>(node))
return static_cast<NodeWrapper*>(wrap_impl(global_object, downcast<HTMLHRElement>(node)));
if (is<HTMLHtmlElement>(node))
return static_cast<NodeWrapper*>(wrap_impl(global_object, downcast<HTMLHtmlElement>(node)));
if (is<HTMLIFrameElement>(node))
return static_cast<NodeWrapper*>(wrap_impl(global_object, downcast<HTMLIFrameElement>(node)));
if (is<HTMLImageElement>(node))
return static_cast<NodeWrapper*>(wrap_impl(global_object, downcast<HTMLImageElement>(node)));
if (is<HTMLInputElement>(node))
return static_cast<NodeWrapper*>(wrap_impl(global_object, downcast<HTMLInputElement>(node)));
if (is<HTMLLinkElement>(node))
return static_cast<NodeWrapper*>(wrap_impl(global_object, downcast<HTMLLinkElement>(node)));
if (is<HTMLObjectElement>(node))
return static_cast<NodeWrapper*>(wrap_impl(global_object, downcast<HTMLObjectElement>(node)));
if (is<HTMLScriptElement>(node))
return static_cast<NodeWrapper*>(wrap_impl(global_object, downcast<HTMLScriptElement>(node)));
if (is<HTMLStyleElement>(node))
return static_cast<NodeWrapper*>(wrap_impl(global_object, downcast<HTMLStyleElement>(node)));
if (is<HTMLTableCellElement>(node))
return static_cast<NodeWrapper*>(wrap_impl(global_object, downcast<HTMLTableCellElement>(node)));
if (is<HTMLTableElement>(node))
return static_cast<NodeWrapper*>(wrap_impl(global_object, downcast<HTMLTableElement>(node)));
if (is<HTMLTableRowElement>(node))
return static_cast<NodeWrapper*>(wrap_impl(global_object, downcast<HTMLTableRowElement>(node)));
if (is<HTMLTitleElement>(node))
return static_cast<NodeWrapper*>(wrap_impl(global_object, downcast<HTMLTitleElement>(node)));
if (is<HTMLElement>(node))
return static_cast<NodeWrapper*>(wrap_impl(global_object, downcast<HTMLElement>(node)));
if (is<DOM::Element>(node))

View file

@ -169,9 +169,27 @@ libweb_js_wrapper(DOM/EventTarget)
libweb_js_wrapper(DOM/MouseEvent)
libweb_js_wrapper(DOM/Node)
libweb_js_wrapper(HTML/CanvasRenderingContext2D)
libweb_js_wrapper(HTML/HTMLAnchorElement)
libweb_js_wrapper(HTML/HTMLBodyElement)
libweb_js_wrapper(HTML/HTMLBRElement)
libweb_js_wrapper(HTML/HTMLCanvasElement)
libweb_js_wrapper(HTML/HTMLElement)
libweb_js_wrapper(HTML/HTMLFormElement)
libweb_js_wrapper(HTML/HTMLHeadElement)
libweb_js_wrapper(HTML/HTMLHeadingElement)
libweb_js_wrapper(HTML/HTMLHRElement)
libweb_js_wrapper(HTML/HTMLHtmlElement)
libweb_js_wrapper(HTML/HTMLIFrameElement)
libweb_js_wrapper(HTML/HTMLImageElement)
libweb_js_wrapper(HTML/HTMLInputElement)
libweb_js_wrapper(HTML/HTMLLinkElement)
libweb_js_wrapper(HTML/HTMLObjectElement)
libweb_js_wrapper(HTML/HTMLScriptElement)
libweb_js_wrapper(HTML/HTMLStyleElement)
libweb_js_wrapper(HTML/HTMLTableCellElement)
libweb_js_wrapper(HTML/HTMLTableElement)
libweb_js_wrapper(HTML/HTMLTableRowElement)
libweb_js_wrapper(HTML/HTMLTitleElement)
libweb_js_wrapper(HTML/ImageData)
get_property(WRAPPER_SOURCES GLOBAL PROPERTY wrapper_sources)

View file

@ -481,6 +481,7 @@ void generate_implementation(const IDL::Interface& interface)
out() << "#include <LibWeb/DOM/Element.h>";
out() << "#include <LibWeb/HTML/HTMLElement.h>";
out() << "#include <LibWeb/DOM/EventListener.h>";
out() << "#include <LibWeb/Bindings/DocumentWrapper.h>";
out() << "#include <LibWeb/Bindings/DocumentTypeWrapper.h>";
out() << "#include <LibWeb/Bindings/HTMLCanvasElementWrapper.h>";
out() << "#include <LibWeb/Bindings/HTMLImageElementWrapper.h>";

View file

@ -34,30 +34,51 @@ namespace AttributeNames {
void initialize();
#define ENUMERATE_HTML_ATTRIBUTES \
__ENUMERATE_HTML_ATTRIBUTE(action) \
__ENUMERATE_HTML_ATTRIBUTE(align) \
__ENUMERATE_HTML_ATTRIBUTE(alt) \
__ENUMERATE_HTML_ATTRIBUTE(async) \
__ENUMERATE_HTML_ATTRIBUTE(bgcolor) \
__ENUMERATE_HTML_ATTRIBUTE(class_) \
__ENUMERATE_HTML_ATTRIBUTE(colspan) \
__ENUMERATE_HTML_ATTRIBUTE(data) \
__ENUMERATE_HTML_ATTRIBUTE(defer) \
__ENUMERATE_HTML_ATTRIBUTE(height) \
__ENUMERATE_HTML_ATTRIBUTE(href) \
__ENUMERATE_HTML_ATTRIBUTE(id) \
__ENUMERATE_HTML_ATTRIBUTE(lang) \
__ENUMERATE_HTML_ATTRIBUTE(method) \
__ENUMERATE_HTML_ATTRIBUTE(name) \
__ENUMERATE_HTML_ATTRIBUTE(rel) \
__ENUMERATE_HTML_ATTRIBUTE(size) \
__ENUMERATE_HTML_ATTRIBUTE(src) \
__ENUMERATE_HTML_ATTRIBUTE(style) \
__ENUMERATE_HTML_ATTRIBUTE(target) \
__ENUMERATE_HTML_ATTRIBUTE(title) \
__ENUMERATE_HTML_ATTRIBUTE(type) \
__ENUMERATE_HTML_ATTRIBUTE(value) \
#define ENUMERATE_HTML_ATTRIBUTES \
__ENUMERATE_HTML_ATTRIBUTE(abbr) \
__ENUMERATE_HTML_ATTRIBUTE(accept) \
__ENUMERATE_HTML_ATTRIBUTE(action) \
__ENUMERATE_HTML_ATTRIBUTE(align) \
__ENUMERATE_HTML_ATTRIBUTE(allow) \
__ENUMERATE_HTML_ATTRIBUTE(alt) \
__ENUMERATE_HTML_ATTRIBUTE(async) \
__ENUMERATE_HTML_ATTRIBUTE(bgcolor) \
__ENUMERATE_HTML_ATTRIBUTE(class_) \
__ENUMERATE_HTML_ATTRIBUTE(colspan) \
__ENUMERATE_HTML_ATTRIBUTE(data) \
__ENUMERATE_HTML_ATTRIBUTE(download) \
__ENUMERATE_HTML_ATTRIBUTE(defer) \
__ENUMERATE_HTML_ATTRIBUTE(dirname) \
__ENUMERATE_HTML_ATTRIBUTE(headers) \
__ENUMERATE_HTML_ATTRIBUTE(height) \
__ENUMERATE_HTML_ATTRIBUTE(href) \
__ENUMERATE_HTML_ATTRIBUTE(hreflang) \
__ENUMERATE_HTML_ATTRIBUTE(id) \
__ENUMERATE_HTML_ATTRIBUTE(imagesizes) \
__ENUMERATE_HTML_ATTRIBUTE(imagesrcset) \
__ENUMERATE_HTML_ATTRIBUTE(integrity) \
__ENUMERATE_HTML_ATTRIBUTE(lang) \
__ENUMERATE_HTML_ATTRIBUTE(max) \
__ENUMERATE_HTML_ATTRIBUTE(media) \
__ENUMERATE_HTML_ATTRIBUTE(method) \
__ENUMERATE_HTML_ATTRIBUTE(min) \
__ENUMERATE_HTML_ATTRIBUTE(name) \
__ENUMERATE_HTML_ATTRIBUTE(pattern) \
__ENUMERATE_HTML_ATTRIBUTE(ping) \
__ENUMERATE_HTML_ATTRIBUTE(placeholder) \
__ENUMERATE_HTML_ATTRIBUTE(rel) \
__ENUMERATE_HTML_ATTRIBUTE(size) \
__ENUMERATE_HTML_ATTRIBUTE(sizes) \
__ENUMERATE_HTML_ATTRIBUTE(src) \
__ENUMERATE_HTML_ATTRIBUTE(srcdoc) \
__ENUMERATE_HTML_ATTRIBUTE(srcset) \
__ENUMERATE_HTML_ATTRIBUTE(step) \
__ENUMERATE_HTML_ATTRIBUTE(style) \
__ENUMERATE_HTML_ATTRIBUTE(target) \
__ENUMERATE_HTML_ATTRIBUTE(title) \
__ENUMERATE_HTML_ATTRIBUTE(type) \
__ENUMERATE_HTML_ATTRIBUTE(usemap) \
__ENUMERATE_HTML_ATTRIBUTE(value) \
__ENUMERATE_HTML_ATTRIBUTE(width)
#define __ENUMERATE_HTML_ATTRIBUTE(name) extern FlyString name;

View file

@ -93,9 +93,27 @@ class ElementWrapper;
class EventWrapper;
class EventListenerWrapper;
class EventTargetWrapper;
class HTMLAnchorElementWrapper;
class HTMLBodyElementWrapper;
class HTMLBRElementWrapper;
class HTMLCanvasElementWrapper;
class HTMLElementWrapper;
class HTMLFormElementWrapper;
class HTMLHeadElementWrapper;
class HTMLHeadingElementWrapper;
class HTMLHRElementWrapper;
class HTMLHtmlElementWrapper;
class HTMLIFrameElementWrapper;
class HTMLImageElementWrapper;
class HTMLInputElementWrapper;
class HTMLLinkElementWrapper;
class HTMLObjectElementWrapper;
class HTMLScriptElementWrapper;
class HTMLStyleElementWrapper;
class HTMLTableCellElementWrapper;
class HTMLTableElementWrapper;
class HTMLTableRowElementWrapper;
class HTMLTitleElementWrapper;
class ImageDataWrapper;
class LocationObject;
class MouseEventWrapper;

View file

@ -32,6 +32,8 @@ namespace Web {
class HTMLAnchorElement : public HTMLElement {
public:
using WrapperType = Bindings::HTMLAnchorElementWrapper;
HTMLAnchorElement(DOM::Document&, const FlyString& local_name);
virtual ~HTMLAnchorElement() override;

View file

@ -0,0 +1,10 @@
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;
}

View file

@ -32,6 +32,8 @@ namespace Web {
class HTMLBRElement final : public HTMLElement {
public:
using WrapperType = Bindings::HTMLBRElementWrapper;
HTMLBRElement(DOM::Document&, const FlyString& local_name);
virtual ~HTMLBRElement() override;

View file

@ -0,0 +1,5 @@
interface HTMLBRElement : HTMLElement {
}

View file

@ -32,6 +32,8 @@ namespace Web {
class HTMLBodyElement : public HTMLElement {
public:
using WrapperType = Bindings::HTMLBodyElementWrapper;
HTMLBodyElement(DOM::Document&, const FlyString& local_name);
virtual ~HTMLBodyElement() override;

View file

@ -0,0 +1,5 @@
interface HTMLBodyElement : HTMLElement {
}

View file

@ -33,6 +33,8 @@ namespace Web {
class HTMLFormElement : public HTMLElement {
public:
using WrapperType = Bindings::HTMLFormElementWrapper;
HTMLFormElement(DOM::Document&, const FlyString& local_name);
virtual ~HTMLFormElement() override;

View file

@ -0,0 +1,6 @@
interface HTMLFormElement : HTMLElement {
[Reflect] attribute DOMString name;
[Reflect] attribute DOMString rel;
}

View file

@ -32,6 +32,8 @@ namespace Web {
class HTMLHRElement : public HTMLElement {
public:
using WrapperType = Bindings::HTMLHRElementWrapper;
HTMLHRElement(DOM::Document&, const FlyString& local_name);
virtual ~HTMLHRElement() override;
};

View file

@ -0,0 +1,5 @@
interface HTMLHRElement : HTMLElement {
}

View file

@ -32,6 +32,8 @@ namespace Web {
class HTMLHeadElement : public HTMLElement {
public:
using WrapperType = Bindings::HTMLHeadElementWrapper;
HTMLHeadElement(DOM::Document&, const FlyString& local_name);
virtual ~HTMLHeadElement() override;
};

View file

@ -0,0 +1,5 @@
interface HTMLHeadElement : HTMLElement {
}

View file

@ -32,8 +32,14 @@ namespace Web {
class HTMLHeadingElement : public HTMLElement {
public:
using WrapperType = Bindings::HTMLHeadingElementWrapper;
HTMLHeadingElement(DOM::Document&, const FlyString& local_name);
virtual ~HTMLHeadingElement() override;
};
}
AK_BEGIN_TYPE_TRAITS(Web::HTMLHeadingElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTMLElement>(node).local_name().is_one_of(Web::HTML::TagNames::h1, Web::HTML::TagNames::h2, Web::HTML::TagNames::h3, Web::HTML::TagNames::h4, Web::HTML::TagNames::h5, Web::HTML::TagNames::h6); }
AK_END_TYPE_TRAITS()

View file

@ -0,0 +1,5 @@
interface HTMLHeadingElement : HTMLElement {
}

View file

@ -32,6 +32,8 @@ namespace Web {
class HTMLHtmlElement : public HTMLElement {
public:
using WrapperType = Bindings::HTMLHtmlElementWrapper;
HTMLHtmlElement(DOM::Document&, const FlyString& local_name);
virtual ~HTMLHtmlElement() override;
};

View file

@ -0,0 +1,5 @@
interface HTMLHtmlElement : HTMLElement {
}

View file

@ -82,7 +82,7 @@ void HTMLIFrameElement::load_src(const String& value)
m_hosted_frame->loader().load(url, FrameLoader::Type::IFrame);
}
const DOM::Document* HTMLIFrameElement::hosted_document() const
const DOM::Document* HTMLIFrameElement::content_document() const
{
return m_hosted_frame ? m_hosted_frame->document() : nullptr;
}

View file

@ -32,6 +32,8 @@ namespace Web {
class HTMLIFrameElement final : public HTMLElement {
public:
using WrapperType = Bindings::HTMLIFrameElementWrapper;
HTMLIFrameElement(DOM::Document&, const FlyString& local_name);
virtual ~HTMLIFrameElement() override;
@ -40,7 +42,7 @@ public:
Frame* hosted_frame() { return m_hosted_frame; }
const Frame* hosted_frame() const { return m_hosted_frame; }
const DOM::Document* hosted_document() const;
const DOM::Document* content_document() const;
private:
virtual void document_did_attach_to_frame(Frame&) override;

View file

@ -0,0 +1,12 @@
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;
readonly attribute Document? contentDocument;
}

View file

@ -2,5 +2,8 @@ interface HTMLImageElement : HTMLElement {
[Reflect] attribute DOMString src;
[Reflect] attribute DOMString alt;
[Reflect] attribute DOMString srcset;
[Reflect] attribute DOMString sizes;
[Reflect=usemap] attribute DOMString useMap;
}

View file

@ -32,6 +32,8 @@ namespace Web {
class HTMLInputElement : public HTMLElement {
public:
using WrapperType = Bindings::HTMLInputElementWrapper;
HTMLInputElement(DOM::Document&, const FlyString& local_name);
virtual ~HTMLInputElement() override;

View file

@ -0,0 +1,14 @@
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;
}

View file

@ -35,6 +35,8 @@ class HTMLLinkElement final
: public HTMLElement
, public ResourceClient {
public:
using WrapperType = Bindings::HTMLLinkElementWrapper;
HTMLLinkElement(DOM::Document&, const FlyString& local_name);
virtual ~HTMLLinkElement() override;

View file

@ -0,0 +1,12 @@
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;
}

View file

@ -37,6 +37,8 @@ class LayoutDocument;
class HTMLObjectElement final : public HTMLElement {
public:
using WrapperType = Bindings::HTMLObjectElementWrapper;
HTMLObjectElement(DOM::Document&, const FlyString& local_name);
virtual ~HTMLObjectElement() override;

View file

@ -0,0 +1,8 @@
interface HTMLObjectElement : HTMLElement {
[Reflect] attribute DOMString data;
[Reflect] attribute DOMString type;
[Reflect] attribute DOMString name;
[Reflect=usemap] attribute DOMString useMap;
}

View file

@ -33,6 +33,8 @@ namespace Web {
class HTMLScriptElement : public HTMLElement {
public:
using WrapperType = Bindings::HTMLScriptElementWrapper;
HTMLScriptElement(DOM::Document&, const FlyString& local_name);
virtual ~HTMLScriptElement() override;

View file

@ -0,0 +1,7 @@
interface HTMLScriptElement : HTMLElement {
[Reflect] attribute DOMString src;
[Reflect] attribute DOMString type;
[Reflect] attribute DOMString integrity;
}

View file

@ -32,6 +32,8 @@ namespace Web {
class HTMLStyleElement : public HTMLElement {
public:
using WrapperType = Bindings::HTMLStyleElementWrapper;
HTMLStyleElement(DOM::Document&, const FlyString& local_name);
virtual ~HTMLStyleElement() override;

View file

@ -0,0 +1,5 @@
interface HTMLStyleElement : HTMLElement {
[Reflect] attribute DOMString media;
}

View file

@ -32,6 +32,8 @@ namespace Web {
class HTMLTableCellElement final : public HTMLElement {
public:
using WrapperType = Bindings::HTMLTableCellElementWrapper;
HTMLTableCellElement(DOM::Document&, const FlyString& local_name);
virtual ~HTMLTableCellElement() override;
@ -42,5 +44,5 @@ private:
}
AK_BEGIN_TYPE_TRAITS(Web::HTMLTableCellElement)
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTMLElement>(node).local_name() == Web::HTML::TagNames::td; }
static bool is_type(const Web::DOM::Node& node) { return node.is_html_element() && downcast<Web::HTMLElement>(node).local_name().is_one_of(Web::HTML::TagNames::td, Web::HTML::TagNames::th); }
AK_END_TYPE_TRAITS()

View file

@ -0,0 +1,6 @@
interface HTMLTableCellElement : HTMLElement {
[Reflect] attribute DOMString headers;
[Reflect] attribute DOMString abbr;
}

View file

@ -32,6 +32,8 @@ namespace Web {
class HTMLTableElement final : public HTMLElement {
public:
using WrapperType = Bindings::HTMLTableElementWrapper;
HTMLTableElement(DOM::Document&, const FlyString& local_name);
virtual ~HTMLTableElement() override;

View file

@ -0,0 +1,5 @@
interface HTMLTableElement : HTMLElement {
}

View file

@ -32,6 +32,8 @@ namespace Web {
class HTMLTableRowElement : public HTMLElement {
public:
using WrapperType = Bindings::HTMLTableRowElementWrapper;
HTMLTableRowElement(DOM::Document&, const FlyString& local_name);
virtual ~HTMLTableRowElement() override;
};

View file

@ -0,0 +1,5 @@
interface HTMLTableRowElement : HTMLElement {
}

View file

@ -32,6 +32,8 @@ namespace Web {
class HTMLTitleElement : public HTMLElement {
public:
using WrapperType = Bindings::HTMLTitleElementWrapper;
HTMLTitleElement(DOM::Document&, const FlyString& local_name);
virtual ~HTMLTitleElement() override;
};

View file

@ -0,0 +1,5 @@
interface HTMLTitleElement : HTMLElement {
}

View file

@ -64,7 +64,7 @@ void LayoutFrame::paint(PaintContext& context, PaintPhase phase)
LayoutReplaced::paint(context, phase);
if (phase == PaintPhase::Foreground) {
auto* hosted_document = node().hosted_document();
auto* hosted_document = node().content_document();
if (!hosted_document)
return;
auto* hosted_layout_tree = hosted_document->layout_node();