Browse Source

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.
Sam Atkins 10 months ago
parent
commit
5bd585d446

+ 7 - 0
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();
+}
+
 }

+ 2 - 0
Userland/Libraries/LibWeb/CSS/StyleValues/CalculatedStyleValue.h

@@ -121,6 +121,8 @@ public:
 
     bool contains_percentage() const;
 
+    String dump() const;
+
 private:
     explicit CalculatedStyleValue(NonnullOwnPtr<CalculationNode> calculation, CSSNumericType resolved_type)
         : CSSStyleValue(Type::Calculated)