summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-06-21 00:59:28 +0200
committerAndreas Kling <kling@serenityos.org>2020-06-21 01:00:30 +0200
commitfaff557400a0c6979e82cf22769d9df6f988ed94 (patch)
tree42df8f1fe66ec7aaeb06d122b8a2eb0c9e58d844
parent319ef8aa86f30d016ce331ce507c7fe91ea67b96 (diff)
downloadserenity-faff557400a0c6979e82cf22769d9df6f988ed94.zip
LibWeb: Expose Document.body to the web
Also, make it return a HTMLElement since Document.body should actually return the frameset element in a frame-based document.
-rw-r--r--Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp1
-rw-r--r--Libraries/LibWeb/DOM/Document.cpp2
-rw-r--r--Libraries/LibWeb/DOM/Document.h2
-rw-r--r--Libraries/LibWeb/DOM/Document.idl2
4 files changed, 5 insertions, 2 deletions
diff --git a/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp b/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp
index 7f4fc52665..043e2811c8 100644
--- a/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp
+++ b/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp
@@ -376,6 +376,7 @@ void generate_implementation(const IDL::Interface& interface)
out() << "#include <LibWeb/Bindings/NodeWrapperFactory.h>";
out() << "#include <LibWeb/Bindings/" << wrapper_class << ".h>";
out() << "#include <LibWeb/DOM/Element.h>";
+ out() << "#include <LibWeb/DOM/HTMLElement.h>";
out() << "namespace Web {";
out() << "namespace Bindings {";
diff --git a/Libraries/LibWeb/DOM/Document.cpp b/Libraries/LibWeb/DOM/Document.cpp
index 19083596f0..cacd240404 100644
--- a/Libraries/LibWeb/DOM/Document.cpp
+++ b/Libraries/LibWeb/DOM/Document.cpp
@@ -138,7 +138,7 @@ const HTMLHeadElement* Document::head() const
return html->first_child_of_type<HTMLHeadElement>();
}
-const HTMLBodyElement* Document::body() const
+const HTMLElement* Document::body() const
{
auto* html = document_element();
if (!html)
diff --git a/Libraries/LibWeb/DOM/Document.h b/Libraries/LibWeb/DOM/Document.h
index 5073b14ec3..0997643585 100644
--- a/Libraries/LibWeb/DOM/Document.h
+++ b/Libraries/LibWeb/DOM/Document.h
@@ -81,7 +81,7 @@ public:
const HTMLHtmlElement* document_element() const;
const HTMLHeadElement* head() const;
- const HTMLBodyElement* body() const;
+ const HTMLElement* body() const;
String title() const;
diff --git a/Libraries/LibWeb/DOM/Document.idl b/Libraries/LibWeb/DOM/Document.idl
index 2337154044..59f032b216 100644
--- a/Libraries/LibWeb/DOM/Document.idl
+++ b/Libraries/LibWeb/DOM/Document.idl
@@ -5,4 +5,6 @@ interface Document : Node {
ArrayFromVector querySelectorAll(DOMString selectors);
Element createElement(DOMString tagName);
+ readonly attribute HTMLElement? body;
+
}