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

LibWeb/HTML: Port Window.scroll() to IDL

...with various changes required due to ScrollBehavior / ScrollOptions
moving from Element.idl to Window.idl.
This commit is contained in:
Linus Groh 2023-03-06 20:53:49 +00:00
parent 40b4ee88de
commit 2b6d9cca1a
5 changed files with 126 additions and 79 deletions

View file

@ -57,6 +57,10 @@ interface Window : EventTarget {
[Replaceable, ImplementedAs=scroll_x] readonly attribute double pageXOffset;
[Replaceable] readonly attribute double scrollY;
[Replaceable, ImplementedAs=scroll_y] readonly attribute double pageYOffset;
undefined scroll(optional ScrollToOptions options = {});
undefined scroll(unrestricted double x, unrestricted double y);
[ImplementedAs=scroll] undefined scrollTo(optional ScrollToOptions options = {});
[ImplementedAs=scroll] undefined scrollTo(unrestricted double x, unrestricted double y);
// FIXME: Everything from here on should be shared through WindowOrWorkerGlobalScope
// https://w3c.github.io/hr-time/#the-performance-attribute
@ -68,3 +72,13 @@ interface Window : EventTarget {
Window includes GlobalEventHandlers;
Window includes WindowEventHandlers;
Window includes WindowOrWorkerGlobalScope;
enum ScrollBehavior { "auto", "instant", "smooth" };
dictionary ScrollOptions {
ScrollBehavior behavior = "auto";
};
dictionary ScrollToOptions : ScrollOptions {
unrestricted double left;
unrestricted double top;
};