mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Don't match native anonymous content to user/author rules.
This commit is contained in:
parent
210b1be1d0
commit
22b62e0913
5 changed files with 83 additions and 60 deletions
|
@ -330,9 +330,9 @@ impl Stylist {
|
|||
pseudo: &PseudoElement,
|
||||
parent: &Arc<ComputedValues>)
|
||||
-> Option<(Arc<ComputedValues>, StrongRuleNode)>
|
||||
where E: Element<Impl=SelectorImpl> +
|
||||
fmt::Debug +
|
||||
PresentationalHintsSynthetizer
|
||||
where E: ElementExt +
|
||||
fmt::Debug +
|
||||
PresentationalHintsSynthetizer
|
||||
{
|
||||
debug_assert!(SelectorImpl::pseudo_element_cascade_type(pseudo).is_lazy());
|
||||
if self.pseudos_map.get(pseudo).is_none() {
|
||||
|
@ -418,7 +418,7 @@ impl Stylist {
|
|||
pseudo_element: Option<&PseudoElement>,
|
||||
applicable_declarations: &mut V,
|
||||
reason: MatchingReason) -> StyleRelations
|
||||
where E: Element<Impl=SelectorImpl> +
|
||||
where E: ElementExt +
|
||||
fmt::Debug +
|
||||
PresentationalHintsSynthetizer,
|
||||
V: Push<ApplicableDeclarationBlock> + VecLike<ApplicableDeclarationBlock>
|
||||
|
@ -456,66 +456,71 @@ impl Stylist {
|
|||
}
|
||||
debug!("preshints: {:?}", relations);
|
||||
|
||||
// Step 3: User and author normal rules.
|
||||
map.user.get_all_matching_rules(element,
|
||||
parent_bf,
|
||||
applicable_declarations,
|
||||
&mut relations,
|
||||
reason,
|
||||
Importance::Normal);
|
||||
debug!("user normal: {:?}", relations);
|
||||
map.author.get_all_matching_rules(element,
|
||||
parent_bf,
|
||||
applicable_declarations,
|
||||
&mut relations,
|
||||
reason,
|
||||
Importance::Normal);
|
||||
debug!("author normal: {:?}", relations);
|
||||
if element.matches_user_and_author_rules() {
|
||||
// Step 3: User and author normal rules.
|
||||
map.user.get_all_matching_rules(element,
|
||||
parent_bf,
|
||||
applicable_declarations,
|
||||
&mut relations,
|
||||
reason,
|
||||
Importance::Normal);
|
||||
debug!("user normal: {:?}", relations);
|
||||
map.author.get_all_matching_rules(element,
|
||||
parent_bf,
|
||||
applicable_declarations,
|
||||
&mut relations,
|
||||
reason,
|
||||
Importance::Normal);
|
||||
debug!("author normal: {:?}", relations);
|
||||
|
||||
// Step 4: Normal style attributes.
|
||||
if let Some(sa) = style_attribute {
|
||||
if sa.read().any_normal() {
|
||||
relations |= AFFECTED_BY_STYLE_ATTRIBUTE;
|
||||
Push::push(
|
||||
applicable_declarations,
|
||||
ApplicableDeclarationBlock::from_declarations(sa.clone(), Importance::Normal));
|
||||
// Step 4: Normal style attributes.
|
||||
if let Some(sa) = style_attribute {
|
||||
if sa.read().any_normal() {
|
||||
relations |= AFFECTED_BY_STYLE_ATTRIBUTE;
|
||||
Push::push(
|
||||
applicable_declarations,
|
||||
ApplicableDeclarationBlock::from_declarations(sa.clone(), Importance::Normal));
|
||||
}
|
||||
}
|
||||
|
||||
debug!("style attr: {:?}", relations);
|
||||
|
||||
// Step 5: Author-supplied `!important` rules.
|
||||
map.author.get_all_matching_rules(element,
|
||||
parent_bf,
|
||||
applicable_declarations,
|
||||
&mut relations,
|
||||
reason,
|
||||
Importance::Important);
|
||||
|
||||
debug!("author important: {:?}", relations);
|
||||
|
||||
// Step 6: `!important` style attributes.
|
||||
if let Some(sa) = style_attribute {
|
||||
if sa.read().any_important() {
|
||||
relations |= AFFECTED_BY_STYLE_ATTRIBUTE;
|
||||
Push::push(
|
||||
applicable_declarations,
|
||||
ApplicableDeclarationBlock::from_declarations(sa.clone(), Importance::Important));
|
||||
}
|
||||
}
|
||||
|
||||
debug!("style attr important: {:?}", relations);
|
||||
|
||||
// Step 7: User `!important` rules.
|
||||
map.user.get_all_matching_rules(element,
|
||||
parent_bf,
|
||||
applicable_declarations,
|
||||
&mut relations,
|
||||
reason,
|
||||
Importance::Important);
|
||||
|
||||
debug!("user important: {:?}", relations);
|
||||
} else {
|
||||
debug!("skipping non-agent rules");
|
||||
}
|
||||
|
||||
debug!("style attr: {:?}", relations);
|
||||
|
||||
// Step 5: Author-supplied `!important` rules.
|
||||
map.author.get_all_matching_rules(element,
|
||||
parent_bf,
|
||||
applicable_declarations,
|
||||
&mut relations,
|
||||
reason,
|
||||
Importance::Important);
|
||||
|
||||
debug!("author important: {:?}", relations);
|
||||
|
||||
// Step 6: `!important` style attributes.
|
||||
if let Some(sa) = style_attribute {
|
||||
if sa.read().any_important() {
|
||||
relations |= AFFECTED_BY_STYLE_ATTRIBUTE;
|
||||
Push::push(
|
||||
applicable_declarations,
|
||||
ApplicableDeclarationBlock::from_declarations(sa.clone(), Importance::Important));
|
||||
}
|
||||
}
|
||||
|
||||
debug!("style attr important: {:?}", relations);
|
||||
|
||||
// Step 7: User and UA `!important` rules.
|
||||
map.user.get_all_matching_rules(element,
|
||||
parent_bf,
|
||||
applicable_declarations,
|
||||
&mut relations,
|
||||
reason,
|
||||
Importance::Important);
|
||||
|
||||
debug!("user important: {:?}", relations);
|
||||
|
||||
// Step 8: UA `!important` rules.
|
||||
map.user_agent.get_all_matching_rules(element,
|
||||
parent_bf,
|
||||
applicable_declarations,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue