2021-04-04 00:14:39 +02:00
|
|
|
/*
|
2021-04-22 22:51:19 +02:00
|
|
|
* Copyright (c) 2021, Linus Groh <linusg@serenityos.org>
|
2021-04-04 00:14:39 +02:00
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2021-04-04 00:14:39 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <LibGfx/Rect.h>
|
|
|
|
#include <LibWeb/Bindings/Wrappable.h>
|
|
|
|
#include <LibWeb/Forward.h>
|
|
|
|
|
|
|
|
namespace Web::CSS {
|
|
|
|
|
|
|
|
class Screen final
|
|
|
|
: public RefCounted<Screen>
|
|
|
|
, public Bindings::Wrappable {
|
|
|
|
|
|
|
|
public:
|
|
|
|
using WrapperType = Bindings::ScreenWrapper;
|
|
|
|
|
|
|
|
static NonnullRefPtr<Screen> create(DOM::Window& window)
|
|
|
|
{
|
2021-04-23 16:46:57 +02:00
|
|
|
return adopt_ref(*new Screen(window));
|
2021-04-04 00:14:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
i32 width() const { return screen_rect().width(); }
|
|
|
|
i32 height() const { return screen_rect().height(); }
|
|
|
|
i32 avail_width() const { return screen_rect().width(); }
|
|
|
|
i32 avail_height() const { return screen_rect().height(); }
|
|
|
|
u32 color_depth() const { return 24; }
|
|
|
|
u32 pixel_depth() const { return 24; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
explicit Screen(DOM::Window&);
|
|
|
|
|
|
|
|
Gfx::IntRect screen_rect() const;
|
|
|
|
|
|
|
|
DOM::Window& m_window;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|