diff --git a/Libraries/LibWeb/CSS/Angle.cpp b/Libraries/LibWeb/CSS/Angle.cpp index 16e91fef4d3..44fa016ba03 100644 --- a/Libraries/LibWeb/CSS/Angle.cpp +++ b/Libraries/LibWeb/CSS/Angle.cpp @@ -29,7 +29,7 @@ Angle Angle::percentage_of(Percentage const& percentage) const String Angle::to_string() const { - return MUST(String::formatted("{}deg", to_degrees())); + return MUST(String::formatted("{}{}", raw_value(), unit_name())); } double Angle::to_degrees() const diff --git a/Libraries/LibWeb/CSS/StyleValues/AngleStyleValue.cpp b/Libraries/LibWeb/CSS/StyleValues/AngleStyleValue.cpp index 2ce2aeddc76..9df73ce5b52 100644 --- a/Libraries/LibWeb/CSS/StyleValues/AngleStyleValue.cpp +++ b/Libraries/LibWeb/CSS/StyleValues/AngleStyleValue.cpp @@ -19,8 +19,10 @@ AngleStyleValue::AngleStyleValue(Angle angle) AngleStyleValue::~AngleStyleValue() = default; -String AngleStyleValue::to_string(SerializationMode) const +String AngleStyleValue::to_string(SerializationMode serialization_mode) const { + if (serialization_mode == SerializationMode::ResolvedValue) + return MUST(String::formatted("{}deg", m_angle.to_degrees())); return m_angle.to_string(); } diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-transforms/parsing/rotate-parsing-valid.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-transforms/parsing/rotate-parsing-valid.txt index 06f65152234..6a5263aa9c5 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/css-transforms/parsing/rotate-parsing-valid.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-transforms/parsing/rotate-parsing-valid.txt @@ -2,22 +2,21 @@ Harness status: OK Found 17 tests -2 Pass -15 Fail +17 Pass Pass e.style['rotate'] = "none" should set the property value Pass e.style['rotate'] = "0deg" should set the property value -Fail e.style['rotate'] = "100 200 300 400grad" should set the property value -Fail e.style['rotate'] = "400grad 100 200 300" should set the property value -Fail e.style['rotate'] = "0 0 0 400grad" should set the property value -Fail e.style['rotate'] = "x 400grad" should set the property value -Fail e.style['rotate'] = "400grad x" should set the property value -Fail e.style['rotate'] = "0.5 0 0 400grad" should set the property value -Fail e.style['rotate'] = "1 0 0 400grad" should set the property value -Fail e.style['rotate'] = "y 400grad" should set the property value -Fail e.style['rotate'] = "400grad y" should set the property value -Fail e.style['rotate'] = "0 0.5 0 400grad" should set the property value -Fail e.style['rotate'] = "0 1 0 400grad" should set the property value -Fail e.style['rotate'] = "400grad" should set the property value -Fail e.style['rotate'] = "400grad z" should set the property value -Fail e.style['rotate'] = "0 0 0.5 400grad" should set the property value -Fail e.style['rotate'] = "0 0 1 400grad" should set the property value \ No newline at end of file +Pass e.style['rotate'] = "100 200 300 400grad" should set the property value +Pass e.style['rotate'] = "400grad 100 200 300" should set the property value +Pass e.style['rotate'] = "0 0 0 400grad" should set the property value +Pass e.style['rotate'] = "x 400grad" should set the property value +Pass e.style['rotate'] = "400grad x" should set the property value +Pass e.style['rotate'] = "0.5 0 0 400grad" should set the property value +Pass e.style['rotate'] = "1 0 0 400grad" should set the property value +Pass e.style['rotate'] = "y 400grad" should set the property value +Pass e.style['rotate'] = "400grad y" should set the property value +Pass e.style['rotate'] = "0 0.5 0 400grad" should set the property value +Pass e.style['rotate'] = "0 1 0 400grad" should set the property value +Pass e.style['rotate'] = "400grad" should set the property value +Pass e.style['rotate'] = "400grad z" should set the property value +Pass e.style['rotate'] = "0 0 0.5 400grad" should set the property value +Pass e.style['rotate'] = "0 0 1 400grad" should set the property value \ No newline at end of file