diff --git a/Libraries/LibWeb/Bindings/HTMLCanvasElementWrapper.cpp b/Libraries/LibWeb/Bindings/HTMLCanvasElementWrapper.cpp
index 1e7e904b62..954bd3baf8 100644
--- a/Libraries/LibWeb/Bindings/HTMLCanvasElementWrapper.cpp
+++ b/Libraries/LibWeb/Bindings/HTMLCanvasElementWrapper.cpp
@@ -39,7 +39,7 @@ namespace Web {
namespace Bindings {
HTMLCanvasElementWrapper::HTMLCanvasElementWrapper(JS::GlobalObject& global_object, HTMLCanvasElement& element)
- : ElementWrapper(global_object, element)
+ : HTMLElementWrapper(global_object, element)
{
}
diff --git a/Libraries/LibWeb/Bindings/HTMLCanvasElementWrapper.h b/Libraries/LibWeb/Bindings/HTMLCanvasElementWrapper.h
index dcea425e86..d981484b7e 100644
--- a/Libraries/LibWeb/Bindings/HTMLCanvasElementWrapper.h
+++ b/Libraries/LibWeb/Bindings/HTMLCanvasElementWrapper.h
@@ -26,12 +26,12 @@
#pragma once
-#include
+#include
namespace Web {
namespace Bindings {
-class HTMLCanvasElementWrapper : public ElementWrapper {
+class HTMLCanvasElementWrapper : public HTMLElementWrapper {
public:
HTMLCanvasElementWrapper(JS::GlobalObject&, HTMLCanvasElement&);
virtual void initialize(JS::Interpreter&, JS::GlobalObject&) override;
diff --git a/Libraries/LibWeb/Bindings/HTMLImageElementWrapper.cpp b/Libraries/LibWeb/Bindings/HTMLImageElementWrapper.cpp
index 1bfd457349..d4c0f274ea 100644
--- a/Libraries/LibWeb/Bindings/HTMLImageElementWrapper.cpp
+++ b/Libraries/LibWeb/Bindings/HTMLImageElementWrapper.cpp
@@ -36,7 +36,7 @@ namespace Web {
namespace Bindings {
HTMLImageElementWrapper::HTMLImageElementWrapper(JS::GlobalObject& global_object, HTMLImageElement& element)
- : ElementWrapper(global_object, element)
+ : HTMLElementWrapper(global_object, element)
{
}
diff --git a/Libraries/LibWeb/Bindings/HTMLImageElementWrapper.h b/Libraries/LibWeb/Bindings/HTMLImageElementWrapper.h
index e5bda62fce..8d6cc0b40b 100644
--- a/Libraries/LibWeb/Bindings/HTMLImageElementWrapper.h
+++ b/Libraries/LibWeb/Bindings/HTMLImageElementWrapper.h
@@ -26,12 +26,12 @@
#pragma once
-#include
+#include
namespace Web {
namespace Bindings {
-class HTMLImageElementWrapper : public ElementWrapper {
+class HTMLImageElementWrapper : public HTMLElementWrapper {
public:
HTMLImageElementWrapper(JS::GlobalObject&, HTMLImageElement&);
virtual ~HTMLImageElementWrapper() override;
diff --git a/Libraries/LibWeb/Bindings/NodeWrapperFactory.cpp b/Libraries/LibWeb/Bindings/NodeWrapperFactory.cpp
index a15708318a..30bc0edeb1 100644
--- a/Libraries/LibWeb/Bindings/NodeWrapperFactory.cpp
+++ b/Libraries/LibWeb/Bindings/NodeWrapperFactory.cpp
@@ -28,6 +28,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -45,6 +46,8 @@ NodeWrapper* wrap(JS::Heap& heap, Node& node)
return static_cast(wrap_impl(heap, to(node)));
if (is(node))
return static_cast(wrap_impl(heap, to(node)));
+ if (is(node))
+ return static_cast(wrap_impl(heap, to(node)));
if (is(node))
return static_cast(wrap_impl(heap, to(node)));
return static_cast(wrap_impl(heap, node));
diff --git a/Libraries/LibWeb/Bindings/Wrapper.h b/Libraries/LibWeb/Bindings/Wrapper.h
index 8ddb818daf..bcb72bb440 100644
--- a/Libraries/LibWeb/Bindings/Wrapper.h
+++ b/Libraries/LibWeb/Bindings/Wrapper.h
@@ -42,6 +42,7 @@ public:
virtual bool is_node_wrapper() const { return false; }
virtual bool is_document_wrapper() const { return false; }
virtual bool is_element_wrapper() const { return false; }
+ virtual bool is_htmlelement_wrapper() const { return false; }
protected:
explicit Wrapper(Object& prototype)
diff --git a/Libraries/LibWeb/CMakeLists.txt b/Libraries/LibWeb/CMakeLists.txt
index 0169dc17c2..101c1a05f0 100644
--- a/Libraries/LibWeb/CMakeLists.txt
+++ b/Libraries/LibWeb/CMakeLists.txt
@@ -1,12 +1,6 @@
set(SOURCES
Bindings/CanvasRenderingContext2DWrapper.cpp
- Bindings/DocumentWrapper.cpp
- Bindings/DocumentWrapper.h
- Bindings/ElementWrapper.cpp
- Bindings/ElementWrapper.h
Bindings/EventListenerWrapper.cpp
- Bindings/EventTargetWrapper.cpp
- Bindings/EventTargetWrapper.h
Bindings/EventWrapper.cpp
Bindings/HTMLCanvasElementWrapper.cpp
Bindings/HTMLImageElementWrapper.cpp
@@ -14,8 +8,6 @@ set(SOURCES
Bindings/LocationObject.cpp
Bindings/MouseEventWrapper.cpp
Bindings/NavigatorObject.cpp
- Bindings/NodeWrapper.cpp
- Bindings/NodeWrapper.h
Bindings/NodeWrapperFactory.cpp
Bindings/WindowObject.cpp
Bindings/Wrappable.cpp
@@ -128,7 +120,19 @@ set(GENERATED_SOURCES
../../Services/ProtocolServer/ProtocolServerEndpoint.h
)
+set_property(GLOBAL PROPERTY wrapper_sources)
+function(add_wrapper_sources)
+ get_property(tmp GLOBAL PROPERTY wrapper_sources)
+ foreach(arg ${ARGV})
+ set(tmp ${tmp}
+ ${arg}
+ )
+ endforeach()
+ set_property(GLOBAL PROPERTY wrapper_sources "${tmp}")
+endfunction(add_wrapper_sources)
+
function(libweb_js_wrapper class)
+ add_wrapper_sources(Bindings/${class}Wrapper.cpp Bindings/${class}Wrapper.h)
add_custom_command(
OUTPUT Bindings/${class}Wrapper.h
COMMAND /bin/mkdir -p Bindings
@@ -146,12 +150,17 @@ function(libweb_js_wrapper class)
MAIN_DEPENDENCY DOM/${class}.idl
)
add_custom_target(generate_${class}Wrapper.h DEPENDS Bindings/${class}Wrapper.h)
+ add_custom_target(generate_${class}Wrapper.cpp DEPENDS Bindings/${class}Wrapper.cpp)
endfunction()
libweb_js_wrapper(EventTarget)
libweb_js_wrapper(Node)
libweb_js_wrapper(Document)
libweb_js_wrapper(Element)
+libweb_js_wrapper(HTMLElement)
+
+get_property(WRAPPER_SOURCES GLOBAL PROPERTY wrapper_sources)
+set(SOURCES ${SOURCES} ${WRAPPER_SOURCES})
add_custom_command(
OUTPUT CSS/PropertyID.h
diff --git a/Libraries/LibWeb/DOM/HTMLElement.h b/Libraries/LibWeb/DOM/HTMLElement.h
index 42c9fa2ffa..f3b42191c9 100644
--- a/Libraries/LibWeb/DOM/HTMLElement.h
+++ b/Libraries/LibWeb/DOM/HTMLElement.h
@@ -32,10 +32,13 @@ namespace Web {
class HTMLElement : public Element {
public:
+ using WrapperType = Bindings::HTMLElementWrapper;
+
HTMLElement(Document&, const FlyString& tag_name);
virtual ~HTMLElement() override;
String title() const { return attribute(HTML::AttributeNames::title); }
+ void set_title(const String& value) { set_attribute(HTML::AttributeNames::title, value); }
private:
virtual bool is_html_element() const final { return true; }
diff --git a/Libraries/LibWeb/DOM/HTMLElement.idl b/Libraries/LibWeb/DOM/HTMLElement.idl
new file mode 100644
index 0000000000..ab385b83d8
--- /dev/null
+++ b/Libraries/LibWeb/DOM/HTMLElement.idl
@@ -0,0 +1,5 @@
+interface HTMLElement : Element {
+
+ attribute DOMString title;
+
+}
diff --git a/Libraries/LibWeb/Forward.h b/Libraries/LibWeb/Forward.h
index d07566e00f..59b309e32a 100644
--- a/Libraries/LibWeb/Forward.h
+++ b/Libraries/LibWeb/Forward.h
@@ -81,6 +81,7 @@ class EventWrapper;
class EventListenerWrapper;
class EventTargetWrapper;
class HTMLCanvasElementWrapper;
+class HTMLElementWrapper;
class HTMLImageElementWrapper;
class ImageDataWrapper;
class LocationObject;