mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:47:34 +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
|
@ -334,7 +334,7 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& computed_style)
|
|||
}
|
||||
}
|
||||
|
||||
if (auto attachment_value = value_for_layer(attachments, layer_index); attachment_value && attachment_value->has_identifier()) {
|
||||
if (auto attachment_value = value_for_layer(attachments, layer_index); attachment_value && attachment_value->is_identifier()) {
|
||||
switch (attachment_value->to_identifier()) {
|
||||
case CSS::ValueID::Fixed:
|
||||
layer.attachment = CSS::BackgroundAttachment::Fixed;
|
||||
|
@ -363,11 +363,11 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& computed_style)
|
|||
}
|
||||
};
|
||||
|
||||
if (auto origin_value = value_for_layer(origins, layer_index); origin_value && origin_value->has_identifier()) {
|
||||
if (auto origin_value = value_for_layer(origins, layer_index); origin_value && origin_value->is_identifier()) {
|
||||
layer.origin = as_box(origin_value->to_identifier());
|
||||
}
|
||||
|
||||
if (auto clip_value = value_for_layer(clips, layer_index); clip_value && clip_value->has_identifier()) {
|
||||
if (auto clip_value = value_for_layer(clips, layer_index); clip_value && clip_value->is_identifier()) {
|
||||
layer.clip = as_box(clip_value->to_identifier());
|
||||
}
|
||||
|
||||
|
@ -389,7 +389,7 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& computed_style)
|
|||
layer.size_type = CSS::BackgroundSize::LengthPercentage;
|
||||
layer.size_x = size.size_x();
|
||||
layer.size_y = size.size_y();
|
||||
} else if (size_value->has_identifier()) {
|
||||
} else if (size_value->is_identifier()) {
|
||||
switch (size_value->to_identifier()) {
|
||||
case CSS::ValueID::Contain:
|
||||
layer.size_type = CSS::BackgroundSize::Contain;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue