mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 12:05:07 +00:00
![]() A '0' token can be interpreted both as a Number, and as a Length. This is problematic as in our CSS parser, we often call parse_css_value() first, to figure out what something is, and then assign it. So we do not know in advance whether we want a Length or not. Previously, it always got parsed as a Length, and then every place that expected a NumericStyleValue had to also check for a Length(0), which is easy to forget to do. In particular, this was causing issues with the `flex` property parsing. To solve this, we now always parse 0 as a NumericStyleValue, and NSVs of 0 pretend to be a Length(0px) when asked. In two places, we were casting to a LengthStyleValue* based on is_length(), which no longer works, so those have been adjusted to use `StyleValue::to_length()` instead. They also now check for `is_numeric()` first, to avoid the extra conversion to a Length and back. Possibly this opens up new issues elsewhere. In my testing it seems fine, but until we can get CSS test suites running, it's hard to know for certain. |
||
---|---|---|
.. | ||
DeclarationOrAtRule.h | ||
Parser.cpp | ||
Parser.h | ||
StyleBlockRule.h | ||
StyleComponentValueRule.h | ||
StyleDeclarationRule.h | ||
StyleFunctionRule.h | ||
StyleRule.h | ||
StyleRules.cpp | ||
Token.cpp | ||
Token.h | ||
Tokenizer.cpp | ||
Tokenizer.h |