mirror of
https://github.com/SerenityOS/serenity
synced 2024-07-22 02:26:11 +00:00
LibWeb: Allow calc() in CSS position values
This commit is contained in:
parent
1b0cc67a28
commit
19da17f07e
|
@ -204,6 +204,10 @@
|
|||
.grad-radial-repeat-3 {
|
||||
background-image: repeating-radial-gradient(circle at 100%, #333, #333 10px, #eee 10px, #eee 20px);
|
||||
}
|
||||
|
||||
.grad-radial-calc {
|
||||
background-image: repeating-radial-gradient(circle at calc(100% - 10px) calc(20% + 10px), #333, #333 10px, #eee 10px, #eee 20px);
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<div class="box grad-0"></div>
|
||||
|
@ -245,5 +249,6 @@
|
|||
<div class="rect grad-radial-repeat-1"></div>
|
||||
<div class="rect grad-radial-repeat-2"></div>
|
||||
<div class="rect grad-radial-repeat-3"></div>
|
||||
<div class="rect grad-radial-calc"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 317 KiB After Width: | Height: | Size: 350 KiB |
|
@ -2359,11 +2359,17 @@ RefPtr<PositionStyleValue> Parser::parse_position_value(TokenStream<ComponentVal
|
|||
auto parse_length_percentage = [&](ComponentValue const& token) -> Optional<LengthPercentage> {
|
||||
if (token.is(Token::Type::EndOfFile))
|
||||
return {};
|
||||
// FIXME: calc()!
|
||||
auto dimension = parse_dimension(token);
|
||||
if (!dimension.has_value() || !dimension->is_length_percentage())
|
||||
|
||||
if (auto dimension = parse_dimension(token); dimension.has_value()) {
|
||||
if (dimension->is_length_percentage())
|
||||
return dimension->length_percentage();
|
||||
return {};
|
||||
return dimension->length_percentage();
|
||||
}
|
||||
|
||||
if (auto calc = parse_calculated_value(token); calc && calc->resolves_to_length_percentage())
|
||||
return LengthPercentage { calc.release_nonnull() };
|
||||
|
||||
return {};
|
||||
};
|
||||
|
||||
auto is_horizontal = [](PositionEdge edge, bool accept_center) -> bool {
|
||||
|
|
Loading…
Reference in a new issue