feat: Add backdrop-filter

Implements #16
This commit is contained in:
H. C. Kruse 2024-02-24 10:53:18 +01:00
parent d5ef84eed3
commit 3e73f15057
No known key found for this signature in database
GPG key ID: 0EADE441303A09B4
2 changed files with 18 additions and 0 deletions

View file

@ -69,6 +69,7 @@ class StylesheetSanitizerHook {
$extended->addAspectRatio( $extender, $matcherFactory );
$extended->addInlineBlockMarginPaddingProperties( $extender, $matcherFactory );
$extended->addInsetProperties( $extender, $matcherFactory );
$extended->addBackdropFilter( $extender );
$propertySanitizer->setKnownProperties( $extender->getKnownProperties() );
}

View file

@ -330,6 +330,23 @@ class TemplateStylesExtender {
}
}
/**
* Adds the backdrop-filter matcher
*
* @param StylePropertySanitizer $propertySanitizer
*/
public function addBackdropFilter( StylePropertySanitizer $propertySanitizer ): void {
try {
$filter = $propertySanitizer->getKnownProperties()['filter'];
$propertySanitizer->addKnownProperties( [
'backdrop-filter' => Quantifier::plus( $filter ),
] );
} catch ( InvalidArgumentException $e ) {
// Fail silently
}
}
/**
* Loads a config value for a given key from the main config
* Returns null on if an ConfigException was thrown