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:
Emilio Cobos Álvarez 2019-12-31 18:14:35 +00:00
parent 69bf0e40a6
commit 4f4d480326
No known key found for this signature in database
GPG key ID: E1152D0994E4BF8A
2 changed files with 60 additions and 8 deletions

View file

@ -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.
///