mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-25 05:55:13 +00:00
WebContent: Correctly locate custom properties for pseudo-elements
We can't simply walk the element tree and pass in `pseudo_element` each time. Instead, we want to look at: 1. Element's pseudo-element 2. Element 3. Element's parents
This commit is contained in:
parent
49b505e4ae
commit
7dbef8d3d5
Notes:
github-actions[bot]
2025-02-12 13:49:48 +00:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/LadybirdBrowser/ladybird/commit/7dbef8d3d5f Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3529
1 changed files with 7 additions and 2 deletions
|
@ -529,15 +529,20 @@ void ConnectionFromClient::inspect_dom_node(u64 page_id, Web::UniqueNodeID const
|
||||||
HashTable<FlyString> seen_properties;
|
HashTable<FlyString> seen_properties;
|
||||||
|
|
||||||
auto const* element_to_check = &element;
|
auto const* element_to_check = &element;
|
||||||
|
auto pseudo_element_to_check = pseudo_element;
|
||||||
while (element_to_check) {
|
while (element_to_check) {
|
||||||
for (auto const& property : element_to_check->custom_properties(pseudo_element)) {
|
for (auto const& property : element_to_check->custom_properties(pseudo_element_to_check)) {
|
||||||
if (!seen_properties.contains(property.key)) {
|
if (!seen_properties.contains(property.key)) {
|
||||||
seen_properties.set(property.key);
|
seen_properties.set(property.key);
|
||||||
MUST(serializer.add(property.key, property.value.value->to_string(Web::CSS::CSSStyleValue::SerializationMode::Normal)));
|
MUST(serializer.add(property.key, property.value.value->to_string(Web::CSS::CSSStyleValue::SerializationMode::Normal)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
element_to_check = element_to_check->parent_element();
|
if (pseudo_element_to_check.has_value()) {
|
||||||
|
pseudo_element_to_check.clear();
|
||||||
|
} else {
|
||||||
|
element_to_check = element_to_check->parent_element();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MUST(serializer.finish());
|
MUST(serializer.finish());
|
||||||
|
|
Loading…
Add table
Reference in a new issue