mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:38:11 +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:
parent
0bbced444b
commit
498845ea2f
3 changed files with 9 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue