From 5bd585d446085fb9944feb575d479e1efa238b8c Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Fri, 16 Aug 2024 16:42:58 +0100 Subject: [PATCH] LibWeb/CSS: Add dump method to CalculatedStyleValue The individual nodes all have dump methods, but there was no way of calling them from the outside. So now there is. --- .../LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp | 7 +++++++ .../LibWeb/CSS/StyleValues/CalculatedStyleValue.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp index 373cdeafa0e..b3416439abc 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.cpp @@ -2766,4 +2766,11 @@ bool CalculatedStyleValue::contains_percentage() const return m_calculation->contains_percentage(); } +String CalculatedStyleValue::dump() const +{ + StringBuilder builder; + m_calculation->dump(builder, 0); + return builder.to_string_without_validation(); +} + } diff --git a/Userland/Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.h index 3e578a73b20..8d299fe2e91 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.h @@ -121,6 +121,8 @@ public: bool contains_percentage() const; + String dump() const; + private: explicit CalculatedStyleValue(NonnullOwnPtr calculation, CSSNumericType resolved_type) : CSSStyleValue(Type::Calculated)