mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-16 04:59:23 +00:00
LibWeb/CSS: Add flag to disable create-internal-rep type checking
CSSTransformComponents hold other CSSStyleValues as their parameters. We want to be able to create internal representations from those parameters without them caring if they would be valid when directly assigned to the property. This is a temporary solution to make transform functions work. To be completely correct, we need to know what is allowed in that context, along with value ranges - a combination of the contexts we create when parsing, and when computing calculations. For transform functions, this doesn't matter, as there's no limit to the range of allowed values.
This commit is contained in:
parent
35fd3bda79
commit
5178d1ebe3
Notes:
github-actions[bot]
2025-10-14 12:42:59 +00:00
Author: https://github.com/AtkinsSJ
Commit: 5178d1ebe3
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6466
13 changed files with 52 additions and 18 deletions
|
@ -26,7 +26,7 @@ void CSSMathValue::initialize(JS::Realm& realm)
|
|||
}
|
||||
|
||||
// https://drafts.css-houdini.org/css-typed-om-1/#create-an-internal-representation
|
||||
WebIDL::ExceptionOr<NonnullRefPtr<StyleValue const>> CSSMathValue::create_an_internal_representation(PropertyNameAndID const& property) const
|
||||
WebIDL::ExceptionOr<NonnullRefPtr<StyleValue const>> CSSMathValue::create_an_internal_representation(PropertyNameAndID const& property, PerformTypeCheck perform_type_check) const
|
||||
{
|
||||
// If value is a CSSStyleValue subclass,
|
||||
// If value does not match the grammar of a list-valued property iteration of property, throw a TypeError.
|
||||
|
@ -59,7 +59,7 @@ WebIDL::ExceptionOr<NonnullRefPtr<StyleValue const>> CSSMathValue::create_an_int
|
|||
return false;
|
||||
}();
|
||||
|
||||
if (!matches)
|
||||
if (perform_type_check == PerformTypeCheck::Yes && !matches)
|
||||
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Property does not accept values of this type."sv };
|
||||
|
||||
return CalculatedStyleValue::create(TRY(create_calculation_node(context)), type(), move(context));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue