LibWeb/CSS: Implement converting CSSTransformValues to StyleValues

This commit is contained in:
Sam Atkins 2025-10-13 16:38:36 +01:00
commit 3716db1c61
Notes: github-actions[bot] 2025-10-14 12:42:50 +00:00
20 changed files with 198 additions and 5 deletions

View file

@ -9,6 +9,8 @@
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/CSS/CSSNumericValue.h>
#include <LibWeb/CSS/CSSUnitValue.h>
#include <LibWeb/CSS/PropertyNameAndID.h>
#include <LibWeb/CSS/StyleValues/TransformationStyleValue.h>
#include <LibWeb/Geometry/DOMMatrix.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
@ -199,4 +201,22 @@ WebIDL::ExceptionOr<void> CSSScale::set_z(CSSNumberish value)
return {};
}
WebIDL::ExceptionOr<NonnullRefPtr<TransformationStyleValue const>> CSSScale::create_style_value(PropertyNameAndID const& property) const
{
if (is_2d()) {
return TransformationStyleValue::create(property.id(), TransformFunction::Scale,
{
TRY(m_x->create_an_internal_representation(property, CSSStyleValue::PerformTypeCheck::No)),
TRY(m_y->create_an_internal_representation(property, CSSStyleValue::PerformTypeCheck::No)),
});
}
return TransformationStyleValue::create(property.id(), TransformFunction::Scale3d,
{
TRY(m_x->create_an_internal_representation(property, CSSStyleValue::PerformTypeCheck::No)),
TRY(m_y->create_an_internal_representation(property, CSSStyleValue::PerformTypeCheck::No)),
TRY(m_z->create_an_internal_representation(property, CSSStyleValue::PerformTypeCheck::No)),
});
}
}