Просмотр исходного кода

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.
Luke 5 лет назад
Родитель
Сommit
a2b40de0cc
44 измененных файлов с 327 добавлено и 29 удалено
  1. 73 1
      Libraries/LibWeb/Bindings/NodeWrapperFactory.cpp
  2. 18 0
      Libraries/LibWeb/CMakeLists.txt
  3. 1 0
      Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp
  4. 45 24
      Libraries/LibWeb/DOM/AttributeNames.h
  5. 18 0
      Libraries/LibWeb/Forward.h
  6. 2 0
      Libraries/LibWeb/HTML/HTMLAnchorElement.h
  7. 10 0
      Libraries/LibWeb/HTML/HTMLAnchorElement.idl
  8. 2 0
      Libraries/LibWeb/HTML/HTMLBRElement.h
  9. 5 0
      Libraries/LibWeb/HTML/HTMLBRElement.idl
  10. 2 0
      Libraries/LibWeb/HTML/HTMLBodyElement.h
  11. 5 0
      Libraries/LibWeb/HTML/HTMLBodyElement.idl
  12. 2 0
      Libraries/LibWeb/HTML/HTMLFormElement.h
  13. 6 0
      Libraries/LibWeb/HTML/HTMLFormElement.idl
  14. 2 0
      Libraries/LibWeb/HTML/HTMLHRElement.h
  15. 5 0
      Libraries/LibWeb/HTML/HTMLHRElement.idl
  16. 2 0
      Libraries/LibWeb/HTML/HTMLHeadElement.h
  17. 5 0
      Libraries/LibWeb/HTML/HTMLHeadElement.idl
  18. 6 0
      Libraries/LibWeb/HTML/HTMLHeadingElement.h
  19. 5 0
      Libraries/LibWeb/HTML/HTMLHeadingElement.idl
  20. 2 0
      Libraries/LibWeb/HTML/HTMLHtmlElement.h
  21. 5 0
      Libraries/LibWeb/HTML/HTMLHtmlElement.idl
  22. 1 1
      Libraries/LibWeb/HTML/HTMLIFrameElement.cpp
  23. 3 1
      Libraries/LibWeb/HTML/HTMLIFrameElement.h
  24. 12 0
      Libraries/LibWeb/HTML/HTMLIFrameElement.idl
  25. 3 0
      Libraries/LibWeb/HTML/HTMLImageElement.idl
  26. 2 0
      Libraries/LibWeb/HTML/HTMLInputElement.h
  27. 14 0
      Libraries/LibWeb/HTML/HTMLInputElement.idl
  28. 2 0
      Libraries/LibWeb/HTML/HTMLLinkElement.h
  29. 12 0
      Libraries/LibWeb/HTML/HTMLLinkElement.idl
  30. 2 0
      Libraries/LibWeb/HTML/HTMLObjectElement.h
  31. 8 0
      Libraries/LibWeb/HTML/HTMLObjectElement.idl
  32. 2 0
      Libraries/LibWeb/HTML/HTMLScriptElement.h
  33. 7 0
      Libraries/LibWeb/HTML/HTMLScriptElement.idl
  34. 2 0
      Libraries/LibWeb/HTML/HTMLStyleElement.h
  35. 5 0
      Libraries/LibWeb/HTML/HTMLStyleElement.idl
  36. 3 1
      Libraries/LibWeb/HTML/HTMLTableCellElement.h
  37. 6 0
      Libraries/LibWeb/HTML/HTMLTableCellElement.idl
  38. 2 0
      Libraries/LibWeb/HTML/HTMLTableElement.h
  39. 5 0
      Libraries/LibWeb/HTML/HTMLTableElement.idl
  40. 2 0
      Libraries/LibWeb/HTML/HTMLTableRowElement.h
  41. 5 0
      Libraries/LibWeb/HTML/HTMLTableRowElement.idl
  42. 2 0
      Libraries/LibWeb/HTML/HTMLTitleElement.h
  43. 5 0
      Libraries/LibWeb/HTML/HTMLTitleElement.idl
  44. 1 1
      Libraries/LibWeb/Layout/LayoutFrame.cpp

+ 73 - 1
Libraries/LibWeb/Bindings/NodeWrapperFactory.cpp

