ladybird/Userland/Libraries/LibWeb/CSS/Screen.cpp

40 lines
891 B
C++
Raw Normal View History

/*
* Copyright (c) 2021, Linus Groh <linusg@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibGfx/Rect.h>
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/Bindings/ScreenPrototype.h>
#include <LibWeb/CSS/Screen.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/Page/Page.h>
namespace Web::CSS {
2022-08-31 18:52:54 +02:00
JS::NonnullGCPtr<Screen> Screen::create(HTML::Window& window)
{
return *window.heap().allocate<Screen>(window.realm(), window);
}
Screen::Screen(HTML::Window& window)
2022-08-31 18:52:54 +02:00
: PlatformObject(window.realm())
, m_window(window)
{
set_prototype(&Bindings::ensure_web_prototype<Bindings::ScreenPrototype>(window.realm(), "Screen"));
2022-08-31 18:52:54 +02:00
}
void Screen::visit_edges(Cell::Visitor& visitor)
{
2022-08-31 18:52:54 +02:00
Base::visit_edges(visitor);
visitor.visit(m_window.ptr());
}
Gfx::IntRect Screen::screen_rect() const
{
return window().page()->screen_rect();
}
}