mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-21 09:49:21 +00:00
LibWeb: Apply type
presentational hint for HTMLUListElement
This commit is contained in:
parent
7612f2161c
commit
74bf7bc28e
Notes:
github-actions[bot]
2025-02-21 01:26:31 +00:00
Author: https://github.com/tcl3
Commit: 74bf7bc28e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3614
4 changed files with 59 additions and 0 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <LibWeb/Bindings/HTMLUListElementPrototype.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/CSS/StyleValues/CSSKeywordValue.h>
|
||||
#include <LibWeb/HTML/HTMLUListElement.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
@ -25,4 +26,30 @@ void HTMLUListElement::initialize(JS::Realm& realm)
|
|||
WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLUListElement);
|
||||
}
|
||||
|
||||
bool HTMLUListElement::is_presentational_hint(FlyString const& name) const
|
||||
{
|
||||
if (Base::is_presentational_hint(name))
|
||||
return true;
|
||||
|
||||
return name == HTML::AttributeNames::type;
|
||||
}
|
||||
|
||||
void HTMLUListElement::apply_presentational_hints(GC::Ref<CSS::CascadedProperties> cascaded_properties) const
|
||||
{
|
||||
// https://html.spec.whatwg.org/multipage/rendering.html#lists
|
||||
for_each_attribute([&](auto& name, auto& value) {
|
||||
if (name == HTML::AttributeNames::type) {
|
||||
if (value.equals_ignoring_ascii_case("none"sv)) {
|
||||
cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::ListStyleType, CSS::CSSKeywordValue::create(CSS::Keyword::None));
|
||||
} else if (value.equals_ignoring_ascii_case("disc"sv)) {
|
||||
cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::ListStyleType, CSS::CSSKeywordValue::create(CSS::Keyword::Disc));
|
||||
} else if (value.equals_ignoring_ascii_case("circle"sv)) {
|
||||
cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::ListStyleType, CSS::CSSKeywordValue::create(CSS::Keyword::Circle));
|
||||
} else if (value.equals_ignoring_ascii_case("square"sv)) {
|
||||
cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::ListStyleType, CSS::CSSKeywordValue::create(CSS::Keyword::Square));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,6 +25,9 @@ private:
|
|||
HTMLUListElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
|
||||
virtual bool is_presentational_hint(FlyString const&) const override;
|
||||
virtual void apply_presentational_hints(GC::Ref<CSS::CascadedProperties>) const override;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue