aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/css/matching.rs
diff options
context:
space:
mode:
authorMs2ger <Ms2ger@gmail.com>2015-10-15 10:38:27 +0200
committerMs2ger <Ms2ger@gmail.com>2015-10-19 14:59:17 +0200
commite5df6fa753b57b5df5b3534456dbd93743e286f5 (patch)
treeb15592c6395655c2286ec33ea40852311a4cb609 /components/layout/css/matching.rs
parent50ad1b064d6e85e84707d83ca8f4b5b541b6b8da (diff)
downloadservo-e5df6fa753b57b5df5b3534456dbd93743e286f5.tar.gz
servo-e5df6fa753b57b5df5b3534456dbd93743e286f5.zip
Improve code flow in share_style_if_possible.
Diffstat (limited to 'components/layout/css/matching.rs')
-rw-r--r--components/layout/css/matching.rs17
1 files changed, 9 insertions, 8 deletions
diff --git a/components/layout/css/matching.rs b/components/layout/css/matching.rs
index 439ecf842cf..9fc903a4f29 100644
--- a/components/layout/css/matching.rs
+++ b/components/layout/css/matching.rs
@@ -580,15 +580,16 @@ impl<'ln> MatchMethods for LayoutNode<'ln> {
if opts::get().disable_share_style_cache {
return StyleSharingResult::CannotShare(false)
}
- let ok = {
- if let Some(element) = self.as_element() {
- element.style_attribute().is_none() &&
- element.get_attr(&ns!(""), &atom!("id")).is_none()
- } else {
- false
- }
+
+ let element = match self.as_element() {
+ Some(element) => element,
+ None => return StyleSharingResult::CannotShare(false),
};
- if !ok {
+
+ if element.style_attribute().is_some() {
+ return StyleSharingResult::CannotShare(false)
+ }
+ if element.get_attr(&ns!(""), &atom!("id")).is_some() {
return StyleSharingResult::CannotShare(false)
}