Skip to content

Commit 6758dec

Browse files
committed
LibWeb: Replace ListStyleStyleValue with ShorthandStyleValue
1 parent f5cb2e8 commit 6758dec

File tree

10 files changed

+5
-88
lines changed

10 files changed

+5
-88
lines changed

Meta/gn/secondary/Userland/Libraries/LibWeb/CSS/StyleValues/BUILD.gn

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ source_set("StyleValues") {
2424
"IntegerStyleValue.cpp",
2525
"LengthStyleValue.cpp",
2626
"LinearGradientStyleValue.cpp",
27-
"ListStyleStyleValue.cpp",
2827
"MathDepthStyleValue.cpp",
2928
"NumberStyleValue.cpp",
3029
"OverflowStyleValue.cpp",

Userland/Libraries/LibWeb/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ set(SOURCES
101101
CSS/StyleValues/IntegerStyleValue.cpp
102102
CSS/StyleValues/LengthStyleValue.cpp
103103
CSS/StyleValues/LinearGradientStyleValue.cpp
104-
CSS/StyleValues/ListStyleStyleValue.cpp
105104
CSS/StyleValues/MathDepthStyleValue.cpp
106105
CSS/StyleValues/NumberStyleValue.cpp
107106
CSS/StyleValues/OverflowStyleValue.cpp

Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
#include <LibWeb/CSS/StyleValues/InitialStyleValue.h>
5858
#include <LibWeb/CSS/StyleValues/IntegerStyleValue.h>
5959
#include <LibWeb/CSS/StyleValues/LengthStyleValue.h>
60-
#include <LibWeb/CSS/StyleValues/ListStyleStyleValue.h>
6160
#include <LibWeb/CSS/StyleValues/MathDepthStyleValue.h>
6261
#include <LibWeb/CSS/StyleValues/NumberStyleValue.h>
6362
#include <LibWeb/CSS/StyleValues/OverflowStyleValue.h>
@@ -4498,7 +4497,9 @@ RefPtr<StyleValue> Parser::parse_list_style_value(Vector<ComponentValue> const&
44984497
if (!list_type)
44994498
list_type = property_initial_value(m_context.realm(), PropertyID::ListStyleType);
45004499

4501-
return ListStyleStyleValue::create(list_position.release_nonnull(), list_image.release_nonnull(), list_type.release_nonnull());
4500+
return ShorthandStyleValue::create(PropertyID::ListStyle,
4501+
{ PropertyID::ListStylePosition, PropertyID::ListStyleImage, PropertyID::ListStyleType },
4502+
{ list_position.release_nonnull(), list_image.release_nonnull(), list_type.release_nonnull() });
45024503
}
45034504

45044505
RefPtr<StyleValue> Parser::parse_math_depth_value(Vector<ComponentValue> const& component_values)

Userland/Libraries/LibWeb/CSS/StyleComputer.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
#include <LibWeb/CSS/StyleValues/IdentifierStyleValue.h>
4343
#include <LibWeb/CSS/StyleValues/IntegerStyleValue.h>
4444
#include <LibWeb/CSS/StyleValues/LengthStyleValue.h>
45-
#include <LibWeb/CSS/StyleValues/ListStyleStyleValue.h>
4645
#include <LibWeb/CSS/StyleValues/MathDepthStyleValue.h>
4746
#include <LibWeb/CSS/StyleValues/NumberStyleValue.h>
4847
#include <LibWeb/CSS/StyleValues/OverflowStyleValue.h>
@@ -705,14 +704,6 @@ static void set_property_expanding_shorthands(StyleProperties& style, CSS::Prope
705704
}
706705

707706
if (property_id == CSS::PropertyID::ListStyle) {
708-
if (value.is_list_style()) {
709-
auto const& list_style = value.as_list_style();
710-
set_longhand_property(CSS::PropertyID::ListStylePosition, list_style.position());
711-
set_longhand_property(CSS::PropertyID::ListStyleImage, list_style.image());
712-
set_longhand_property(CSS::PropertyID::ListStyleType, list_style.style_type());
713-
return;
714-
}
715-
716707
set_longhand_property(CSS::PropertyID::ListStylePosition, value);
717708
set_longhand_property(CSS::PropertyID::ListStyleImage, value);
718709
set_longhand_property(CSS::PropertyID::ListStyleType, value);

Userland/Libraries/LibWeb/CSS/StyleValue.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
#include <LibWeb/CSS/StyleValues/IntegerStyleValue.h>
3838
#include <LibWeb/CSS/StyleValues/LengthStyleValue.h>
3939
#include <LibWeb/CSS/StyleValues/LinearGradientStyleValue.h>
40-
#include <LibWeb/CSS/StyleValues/ListStyleStyleValue.h>
4140
#include <LibWeb/CSS/StyleValues/MathDepthStyleValue.h>
4241
#include <LibWeb/CSS/StyleValues/NumberStyleValue.h>
4342
#include <LibWeb/CSS/StyleValues/OverflowStyleValue.h>

Userland/Libraries/LibWeb/CSS/StyleValue.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ using StyleValueVector = Vector<ValueComparingNonnullRefPtr<StyleValue const>>;
109109
__ENUMERATE_STYLE_VALUE_TYPE(Integer, integer) \
110110
__ENUMERATE_STYLE_VALUE_TYPE(Length, length) \
111111
__ENUMERATE_STYLE_VALUE_TYPE(LinearGradient, linear_gradient) \
112-
__ENUMERATE_STYLE_VALUE_TYPE(ListStyle, list_style) \
113112
__ENUMERATE_STYLE_VALUE_TYPE(MathDepth, math_depth) \
114113
__ENUMERATE_STYLE_VALUE_TYPE(Number, number) \
115114
__ENUMERATE_STYLE_VALUE_TYPE(Overflow, overflow) \

Userland/Libraries/LibWeb/CSS/StyleValues/ListStyleStyleValue.cpp

Lines changed: 0 additions & 19 deletions
This file was deleted.

Userland/Libraries/LibWeb/CSS/StyleValues/ListStyleStyleValue.h

Lines changed: 0 additions & 53 deletions
This file was deleted.

Userland/Libraries/LibWeb/CSS/StyleValues/ShorthandStyleValue.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ String ShorthandStyleValue::to_string() const
145145
return MUST(String::formatted("{}", construct_rows_string()));
146146
return MUST(String::formatted("{} / {}", construct_rows_string(), columns.grid_track_size_list().to_string()));
147147
}
148+
case PropertyID::ListStyle:
149+
return MUST(String::formatted("{} {} {}", longhand(PropertyID::ListStylePosition)->to_string(), longhand(PropertyID::ListStyleImage)->to_string(), longhand(PropertyID::ListStyleType)->to_string()));
148150
default:
149151
StringBuilder builder;
150152
auto first = true;

Userland/Libraries/LibWeb/Forward.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ class LengthOrCalculated;
127127
class LengthPercentage;
128128
class LengthStyleValue;
129129
class LinearGradientStyleValue;
130-
class ListStyleStyleValue;
131130
class MathDepthStyleValue;
132131
class MediaFeatureValue;
133132
class MediaList;

0 commit comments

Comments
 (0)