From 1829c72061999b4b7373298526e9080d35030059 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Oliveira?= Date: Sun, 23 Aug 2015 14:15:21 +0100 Subject: [PATCH] remove PrivateCSSStyleDeclarationHelpers trait from Element, call get_inline_style_declaration and get_important_inline_style_declaration inline closes #7319 --- components/script/dom/cssstyledeclaration.rs | 23 +++----------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/components/script/dom/cssstyledeclaration.rs b/components/script/dom/cssstyledeclaration.rs index cb59a097b85..5e2b82c186d 100644 --- a/components/script/dom/cssstyledeclaration.rs +++ b/components/script/dom/cssstyledeclaration.rs @@ -78,23 +78,6 @@ impl CSSStyleDeclaration { } } -trait PrivateCSSStyleDeclarationHelpers { - fn get_declaration(&self, property: &Atom) -> Option>; - fn get_important_declaration(&self, property: &Atom) -> Option>; -} - -impl PrivateCSSStyleDeclarationHelpers for Element { - fn get_declaration(&self, property: &Atom) -> Option> { - let element = ElementCast::from_ref(self); - element.get_inline_style_declaration(property) - } - - fn get_important_declaration(&self, property: &Atom) -> Option> { - let element = ElementCast::from_ref(self); - element.get_important_inline_style_declaration(property) - } -} - impl CSSStyleDeclaration { fn get_computed_style(&self, property: &Atom) -> Option { let owner = self.owner.root(); @@ -163,7 +146,7 @@ impl<'a> CSSStyleDeclarationMethods for &'a CSSStyleDeclaration { // Step 2.2 for longhand in &*longhand_properties { // Step 2.2.1 - let declaration = owner.get_declaration(&Atom::from_slice(&longhand)); + let declaration = owner.get_inline_style_declaration(&Atom::from_slice(&longhand)); // Step 2.2.2 & 2.2.3 match declaration { @@ -178,7 +161,7 @@ impl<'a> CSSStyleDeclarationMethods for &'a CSSStyleDeclaration { // Step 3 & 4 // FIXME: redundant let binding https://github.com/rust-lang/rust/issues/22252 - let result = match owner.get_declaration(&property) { + let result = match owner.get_inline_style_declaration(&property) { Some(declaration) => declaration.value(), None => "".to_owned(), }; @@ -204,7 +187,7 @@ impl<'a> CSSStyleDeclarationMethods for &'a CSSStyleDeclaration { } else { // FIXME: extra let binding https://github.com/rust-lang/rust/issues/22323 let owner = self.owner.root(); - if owner.get_important_declaration(&property).is_some() { + if owner.get_important_inline_style_declaration(&property).is_some() { return "important".to_owned(); } }