mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-28 02:27:19 +02:00
LibWeb: Support calc(...) in box-shadow's values of type Length
The CSS box-shadow property takes 2-4 properties that are `<length>`s, those being: - offset-x - offset-y - blur-radius - spread-radius Previously these were resolved directly to concrete Lengths at parse time, but now they will be parsed as LengthStyleValues and/or CalculatedStyleValues and be stored that way until styles are later resolved.
This commit is contained in:
Notes:
sideshowbarker
2024-07-17 07:35:03 +09:00
Author: https://github.com/FalseHonesty Commit: https://github.com/SerenityOS/serenity/commit/110eeb8591 Pull-request: https://github.com/SerenityOS/serenity/pull/19190 Reviewed-by: https://github.com/AtkinsSJ
@@ -523,8 +523,12 @@ ErrorOr<RefPtr<StyleValue const>> ResolvedCSSStyleDeclaration::style_value_for_p
|
||||
if (box_shadow_layers.is_empty())
|
||||
return nullptr;
|
||||
|
||||
auto make_box_shadow_style_value = [](ShadowData const& data) {
|
||||
return ShadowStyleValue::create(data.color, data.offset_x, data.offset_y, data.blur_radius, data.spread_distance, data.placement);
|
||||
auto make_box_shadow_style_value = [](ShadowData const& data) -> ErrorOr<NonnullRefPtr<ShadowStyleValue>> {
|
||||
auto offset_x = TRY(LengthStyleValue::create(data.offset_x));
|
||||
auto offset_y = TRY(LengthStyleValue::create(data.offset_y));
|
||||
auto blur_radius = TRY(LengthStyleValue::create(data.blur_radius));
|
||||
auto spread_distance = TRY(LengthStyleValue::create(data.spread_distance));
|
||||
return ShadowStyleValue::create(data.color, offset_x, offset_y, blur_radius, spread_distance, data.placement);
|
||||
};
|
||||
|
||||
if (box_shadow_layers.size() == 1)
|
||||
|
||||
Reference in New Issue
Block a user