mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:17:35 +00:00
LibWeb: Correctly parse numeric and 'auto' z-index values
As with `opacity`, this code expected a Length value, when it is specced to take a Number or `auto`. Now it's correct. :^)
This commit is contained in:
parent
b8c4320ffa
commit
2a141600a3
1 changed files with 9 additions and 3 deletions
|
@ -291,10 +291,16 @@ float StyleProperties::line_height(const Layout::Node& layout_node) const
|
||||||
|
|
||||||
Optional<int> StyleProperties::z_index() const
|
Optional<int> StyleProperties::z_index() const
|
||||||
{
|
{
|
||||||
auto value = property(CSS::PropertyID::ZIndex);
|
auto maybe_value = property(CSS::PropertyID::ZIndex);
|
||||||
if (!value.has_value())
|
if (!maybe_value.has_value())
|
||||||
return {};
|
return {};
|
||||||
return static_cast<int>(value.value()->to_length().raw_value());
|
auto& value = maybe_value.value();
|
||||||
|
|
||||||
|
if (value->is_auto())
|
||||||
|
return 0;
|
||||||
|
if (value->is_numeric())
|
||||||
|
return static_cast<int>(static_cast<NumericStyleValue&>(*value).value());
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<float> StyleProperties::opacity() const
|
Optional<float> StyleProperties::opacity() const
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue