Преглед на файлове

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.
Andreas Kling преди 3 години
родител
ревизия
734ff422ad
променени са 1 файла, в които са добавени 2 реда и са изтрити 0 реда
  1. 2 0
      Userland/Libraries/LibWeb/CSS/Percentage.h

+ 2 - 0
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;