mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:27:45 +00:00
LibWeb: Add DOM::Window::page()
This helps us to get from a Window to the containing Page, without clients having to go through Document.
This commit is contained in:
parent
84fcf879f9
commit
d392349b6e
4 changed files with 18 additions and 5 deletions
|
@ -42,20 +42,20 @@ void Window::set_wrapper(Badge<Bindings::WindowObject>, Bindings::WindowObject&
|
|||
|
||||
void Window::alert(const String& message)
|
||||
{
|
||||
if (auto* page = m_document.page())
|
||||
if (auto* page = this->page())
|
||||
page->client().page_did_request_alert(message);
|
||||
}
|
||||
|
||||
bool Window::confirm(const String& message)
|
||||
{
|
||||
if (auto* page = m_document.page())
|
||||
if (auto* page = this->page())
|
||||
return page->client().page_did_request_confirm(message);
|
||||
return false;
|
||||
}
|
||||
|
||||
String Window::prompt(const String& message, const String& default_)
|
||||
{
|
||||
if (auto* page = m_document.page())
|
||||
if (auto* page = this->page())
|
||||
return page->client().page_did_request_prompt(message, default_);
|
||||
return {};
|
||||
}
|
||||
|
@ -177,4 +177,14 @@ int Window::inner_height() const
|
|||
return document().layout_node()->height();
|
||||
}
|
||||
|
||||
Page* Window::page()
|
||||
{
|
||||
return document().page();
|
||||
}
|
||||
|
||||
Page const* Window::page() const
|
||||
{
|
||||
return document().page();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue