mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:27:45 +00:00
LibWeb: Make resolved styles handle calculated length-percentages
This could lead to a crash when inspecting for example the <body> on holidaycss.js.org, because it has `width: calc(100% - 1em)`
This commit is contained in:
parent
fe0f0b0acf
commit
450c0df938
2 changed files with 9 additions and 1 deletions
|
@ -83,6 +83,12 @@ public:
|
||||||
return m_value.template get<Percentage>();
|
return m_value.template get<Percentage>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NonnullRefPtr<CalculatedStyleValue> const& calculated() const
|
||||||
|
{
|
||||||
|
VERIFY(is_calculated());
|
||||||
|
return m_value.template get<NonnullRefPtr<CalculatedStyleValue>>();
|
||||||
|
}
|
||||||
|
|
||||||
virtual T resolve_calculated(NonnullRefPtr<CalculatedStyleValue> const&, [[maybe_unused]] Layout::Node const&, [[maybe_unused]] T const& reference_value) const
|
virtual T resolve_calculated(NonnullRefPtr<CalculatedStyleValue> const&, [[maybe_unused]] Layout::Node const&, [[maybe_unused]] T const& reference_value) const
|
||||||
{
|
{
|
||||||
VERIFY_NOT_REACHED();
|
VERIFY_NOT_REACHED();
|
||||||
|
|
|
@ -497,7 +497,9 @@ static NonnullRefPtr<StyleValue> style_value_for_length_percentage(LengthPercent
|
||||||
{
|
{
|
||||||
if (length_percentage.is_percentage())
|
if (length_percentage.is_percentage())
|
||||||
return PercentageStyleValue::create(length_percentage.percentage());
|
return PercentageStyleValue::create(length_percentage.percentage());
|
||||||
return LengthStyleValue::create(length_percentage.length());
|
if (length_percentage.is_length())
|
||||||
|
return LengthStyleValue::create(length_percentage.length());
|
||||||
|
return length_percentage.calculated();
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<StyleValue> ResolvedCSSStyleDeclaration::style_value_for_property(Layout::NodeWithStyle const& layout_node, PropertyID property_id) const
|
RefPtr<StyleValue> ResolvedCSSStyleDeclaration::style_value_for_property(Layout::NodeWithStyle const& layout_node, PropertyID property_id) const
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue