mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
style: Simplify NAC setup
Make all UA widgets also NAC. Keep the UA widget flag but break at anonymous subtree boundaries, so that only nodes inside the UA widget directly (and not NAC from those) get the flag. This is important because two callers depend on this difference: * The style system, since we still want to match content rules from stylesheets in the UA widget. We also match user rules, which is a bit sketchy, but that was the previous behavior, will file a follow-up for that. * The reflector code, since we want the scope for UA widgets to not include the NAC nodes inside that UA widget. nsINode::IsInUAWidget got it wrong. After this patch, ChromeOnlyAccess is equivalent to IsInNativeAnonymousSubtree, so we should probably unify the naming. That's left for a follow-up patch because I don't have a strong preference. Differential Revision: https://phabricator.services.mozilla.com/D174310
This commit is contained in:
parent
0917ee3f9b
commit
5dd35ac6cd
6 changed files with 87 additions and 113 deletions
|
@ -388,10 +388,10 @@ pub trait TElement:
|
|||
true
|
||||
}
|
||||
|
||||
/// Whether this element should match user and author rules.
|
||||
/// Whether this element should match user and content rules.
|
||||
///
|
||||
/// We use this for Native Anonymous Content in Gecko.
|
||||
fn matches_user_and_author_rules(&self) -> bool {
|
||||
fn matches_user_and_content_rules(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
|
@ -651,11 +651,6 @@ pub trait TElement:
|
|||
false
|
||||
}
|
||||
|
||||
/// Returns true if this element is in a native anonymous subtree.
|
||||
fn is_in_native_anonymous_subtree(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
/// Returns the pseudo-element implemented by this element, if any.
|
||||
///
|
||||
/// Gecko traverses pseudo-elements during the style traversal, and we need
|
||||
|
@ -791,11 +786,8 @@ pub trait TElement:
|
|||
use crate::rule_collector::containing_shadow_ignoring_svg_use;
|
||||
|
||||
let target = self.rule_hash_target();
|
||||
if !target.matches_user_and_author_rules() {
|
||||
return false;
|
||||
}
|
||||
|
||||
let mut doc_rules_apply = true;
|
||||
let matches_user_and_content_rules = target.matches_user_and_content_rules();
|
||||
let mut doc_rules_apply = matches_user_and_content_rules;
|
||||
|
||||
// Use the same rules to look for the containing host as we do for rule
|
||||
// collection.
|
||||
|
@ -843,9 +835,9 @@ pub trait TElement:
|
|||
},
|
||||
None => {
|
||||
// TODO(emilio): Should probably distinguish with
|
||||
// MatchesDocumentRules::{No,Yes,IfPart} or
|
||||
// something so that we could skip some work.
|
||||
doc_rules_apply = true;
|
||||
// MatchesDocumentRules::{No,Yes,IfPart} or something so that we could
|
||||
// skip some work.
|
||||
doc_rules_apply = matches_user_and_content_rules;
|
||||
break;
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue