mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-19 07:33:20 +00:00
LibWeb: Resolve percentages in <angular-color-stop-list>
as angles
This commit is contained in:
parent
62c00712fa
commit
cc2c8e8615
Notes:
github-actions[bot]
2025-10-17 07:38:54 +00:00
Author: https://github.com/Calme1709
Commit: cc2c8e8615
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6497
Reviewed-by: https://github.com/tcl3 ✅
4 changed files with 11 additions and 5 deletions
|
@ -120,6 +120,8 @@ Optional<Vector<LinearColorStopListElement>> Parser::parse_linear_color_stop_lis
|
|||
|
||||
Optional<Vector<AngularColorStopListElement>> Parser::parse_angular_color_stop_list(TokenStream<ComponentValue>& tokens)
|
||||
{
|
||||
auto context_guard = push_temporary_value_parsing_context(SpecialContext::AngularColorStopList);
|
||||
|
||||
// <angular-color-stop-list> =
|
||||
// <angular-color-stop> , [ <angular-color-hint>? , <angular-color-stop> ]#
|
||||
return parse_color_stop_list<AngularColorStopListElement>(
|
||||
|
|
|
@ -564,6 +564,7 @@ private:
|
|||
DescriptorID descriptor;
|
||||
};
|
||||
enum SpecialContext : u8 {
|
||||
AngularColorStopList,
|
||||
ShadowBlurRadius,
|
||||
TranslateZArgument
|
||||
};
|
||||
|
|
|
@ -4110,7 +4110,8 @@ RefPtr<CalculatedStyleValue const> Parser::parse_calculated_value(ComponentValue
|
|||
return CalculationContext::for_property(PropertyNameAndID::from_id(property_id));
|
||||
},
|
||||
[](FunctionContext const& function) -> Optional<CalculationContext> {
|
||||
// Gradients resolve percentages as lengths relative to the gradient-box.
|
||||
// Gradients resolve percentages as lengths relative to the gradient-box (except within
|
||||
// <angular-color-stop-list>s which are handled by a special context)
|
||||
if (function.name.is_one_of_ignoring_ascii_case(
|
||||
"linear-gradient"sv, "repeating-linear-gradient"sv,
|
||||
"radial-gradient"sv, "repeating-radial-gradient"sv,
|
||||
|
@ -4140,6 +4141,8 @@ RefPtr<CalculatedStyleValue const> Parser::parse_calculated_value(ComponentValue
|
|||
},
|
||||
[](SpecialContext special_context) -> Optional<CalculationContext> {
|
||||
switch (special_context) {
|
||||
case SpecialContext::AngularColorStopList:
|
||||
return CalculationContext { .percentages_resolve_as = ValueType::Angle };
|
||||
case SpecialContext::ShadowBlurRadius:
|
||||
return CalculationContext { .accepted_type_ranges = { { ValueType::Length, { 0, NumericLimits<float>::max() } } } };
|
||||
case SpecialContext::TranslateZArgument:
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue