mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-05 18:52:56 +00:00
LibWeb: Implement HTMLMarqueeElement.scrollAmount
This commit is contained in:
parent
66528a17cb
commit
2a408ecfbc
Notes:
sideshowbarker
2024-07-17 06:09:44 +09:00
Author: https://github.com/jamierocks
Commit: 2a408ecfbc
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/608
4 changed files with 26 additions and 1 deletions
|
@ -224,6 +224,7 @@ namespace AttributeNames {
|
||||||
__ENUMERATE_HTML_ATTRIBUTE(rowspan) \
|
__ENUMERATE_HTML_ATTRIBUTE(rowspan) \
|
||||||
__ENUMERATE_HTML_ATTRIBUTE(rules) \
|
__ENUMERATE_HTML_ATTRIBUTE(rules) \
|
||||||
__ENUMERATE_HTML_ATTRIBUTE(scheme) \
|
__ENUMERATE_HTML_ATTRIBUTE(scheme) \
|
||||||
|
__ENUMERATE_HTML_ATTRIBUTE(scrollamount) \
|
||||||
__ENUMERATE_HTML_ATTRIBUTE(scrolling) \
|
__ENUMERATE_HTML_ATTRIBUTE(scrolling) \
|
||||||
__ENUMERATE_HTML_ATTRIBUTE(selected) \
|
__ENUMERATE_HTML_ATTRIBUTE(selected) \
|
||||||
__ENUMERATE_HTML_ATTRIBUTE(shadowrootclonable) \
|
__ENUMERATE_HTML_ATTRIBUTE(shadowrootclonable) \
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, the SerenityOS developers.
|
* Copyright (c) 2020, the SerenityOS developers.
|
||||||
|
* Copyright (c) 2024, Jamie Mansfield <jmansfield@cadixdev.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -9,6 +10,7 @@
|
||||||
#include <LibWeb/CSS/StyleProperties.h>
|
#include <LibWeb/CSS/StyleProperties.h>
|
||||||
#include <LibWeb/CSS/StyleValues/ColorStyleValue.h>
|
#include <LibWeb/CSS/StyleValues/ColorStyleValue.h>
|
||||||
#include <LibWeb/HTML/HTMLMarqueeElement.h>
|
#include <LibWeb/HTML/HTMLMarqueeElement.h>
|
||||||
|
#include <LibWeb/HTML/Numbers.h>
|
||||||
#include <LibWeb/HTML/Parser/HTMLParser.h>
|
#include <LibWeb/HTML/Parser/HTMLParser.h>
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
@ -41,4 +43,21 @@ void HTMLMarqueeElement::apply_presentational_hints(CSS::StyleProperties& style)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/obsolete.html#dom-marquee-scrollamount
|
||||||
|
WebIDL::UnsignedLong HTMLMarqueeElement::scroll_amount()
|
||||||
|
{
|
||||||
|
// The scrollAmount IDL attribute must reflect the scrollamount content attribute. The default value is 6.
|
||||||
|
if (auto scroll_amount_string = get_attribute(HTML::AttributeNames::scrollamount); scroll_amount_string.has_value()) {
|
||||||
|
if (auto scroll_amount = parse_non_negative_integer(*scroll_amount_string); scroll_amount.has_value())
|
||||||
|
return *scroll_amount;
|
||||||
|
}
|
||||||
|
return 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/obsolete.html#dom-marquee-scrollamount
|
||||||
|
WebIDL::ExceptionOr<void> HTMLMarqueeElement::set_scroll_amount(WebIDL::UnsignedLong value)
|
||||||
|
{
|
||||||
|
return set_attribute(HTML::AttributeNames::scrollamount, MUST(String::number(value)));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, the SerenityOS developers.
|
* Copyright (c) 2020, the SerenityOS developers.
|
||||||
|
* Copyright (c) 2024, Jamie Mansfield <jmansfield@cadixdev.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -7,6 +8,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <LibWeb/HTML/HTMLElement.h>
|
#include <LibWeb/HTML/HTMLElement.h>
|
||||||
|
#include <LibWeb/WebIDL/Types.h>
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
|
||||||
|
@ -18,6 +20,9 @@ class HTMLMarqueeElement final : public HTMLElement {
|
||||||
public:
|
public:
|
||||||
virtual ~HTMLMarqueeElement() override;
|
virtual ~HTMLMarqueeElement() override;
|
||||||
|
|
||||||
|
WebIDL::UnsignedLong scroll_amount();
|
||||||
|
WebIDL::ExceptionOr<void> set_scroll_amount(WebIDL::UnsignedLong);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLMarqueeElement(DOM::Document&, DOM::QualifiedName);
|
HTMLMarqueeElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ interface HTMLMarqueeElement : HTMLElement {
|
||||||
[CEReactions, Reflect] attribute DOMString height;
|
[CEReactions, Reflect] attribute DOMString height;
|
||||||
[CEReactions, Reflect] attribute unsigned long hspace;
|
[CEReactions, Reflect] attribute unsigned long hspace;
|
||||||
[FIXME, CEReactions] attribute long loop;
|
[FIXME, CEReactions] attribute long loop;
|
||||||
[FIXME, CEReactions] attribute unsigned long scrollAmount;
|
[CEReactions] attribute unsigned long scrollAmount;
|
||||||
[FIXME, CEReactions] attribute unsigned long scrollDelay;
|
[FIXME, CEReactions] attribute unsigned long scrollDelay;
|
||||||
[FIXME, CEReactions] attribute boolean trueSpeed;
|
[FIXME, CEReactions] attribute boolean trueSpeed;
|
||||||
[CEReactions, Reflect] attribute unsigned long vspace;
|
[CEReactions, Reflect] attribute unsigned long vspace;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue