LibWeb: Fill in some missing FooOrCalculated types

This commit is contained in:
Sam Atkins 2023-12-27 12:56:00 +00:00 committed by Andreas Kling
parent 07928129dd
commit e907ad44c3
Notes: sideshowbarker 2024-07-17 09:49:48 +09:00
3 changed files with 40 additions and 0 deletions

View File

@ -13,11 +13,21 @@ Angle AngleOrCalculated::resolve_calculated(NonnullRefPtr<CalculatedStyleValue>
return calculated->resolve_angle().value();
}
Flex FlexOrCalculated::resolve_calculated(NonnullRefPtr<CalculatedStyleValue> const& calculated, Layout::Node const&) const
{
return calculated->resolve_flex().value();
}
Frequency FrequencyOrCalculated::resolve_calculated(NonnullRefPtr<CalculatedStyleValue> const& calculated, Layout::Node const&) const
{
return calculated->resolve_frequency().value();
}
i64 IntegerOrCalculated::resolve_calculated(NonnullRefPtr<CalculatedStyleValue> const& calculated, Layout::Node const&) const
{
return calculated->resolve_integer().value();
}
Length LengthOrCalculated::resolve_calculated(NonnullRefPtr<CalculatedStyleValue> const& calculated, Layout::Node const& layout_node) const
{
return calculated->resolve_length(layout_node).value();
@ -30,6 +40,11 @@ Length LengthOrCalculated::resolved(Length::ResolutionContext const& context) co
return value();
}
double NumberOrCalculated::resolve_calculated(NonnullRefPtr<CalculatedStyleValue> const& calculated, Layout::Node const&) const
{
return calculated->resolve_number().value();
}
Percentage PercentageOrCalculated::resolve_calculated(NonnullRefPtr<CalculatedStyleValue> const& calculated, Layout::Node const&) const
{
return calculated->resolve_percentage().value();

View File

@ -8,6 +8,7 @@
#include <AK/Variant.h>
#include <LibWeb/CSS/Angle.h>
#include <LibWeb/CSS/Flex.h>
#include <LibWeb/CSS/Frequency.h>
#include <LibWeb/CSS/Length.h>
#include <LibWeb/CSS/Percentage.h>
@ -84,6 +85,13 @@ public:
Angle resolve_calculated(NonnullRefPtr<CalculatedStyleValue> const&, Layout::Node const&) const override;
};
class FlexOrCalculated : public CalculatedOr<Flex> {
public:
using CalculatedOr<Flex>::CalculatedOr;
Flex resolve_calculated(NonnullRefPtr<CalculatedStyleValue> const&, Layout::Node const&) const override;
};
class FrequencyOrCalculated : public CalculatedOr<Frequency> {
public:
using CalculatedOr<Frequency>::CalculatedOr;
@ -91,6 +99,13 @@ public:
Frequency resolve_calculated(NonnullRefPtr<CalculatedStyleValue> const&, Layout::Node const&) const override;
};
class IntegerOrCalculated : public CalculatedOr<i64> {
public:
using CalculatedOr<i64>::CalculatedOr;
i64 resolve_calculated(NonnullRefPtr<CalculatedStyleValue> const&, Layout::Node const&) const override;
};
class LengthOrCalculated : public CalculatedOr<Length> {
public:
using CalculatedOr<Length>::CalculatedOr;
@ -99,6 +114,13 @@ public:
[[nodiscard]] Length resolved(Length::ResolutionContext const&) const;
};
class NumberOrCalculated : public CalculatedOr<double> {
public:
using CalculatedOr<double>::CalculatedOr;
double resolve_calculated(NonnullRefPtr<CalculatedStyleValue> const&, Layout::Node const&) const override;
};
class PercentageOrCalculated : public CalculatedOr<Percentage> {
public:
using CalculatedOr<Percentage>::CalculatedOr;

View File

@ -119,6 +119,7 @@ class ElementInlineCSSStyleDeclaration;
class ExplicitGridTrack;
class FilterValueListStyleValue;
class Flex;
class FlexOrCalculated;
class FlexStyleValue;
class FontFace;
class Frequency;
@ -138,6 +139,7 @@ class IdentifierStyleValue;
class ImageStyleValue;
class InheritStyleValue;
class InitialStyleValue;
class IntegerOrCalculated;
class IntegerStyleValue;
class Length;
class LengthBox;
@ -152,6 +154,7 @@ class MediaQuery;
class MediaQueryList;
class MediaQueryListEvent;
class Number;
class NumberOrCalculated;
class NumberStyleValue;
class Percentage;
class PercentageOrCalculated;