diff options
-rw-r--r-- | Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_PropertyID_cpp.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
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 53f3a70def..c7d3d82ba6 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_PropertyID_cpp.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_PropertyID_cpp.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org> + * Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org> * * SPDX-License-Identifier: BSD-2-Clause */ @@ -334,10 +335,14 @@ bool property_accepts_value(PropertyID property_id, StyleValue& style_value) if (style_value.is_image()) return true; )~~~"); - } else if (type_name == "length" || type_name == "percentage") { - // FIXME: Handle lengths and percentages separately + } else if (type_name == "length") { property_generator.append(R"~~~( - if (style_value.has_length() || style_value.is_calculated()) + if ((style_value.has_length() && !style_value.to_length().is_percentage()) || style_value.is_calculated()) + return true; +)~~~"); + } else if (type_name == "percentage") { + property_generator.append(R"~~~( + if ((style_value.has_length() && style_value.to_length().is_percentage()) || style_value.is_calculated()) return true; )~~~"); } else if (type_name == "number" || type_name == "integer") { |