diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2017-12-18 12:53:38 +0100 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-01-09 14:26:03 +0100 |
commit | 76257ae4df6e658288b8845fbd70b9fb0f5fd64f (patch) | |
tree | 2dfb317dd972c8884f393e6f6b806fb9c17e9e3b /components/style/sharing | |
parent | ce1d8cd232dfbc9e0a52f9467ba2bc209087ea63 (diff) | |
download | servo-76257ae4df6e658288b8845fbd70b9fb0f5fd64f.tar.gz servo-76257ae4df6e658288b8845fbd70b9fb0f5fd64f.zip |
style: Add a necessary check for style sharing between ::slotted() nodes.
If two elements are assigned to different slots, even within the same shadow
root, they could match different rules, due to the slot being assigned to yet
another slot in another shadow root.
MozReview-Commit-ID: CfZJCVxIQzM
Diffstat (limited to 'components/style/sharing')
-rw-r--r-- | components/style/sharing/mod.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/components/style/sharing/mod.rs b/components/style/sharing/mod.rs index 6a2e16a1177..fd25c1b72cc 100644 --- a/components/style/sharing/mod.rs +++ b/components/style/sharing/mod.rs @@ -668,6 +668,17 @@ impl<E: TElement> StyleSharingCache<E> { return None; } + // If the elements are not assigned to the same slot they could match + // different ::slotted() rules in the slot scope. + // + // If two elements are assigned to different slots, even within the same + // shadow root, they could match different rules, due to the slot being + // assigned to yet another slot in another shadow root. + if target.element.assigned_slot() != candidate.element.assigned_slot() { + trace!("Miss: Different style scopes"); + return None; + } + if *target.get_local_name() != *candidate.element.get_local_name() { trace!("Miss: Local Name"); return None; |