mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
style: Fix elements not being query containers for the pseudo-element they originate. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D164807
This commit is contained in:
parent
c511b9c3f9
commit
661e7d5c48
5 changed files with 129 additions and 50 deletions
|
@ -966,7 +966,7 @@ impl Stylist {
|
|||
element: E,
|
||||
pseudo: &PseudoElement,
|
||||
rule_inclusion: RuleInclusion,
|
||||
parent_style: &ComputedValues,
|
||||
parent_style: &Arc<ComputedValues>,
|
||||
is_probe: bool,
|
||||
matching_fn: Option<&dyn Fn(&PseudoElement) -> bool>,
|
||||
) -> Option<Arc<ComputedValues>>
|
||||
|
@ -1105,7 +1105,7 @@ impl Stylist {
|
|||
&self,
|
||||
guards: &StylesheetGuards,
|
||||
element: E,
|
||||
parent_style: &ComputedValues,
|
||||
parent_style: &Arc<ComputedValues>,
|
||||
pseudo: &PseudoElement,
|
||||
is_probe: bool,
|
||||
rule_inclusion: RuleInclusion,
|
||||
|
@ -1125,7 +1125,7 @@ impl Stylist {
|
|||
};
|
||||
|
||||
let mut declarations = ApplicableDeclarationList::new();
|
||||
let mut matching_context = MatchingContext::new(
|
||||
let mut matching_context = MatchingContext::<'_, E::Impl>::new(
|
||||
MatchingMode::ForStatelessPseudoElement,
|
||||
None,
|
||||
None,
|
||||
|
@ -1134,6 +1134,7 @@ impl Stylist {
|
|||
);
|
||||
|
||||
matching_context.pseudo_element_matching_fn = matching_fn;
|
||||
matching_context.extra_data.originating_element_style = Some(parent_style.clone());
|
||||
|
||||
self.push_applicable_declarations(
|
||||
element,
|
||||
|
@ -1155,7 +1156,7 @@ impl Stylist {
|
|||
let mut visited_rules = None;
|
||||
if parent_style.visited_style().is_some() {
|
||||
let mut declarations = ApplicableDeclarationList::new();
|
||||
let mut matching_context = MatchingContext::new_for_visited(
|
||||
let mut matching_context = MatchingContext::<'_, E::Impl>::new_for_visited(
|
||||
MatchingMode::ForStatelessPseudoElement,
|
||||
None,
|
||||
None,
|
||||
|
@ -1164,6 +1165,7 @@ impl Stylist {
|
|||
needs_selector_flags,
|
||||
);
|
||||
matching_context.pseudo_element_matching_fn = matching_fn;
|
||||
matching_context.extra_data.originating_element_style = Some(parent_style.clone());
|
||||
|
||||
self.push_applicable_declarations(
|
||||
element,
|
||||
|
@ -2380,7 +2382,14 @@ impl CascadeData {
|
|||
None => return true,
|
||||
Some(ref c) => c,
|
||||
};
|
||||
let matches = condition.matches(stylist.device(), element, &mut context.extra_data.cascade_input_flags).to_bool(/* unknown = */ false);
|
||||
let matches = condition
|
||||
.matches(
|
||||
stylist.device(),
|
||||
element,
|
||||
context.extra_data.originating_element_style.as_ref(),
|
||||
&mut context.extra_data.cascade_input_flags,
|
||||
)
|
||||
.to_bool(/* unknown = */ false);
|
||||
if !matches {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue