mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:27:43 +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:
parent
40b4ee88de
commit
2b6d9cca1a
5 changed files with 126 additions and 79 deletions
|
@ -33,6 +33,17 @@ class IdleCallback;
|
|||
// https://html.spec.whatwg.org/#timerhandler
|
||||
using TimerHandler = Variant<JS::Handle<WebIDL::CallbackType>, DeprecatedString>;
|
||||
|
||||
// https://w3c.github.io/csswg-drafts/cssom-view/#dictdef-scrolloptions
|
||||
struct ScrollOptions {
|
||||
Bindings::ScrollBehavior behavior { Bindings::ScrollBehavior::Auto };
|
||||
};
|
||||
|
||||
// https://w3c.github.io/csswg-drafts/cssom-view/#dictdef-scrolltooptions
|
||||
struct ScrollToOptions : public ScrollOptions {
|
||||
Optional<double> left;
|
||||
Optional<double> top;
|
||||
};
|
||||
|
||||
class Window final
|
||||
: public DOM::EventTarget
|
||||
, public HTML::GlobalEventHandlers
|
||||
|
@ -164,6 +175,8 @@ public:
|
|||
|
||||
double scroll_x() const;
|
||||
double scroll_y() const;
|
||||
void scroll(ScrollToOptions const&);
|
||||
void scroll(double x, double y);
|
||||
|
||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<HighResolutionTime::Performance>> performance();
|
||||
|
||||
|
@ -233,7 +246,6 @@ private:
|
|||
|
||||
JS_DECLARE_NATIVE_FUNCTION(device_pixel_ratio_getter);
|
||||
|
||||
JS_DECLARE_NATIVE_FUNCTION(scroll);
|
||||
JS_DECLARE_NATIVE_FUNCTION(scroll_by);
|
||||
|
||||
JS_DECLARE_NATIVE_FUNCTION(screen_x_getter);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue