summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Layout
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2023-04-19 12:00:38 +0100
committerAndreas Kling <kling@serenityos.org>2023-04-19 18:25:18 +0200
commit0f9f6aef81d14d12763501da4a65330170271d52 (patch)
treeb83eda262ca2db6b9dad63ecaa5fb18374161558 /Userland/Libraries/LibWeb/Layout
parent4ddacf4740052f0d1ed34a08c95fe82a05c462bf (diff)
downloadserenity-0f9f6aef81d14d12763501da4a65330170271d52.zip
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.
Diffstat (limited to 'Userland/Libraries/LibWeb/Layout')
-rw-r--r--Userland/Libraries/LibWeb/Layout/Node.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/Node.cpp b/Userland/Libraries/LibWeb/Layout/Node.cpp
index d40e6656df..b7688f1e84 100644
--- a/Userland/Libraries/LibWeb/Layout/Node.cpp
+++ b/Userland/Libraries/LibWeb/Layout/Node.cpp
@@ -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;