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

LibWeb: Make computed opacity always available

No need to store opacity as Optional<float> as there's always a value
(and the default initial value is 1.)
This commit is contained in:
Andreas Kling 2021-10-19 15:27:40 +02:00
parent 07f15aa550
commit ff45eb7fb1
6 changed files with 14 additions and 20 deletions

View file

@ -121,11 +121,11 @@ Optional<int> StyleProperties::z_index() const
return {};
}
Optional<float> StyleProperties::opacity() const
float StyleProperties::opacity() const
{
auto maybe_value = property(CSS::PropertyID::Opacity);
if (!maybe_value.has_value())
return {};
return 1.0f;
auto& value = maybe_value.value();
if (value->has_number())
@ -137,7 +137,7 @@ Optional<float> StyleProperties::opacity() const
return clamp(length.raw_value() / 100.0f, 0.0f, 1.0f);
}
return {};
return 1.0f;
}
Optional<CSS::FlexDirection> StyleProperties::flex_direction() const