mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
style: Fix a silly mistake in which we'd prefer a local name / tag invalidation to an id invalidation.
ID invalidations should always win. This also prefers invalidations deeper in the subtree to higher up. Differential Revision: https://phabricator.services.mozilla.com/D85615
This commit is contained in:
parent
1f36216b59
commit
dfa715a8d8
1 changed files with 5 additions and 3 deletions
|
@ -340,6 +340,8 @@ impl StylesheetInvalidationSet {
|
||||||
data.hint.contains(RestyleHint::RESTYLE_SELF) || any_children_invalid
|
data.hint.contains(RestyleHint::RESTYLE_SELF) || any_children_invalid
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// TODO(emilio): Reuse the bucket stuff from selectormap? That handles
|
||||||
|
/// :is() / :where() etc.
|
||||||
fn scan_component(
|
fn scan_component(
|
||||||
component: &Component<SelectorImpl>,
|
component: &Component<SelectorImpl>,
|
||||||
invalidation: &mut Option<Invalidation>,
|
invalidation: &mut Option<Invalidation>,
|
||||||
|
@ -349,7 +351,7 @@ impl StylesheetInvalidationSet {
|
||||||
ref name,
|
ref name,
|
||||||
ref lower_name,
|
ref lower_name,
|
||||||
}) => {
|
}) => {
|
||||||
if invalidation.as_ref().map_or(true, |s| !s.is_id_or_class()) {
|
if invalidation.is_none() {
|
||||||
*invalidation = Some(Invalidation::LocalName {
|
*invalidation = Some(Invalidation::LocalName {
|
||||||
name: name.clone(),
|
name: name.clone(),
|
||||||
lower_name: lower_name.clone(),
|
lower_name: lower_name.clone(),
|
||||||
|
@ -357,12 +359,12 @@ impl StylesheetInvalidationSet {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Component::Class(ref class) => {
|
Component::Class(ref class) => {
|
||||||
if invalidation.as_ref().map_or(true, |s| !s.is_id()) {
|
if invalidation.as_ref().map_or(true, |s| !s.is_id_or_class()) {
|
||||||
*invalidation = Some(Invalidation::Class(class.clone()));
|
*invalidation = Some(Invalidation::Class(class.clone()));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Component::ID(ref id) => {
|
Component::ID(ref id) => {
|
||||||
if invalidation.is_none() {
|
if invalidation.as_ref().map_or(true, |s| !s.is_id()) {
|
||||||
*invalidation = Some(Invalidation::ID(id.clone()));
|
*invalidation = Some(Invalidation::ID(id.clone()));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue