mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-28 04:08:08 +00:00
LibWeb: Handle CSS "ex" lengths (relative to font x-height)
These are pretty rare, but they do come up in some places and it's not hard to support. The Gfx::Font information is approximate (and bad) but we can fix that separately.
This commit is contained in:
@@ -284,6 +284,9 @@ static CSS::Length parse_length(const CSS::ParsingContext& context, const String
|
||||
} else if (view.to_string().to_lowercase().ends_with("em")) {
|
||||
type = CSS::Length::Type::Em;
|
||||
value = try_parse_float(view.substring_view(0, view.length() - 2));
|
||||
} else if (view.to_string().to_lowercase().ends_with("ex")) {
|
||||
type = CSS::Length::Type::Ex;
|
||||
value = try_parse_float(view.substring_view(0, view.length() - 2));
|
||||
} else if (view == "0") {
|
||||
type = CSS::Length::Type::Px;
|
||||
value = 0;
|
||||
|
||||
Reference in New Issue
Block a user