ladybird/Userland/Libraries/LibWeb/CSS
Sam Atkins c8c2a8df56 LibWeb: Make '0' always be both a number and a length in CSS
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.
2021-08-14 12:45:01 +02:00
..
Parser LibWeb: Make '0' always be both a number and a length in CSS 2021-08-14 12:45:01 +02:00
.gitignore
ComputedValues.h LibWeb: Add auto as a recognized argument of flex-basis 2021-08-07 15:21:34 +02:00
CSSImportRule.cpp
CSSImportRule.h
CSSRule.cpp
CSSRule.h
CSSStyleDeclaration.cpp
CSSStyleDeclaration.h
CSSStyleDeclaration.idl LibWeb: Add a CustomHasProperty trait to WrapperGenerator 2021-07-26 15:56:15 +01:00
CSSStyleRule.cpp LibWeb: Make CSS::Selector reference counted 2021-07-14 13:31:00 +02:00
CSSStyleRule.h LibWeb: Make CSS::Selector reference counted 2021-07-14 13:31:00 +02:00
CSSStyleSheet.cpp
CSSStyleSheet.h
CSSStyleSheet.idl
Default.css
Identifiers.json LibWeb: Resolve CSS text-decoration from value list 2021-07-22 23:09:01 +02:00
Length.cpp Everywhere: Use tobyase@serenityos.org for my copyright headers 2021-08-09 21:43:05 +02:00
Length.h LibWeb: Add calc() resolution to CSS::Length 2021-07-24 03:02:07 +04:30
LengthBox.h
Properties.json LibWeb: Add box-shadow as a known ValueID 2021-07-24 22:16:48 +02:00
QuirksMode.css
Screen.cpp
Screen.h
Screen.idl
Selector.cpp LibWeb: Remove unused header includes 2021-08-01 08:10:16 +02:00
Selector.h LibWeb: Make CSS 'An+B' parsing spec-compliant 2021-07-31 00:18:11 +02:00
SelectorEngine.cpp LibWeb: Switch to new CSS Parser :^) 2021-08-02 19:01:25 +04:30
SelectorEngine.h LibWeb: Convert CSS Dump, Selector, & SelectorEngine to east const 2021-07-14 13:31:00 +02:00
StyleInvalidator.cpp
StyleInvalidator.h
StyleProperties.cpp LibWeb: Make '0' always be both a number and a length in CSS 2021-08-14 12:45:01 +02:00
StyleProperties.h LibWeb: Make box-shadow known throughout the CSS subsystem 2021-07-24 22:16:48 +02:00
StyleResolver.cpp LibWeb: Remove pointless type casts 2021-08-12 21:10:44 +02:00
StyleResolver.h LibWeb: Convert StyleResolver.{h,cpp} to east const 2021-07-22 23:09:01 +02:00
StyleSheet.cpp
StyleSheet.h
StyleSheet.idl
StyleSheetList.cpp
StyleSheetList.h
StyleSheetList.idl
StyleValue.cpp LibWeb: Add CSS ValueListStyleValue 2021-07-22 23:09:01 +02:00
StyleValue.h LibWeb: Make '0' always be both a number and a length in CSS 2021-08-14 12:45:01 +02:00