summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2022-11-01 15:45:06 -0400
committerLinus Groh <mail@linusgroh.de>2022-11-01 21:16:50 +0000
commit8cc1997f331cd6d3097ef04059a133f993fdcca0 (patch)
treefd0f53a235ed691cfe10b1922db72193bbb0891d /Userland
parent325e3c7bc646765ea16b603060bfa3ea47624dde (diff)
downloadserenity-8cc1997f331cd6d3097ef04059a133f993fdcca0.zip
LibWeb: Retrieve the last known window position for window.screenX/Y
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibWeb/HTML/Window.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/Window.cpp b/Userland/Libraries/LibWeb/HTML/Window.cpp
index 81d520f823..abad78e698 100644
--- a/Userland/Libraries/LibWeb/HTML/Window.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Window.cpp
@@ -509,6 +509,8 @@ int Window::screen_x() const
{
// The screenX and screenLeft attributes must return the x-coordinate, relative to the origin of the Web-exposed screen area,
// of the left of the client window as number of CSS pixels, or zero if there is no such thing.
+ if (auto* page = this->page())
+ return page->window_position().x();
return 0;
}
@@ -517,6 +519,8 @@ int Window::screen_y() const
{
// The screenY and screenTop attributes must return the y-coordinate, relative to the origin of the screen of the Web-exposed screen area,
// of the top of the client window as number of CSS pixels, or zero if there is no such thing.
+ if (auto* page = this->page())
+ return page->window_position().y();
return 0;
}