diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp index 8b13baa04c..16a803bc32 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.cpp +++ b/Userland/Libraries/LibWeb/DOM/Element.cpp @@ -1774,4 +1774,16 @@ HashMap const& Element::custom_properti return m_pseudo_element_custom_properties[to_underlying(pseudo_element.value())]; } +// https://drafts.csswg.org/cssom-view/#dom-element-scroll +void Element::scroll(double x, double y) +{ + dbgln("FIXME: Implement Element::scroll(x: {}, y: {}", x, y); +} + +// https://drafts.csswg.org/cssom-view/#dom-element-scroll +void Element::scroll(HTML::ScrollToOptions const&) +{ + dbgln("FIXME: Implement Element::scroll(ScrollToOptions)"); +} + } diff --git a/Userland/Libraries/LibWeb/DOM/Element.h b/Userland/Libraries/LibWeb/DOM/Element.h index 75b1079249..d3cdeb6c76 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.h +++ b/Userland/Libraries/LibWeb/DOM/Element.h @@ -21,6 +21,7 @@ #include #include #include +#include #include namespace Web::DOM { @@ -306,6 +307,9 @@ public: void set_custom_element_state(CustomElementState value) { m_custom_element_state = value; } void setup_custom_element_from_constructor(HTML::CustomElementDefinition& custom_element_definition, Optional const& is_value); + void scroll(HTML::ScrollToOptions const&); + void scroll(double x, double y); + protected: Element(Document&, DOM::QualifiedName); virtual JS::ThrowCompletionOr initialize(JS::Realm&) override; diff --git a/Userland/Libraries/LibWeb/DOM/Element.idl b/Userland/Libraries/LibWeb/DOM/Element.idl index f5d607d957..aeb3f55caa 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.idl +++ b/Userland/Libraries/LibWeb/DOM/Element.idl @@ -79,6 +79,11 @@ interface Element : Node { undefined scrollIntoView(optional (boolean or ScrollIntoViewOptions) arg = {}); + 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); + }; dictionary ShadowRootInit {