diff --git a/Userland/Libraries/LibWeb/HTML/AttributeNames.h b/Userland/Libraries/LibWeb/HTML/AttributeNames.h index d0f4fba2dc..942df21e16 100644 --- a/Userland/Libraries/LibWeb/HTML/AttributeNames.h +++ b/Userland/Libraries/LibWeb/HTML/AttributeNames.h @@ -225,6 +225,7 @@ namespace AttributeNames { __ENUMERATE_HTML_ATTRIBUTE(rules) \ __ENUMERATE_HTML_ATTRIBUTE(scheme) \ __ENUMERATE_HTML_ATTRIBUTE(scrollamount) \ + __ENUMERATE_HTML_ATTRIBUTE(scrolldelay) \ __ENUMERATE_HTML_ATTRIBUTE(scrolling) \ __ENUMERATE_HTML_ATTRIBUTE(selected) \ __ENUMERATE_HTML_ATTRIBUTE(shadowrootclonable) \ diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp index 45aff94189..0ae41d657f 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp @@ -60,4 +60,21 @@ WebIDL::ExceptionOr HTMLMarqueeElement::set_scroll_amount(WebIDL::Unsigned return set_attribute(HTML::AttributeNames::scrollamount, MUST(String::number(value))); } +// https://html.spec.whatwg.org/multipage/obsolete.html#dom-marquee-scrolldelay +WebIDL::UnsignedLong HTMLMarqueeElement::scroll_delay() +{ + // The scrollDelay IDL attribute must reflect the scrolldelay content attribute. The default value is 85. + if (auto scroll_delay_string = get_attribute(HTML::AttributeNames::scrolldelay); scroll_delay_string.has_value()) { + if (auto scroll_delay = parse_non_negative_integer(*scroll_delay_string); scroll_delay.has_value()) + return *scroll_delay; + } + return 85; +} + +// https://html.spec.whatwg.org/multipage/obsolete.html#dom-marquee-scrolldelay +WebIDL::ExceptionOr HTMLMarqueeElement::set_scroll_delay(WebIDL::UnsignedLong value) +{ + return set_attribute(HTML::AttributeNames::scrolldelay, MUST(String::number(value))); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.h b/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.h index 79e83e8745..63e3352ee0 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.h @@ -23,6 +23,9 @@ public: WebIDL::UnsignedLong scroll_amount(); WebIDL::ExceptionOr set_scroll_amount(WebIDL::UnsignedLong); + WebIDL::UnsignedLong scroll_delay(); + WebIDL::ExceptionOr set_scroll_delay(WebIDL::UnsignedLong); + private: HTMLMarqueeElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.idl b/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.idl index 96bcaf51dd..1403158097 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.idl +++ b/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.idl @@ -13,7 +13,7 @@ interface HTMLMarqueeElement : HTMLElement { [CEReactions, Reflect] attribute unsigned long hspace; [FIXME, CEReactions] attribute long loop; [CEReactions] attribute unsigned long scrollAmount; - [FIXME, CEReactions] attribute unsigned long scrollDelay; + [CEReactions] attribute unsigned long scrollDelay; [FIXME, CEReactions] attribute boolean trueSpeed; [CEReactions, Reflect] attribute unsigned long vspace; [CEReactions, Reflect] attribute DOMString width;