mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-02 01:08:48 +00:00
LibWeb/CSS: Discard unsupported style properties on pseudo-elements
Quite simply, ignore any declarations for properties we don't want, while computing a pseudo-element's style. I've imported a WPT test for this, which fails without this patch.
This commit is contained in:
parent
1108988656
commit
9e65291ebd
Notes:
github-actions[bot]
2025-03-24 09:50:54 +00:00
Author: https://github.com/AtkinsSJ
Commit: 9e65291ebd
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4021
5 changed files with 46 additions and 9 deletions
|
@ -1030,6 +1030,9 @@ void StyleComputer::cascade_declarations(
|
|||
if (important != property.important)
|
||||
continue;
|
||||
|
||||
if (pseudo_element.has_value() && !pseudo_element_supports_property(*pseudo_element, property.property_id))
|
||||
continue;
|
||||
|
||||
if (property.property_id == CSS::PropertyID::All) {
|
||||
set_all_properties(cascaded_properties, element, pseudo_element, property.value, m_document, &match->declaration(), cascade_origin, important, layer_name);
|
||||
continue;
|
||||
|
@ -1596,11 +1599,13 @@ GC::Ref<CascadedProperties> StyleComputer::compute_cascaded_values(DOM::Element&
|
|||
// Then we resolve all the CSS custom properties ("variables") for this element:
|
||||
// FIXME: Also resolve !important custom properties, in a second cascade.
|
||||
|
||||
HashMap<FlyString, CSS::StyleProperty> custom_properties;
|
||||
for (auto& layer : matching_rule_set.author_rules) {
|
||||
cascade_custom_properties(element, pseudo_element, layer.rules, custom_properties);
|
||||
if (!pseudo_element.has_value() || pseudo_element_supports_property(*pseudo_element, PropertyID::Custom)) {
|
||||
HashMap<FlyString, CSS::StyleProperty> custom_properties;
|
||||
for (auto& layer : matching_rule_set.author_rules) {
|
||||
cascade_custom_properties(element, pseudo_element, layer.rules, custom_properties);
|
||||
}
|
||||
element.set_custom_properties(pseudo_element, move(custom_properties));
|
||||
}
|
||||
element.set_custom_properties(pseudo_element, move(custom_properties));
|
||||
|
||||
// Then we apply the declarations from the matched rules in cascade order:
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue