diff options
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Angle.cpp | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Angle.h | 1 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Frequency.cpp | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Frequency.h | 1 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Length.cpp | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Length.h | 1 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Percentage.h | 2 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Time.cpp | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Time.h | 1 |
9 files changed, 30 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Angle.cpp b/Userland/Libraries/LibWeb/CSS/Angle.cpp index d86cccefc5..931a43c7df 100644 --- a/Userland/Libraries/LibWeb/CSS/Angle.cpp +++ b/Userland/Libraries/LibWeb/CSS/Angle.cpp @@ -96,4 +96,10 @@ Optional<Angle::Type> Angle::unit_from_name(StringView name) return {}; } +NonnullRefPtr<CalculatedStyleValue> Angle::calculated_style_value() const +{ + VERIFY(!m_calculated_style.is_null()); + return *m_calculated_style; +} + } diff --git a/Userland/Libraries/LibWeb/CSS/Angle.h b/Userland/Libraries/LibWeb/CSS/Angle.h index ed49a80bcb..4124df0bca 100644 --- a/Userland/Libraries/LibWeb/CSS/Angle.h +++ b/Userland/Libraries/LibWeb/CSS/Angle.h @@ -31,6 +31,7 @@ public: Angle percentage_of(Percentage const&) const; bool is_calculated() const { return m_type == Type::Calculated; } + NonnullRefPtr<CalculatedStyleValue> calculated_style_value() const; String to_string() const; float to_degrees() const; diff --git a/Userland/Libraries/LibWeb/CSS/Frequency.cpp b/Userland/Libraries/LibWeb/CSS/Frequency.cpp index 31d1eb3ab4..0107e6af93 100644 --- a/Userland/Libraries/LibWeb/CSS/Frequency.cpp +++ b/Userland/Libraries/LibWeb/CSS/Frequency.cpp @@ -83,4 +83,10 @@ Optional<Frequency::Type> Frequency::unit_from_name(StringView name) return {}; } +NonnullRefPtr<CalculatedStyleValue> Frequency::calculated_style_value() const +{ + VERIFY(!m_calculated_style.is_null()); + return *m_calculated_style; +} + } diff --git a/Userland/Libraries/LibWeb/CSS/Frequency.h b/Userland/Libraries/LibWeb/CSS/Frequency.h index 0c0c326549..741f16497b 100644 --- a/Userland/Libraries/LibWeb/CSS/Frequency.h +++ b/Userland/Libraries/LibWeb/CSS/Frequency.h @@ -28,6 +28,7 @@ public: Frequency percentage_of(Percentage const&) const; bool is_calculated() const { return m_type == Type::Calculated; } + NonnullRefPtr<CalculatedStyleValue> calculated_style_value() const; String to_string() const; float to_hertz() const; diff --git a/Userland/Libraries/LibWeb/CSS/Length.cpp b/Userland/Libraries/LibWeb/CSS/Length.cpp index c8ada1dd86..941be4d220 100644 --- a/Userland/Libraries/LibWeb/CSS/Length.cpp +++ b/Userland/Libraries/LibWeb/CSS/Length.cpp @@ -198,4 +198,10 @@ Optional<Length::Type> Length::unit_from_name(StringView name) return {}; } +NonnullRefPtr<CalculatedStyleValue> Length::calculated_style_value() const +{ + VERIFY(!m_calculated_style.is_null()); + return *m_calculated_style; +} + } diff --git a/Userland/Libraries/LibWeb/CSS/Length.h b/Userland/Libraries/LibWeb/CSS/Length.h index 97663b95fd..d1d519d078 100644 --- a/Userland/Libraries/LibWeb/CSS/Length.h +++ b/Userland/Libraries/LibWeb/CSS/Length.h @@ -76,6 +76,7 @@ public: } float raw_value() const { return m_value; } + NonnullRefPtr<CalculatedStyleValue> calculated_style_value() const; float to_px(Layout::Node const&) const; diff --git a/Userland/Libraries/LibWeb/CSS/Percentage.h b/Userland/Libraries/LibWeb/CSS/Percentage.h index fedad0fc6f..68bb465728 100644 --- a/Userland/Libraries/LibWeb/CSS/Percentage.h +++ b/Userland/Libraries/LibWeb/CSS/Percentage.h @@ -98,6 +98,8 @@ public: { return m_value.visit( [&](T const& t) { + if (t.is_calculated()) + return resolve_calculated(t.calculated_style_value(), layout_node, reference_value); return t; }, [&](Percentage const& percentage) { diff --git a/Userland/Libraries/LibWeb/CSS/Time.cpp b/Userland/Libraries/LibWeb/CSS/Time.cpp index ee8aaa0075..5b5c956b6c 100644 --- a/Userland/Libraries/LibWeb/CSS/Time.cpp +++ b/Userland/Libraries/LibWeb/CSS/Time.cpp @@ -83,4 +83,10 @@ Optional<Time::Type> Time::unit_from_name(StringView name) return {}; } +NonnullRefPtr<CalculatedStyleValue> Time::calculated_style_value() const +{ + VERIFY(!m_calculated_style.is_null()); + return *m_calculated_style; +} + } diff --git a/Userland/Libraries/LibWeb/CSS/Time.h b/Userland/Libraries/LibWeb/CSS/Time.h index 1c2d1b140a..52c05603b7 100644 --- a/Userland/Libraries/LibWeb/CSS/Time.h +++ b/Userland/Libraries/LibWeb/CSS/Time.h @@ -29,6 +29,7 @@ public: Time percentage_of(Percentage const&) const; bool is_calculated() const { return m_type == Type::Calculated; } + NonnullRefPtr<CalculatedStyleValue> calculated_style_value() const; String to_string() const; float to_seconds() const; |