summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/CSS/Screen.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-12-09 15:47:48 +0100
committerAndreas Kling <kling@serenityos.org>2021-12-09 21:28:52 +0100
commitc268d0fa1370162bff4355aac17f4446da9225a7 (patch)
tree35f6f730026eb364896736c4eb8a2f6ac8bdade6 /Userland/Libraries/LibWeb/CSS/Screen.h
parent7fc770cfacf865af33cdf9449bed15f8f16036b9 (diff)
downloadserenity-c268d0fa1370162bff4355aac17f4446da9225a7.zip
LibWeb: Make CSS::Screen forward its ref count to DOM::Window
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS/Screen.h')
-rw-r--r--Userland/Libraries/LibWeb/CSS/Screen.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Screen.h b/Userland/Libraries/LibWeb/CSS/Screen.h
index 7ca9b0f6d0..d76a5c0620 100644
--- a/Userland/Libraries/LibWeb/CSS/Screen.h
+++ b/Userland/Libraries/LibWeb/CSS/Screen.h
@@ -6,22 +6,25 @@
#pragma once
+#include <AK/RefCountForwarder.h>
#include <LibGfx/Rect.h>
#include <LibWeb/Bindings/Wrappable.h>
+#include <LibWeb/DOM/Window.h>
#include <LibWeb/Forward.h>
namespace Web::CSS {
class Screen final
- : public RefCounted<Screen>
+ : public RefCountForwarder<DOM::Window>
, public Bindings::Wrappable {
public:
using WrapperType = Bindings::ScreenWrapper;
+ using AllowOwnPtr = TrueType;
- static NonnullRefPtr<Screen> create(DOM::Window& window)
+ static NonnullOwnPtr<Screen> create(Badge<DOM::Window>, DOM::Window& window)
{
- return adopt_ref(*new Screen(window));
+ return adopt_own(*new Screen(window));
}
i32 width() const { return screen_rect().width(); }
@@ -34,9 +37,9 @@ public:
private:
explicit Screen(DOM::Window&);
- Gfx::IntRect screen_rect() const;
+ DOM::Window const& window() const { return ref_count_target(); }
- DOM::Window& m_window;
+ Gfx::IntRect screen_rect() const;
};
}