1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-30 22:48:11 +00:00

LibWeb: Perform CSS custom property cascade once instead of per-property

Previously we would re-run the entire CSS selector machinery for each
property resolved. Instead of doing that, we now resolve a final set of
custom property key/value pairs at the start of the cascade.
This commit is contained in:
Andreas Kling 2022-02-10 17:04:31 +01:00
parent b248661f11
commit 8d104b7de2
4 changed files with 53 additions and 71 deletions

View file

@ -288,9 +288,9 @@ Messages::WebContentServer::InspectDomNodeResponse ClientConnection::inspect_dom
auto const* element_to_check = &element;
while (element_to_check) {
for (auto const& property : element_to_check->custom_properties()) {
if (!seen_properties.contains(property.key) && property.value.style.has_value()) {
if (!seen_properties.contains(property.key)) {
seen_properties.set(property.key);
serializer.add(property.key, property.value.style.value().value->to_string());
serializer.add(property.key, property.value.value->to_string());
}
}