LibWeb: Convert DOM::Window to east-const style

This commit is contained in:
Andreas Kling 2021-09-09 13:50:06 +02:00
parent d392349b6e
commit 8f72729f0e
2 changed files with 14 additions and 14 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2020-2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -40,20 +40,20 @@ void Window::set_wrapper(Badge<Bindings::WindowObject>, Bindings::WindowObject&
m_wrapper = wrapper.make_weak_ptr();
}
void Window::alert(const String& message)
void Window::alert(String const& message)
{
if (auto* page = this->page())
page->client().page_did_request_alert(message);
}
bool Window::confirm(const String& message)
bool Window::confirm(String const& message)
{
if (auto* page = this->page())
return page->client().page_did_request_confirm(message);
return false;
}
String Window::prompt(const String& message, const String& default_)
String Window::prompt(String const& message, String const& default_)
{
if (auto* page = this->page())
return page->client().page_did_request_prompt(message, default_);
@ -118,7 +118,7 @@ i32 Window::request_animation_frame(JS::FunctionObject& callback)
static double fake_timestamp = 0;
i32 link_id = GUI::DisplayLink::register_callback([handle = make_handle(&callback)](i32 link_id) {
auto& function = const_cast<JS::FunctionObject&>(static_cast<const JS::FunctionObject&>(*handle.cell()));
auto& function = const_cast<JS::FunctionObject&>(static_cast<JS::FunctionObject const&>(*handle.cell()));
auto& vm = function.vm();
fake_timestamp += 10;
[[maybe_unused]] auto rc = vm.call(function, JS::js_undefined(), JS::Value(fake_timestamp));
@ -137,7 +137,7 @@ void Window::cancel_animation_frame(i32 id)
GUI::DisplayLink::unregister_callback(id);
}
void Window::did_set_location_href(Badge<Bindings::LocationObject>, const URL& new_href)
void Window::did_set_location_href(Badge<Bindings::LocationObject>, URL const& new_href)
{
auto* frame = document().browsing_context();
if (!frame)

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2020-2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -36,12 +36,12 @@ public:
Page* page();
Page const* page() const;
const Document& document() const { return m_document; }
Document const& document() const { return m_document; }
Document& document() { return m_document; }
void alert(const String&);
bool confirm(const String&);
String prompt(const String&, const String&);
void alert(String const&);
bool confirm(String const&);
String prompt(String const&, String const&);
i32 request_animation_frame(JS::FunctionObject&);
void cancel_animation_frame(i32);
@ -53,11 +53,11 @@ public:
int inner_width() const;
int inner_height() const;
void did_set_location_href(Badge<Bindings::LocationObject>, const URL& new_href);
void did_set_location_href(Badge<Bindings::LocationObject>, URL const& new_href);
void did_call_location_reload(Badge<Bindings::LocationObject>);
Bindings::WindowObject* wrapper() { return m_wrapper; }
const Bindings::WindowObject* wrapper() const { return m_wrapper; }
Bindings::WindowObject const* wrapper() const { return m_wrapper; }
void set_wrapper(Badge<Bindings::WindowObject>, Bindings::WindowObject&);
@ -69,7 +69,7 @@ public:
CSS::Screen& screen() { return *m_screen; }
const Event* current_event() const { return m_current_event; }
Event const* current_event() const { return m_current_event; }
void set_current_event(Event* event) { m_current_event = event; }
private: