1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 19:27:45 +00:00

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
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(); 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 Frequency FrequencyOrCalculated::resolve_calculated(NonnullRefPtr<CalculatedStyleValue> const& calculated, Layout::Node const&) const
{ {
return calculated->resolve_frequency().value(); 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 Length LengthOrCalculated::resolve_calculated(NonnullRefPtr<CalculatedStyleValue> const& calculated, Layout::Node const& layout_node) const
{ {
return calculated->resolve_length(layout_node).value(); return calculated->resolve_length(layout_node).value();
@ -30,6 +40,11 @@ Length LengthOrCalculated::resolved(Length::ResolutionContext const& context) co
return value(); 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 Percentage PercentageOrCalculated::resolve_calculated(NonnullRefPtr<CalculatedStyleValue> const& calculated, Layout::Node const&) const
{ {
return calculated->resolve_percentage().value(); return calculated->resolve_percentage().value();

View file

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

View file

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