1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:27:35 +00:00

LibWeb: Add Window.innerWidth and Window.innerHeight

This commit is contained in:
Andreas Kling 2021-03-16 17:22:01 +01:00
parent 72501775a7
commit 906cccbf7f
4 changed files with 39 additions and 0 deletions

View file

@ -33,6 +33,7 @@
#include <LibWeb/DOM/Window.h>
#include <LibWeb/HighResolutionTime/Performance.h>
#include <LibWeb/InProcessWebView.h>
#include <LibWeb/Layout/InitialContainingBlockBox.h>
#include <LibWeb/Page/Frame.h>
namespace Web::DOM {
@ -181,4 +182,18 @@ JS::Object* Window::create_wrapper(JS::GlobalObject& global_object)
return &global_object;
}
int Window::inner_width() const
{
if (!document().layout_node())
return 0;
return document().layout_node()->width();
}
int Window::inner_height() const
{
if (!document().layout_node())
return 0;
return document().layout_node()->height();
}
}