mirror of
https://github.com/servo/servo.git
synced 2025-10-04 02:29:12 +01:00
style: Do not incorrectly share style across elements with different part names.
Do the same we do for classes for now. We could be more precise and achieve a bit more sharing with some more effort (left a comment there), but it seems unlikely to matter in practice (and if we did that, we'd probably want to do the same for classes). Differential Revision: https://phabricator.services.mozilla.com/D58453
This commit is contained in:
parent
69bf0e40a6
commit
4f4d480326
2 changed files with 60 additions and 8 deletions
|
@ -81,7 +81,7 @@ where
|
|||
target.pres_hints() == candidate.pres_hints()
|
||||
}
|
||||
|
||||
/// Whether a given element has the same class attribute than a given candidate.
|
||||
/// Whether a given element has the same class attribute as a given candidate.
|
||||
///
|
||||
/// We don't try to share style across elements with different class attributes.
|
||||
pub fn have_same_class<E>(
|
||||
|
@ -94,6 +94,19 @@ where
|
|||
target.class_list() == candidate.class_list()
|
||||
}
|
||||
|
||||
/// Whether a given element has the same class attribute as a given candidate.
|
||||
///
|
||||
/// We don't try to share style across elements with different part attributes.
|
||||
pub fn have_same_parts<E>(
|
||||
target: &mut StyleSharingTarget<E>,
|
||||
candidate: &mut StyleSharingCandidate<E>,
|
||||
) -> bool
|
||||
where
|
||||
E: TElement,
|
||||
{
|
||||
target.part_list() == candidate.part_list()
|
||||
}
|
||||
|
||||
/// Whether a given element and a candidate match the same set of "revalidation"
|
||||
/// selectors.
|
||||
///
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue