LibWeb: Implement HTMLMarqueeElement.scrollDelay

This commit is contained in:
Jamie Mansfield 2024-07-13 00:33:26 +01:00 committed by Andreas Kling
parent 2a408ecfbc
commit a917f8124c
Notes: sideshowbarker 2024-07-17 07:25:39 +09:00
4 changed files with 22 additions and 1 deletions

View file

@ -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) \

View file

@ -60,4 +60,21 @@ WebIDL::ExceptionOr<void> 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<void> HTMLMarqueeElement::set_scroll_delay(WebIDL::UnsignedLong value)
{
return set_attribute(HTML::AttributeNames::scrolldelay, MUST(String::number(value)));
}
}

View file

@ -23,6 +23,9 @@ public:
WebIDL::UnsignedLong scroll_amount();
WebIDL::ExceptionOr<void> set_scroll_amount(WebIDL::UnsignedLong);
WebIDL::UnsignedLong scroll_delay();
WebIDL::ExceptionOr<void> set_scroll_delay(WebIDL::UnsignedLong);
private:
HTMLMarqueeElement(DOM::Document&, DOM::QualifiedName);

View file

@ -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;