mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:47:44 +00:00
LibWeb: Simplify StyleValue API now that auto
isn't a length
Now that LengthStyleValue never contains `auto`, IdentifierStyleValue is the only type that can hold an identifier. This lets us remove a couple of virtual methods from StyleValue. I've kept `has_auto()` and `to_identifier()` for convenience, but they are now simple non-virtual methods.
This commit is contained in:
parent
4ddacf4740
commit
0f9f6aef81
6 changed files with 20 additions and 15 deletions
|
@ -336,4 +336,16 @@ ValueComparingNonnullRefPtr<StyleValue const> StyleValue::absolutized(CSSPixelRe
|
|||
return *this;
|
||||
}
|
||||
|
||||
bool StyleValue::has_auto() const
|
||||
{
|
||||
return is_identifier() && as_identifier().id() == ValueID::Auto;
|
||||
}
|
||||
|
||||
ValueID StyleValue::to_identifier() const
|
||||
{
|
||||
if (is_identifier())
|
||||
return as_identifier().id();
|
||||
return ValueID::Invalid;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue