summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Userland/Libraries/LibWeb/CSS/StyleComputer.cpp8
-rw-r--r--Userland/Libraries/LibWeb/CSS/StyleProperties.cpp32
-rw-r--r--Userland/Libraries/LibWeb/CSS/StyleValue.cpp14
-rw-r--r--Userland/Libraries/LibWeb/CSS/StyleValue.h4
4 files changed, 33 insertions, 25 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp
index e3664e337d..087ed52206 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp
+++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp
@@ -1247,10 +1247,10 @@ void StyleComputer::compute_font(StyleProperties& style, DOM::Element const* ele
if (family_value->is_value_list()) {
auto const& family_list = static_cast<StyleValueList const&>(*family_value).values();
for (auto const& family : family_list) {
- if (family.is_identifier()) {
- found_font = find_generic_font(family.to_identifier());
- } else if (family.is_string()) {
- found_font = find_font(family.to_string().release_value_but_fixme_should_propagate_errors());
+ if (family->is_identifier()) {
+ found_font = find_generic_font(family->to_identifier());
+ } else if (family->is_string()) {
+ found_font = find_font(family->to_string().release_value_but_fixme_should_propagate_errors());
}
if (found_font)
break;
diff --git a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
index 0075dccc9f..6e9bab1c12 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
+++ b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
@@ -296,21 +296,21 @@ Vector<CSS::Transformation> StyleProperties::transformations() const
Vector<CSS::Transformation> transformations;
for (auto& it : list.values()) {
- if (!it.is_transformation())
+ if (!it->is_transformation())
return {};
- auto& transformation_style_value = it.as_transformation();
+ auto& transformation_style_value = it->as_transformation();
CSS::Transformation transformation;
transformation.function = transformation_style_value.transform_function();
Vector<TransformValue> values;
for (auto& transformation_value : transformation_style_value.values()) {
- if (transformation_value.is_length()) {
- values.append({ transformation_value.to_length() });
- } else if (transformation_value.is_percentage()) {
- values.append({ transformation_value.as_percentage().percentage() });
- } else if (transformation_value.is_numeric()) {
- values.append({ transformation_value.to_number() });
- } else if (transformation_value.is_angle()) {
- values.append({ transformation_value.as_angle().angle() });
+ if (transformation_value->is_length()) {
+ values.append({ transformation_value->to_length() });
+ } else if (transformation_value->is_percentage()) {
+ values.append({ transformation_value->as_percentage().percentage() });
+ } else if (transformation_value->is_numeric()) {
+ values.append({ transformation_value->to_number() });
+ } else if (transformation_value->is_angle()) {
+ values.append({ transformation_value->as_angle().angle() });
} else {
dbgln("FIXME: Unsupported value in transform!");
}
@@ -487,8 +487,8 @@ CSS::ContentData StyleProperties::content() const
// For now, we'll just assume strings since that is easiest.
StringBuilder builder;
for (auto const& item : content_style_value.content().values()) {
- if (item.is_string()) {
- builder.append(item.to_string().release_value_but_fixme_should_propagate_errors());
+ if (item->is_string()) {
+ builder.append(item->to_string().release_value_but_fixme_should_propagate_errors());
} else {
// TODO: Implement quotes, counters, images, and other things.
}
@@ -499,8 +499,8 @@ CSS::ContentData StyleProperties::content() const
if (content_style_value.has_alt_text()) {
StringBuilder alt_text_builder;
for (auto const& item : content_style_value.alt_text()->values()) {
- if (item.is_string()) {
- alt_text_builder.append(item.to_string().release_value_but_fixme_should_propagate_errors());
+ if (item->is_string()) {
+ alt_text_builder.append(item->to_string().release_value_but_fixme_should_propagate_errors());
} else {
// TODO: Implement counters
}
@@ -592,7 +592,7 @@ Vector<CSS::TextDecorationLine> StyleProperties::text_decoration_line() const
Vector<CSS::TextDecorationLine> lines;
auto& values = value->as_value_list().values();
for (auto const& item : values) {
- lines.append(value_id_to_text_decoration_line(item.to_identifier()).value());
+ lines.append(value_id_to_text_decoration_line(item->to_identifier()).value());
}
return lines;
}
@@ -652,7 +652,7 @@ Vector<ShadowData> StyleProperties::shadow(PropertyID property_id) const
Vector<ShadowData> shadow_data;
shadow_data.ensure_capacity(value_list.size());
for (auto const& layer_value : value_list.values())
- shadow_data.append(make_shadow_data(layer_value.as_shadow()));
+ shadow_data.append(make_shadow_data(layer_value->as_shadow()));
return shadow_data;
}
diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValue.cpp
index 770df8b3bd..31fc57a78f 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleValue.cpp
+++ b/Userland/Libraries/LibWeb/CSS/StyleValue.cpp
@@ -2112,7 +2112,11 @@ ErrorOr<String> TransformationStyleValue::to_string() const
StringBuilder builder;
TRY(builder.try_append(CSS::to_string(m_properties.transform_function)));
TRY(builder.try_append('('));
- TRY(builder.try_join(", "sv, m_properties.values));
+ for (size_t i = 0; i < m_properties.values.size(); ++i) {
+ TRY(builder.try_append(TRY(m_properties.values[i]->to_string())));
+ if (i != m_properties.values.size() - 1)
+ TRY(builder.try_append(", "sv));
+ }
TRY(builder.try_append(')'));
return builder.to_string();
@@ -2158,7 +2162,13 @@ ErrorOr<String> StyleValueList::to_string() const
VERIFY_NOT_REACHED();
}
- return String::from_deprecated_string(DeprecatedString::join(separator, m_properties.values));
+ StringBuilder builder;
+ for (size_t i = 0; i < m_properties.values.size(); ++i) {
+ TRY(builder.try_append(TRY(m_properties.values[i]->to_string())));
+ if (i != m_properties.values.size() - 1)
+ TRY(builder.try_append(separator));
+ }
+ return builder.to_string();
}
ValueComparingNonnullRefPtr<ColorStyleValue> ColorStyleValue::create(Color color)
diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValue.h
index a3881cd909..1426d4b21f 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleValue.h
+++ b/Userland/Libraries/LibWeb/CSS/StyleValue.h
@@ -267,9 +267,7 @@ private:
using RefPtr<T>::operator==;
};
-template<typename T>
-using ValueComparingNonnullRefPtrVector = AK::NonnullPtrVector<ValueComparingNonnullRefPtr<T>>;
-using StyleValueVector = ValueComparingNonnullRefPtrVector<StyleValue const>;
+using StyleValueVector = Vector<ValueComparingNonnullRefPtr<StyleValue const>>;
class StyleValue : public RefCounted<StyleValue> {
public: