1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 10:57:35 +00:00

LibWeb: Resolve custom properties

The way to get the custom properties is pretty weird and this code is
as far from optimized as it gets but somehow it works :^)
This commit is contained in:
Tobias Christiansen 2021-05-24 23:02:58 +02:00 committed by Linus Groh
parent bf9c5ffb3f
commit fd6b04055c
2 changed files with 48 additions and 1 deletions

View file

@ -8,6 +8,7 @@
#include <AK/NonnullRefPtrVector.h>
#include <AK/OwnPtr.h>
#include <LibWeb/CSS/CSSStyleDeclaration.h>
#include <LibWeb/CSS/StyleProperties.h>
#include <LibWeb/Forward.h>
@ -33,6 +34,12 @@ public:
Vector<MatchingRule> collect_matching_rules(const DOM::Element&) const;
void sort_matching_rules(Vector<MatchingRule>&) const;
struct CustomPropertyResolutionTuple {
Optional<StyleProperty> style {};
u32 specificity { 0 };
};
CustomPropertyResolutionTuple resolve_custom_property_with_specificity(const DOM::Element&, const String&) const;
Optional<StyleProperty> resolve_custom_property(const DOM::Element&, const String&) const;
static bool is_inherited_property(CSS::PropertyID);