mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-26 22:38:51 +00:00
LibWeb/CSS: Pass Length::ResolutionContext to resolve_integer
The length resolution context might be needed even when resolving an integer value, since it might contain a sign() function with length values inside. This fixes a WPT subtest.
This commit is contained in:
parent
8bec80ac47
commit
1882a2e19b
Notes:
github-actions[bot]
2024-12-04 12:38:56 +00:00
Author: https://github.com/milotier
Commit: 1882a2e19b
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2640
Reviewed-by: https://github.com/AtkinsSJ ✅
7 changed files with 75 additions and 17 deletions
|
@ -2797,19 +2797,49 @@ Optional<Time> CSSMathValue::resolve_time_percentage(Time const& percentage_basi
|
|||
Optional<double> CSSMathValue::resolve_number() const
|
||||
{
|
||||
auto result = m_calculation->resolve({}, {});
|
||||
|
||||
if (result.value().has<Number>())
|
||||
return result.value().get<Number>().value();
|
||||
return {};
|
||||
}
|
||||
|
||||
Optional<double> CSSMathValue::resolve_number(Length::ResolutionContext const& context) const
|
||||
{
|
||||
auto result = m_calculation->resolve(context, {});
|
||||
|
||||
if (result.value().has<Number>())
|
||||
return result.value().get<Number>().value();
|
||||
return {};
|
||||
}
|
||||
|
||||
Optional<double> CSSMathValue::resolve_number(Layout::Node const& layout_node) const
|
||||
{
|
||||
return resolve_number(Length::ResolutionContext::for_layout_node(layout_node));
|
||||
}
|
||||
|
||||
Optional<i64> CSSMathValue::resolve_integer() const
|
||||
{
|
||||
auto result = m_calculation->resolve({}, {});
|
||||
|
||||
if (result.value().has<Number>())
|
||||
return result.value().get<Number>().integer_value();
|
||||
return {};
|
||||
}
|
||||
|
||||
Optional<i64> CSSMathValue::resolve_integer(Length::ResolutionContext const& context) const
|
||||
{
|
||||
auto result = m_calculation->resolve(context, {});
|
||||
|
||||
if (result.value().has<Number>())
|
||||
return result.value().get<Number>().integer_value();
|
||||
return {};
|
||||
}
|
||||
|
||||
Optional<i64> CSSMathValue::resolve_integer(Layout::Node const& layout_node) const
|
||||
{
|
||||
return resolve_integer(Length::ResolutionContext::for_layout_node(layout_node));
|
||||
}
|
||||
|
||||
bool CSSMathValue::contains_percentage() const
|
||||
{
|
||||
return m_calculation->contains_percentage();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue