1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 05:17:35 +00:00

LibWeb: Add LengthPercentage::is_auto() convenience helper

This lets you ask if a LengthPercentage is `auto` with one call instead
of two, which will make some conditions nicer to express.
This commit is contained in:
Andreas Kling 2022-07-07 11:55:50 +02:00
parent 44025e837f
commit 734ff422ad

View file

@ -182,6 +182,8 @@ class LengthPercentage : public PercentageOr<Length> {
public:
using PercentageOr<Length>::PercentageOr;
bool is_auto() const { return is_length() && length().is_auto(); }
bool is_length() const { return is_t(); }
Length const& length() const { return get_t(); }
virtual Length resolve_calculated(NonnullRefPtr<CalculatedStyleValue> const&, Layout::Node const&, Length const& reference_value) const override;