summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-08-04 20:13:52 +0200
committerAndreas Kling <kling@serenityos.org>2022-08-05 12:42:46 +0200
commit2801ddfa76691d8e9ca7fd6030192dea89e9b528 (patch)
treec28fb9835c2257dabfbe6262823bce21b63ef879 /Userland/Libraries
parent8909ef5b90405c38a0b8b9a55e7069656f22b3dc (diff)
downloadserenity-2801ddfa76691d8e9ca7fd6030192dea89e9b528.zip
LibWeb: Implement (naive) version of HTMLIFrameElement.contentWindow
This should really return the WindowProxy, but since we don't have the infrastructure set up just yet, just return the window object itself for now.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibWeb/HTML/BrowsingContextContainer.cpp9
-rw-r--r--Userland/Libraries/LibWeb/HTML/BrowsingContextContainer.h2
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.idl3
3 files changed, 14 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContextContainer.cpp b/Userland/Libraries/LibWeb/HTML/BrowsingContextContainer.cpp
index 0b40fc808a..7842d9ffcc 100644
--- a/Userland/Libraries/LibWeb/HTML/BrowsingContextContainer.cpp
+++ b/Userland/Libraries/LibWeb/HTML/BrowsingContextContainer.cpp
@@ -103,4 +103,13 @@ const DOM::Document* BrowsingContextContainer::get_svg_document() const
return nullptr;
}
+HTML::Window* BrowsingContextContainer::content_window() const
+{
+ // FIXME: This should return the WindowProxy
+ auto* document = content_document();
+ if (!document)
+ return nullptr;
+ return const_cast<HTML::Window*>(&document->window());
+}
+
}
diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContextContainer.h b/Userland/Libraries/LibWeb/HTML/BrowsingContextContainer.h
index 78b6071d9c..5cdc7ca497 100644
--- a/Userland/Libraries/LibWeb/HTML/BrowsingContextContainer.h
+++ b/Userland/Libraries/LibWeb/HTML/BrowsingContextContainer.h
@@ -21,6 +21,8 @@ public:
const DOM::Document* content_document() const;
DOM::Document const* content_document_without_origin_check() const;
+ HTML::Window* content_window() const;
+
DOM::Document const* get_svg_document() const;
protected:
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.idl
index 3ff48d9b1b..8c25b63df6 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.idl
+++ b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.idl
@@ -13,6 +13,9 @@ interface HTMLIFrameElement : HTMLElement {
readonly attribute Document? contentDocument;
+ // FIXME: Should return a WindowProxy?
+ readonly attribute Window? contentWindow;
+
[Reflect] attribute DOMString align;
[Reflect] attribute DOMString scrolling;
[Reflect=frameborder] attribute DOMString frameBorder;