1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:17:35 +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:
Sam Atkins 2023-04-19 12:00:38 +01:00 committed by Andreas Kling
parent 4ddacf4740
commit 0f9f6aef81
6 changed files with 20 additions and 15 deletions

View file

@ -4388,7 +4388,7 @@ RefPtr<StyleValue> Parser::parse_single_background_position_value(TokenStream<Co
return zero_offset;
};
if (value->has_identifier()) {
if (value->is_identifier()) {
auto identifier = value->to_identifier();
if (is_horizontal(identifier)) {
bool offset_provided = false;
@ -4474,7 +4474,7 @@ RefPtr<StyleValue> Parser::parse_single_background_position_x_or_y_value(TokenSt
};
auto value = parse_value(tokens.next_token());
if (value->has_identifier()) {
if (value->is_identifier()) {
auto identifier = value->to_identifier();
if (identifier == ValueID::Center) {
transaction.commit();