1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:38:11 +00:00

LibWeb: Make StyleProperties::property() always return a value

By the time that property() gets called, we've already given every
single property a value, so we can just return it. This simplifies a
lot of places that were manually handling a lack of value
unnecessarily.
This commit is contained in:
Sam Atkins 2022-04-14 11:52:35 +01:00 committed by Andreas Kling
parent a20188cd91
commit e941f07931
5 changed files with 110 additions and 190 deletions

View file

@ -400,12 +400,10 @@ Optional<StyleProperty> ResolvedCSSStyleDeclaration::property(PropertyID propert
if (!m_element->layout_node()) {
auto style = m_element->document().style_computer().compute_style(const_cast<DOM::Element&>(*m_element));
if (auto maybe_property = style->property(property_id); maybe_property.has_value()) {
return StyleProperty {
.property_id = property_id,
.value = maybe_property.release_value(),
};
}
return StyleProperty {
.property_id = property_id,
.value = style->property(property_id),
};
return {};
}