mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-04 13:30:31 +00:00
LibWeb: Support more CSS functions in grid track size lists
Instead of hard-coding a check for "calc", we now call out to parse_dynamic_value() which allows use of other functions like min(), max(), clamp(), etc.
This commit is contained in:
parent
6a7a7e2337
commit
741c7aef21
Notes:
sideshowbarker
2024-07-17 06:24:08 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/741c7aef21 Pull-request: https://github.com/SerenityOS/serenity/pull/19365
3 changed files with 21 additions and 5 deletions
|
@ -0,0 +1,8 @@
|
|||
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
||||
BlockContainer <html> at (1,1) content-size 798x54.9375 [BFC] children: not-inline
|
||||
Box <body> at (10,10) content-size 780x36.9375 [GFC] children: not-inline
|
||||
BlockContainer <h1> at (55.5,11) content-size 689x34.9375 [BFC] children: inline
|
||||
line 0 width: 200.40625, height: 34.9375, bottom: 34.9375, baseline: 27.0625
|
||||
frag 0 from TextNode start: 0, length: 13, rect: [55.5,11 200.40625x34.9375]
|
||||
"hello friends"
|
||||
TextNode <#text>
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html><style>
|
||||
* { border: 1px solid black; }
|
||||
body {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr min(89ch, 100% - 89px) 1fr;
|
||||
}
|
||||
h1 {
|
||||
grid-column: 2 / auto;
|
||||
margin: 0;
|
||||
}
|
||||
</style><body><h1>hello friends</h1>
|
|
@ -6900,11 +6900,8 @@ Optional<CSS::ExplicitGridTrack> Parser::parse_track_sizing_function(ComponentVa
|
|||
return CSS::ExplicitGridTrack(maybe_min_max_value.value());
|
||||
else
|
||||
return {};
|
||||
} else if (function_token.name().equals_ignoring_ascii_case("calc"sv)) {
|
||||
auto grid_size = parse_grid_size(token);
|
||||
if (!grid_size.has_value())
|
||||
return {};
|
||||
return CSS::ExplicitGridTrack(grid_size.value());
|
||||
} else if (auto maybe_dynamic = parse_dynamic_value(token); !maybe_dynamic.is_error() && maybe_dynamic.value()) {
|
||||
return CSS::ExplicitGridTrack(GridSize(LengthPercentage(maybe_dynamic.release_value()->as_calculated())));
|
||||
}
|
||||
return {};
|
||||
} else if (token.is(Token::Type::Ident) && token.token().ident().equals_ignoring_ascii_case("auto"sv)) {
|
||||
|
|
Loading…
Reference in a new issue