1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 11:17: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

@ -11,6 +11,7 @@
#include <LibWeb/ARIA/ARIAMixin.h>
#include <LibWeb/Bindings/ElementPrototype.h>
#include <LibWeb/Bindings/ShadowRootPrototype.h>
#include <LibWeb/Bindings/WindowGlobalMixin.h>
#include <LibWeb/CSS/CSSStyleDeclaration.h>
#include <LibWeb/CSS/StyleComputer.h>
#include <LibWeb/DOM/Attr.h>
@ -22,6 +23,7 @@
#include <LibWeb/HTML/AttributeNames.h>
#include <LibWeb/HTML/EventLoop/Task.h>
#include <LibWeb/HTML/TagNames.h>
#include <LibWeb/HTML/Window.h>
#include <LibWeb/Layout/Node.h>
#include <LibWeb/Layout/TreeBuilder.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
@ -33,13 +35,8 @@ struct ShadowRootInit {
bool delegates_focus = false;
};
// https://w3c.github.io/csswg-drafts/cssom-view-1/#dictdef-scrolloptions
struct ScrollOptions {
Bindings::ScrollBehavior behavior { Bindings::ScrollBehavior::Auto };
};
// https://w3c.github.io/csswg-drafts/cssom-view-1/#dictdef-scrollintoviewoptions
struct ScrollIntoViewOptions : public ScrollOptions {
struct ScrollIntoViewOptions : public HTML::ScrollOptions {
Bindings::ScrollLogicalPosition block { Bindings::ScrollLogicalPosition::Start };
Bindings::ScrollLogicalPosition inline_ { Bindings::ScrollLogicalPosition::Nearest };
};

View file

@ -11,11 +11,7 @@
#import <DOM/ShadowRoot.idl>
#import <Geometry/DOMRect.idl>
#import <Geometry/DOMRectList.idl>
enum ScrollBehavior { "auto", "smooth" };
dictionary ScrollOptions {
ScrollBehavior behavior = "auto";
};
#import <HTML/Window.idl>
enum ScrollLogicalPosition { "start", "center", "end", "nearest" };
dictionary ScrollIntoViewOptions : ScrollOptions {