aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/traversal.rs
diff options
context:
space:
mode:
authorMs2ger <Ms2ger@gmail.com>2015-10-15 13:55:02 +0200
committerMs2ger <Ms2ger@gmail.com>2015-10-19 15:01:29 +0200
commitf3faaa6b01dda2b9d134d78e8b6f181fb1535344 (patch)
tree730407a8f8ac320aa54d93f7db425a8c41874b7a /components/layout/traversal.rs
parente6e514c89ae93d859415aac04f4fa4192878f853 (diff)
downloadservo-f3faaa6b01dda2b9d134d78e8b6f181fb1535344.tar.gz
servo-f3faaa6b01dda2b9d134d78e8b6f181fb1535344.zip
Define share_style_if_possible on LayoutElement.
Diffstat (limited to 'components/layout/traversal.rs')
-rw-r--r--components/layout/traversal.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs
index a190707a8a5..8d9f8da07ca 100644
--- a/components/layout/traversal.rs
+++ b/components/layout/traversal.rs
@@ -165,10 +165,17 @@ impl<'a> PreorderDomTraversal for RecalcStyleForNode<'a> {
// Check to see whether we can share a style with someone.
let style_sharing_candidate_cache =
&mut self.layout_context.style_sharing_candidate_cache();
- let sharing_result = unsafe {
- node.share_style_if_possible(style_sharing_candidate_cache,
- parent_opt.clone())
+
+ let sharing_result = match node.as_element() {
+ Some(element) => {
+ unsafe {
+ element.share_style_if_possible(style_sharing_candidate_cache,
+ parent_opt.clone())
+ }
+ },
+ None => StyleSharingResult::CannotShare(false),
};
+
// Otherwise, match and cascade selectors.
match sharing_result {
StyleSharingResult::CannotShare(mut shareable) => {