1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:07:35 +00:00

LibWeb: Make box-shadow known throughout the CSS subsystem

This patch spreads box-shadows around:
- The Values important to box-shadows are stored in a BoxShadowData
  struct
- StyleProperties knows how to construct such a struct from a
  BoxShadowStyleValue and a Node knows how to ask for it
- CalculatedValues contain BoxShadowData and expose them
This commit is contained in:
Tobias Christiansen 2021-07-23 21:22:31 +02:00 committed by Andreas Kling
parent 36e6f559c5
commit f1bdaafcf6
4 changed files with 27 additions and 0 deletions

View file

@ -764,4 +764,18 @@ Optional<CSS::Repeat> StyleProperties::background_repeat_y() const
return {};
}
}
Optional<CSS::BoxShadowData> StyleProperties::box_shadow() const
{
auto value_or_error = property(CSS::PropertyID::BoxShadow);
if (!value_or_error.has_value())
return {};
auto value = value_or_error.value();
if (!value->is_box_shadow())
return {};
auto box = verify_cast<CSS::BoxShadowStyleValue>(value.ptr());
return { { box->offset_x(), box->offset_y(), box->blur_radius(), box->color() } };
}
}