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.
This commit is contained in:
Linus Groh 2022-03-05 00:13:13 +01:00 committed by Andreas Kling
parent 986bd2e271
commit 2f021e92a5
Notes: sideshowbarker 2024-07-17 22:41:14 +09:00

View File

@ -14,8 +14,10 @@
#include <LibWeb/Bindings/Wrappable.h>
#include <LibWeb/CSS/MediaQueryList.h>
#include <LibWeb/CSS/Screen.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Event.h>
#include <LibWeb/DOM/EventTarget.h>
#include <LibWeb/HTML/BrowsingContext.h>
#include <LibWeb/HTML/GlobalEventHandlers.h>
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&);