mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-07 00:29:15 +00:00
LibWeb: Set hue-rotate angle to 0 degrees if omitted
This commit is contained in:
parent
61f76c7ec5
commit
2ee86d1e18
Notes:
github-actions[bot]
2025-04-04 16:14:02 +00:00
Author: https://github.com/tcl3
Commit: 2ee86d1e18
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4222
Reviewed-by: https://github.com/AtkinsSJ ✅
4 changed files with 15 additions and 20 deletions
|
@ -24,10 +24,7 @@ float FilterOperation::Blur::resolved_radius(Layout::Node const& node) const
|
||||||
|
|
||||||
float FilterOperation::HueRotate::angle_degrees(Layout::Node const& node) const
|
float FilterOperation::HueRotate::angle_degrees(Layout::Node const& node) const
|
||||||
{
|
{
|
||||||
// Default value when omitted is 0deg.
|
return angle.visit([&](AngleOrCalculated const& a) { return a.resolved({ .length_resolution_context = Length::ResolutionContext::for_layout_node(node) })->to_degrees(); }, [&](Zero) { return 0.0; });
|
||||||
if (!angle.has_value())
|
|
||||||
return 0.0f;
|
|
||||||
return angle->visit([&](AngleOrCalculated const& a) { return a.resolved({ .length_resolution_context = Length::ResolutionContext::for_layout_node(node) })->to_degrees(); }, [&](Zero) { return 0.0; });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float FilterOperation::Color::resolved_amount() const
|
float FilterOperation::Color::resolved_amount() const
|
||||||
|
@ -75,15 +72,13 @@ String FilterValueListStyleValue::to_string(SerializationMode) const
|
||||||
},
|
},
|
||||||
[&](FilterOperation::HueRotate const& hue_rotate) {
|
[&](FilterOperation::HueRotate const& hue_rotate) {
|
||||||
builder.append("hue-rotate("sv);
|
builder.append("hue-rotate("sv);
|
||||||
if (hue_rotate.angle.has_value()) {
|
hue_rotate.angle.visit(
|
||||||
hue_rotate.angle->visit(
|
[&](Angle const& angle) {
|
||||||
[&](Angle const& angle) {
|
builder.append(angle.to_string());
|
||||||
return builder.append(angle.to_string());
|
},
|
||||||
},
|
[&](auto&) {
|
||||||
[&](auto&) {
|
builder.append("0deg"sv);
|
||||||
return builder.append('0');
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
[&](FilterOperation::Color const& color) {
|
[&](FilterOperation::Color const& color) {
|
||||||
builder.appendff("{}(",
|
builder.appendff("{}(",
|
||||||
|
|
|
@ -39,7 +39,7 @@ struct HueRotate {
|
||||||
bool operator==(Zero const&) const = default;
|
bool operator==(Zero const&) const = default;
|
||||||
};
|
};
|
||||||
using AngleOrZero = Variant<AngleOrCalculated, Zero>;
|
using AngleOrZero = Variant<AngleOrCalculated, Zero>;
|
||||||
Optional<AngleOrZero> angle;
|
AngleOrZero angle { Angle::make_degrees(0) };
|
||||||
float angle_degrees(Layout::Node const&) const;
|
float angle_degrees(Layout::Node const&) const;
|
||||||
bool operator==(HueRotate const&) const = default;
|
bool operator==(HueRotate const&) const = default;
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,8 +2,8 @@ Harness status: OK
|
||||||
|
|
||||||
Found 34 tests
|
Found 34 tests
|
||||||
|
|
||||||
16 Pass
|
17 Pass
|
||||||
18 Fail
|
17 Fail
|
||||||
Pass Property filter value 'none'
|
Pass Property filter value 'none'
|
||||||
Pass Property filter value 'blur(100px)'
|
Pass Property filter value 'blur(100px)'
|
||||||
Fail Property filter value 'blur()'
|
Fail Property filter value 'blur()'
|
||||||
|
@ -21,7 +21,7 @@ Fail Property filter value 'grayscale(2)'
|
||||||
Fail Property filter value 'grayscale(calc(2))'
|
Fail Property filter value 'grayscale(calc(2))'
|
||||||
Pass Property filter value 'grayscale()'
|
Pass Property filter value 'grayscale()'
|
||||||
Fail Property filter value 'hue-rotate(90deg)'
|
Fail Property filter value 'hue-rotate(90deg)'
|
||||||
Fail Property filter value 'hue-rotate()'
|
Pass Property filter value 'hue-rotate()'
|
||||||
Pass Property filter value 'invert(0)'
|
Pass Property filter value 'invert(0)'
|
||||||
Fail Property filter value 'invert(100%)'
|
Fail Property filter value 'invert(100%)'
|
||||||
Fail Property filter value 'invert(2)'
|
Fail Property filter value 'invert(2)'
|
||||||
|
|
|
@ -2,8 +2,8 @@ Harness status: OK
|
||||||
|
|
||||||
Found 39 tests
|
Found 39 tests
|
||||||
|
|
||||||
30 Pass
|
31 Pass
|
||||||
9 Fail
|
8 Fail
|
||||||
Pass e.style['filter'] = "none" should set the property value
|
Pass e.style['filter'] = "none" should set the property value
|
||||||
Pass e.style['filter'] = "blur(100px)" should set the property value
|
Pass e.style['filter'] = "blur(100px)" should set the property value
|
||||||
Pass e.style['filter'] = "blur(0)" should set the property value
|
Pass e.style['filter'] = "blur(0)" should set the property value
|
||||||
|
@ -26,7 +26,7 @@ Pass e.style['filter'] = "grayscale(calc(300%))" should set the property value
|
||||||
Pass e.style['filter'] = "grayscale(calc(101% * sign(1em - 1px)))" should set the property value
|
Pass e.style['filter'] = "grayscale(calc(101% * sign(1em - 1px)))" should set the property value
|
||||||
Pass e.style['filter'] = "grayscale()" should set the property value
|
Pass e.style['filter'] = "grayscale()" should set the property value
|
||||||
Fail e.style['filter'] = "hue-rotate(90deg)" should set the property value
|
Fail e.style['filter'] = "hue-rotate(90deg)" should set the property value
|
||||||
Fail e.style['filter'] = "hue-rotate(0)" should set the property value
|
Pass e.style['filter'] = "hue-rotate(0)" should set the property value
|
||||||
Pass e.style['filter'] = "hue-rotate()" should set the property value
|
Pass e.style['filter'] = "hue-rotate()" should set the property value
|
||||||
Pass e.style['filter'] = "invert(0)" should set the property value
|
Pass e.style['filter'] = "invert(0)" should set the property value
|
||||||
Fail e.style['filter'] = "invert(300%)" should set the property value
|
Fail e.style['filter'] = "invert(300%)" should set the property value
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue