mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
LibWeb: Set context for parsing against <foo-percentage> syntax
This means that we correctly parse dimension percentage mixes (i.e. `calc(10px + 10%)` is a valid `<length-percentage>`)
This commit is contained in:
Notes:
github-actions[bot]
2026-03-26 01:13:21 +00:00
Author: https://github.com/Calme1709 Commit: https://github.com/LadybirdBrowser/ladybird/commit/614a5cf33ef Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8330 Reviewed-by: https://github.com/AtkinsSJ ✅
@@ -5162,6 +5162,20 @@ RefPtr<CalculatedStyleValue const> Parser::parse_calculated_value(ComponentValue
|
||||
return {};
|
||||
}
|
||||
VERIFY_NOT_REACHED();
|
||||
},
|
||||
[](SyntaxParsingContext const& syntax_context) -> Optional<CalculationContext> {
|
||||
switch (syntax_context.type) {
|
||||
case ValueType::AnglePercentage:
|
||||
return CalculationContext { .percentages_resolve_as = ValueType::Angle };
|
||||
case ValueType::FrequencyPercentage:
|
||||
return CalculationContext { .percentages_resolve_as = ValueType::Frequency };
|
||||
case ValueType::LengthPercentage:
|
||||
return CalculationContext { .percentages_resolve_as = ValueType::Length };
|
||||
case ValueType::TimePercentage:
|
||||
return CalculationContext { .percentages_resolve_as = ValueType::Time };
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
});
|
||||
if (maybe_context.has_value()) {
|
||||
context = maybe_context.release_value();
|
||||
|
||||
Reference in New Issue
Block a user