@@ -26,13 +26,49 @@
 
 
 #include <LibWeb/Bindings/DocumentWrapper.h>
 #include <LibWeb/Bindings/DocumentWrapper.h>
 #include <LibWeb/Bindings/DocumentTypeWrapper.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/HTMLCanvasElementWrapper.h>
-#include <LibWeb/Bindings/HTMLImageElementWrapper.h>
 #include <LibWeb/Bindings/HTMLElementWrapper.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/Bindings/NodeWrapper.h>
 #include <LibWeb/DOM/Document.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/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/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>
 #include <LibWeb/DOM/Node.h>
 
 
 namespace Web {
 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)));
         return static_cast<NodeWrapper*>(wrap_impl(global_object, downcast<DOM::Document>(node)));
     if (is<DOM::DocumentType>(node))
     if (is<DOM::DocumentType>(node))
         return static_cast<NodeWrapper*>(wrap_impl(global_object, downcast<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))
     if (is<HTMLCanvasElement>(node))
         return static_cast<NodeWrapper*>(wrap_impl(global_object, downcast<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))
     if (is<HTMLImageElement>(node))
         return static_cast<NodeWrapper*>(wrap_impl(global_object, downcast<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))
     if (is<HTMLElement>(node))
         return static_cast<NodeWrapper*>(wrap_impl(global_object, downcast<HTMLElement>(node)));
         return static_cast<NodeWrapper*>(wrap_impl(global_object, downcast<HTMLElement>(node)));
     if (is<DOM::Element>(node))
     if (is<DOM::Element>(node))

+ 18 - 0
Libraries/LibWeb/CMakeLists.txt

@@ -169,9 +169,27 @@ libweb_js_wrapper(DOM/EventTarget)
 libweb_js_wrapper(DOM/MouseEvent)
 libweb_js_wrapper(DOM/MouseEvent)
 libweb_js_wrapper(DOM/Node)
 libweb_js_wrapper(DOM/Node)
 libweb_js_wrapper(HTML/CanvasRenderingContext2D)
 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/HTMLCanvasElement)
 libweb_js_wrapper(HTML/HTMLElement)
 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/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)
 libweb_js_wrapper(HTML/ImageData)
 
 
 get_property(WRAPPER_SOURCES GLOBAL PROPERTY wrapper_sources)
 get_property(WRAPPER_SOURCES GLOBAL PROPERTY wrapper_sources)

+ 1 - 0
Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp

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

+ 45 - 24
Libraries/LibWeb/DOM/AttributeNames.h

@@ -34,30 +34,51 @@ namespace AttributeNames {
 
 
 void initialize();
 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)
     __ENUMERATE_HTML_ATTRIBUTE(width)
 
 
 #define __ENUMERATE_HTML_ATTRIBUTE(name) extern FlyString name;
 #define __ENUMERATE_HTML_ATTRIBUTE(name) extern FlyString name;

+ 18 - 0
Libraries/LibWeb/Forward.h

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

+ 2 - 0
Libraries/LibWeb/HTML/HTMLAnchorElement.h

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

+ 10 - 0
Libraries/LibWeb/HTML/HTMLAnchorElement.idl

@@ -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;
+
+}

+ 2 - 0
Libraries/LibWeb/HTML/HTMLBRElement.h

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

+ 5 - 0
Libraries/LibWeb/HTML/HTMLBRElement.idl

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

+ 2 - 0
Libraries/LibWeb/HTML/HTMLBodyElement.h

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

+ 5 - 0
Libraries/LibWeb/HTML/HTMLBodyElement.idl

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

+ 2 - 0
Libraries/LibWeb/HTML/HTMLFormElement.h

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

+ 6 - 0
Libraries/LibWeb/HTML/HTMLFormElement.idl

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

+ 2 - 0
Libraries/LibWeb/HTML/HTMLHRElement.h

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

+ 5 - 0
Libraries/LibWeb/HTML/HTMLHRElement.idl

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

+ 2 - 0
Libraries/LibWeb/HTML/HTMLHeadElement.h

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

+ 5 - 0
Libraries/LibWeb/HTML/HTMLHeadElement.idl

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

