From 2f021e92a53b0480d2c6478080f2c3dcb4f721fc Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sat, 5 Mar 2022 00:13:13 +0100 Subject: [PATCH] LibWeb: Add Window::browsing_context() https://html.spec.whatwg.org/multipage/window-object.html#window-bc > The Window object's browsing context is the Window object's associated > Document's browsing context. > NOTE: It is either null or a browsing context. --- Userland/Libraries/LibWeb/DOM/Window.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Userland/Libraries/LibWeb/DOM/Window.h b/Userland/Libraries/LibWeb/DOM/Window.h index f22f05ae29..e8b57be84b 100644 --- a/Userland/Libraries/LibWeb/DOM/Window.h +++ b/Userland/Libraries/LibWeb/DOM/Window.h @@ -14,8 +14,10 @@ #include #include #include +#include #include #include +#include #include namespace Web::DOM { @@ -41,9 +43,14 @@ public: Page* page(); Page const* page() const; + // https://html.spec.whatwg.org/multipage/window-object.html#concept-document-window Document const& associated_document() const { return *m_associated_document; } Document& associated_document() { return *m_associated_document; } + // https://html.spec.whatwg.org/multipage/window-object.html#window-bc + HTML::BrowsingContext const* browsing_context() const { return m_associated_document->browsing_context(); } + HTML::BrowsingContext* browsing_context() { return m_associated_document->browsing_context(); } + void alert(String const&); bool confirm(String const&); String prompt(String const&, String const&);