mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
LibWeb: Add support for viewport-relative length units (#3433)
We can now use vh, vw, vmax and vmin as length units in CSS.
This commit is contained in:
parent
d467a0ffef
commit
dcc2c8a125
Notes:
sideshowbarker
2024-07-19 02:49:37 +09:00
Author: https://github.com/networkException 🔰
Commit: dcc2c8a125
Pull-request: https://github.com/SerenityOS/serenity/pull/3433
Reviewed-by: https://github.com/awesomekling
Reviewed-by: https://github.com/linusg
3 changed files with 49 additions and 1 deletions
|
@ -292,6 +292,18 @@ static CSS::Length parse_length(const CSS::ParsingContext& context, const String
|
|||
} else if (view.ends_with("ex", CaseSensitivity::CaseInsensitive)) {
|
||||
type = CSS::Length::Type::Ex;
|
||||
value = try_parse_float(view.substring_view(0, view.length() - 2));
|
||||
} else if (view.ends_with("vw", CaseSensitivity::CaseInsensitive)) {
|
||||
type = CSS::Length::Type::Vw;
|
||||
value = try_parse_float(view.substring_view(0, view.length() - 2));
|
||||
} else if (view.ends_with("vh", CaseSensitivity::CaseInsensitive)) {
|
||||
type = CSS::Length::Type::Vh;
|
||||
value = try_parse_float(view.substring_view(0, view.length() - 2));
|
||||
} else if (view.ends_with("vmax", CaseSensitivity::CaseInsensitive)) {
|
||||
type = CSS::Length::Type::Vmax;
|
||||
value = try_parse_float(view.substring_view(0, view.length() - 4));
|
||||
} else if (view.ends_with("vmin", CaseSensitivity::CaseInsensitive)) {
|
||||
type = CSS::Length::Type::Vmin;
|
||||
value = try_parse_float(view.substring_view(0, view.length() - 4));
|
||||
} else if (view == "0") {
|
||||
type = CSS::Length::Type::Px;
|
||||
value = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue