summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/CSS
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-07-07 11:55:50 +0200
committerAndreas Kling <kling@serenityos.org>2022-07-09 22:16:32 +0200
commit734ff422ad4f6b04b26888d2930c54ff3972809d (patch)
tree490525e173f5b2ddd111318f20c650fd80ca3836 /Userland/Libraries/LibWeb/CSS
parent44025e837fef1af6fe6ac567d7705dbc9f049375 (diff)
downloadserenity-734ff422ad4f6b04b26888d2930c54ff3972809d.zip
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.
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS')
-rw-r--r--Userland/Libraries/LibWeb/CSS/Percentage.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Percentage.h b/Userland/Libraries/LibWeb/CSS/Percentage.h
index f5493c6abb..fedad0fc6f 100644
--- a/Userland/Libraries/LibWeb/CSS/Percentage.h
+++ b/Userland/Libraries/LibWeb/CSS/Percentage.h
@@ -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;