diff options
author | Karol Kosek <krkk@krkk.ct8.pl> | 2021-08-05 16:31:15 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-25 17:55:53 +0200 |
commit | ffa7da0ca56b8f50d8966ca2851622fbae455e22 (patch) | |
tree | 85ebce54a28f396284a81c7e6c635f447f073a22 /Userland/Libraries/LibWeb/CSS/Parser | |
parent | a230524c4668c72b5a519a8f441637f54bee6654 (diff) | |
download | serenity-ffa7da0ca56b8f50d8966ca2851622fbae455e22.zip |
LibWeb: Handle CSS "ch" length unit (mostly)
This isn't 100% spec complaint, as it should use glyph_height()
depending on what the value of the writing-mode is, but we haven't
implemented it yet, so I think it'll be good enough for now.
This can be tested in https://wpt.live/css/css-values/ch-unit-008.html
Other css-unit tests fail as:
- 001 shows an issue related to a renderer (looks to me like you can't
pass a width and height property to a span -- adding `display: block`
to it passes the test),
- 002-004 and 009-012 use mentioned writing-mode,
- 016-017 loads custom fonts, which we also don't support (yet).
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS/Parser')
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index 0f4c91d823..b4e240e89a 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -1466,6 +1466,8 @@ Optional<Length> Parser::parse_length(ParsingContext const& context, StyleCompon type = Length::Type::Em; } else if (unit_string.equals_ignoring_case("ex")) { type = Length::Type::Ex; + } else if (unit_string.equals_ignoring_case("ch")) { + type = Length::Type::Ch; } else if (unit_string.equals_ignoring_case("vw")) { type = Length::Type::Vw; } else if (unit_string.equals_ignoring_case("vh")) { |