LibWeb: Remove now-unused CustomStyleValue
This commit is contained in:
parent
10aa06f16f
commit
c9062b4ed5
Notes:
sideshowbarker
2024-07-17 23:02:29 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/c9062b4ed53 Pull-request: https://github.com/SerenityOS/serenity/pull/11174
6 changed files with 3 additions and 48 deletions
|
@ -267,7 +267,7 @@ bool property_has_quirk(PropertyID property_id, Quirk quirk)
|
|||
|
||||
bool property_accepts_value(PropertyID property_id, StyleValue& style_value)
|
||||
{
|
||||
if (style_value.is_builtin() || style_value.is_custom_property())
|
||||
if (style_value.is_builtin())
|
||||
return true;
|
||||
|
||||
switch (property_id) {
|
||||
|
|
|
@ -1908,15 +1908,8 @@ RefPtr<StyleValue> Parser::parse_dynamic_value(StyleComponentValueRule const& co
|
|||
if (calc_expression)
|
||||
return CalculatedStyleValue::create("(FIXME:calc to string)", calc_expression.release_nonnull());
|
||||
} else if (function.name().equals_ignoring_case("var")) {
|
||||
// FIXME: Handle fallback value as second parameter
|
||||
// https://www.w3.org/TR/css-variables-1/#using-variables
|
||||
if (!component_value.function().values().is_empty()) {
|
||||
auto& property_name_token = component_value.function().values().first();
|
||||
if (property_name_token.is(Token::Type::Ident))
|
||||
return CustomStyleValue::create(property_name_token.token().ident());
|
||||
else
|
||||
dbgln("First argument to var() function was not an ident: '{}'", property_name_token.to_debug_string());
|
||||
}
|
||||
// Declarations using `var()` should already be parsed as an UnresolvedStyleValue before this point.
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -572,13 +572,6 @@ void StyleComputer::cascade_declarations(StyleProperties& style, DOM::Element& e
|
|||
if (important != property.important)
|
||||
continue;
|
||||
auto property_value = property.value;
|
||||
if (property.value->is_custom_property()) {
|
||||
auto custom_property_name = property.value->as_custom_property().custom_property_name();
|
||||
auto resolved = resolve_custom_property(element, custom_property_name);
|
||||
if (resolved.has_value()) {
|
||||
property_value = resolved.value().value;
|
||||
}
|
||||
}
|
||||
if (property.value->is_unresolved()) {
|
||||
if (auto resolved = resolve_unresolved_style_value(element, property.property_id, property.value->as_unresolved()))
|
||||
property_value = resolved.release_nonnull();
|
||||
|
|
|
@ -73,12 +73,6 @@ ColorStyleValue const& StyleValue::as_color() const
|
|||
return static_cast<ColorStyleValue const&>(*this);
|
||||
}
|
||||
|
||||
CustomStyleValue const& StyleValue::as_custom_property() const
|
||||
{
|
||||
VERIFY(is_custom_property());
|
||||
return static_cast<CustomStyleValue const&>(*this);
|
||||
}
|
||||
|
||||
FlexStyleValue const& StyleValue::as_flex() const
|
||||
{
|
||||
VERIFY(is_flex());
|
||||
|
|
|
@ -272,7 +272,6 @@ public:
|
|||
Calculated,
|
||||
Color,
|
||||
CombinedBorderRadius,
|
||||
CustomProperty,
|
||||
Flex,
|
||||
FlexFlow,
|
||||
Font,
|
||||
|
@ -304,7 +303,6 @@ public:
|
|||
bool is_box_shadow() const { return type() == Type::BoxShadow; }
|
||||
bool is_calculated() const { return type() == Type::Calculated; }
|
||||
bool is_color() const { return type() == Type::Color; }
|
||||
bool is_custom_property() const { return type() == Type::CustomProperty; }
|
||||
bool is_flex() const { return type() == Type::Flex; }
|
||||
bool is_flex_flow() const { return type() == Type::FlexFlow; }
|
||||
bool is_font() const { return type() == Type::Font; }
|
||||
|
@ -334,7 +332,6 @@ public:
|
|||
BoxShadowStyleValue const& as_box_shadow() const;
|
||||
CalculatedStyleValue const& as_calculated() const;
|
||||
ColorStyleValue const& as_color() const;
|
||||
CustomStyleValue const& as_custom_property() const;
|
||||
FlexFlowStyleValue const& as_flex_flow() const;
|
||||
FlexStyleValue const& as_flex() const;
|
||||
FontStyleValue const& as_font() const;
|
||||
|
@ -362,7 +359,6 @@ public:
|
|||
BoxShadowStyleValue& as_box_shadow() { return const_cast<BoxShadowStyleValue&>(const_cast<StyleValue const&>(*this).as_box_shadow()); }
|
||||
CalculatedStyleValue& as_calculated() { return const_cast<CalculatedStyleValue&>(const_cast<StyleValue const&>(*this).as_calculated()); }
|
||||
ColorStyleValue& as_color() { return const_cast<ColorStyleValue&>(const_cast<StyleValue const&>(*this).as_color()); }
|
||||
CustomStyleValue& as_custom_property() { return const_cast<CustomStyleValue&>(const_cast<StyleValue const&>(*this).as_custom_property()); }
|
||||
FlexFlowStyleValue& as_flex_flow() { return const_cast<FlexFlowStyleValue&>(const_cast<StyleValue const&>(*this).as_flex_flow()); }
|
||||
FlexStyleValue& as_flex() { return const_cast<FlexStyleValue&>(const_cast<StyleValue const&>(*this).as_flex()); }
|
||||
FontStyleValue& as_font() { return const_cast<FontStyleValue&>(const_cast<StyleValue const&>(*this).as_font()); }
|
||||
|
@ -852,26 +848,6 @@ private:
|
|||
NonnullRefPtr<BorderRadiusStyleValue> m_bottom_left;
|
||||
};
|
||||
|
||||
// FIXME: Allow for fallback
|
||||
class CustomStyleValue : public StyleValue {
|
||||
public:
|
||||
static NonnullRefPtr<CustomStyleValue> create(String const& custom_property_name)
|
||||
{
|
||||
return adopt_ref(*new CustomStyleValue(custom_property_name));
|
||||
}
|
||||
String custom_property_name() const { return m_custom_property_name; }
|
||||
String to_string() const override { return m_custom_property_name; }
|
||||
|
||||
private:
|
||||
explicit CustomStyleValue(String const& custom_property_name)
|
||||
: StyleValue(Type::CustomProperty)
|
||||
, m_custom_property_name(custom_property_name)
|
||||
{
|
||||
}
|
||||
|
||||
String m_custom_property_name {};
|
||||
};
|
||||
|
||||
class FlexStyleValue final : public StyleValue {
|
||||
public:
|
||||
static NonnullRefPtr<FlexStyleValue> create(
|
||||
|
|
|
@ -35,7 +35,6 @@ class CSSStyleDeclaration;
|
|||
class CSSStyleRule;
|
||||
class CSSStyleSheet;
|
||||
class CSSSupportsRule;
|
||||
class CustomStyleValue;
|
||||
class Display;
|
||||
class ElementInlineCSSStyleDeclaration;
|
||||
class FlexFlowStyleValue;
|
||||
|
|
Loading…
Add table
Reference in a new issue