mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
LibWeb: Make 'auto' be both a Length and Identifier in CSS
I had accidentally parsed it in `parse_builtin_or_dynamic_value()` instead of `parse_length()` before, which was confusing, so now it's parsed along with other Lengths. Whether it should be a Length is up for debate, and has been tripping me up a few times, but a lot of code expects it to be one. For now, an 'auto' Length value (or any other value which overloads `is_auto()`) also claims to be a `ValueID::Auto` identifier.
This commit is contained in:
committed by
Andreas Kling
parent
c8c2a8df56
commit
ed962be0fa
@@ -236,7 +236,7 @@ public:
|
||||
bool is_inherit() const { return type() == Type::Inherit; }
|
||||
bool is_initial() const { return type() == Type::Initial; }
|
||||
bool is_color() const { return type() == Type::Color; }
|
||||
bool is_identifier() const { return type() == Type::Identifier; }
|
||||
bool is_identifier() const { return type() == Type::Identifier || is_auto(); }
|
||||
bool is_image() const { return type() == Type::Image; }
|
||||
bool is_string() const { return type() == Type::String; }
|
||||
virtual bool is_length() const { return type() == Type::Length; }
|
||||
@@ -638,6 +638,8 @@ inline CSS::ValueID StyleValue::to_identifier() const
|
||||
{
|
||||
if (is_identifier())
|
||||
return static_cast<const IdentifierStyleValue&>(*this).id();
|
||||
if (is_auto())
|
||||
return CSS::ValueID::Auto;
|
||||
return CSS::ValueID::Invalid;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user