diff --git a/Userland/Libraries/LibWeb/HTML/Window.cpp b/Userland/Libraries/LibWeb/HTML/Window.cpp
index abad78e698..839e268722 100644
--- a/Userland/Libraries/LibWeb/HTML/Window.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Window.cpp
@@ -524,6 +524,24 @@ int Window::screen_y() const
return 0;
}
+// https://drafts.csswg.org/cssom-view/#dom-window-outerwidth
+int Window::outer_width() const
+{
+ // The outerWidth attribute must return the width of the client window. If there is no client window this attribute must return zero.
+ if (auto* page = this->page())
+ return page->window_size().width();
+ return 0;
+}
+
+// https://drafts.csswg.org/cssom-view/#dom-window-screeny
+int Window::outer_height() const
+{
+ // The outerHeight attribute must return the height of the client window. If there is no client window this attribute must return zero.
+ if (auto* page = this->page())
+ return page->window_size().height();
+ return 0;
+}
+
// https://html.spec.whatwg.org/multipage/webstorage.html#dom-localstorage
JS::NonnullGCPtr Window::local_storage()
{
@@ -787,6 +805,9 @@ void Window::initialize_web_interfaces(Badge)
define_native_accessor(realm, "screenLeft", screen_left_getter, {}, attr);
define_native_accessor(realm, "screenTop", screen_top_getter, {}, attr);
+ define_native_accessor(realm, "outerWidth", outer_width_getter, {}, attr);
+ define_native_accessor(realm, "outerHeight", outer_height_getter, {}, attr);
+
define_direct_property("CSS", heap().allocate(realm, realm), 0);
define_native_accessor(realm, "localStorage", local_storage_getter, {}, attr);
@@ -1423,6 +1444,18 @@ JS_DEFINE_NATIVE_FUNCTION(Window::screen_y_getter)
return JS::Value(impl->screen_y());
}
+JS_DEFINE_NATIVE_FUNCTION(Window::outer_width_getter)
+{
+ auto* impl = TRY(impl_from(vm));
+ return JS::Value(impl->outer_width());
+}
+
+JS_DEFINE_NATIVE_FUNCTION(Window::outer_height_getter)
+{
+ auto* impl = TRY(impl_from(vm));
+ return JS::Value(impl->outer_height());
+}
+
JS_DEFINE_NATIVE_FUNCTION(Window::post_message)
{
auto* impl = TRY(impl_from(vm));
diff --git a/Userland/Libraries/LibWeb/HTML/Window.h b/Userland/Libraries/LibWeb/HTML/Window.h
index fa66d2544f..03fdcdd02f 100644
--- a/Userland/Libraries/LibWeb/HTML/Window.h
+++ b/Userland/Libraries/LibWeb/HTML/Window.h
@@ -108,6 +108,9 @@ public:
int screen_x() const;
int screen_y() const;
+ int outer_width() const;
+ int outer_height() const;
+
JS::NonnullGCPtr local_storage();
JS::NonnullGCPtr session_storage();
@@ -233,6 +236,9 @@ private:
JS_DECLARE_NATIVE_FUNCTION(screen_left_getter);
JS_DECLARE_NATIVE_FUNCTION(screen_top_getter);
+ JS_DECLARE_NATIVE_FUNCTION(outer_width_getter);
+ JS_DECLARE_NATIVE_FUNCTION(outer_height_getter);
+
JS_DECLARE_NATIVE_FUNCTION(post_message);
JS_DECLARE_NATIVE_FUNCTION(local_storage_getter);