diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-03-07 02:04:56 +0100 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2018-03-12 21:47:46 +0100 |
commit | c338745b175765e4ed8fc2440dcede537d5ebe1e (patch) | |
tree | d4175ac06822c8f8f81b270fe46bf7e94640f07b /components/style/sharing/mod.rs | |
parent | af12284b6a89b288b61298d64df215f6d6225c83 (diff) | |
download | servo-c338745b175765e4ed8fc2440dcede537d5ebe1e.tar.gz servo-c338745b175765e4ed8fc2440dcede537d5ebe1e.zip |
style: Allow to share style across elements with similar XBL bindings.
Diffstat (limited to 'components/style/sharing/mod.rs')
-rw-r--r-- | components/style/sharing/mod.rs | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/components/style/sharing/mod.rs b/components/style/sharing/mod.rs index 6b3bbb9bccc..788ad3f5e3d 100644 --- a/components/style/sharing/mod.rs +++ b/components/style/sharing/mod.rs @@ -679,12 +679,14 @@ impl<E: TElement> StyleSharingCache<E> { return None; } - // Note that in the XBL case, we should be able to assert that the - // scopes are different, since two elements with different XBL bindings - // need to necessarily have different style (and thus children of them - // would never pass the parent check). - if target.element.style_scope() != candidate.element.style_scope() { - trace!("Miss: Different style scopes"); + // If two elements belong to different shadow trees, different rules may + // apply to them, from the respective trees. + // + // Note that we don't need the same for XBL case, since two elements + // with different XBL bindings need to necessarily have different style + // (and thus children of them would never pass the parent check). + if target.element.containing_shadow() != candidate.element.containing_shadow() { + trace!("Miss: Different containing shadow roots"); return None; } @@ -695,7 +697,9 @@ impl<E: TElement> StyleSharingCache<E> { // 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"); + // TODO(emilio): We could have a look at whether the shadow roots + // actually have slotted rules and such. + trace!("Miss: Different assigned slots"); return None; } |