+ 6 - 0
Libraries/LibWeb/HTML/HTMLHeadingElement.h

@@ -32,8 +32,14 @@ namespace Web {
 
 
 class HTMLHeadingElement : public HTMLElement {
 class HTMLHeadingElement : public HTMLElement {
 public:
 public:
+    using WrapperType = Bindings::HTMLHeadingElementWrapper;
+
     HTMLHeadingElement(DOM::Document&, const FlyString& local_name);
     HTMLHeadingElement(DOM::Document&, const FlyString& local_name);
     virtual ~HTMLHeadingElement() override;
     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()

+ 5 - 0
Libraries/LibWeb/HTML/HTMLHeadingElement.idl

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

+ 2 - 0
Libraries/LibWeb/HTML/HTMLHtmlElement.h

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

+ 5 - 0
Libraries/LibWeb/HTML/HTMLHtmlElement.idl

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

+ 1 - 1
Libraries/LibWeb/HTML/HTMLIFrameElement.cpp

@@ -82,7 +82,7 @@ void HTMLIFrameElement::load_src(const String& value)
     m_hosted_frame->loader().load(url, FrameLoader::Type::IFrame);
     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;
     return m_hosted_frame ? m_hosted_frame->document() : nullptr;
 }
 }

+ 3 - 1
Libraries/LibWeb/HTML/HTMLIFrameElement.h

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

+ 12 - 0
Libraries/LibWeb/HTML/HTMLIFrameElement.idl

@@ -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;
+
+}

+ 3 - 0
Libraries/LibWeb/HTML/HTMLImageElement.idl

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

+ 2 - 0
Libraries/LibWeb/HTML/HTMLInputElement.h

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

+ 14 - 0
Libraries/LibWeb/HTML/HTMLInputElement.idl

@@ -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;
+
+}

+ 2 - 0
Libraries/LibWeb/HTML/HTMLLinkElement.h

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

+ 12 - 0
Libraries/LibWeb/HTML/HTMLLinkElement.idl

@@ -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;
+
+}

+ 2 - 0
Libraries/LibWeb/HTML/HTMLObjectElement.h

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

+ 8 - 0
Libraries/LibWeb/HTML/HTMLObjectElement.idl

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

+ 2 - 0
Libraries/LibWeb/HTML/HTMLScriptElement.h

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

+ 7 - 0
Libraries/LibWeb/HTML/HTMLScriptElement.idl

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

+ 2 - 0
Libraries/LibWeb/HTML/HTMLStyleElement.h

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

+ 5 - 0
Libraries/LibWeb/HTML/HTMLStyleElement.idl

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

+ 3 - 1
Libraries/LibWeb/HTML/HTMLTableCellElement.h

@@ -32,6 +32,8 @@ namespace Web {
 
 
 class HTMLTableCellElement final : public HTMLElement {
 class HTMLTableCellElement final : public HTMLElement {
 public:
 public:
+    using WrapperType = Bindings::HTMLTableCellElementWrapper;
+
     HTMLTableCellElement(DOM::Document&, const FlyString& local_name);
     HTMLTableCellElement(DOM::Document&, const FlyString& local_name);
     virtual ~HTMLTableCellElement() override;
     virtual ~HTMLTableCellElement() override;
 
 
@@ -42,5 +44,5 @@ private:
 }
 }
 
 
 AK_BEGIN_TYPE_TRAITS(Web::HTMLTableCellElement)
 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()
 AK_END_TYPE_TRAITS()

+ 6 - 0
Libraries/LibWeb/HTML/HTMLTableCellElement.idl

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

+ 2 - 0
Libraries/LibWeb/HTML/HTMLTableElement.h

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

+ 5 - 0
Libraries/LibWeb/HTML/HTMLTableElement.idl

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

+ 2 - 0
Libraries/LibWeb/HTML/HTMLTableRowElement.h

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

+ 5 - 0
Libraries/LibWeb/HTML/HTMLTableRowElement.idl

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

+ 2 - 0
Libraries/LibWeb/HTML/HTMLTitleElement.h

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

+ 5 - 0
Libraries/LibWeb/HTML/HTMLTitleElement.idl

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

+ 1 - 1
Libraries/LibWeb/Layout/LayoutFrame.cpp

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