diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_PropertyID_cpp.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_PropertyID_cpp.cpp index e1ac87163f..baedbcbf39 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_PropertyID_cpp.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_PropertyID_cpp.cpp @@ -307,13 +307,12 @@ bool property_accepts_value(PropertyID property_id, StyleValue& style_value) )~~~"); } else if (type_name == "length") { property_generator.append(R"~~~( - if ((style_value.has_length() && !style_value.to_length().is_percentage()) || style_value.is_calculated()) + if (style_value.has_length() || style_value.is_calculated()) return true; )~~~"); } else if (type_name == "percentage") { - // FIXME: Detecting lengths here is temporary until Length/Percentage are fully separated. property_generator.append(R"~~~( - if (style_value.is_percentage() || style_value.is_calculated() || (style_value.has_length() && !style_value.to_length().is_percentage())) + if (style_value.is_percentage() || style_value.is_calculated()) return true; )~~~"); } else if (type_name == "number" || type_name == "integer") { diff --git a/Userland/Libraries/LibWeb/CSS/Length.cpp b/Userland/Libraries/LibWeb/CSS/Length.cpp index 3cdd0117b6..d007d8a025 100644 --- a/Userland/Libraries/LibWeb/CSS/Length.cpp +++ b/Userland/Libraries/LibWeb/CSS/Length.cpp @@ -55,8 +55,6 @@ Length Length::resolved(const Length& fallback_for_undefined, const Layout::Node return fallback_for_undefined; if (is_calculated()) return Length(resolve_calculated_value(layout_node, reference_for_percent), Type::Px); - if (is_percentage()) - return make_px(raw_value() / 100.0f * reference_for_percent); if (is_relative()) return make_px(to_px(layout_node)); return *this; @@ -257,8 +255,6 @@ const char* Length::unit_name() const return "rem"; case Type::Auto: return "auto"; - case Type::Percentage: - return "%"; case Type::Undefined: return "undefined"; case Type::Vh: diff --git a/Userland/Libraries/LibWeb/CSS/Length.h b/Userland/Libraries/LibWeb/CSS/Length.h index ddf620bced..26b03c8425 100644 --- a/Userland/Libraries/LibWeb/CSS/Length.h +++ b/Userland/Libraries/LibWeb/CSS/Length.h @@ -16,7 +16,6 @@ class Length { public: enum class Type { Undefined, - Percentage, Calculated, Auto, Cm, @@ -52,7 +51,6 @@ public: bool is_undefined_or_auto() const { return m_type == Type::Undefined || m_type == Type::Auto; } bool is_undefined() const { return m_type == Type::Undefined; } - bool is_percentage() const { return m_type == Type::Percentage || m_type == Type::Calculated; } bool is_auto() const { return m_type == Type::Auto; } bool is_calculated() const { return m_type == Type::Calculated; } diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index b7dfe9c57c..5e01593468 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -2184,12 +2184,7 @@ Optional Parser::parse_length(StyleComponentValueRule const& component_v if (dimension->is_length()) return dimension->length(); - // FIXME: This is a temporary hack until Length is split up fully. - if (dimension->is_percentage()) { - auto percentage = dimension->percentage(); - return Length { (float)percentage.value(), Length::Type::Percentage }; - } - + // FIXME: auto isn't a length! if (component_value.is(Token::Type::Ident) && component_value.token().ident().equals_ignoring_case("auto")) return Length::make_auto(); diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValue.h index 2d432d55e0..22aa5e88af 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValue.h @@ -1194,10 +1194,6 @@ public: Percentage const& percentage() const { return m_percentage; } Percentage& percentage() { return m_percentage; } - // FIXME: This is a temporary hack until we fully separate Length and Percentage. - bool has_length() const override { return true; } - Length to_length() const override { return { m_percentage.value(), Length::Type::Percentage }; } - virtual String to_string() const override { return m_percentage.to_string();