mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibWeb: Apply type
presentational hint for HTMLLIElement
This commit is contained in:
parent
74bf7bc28e
commit
2550b602ab
Notes:
github-actions[bot]
2025-02-21 01:26:25 +00:00
Author: https://github.com/tcl3
Commit: 2550b602ab
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3614
6 changed files with 161 additions and 0 deletions
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <LibWeb/Bindings/HTMLLIElementPrototype.h>
|
||||
#include <LibWeb/CSS/StyleValues/CSSKeywordValue.h>
|
||||
#include <LibWeb/HTML/HTMLLIElement.h>
|
||||
#include <LibWeb/HTML/Numbers.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
|
@ -38,4 +39,40 @@ WebIDL::Long HTMLLIElement::value()
|
|||
return 0;
|
||||
}
|
||||
|
||||
bool HTMLLIElement::is_presentational_hint(FlyString const& name) const
|
||||
{
|
||||
if (Base::is_presentational_hint(name))
|
||||
return true;
|
||||
|
||||
return name == HTML::AttributeNames::type;
|
||||
}
|
||||
|
||||
void HTMLLIElement::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 == "1"sv) {
|
||||
cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::ListStyleType, CSS::CSSKeywordValue::create(CSS::Keyword::Decimal));
|
||||
} else if (value == "a"sv) {
|
||||
cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::ListStyleType, CSS::CSSKeywordValue::create(CSS::Keyword::LowerAlpha));
|
||||
} else if (value == "A"sv) {
|
||||
cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::ListStyleType, CSS::CSSKeywordValue::create(CSS::Keyword::UpperAlpha));
|
||||
} else if (value == "i"sv) {
|
||||
cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::ListStyleType, CSS::CSSKeywordValue::create(CSS::Keyword::LowerRoman));
|
||||
} else if (value == "I"sv) {
|
||||
cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::ListStyleType, CSS::CSSKeywordValue::create(CSS::Keyword::UpperRoman));
|
||||
} else 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));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue