summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/CSS/Screen.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-08-31 18:52:54 +0200
committerAndreas Kling <kling@serenityos.org>2022-09-06 00:27:09 +0200
commit8c90e08e0bc496c69537df5d011cc22cbe4aed04 (patch)
tree55a449675c706aec68b72e55dca56caec784a4ee /Userland/Libraries/LibWeb/CSS/Screen.h
parentd5e831988e169b917f27440e1cc74eb15c7af521 (diff)
downloadserenity-8c90e08e0bc496c69537df5d011cc22cbe4aed04.zip
LibWeb: Make CSS::Screen GC-allocated
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS/Screen.h')
-rw-r--r--Userland/Libraries/LibWeb/CSS/Screen.h20
1 files changed, 9 insertions, 11 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Screen.h b/Userland/Libraries/LibWeb/CSS/Screen.h
index ce0e1abd9e..e88813e4b7 100644
--- a/Userland/Libraries/LibWeb/CSS/Screen.h
+++ b/Userland/Libraries/LibWeb/CSS/Screen.h
@@ -6,26 +6,20 @@
#pragma once
-#include <AK/RefCountForwarder.h>
#include <LibGfx/Rect.h>
-#include <LibWeb/Bindings/Wrappable.h>
+#include <LibWeb/Bindings/PlatformObject.h>
#include <LibWeb/Forward.h>
#include <LibWeb/HTML/Window.h>
namespace Web::CSS {
-class Screen final
- : public RefCounted<Screen>
- , public Bindings::Wrappable {
+class Screen final : public Bindings::PlatformObject {
+ WEB_PLATFORM_OBJECT(Screen, Bindings::PlatformObject);
public:
- using WrapperType = Bindings::ScreenWrapper;
using AllowOwnPtr = TrueType;
- static NonnullOwnPtr<Screen> create(Badge<HTML::Window>, HTML::Window& window)
- {
- return adopt_own(*new Screen(window));
- }
+ static JS::NonnullGCPtr<Screen> create(HTML::Window&);
i32 width() const { return screen_rect().width(); }
i32 height() const { return screen_rect().height(); }
@@ -37,11 +31,15 @@ public:
private:
explicit Screen(HTML::Window&);
+ virtual void visit_edges(Cell::Visitor&) override;
+
HTML::Window const& window() const { return *m_window; }
Gfx::IntRect screen_rect() const;
- JS::Handle<HTML::Window> m_window;
+ JS::NonnullGCPtr<HTML::Window> m_window;
};
}
+
+WRAPPER_HACK(Screen, Web::CSS)