mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Auto merge of #7330 - jxs:master, r=nox
remove PrivateCSSStyleDeclarationHelpers trait from Element, call get_inline_style_declaration and get_important_inline_style_declaration inline closes #7319 <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7330) <!-- Reviewable:end -->
This commit is contained in:
commit
f63d35662e
1 changed files with 3 additions and 20 deletions
|
@ -78,23 +78,6 @@ impl CSSStyleDeclaration {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
trait PrivateCSSStyleDeclarationHelpers {
|
|
||||||
fn get_declaration(&self, property: &Atom) -> Option<Ref<PropertyDeclaration>>;
|
|
||||||
fn get_important_declaration(&self, property: &Atom) -> Option<Ref<PropertyDeclaration>>;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl PrivateCSSStyleDeclarationHelpers for Element {
|
|
||||||
fn get_declaration(&self, property: &Atom) -> Option<Ref<PropertyDeclaration>> {
|
|
||||||
let element = ElementCast::from_ref(self);
|
|
||||||
element.get_inline_style_declaration(property)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_important_declaration(&self, property: &Atom) -> Option<Ref<PropertyDeclaration>> {
|
|
||||||
let element = ElementCast::from_ref(self);
|
|
||||||
element.get_important_inline_style_declaration(property)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl CSSStyleDeclaration {
|
impl CSSStyleDeclaration {
|
||||||
fn get_computed_style(&self, property: &Atom) -> Option<DOMString> {
|
fn get_computed_style(&self, property: &Atom) -> Option<DOMString> {
|
||||||
let owner = self.owner.root();
|
let owner = self.owner.root();
|
||||||
|
@ -163,7 +146,7 @@ impl<'a> CSSStyleDeclarationMethods for &'a CSSStyleDeclaration {
|
||||||
// Step 2.2
|
// Step 2.2
|
||||||
for longhand in &*longhand_properties {
|
for longhand in &*longhand_properties {
|
||||||
// Step 2.2.1
|
// 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
|
// Step 2.2.2 & 2.2.3
|
||||||
match declaration {
|
match declaration {
|
||||||
|
@ -178,7 +161,7 @@ impl<'a> CSSStyleDeclarationMethods for &'a CSSStyleDeclaration {
|
||||||
|
|
||||||
// Step 3 & 4
|
// Step 3 & 4
|
||||||
// FIXME: redundant let binding https://github.com/rust-lang/rust/issues/22252
|
// 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(),
|
Some(declaration) => declaration.value(),
|
||||||
None => "".to_owned(),
|
None => "".to_owned(),
|
||||||
};
|
};
|
||||||
|
@ -204,7 +187,7 @@ impl<'a> CSSStyleDeclarationMethods for &'a CSSStyleDeclaration {
|
||||||
} else {
|
} else {
|
||||||
// FIXME: extra let binding https://github.com/rust-lang/rust/issues/22323
|
// FIXME: extra let binding https://github.com/rust-lang/rust/issues/22323
|
||||||
let owner = self.owner.root();
|
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();
|
return "important".to_owned();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue