mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Replace Root::deref() calls by Root::r() calls where possible.
This changes those calls that were already sound.
This commit is contained in:
parent
c9f26dfd59
commit
1dad710063
61 changed files with 479 additions and 471 deletions
|
@ -85,13 +85,13 @@ trait PrivateCSSStyleDeclarationHelpers {
|
|||
impl<'a> PrivateCSSStyleDeclarationHelpers for JSRef<'a, CSSStyleDeclaration> {
|
||||
fn get_declaration(self, property: &Atom) -> Option<PropertyDeclaration> {
|
||||
let owner = self.owner.root();
|
||||
let element: JSRef<Element> = ElementCast::from_ref(*owner);
|
||||
let element: JSRef<Element> = ElementCast::from_ref(owner.r());
|
||||
element.get_inline_style_declaration(property).map(|decl| decl.clone())
|
||||
}
|
||||
|
||||
fn get_important_declaration(self, property: &Atom) -> Option<PropertyDeclaration> {
|
||||
let owner = self.owner.root();
|
||||
let element: JSRef<Element> = ElementCast::from_ref(*owner);
|
||||
let element: JSRef<Element> = ElementCast::from_ref(owner.r());
|
||||
element.get_important_inline_style_declaration(property).map(|decl| decl.clone())
|
||||
}
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ impl<'a> PrivateCSSStyleDeclarationHelpers for JSRef<'a, CSSStyleDeclaration> {
|
|||
impl<'a> CSSStyleDeclarationMethods for JSRef<'a, CSSStyleDeclaration> {
|
||||
fn Length(self) -> u32 {
|
||||
let owner = self.owner.root();
|
||||
let elem: JSRef<Element> = ElementCast::from_ref(*owner);
|
||||
let elem: JSRef<Element> = ElementCast::from_ref(owner.r());
|
||||
let len = match *elem.style_attribute().borrow() {
|
||||
Some(ref declarations) => declarations.normal.len() + declarations.important.len(),
|
||||
None => 0
|
||||
|
@ -109,7 +109,7 @@ impl<'a> CSSStyleDeclarationMethods for JSRef<'a, CSSStyleDeclaration> {
|
|||
|
||||
fn Item(self, index: u32) -> DOMString {
|
||||
let owner = self.owner.root();
|
||||
let elem: JSRef<Element> = ElementCast::from_ref(*owner);
|
||||
let elem: JSRef<Element> = ElementCast::from_ref(owner.r());
|
||||
let style_attribute = elem.style_attribute().borrow();
|
||||
let result = style_attribute.as_ref().and_then(|declarations| {
|
||||
if index as uint > declarations.normal.len() {
|
||||
|
@ -218,7 +218,7 @@ impl<'a> CSSStyleDeclarationMethods for JSRef<'a, CSSStyleDeclaration> {
|
|||
synthesized_declaration.push_str(value.as_slice());
|
||||
|
||||
let owner = self.owner.root();
|
||||
let window = window_from_node(*owner).root();
|
||||
let window = window_from_node(owner.r()).root();
|
||||
let page = window.page();
|
||||
let decl_block = parse_style_attribute(synthesized_declaration.as_slice(),
|
||||
&page.get_url());
|
||||
|
@ -229,7 +229,7 @@ impl<'a> CSSStyleDeclarationMethods for JSRef<'a, CSSStyleDeclaration> {
|
|||
}
|
||||
|
||||
let owner = self.owner.root();
|
||||
let element: JSRef<Element> = ElementCast::from_ref(*owner);
|
||||
let element: JSRef<Element> = ElementCast::from_ref(owner.r());
|
||||
|
||||
// Step 8
|
||||
for decl in decl_block.normal.iter() {
|
||||
|
@ -240,7 +240,7 @@ impl<'a> CSSStyleDeclarationMethods for JSRef<'a, CSSStyleDeclaration> {
|
|||
|
||||
let document = document_from_node(element).root();
|
||||
let node: JSRef<Node> = NodeCast::from_ref(element);
|
||||
document.content_changed(node, NodeDamage::NodeStyleDamaged);
|
||||
document.r().content_changed(node, NodeDamage::NodeStyleDamaged);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -266,11 +266,11 @@ impl<'a> CSSStyleDeclarationMethods for JSRef<'a, CSSStyleDeclaration> {
|
|||
}
|
||||
|
||||
let owner = self.owner.root();
|
||||
let window = window_from_node(*owner).root();
|
||||
let window = window_from_node(owner.r()).root();
|
||||
let page = window.page();
|
||||
let decl_block = parse_style_attribute(property.as_slice(),
|
||||
&page.get_url());
|
||||
let element: JSRef<Element> = ElementCast::from_ref(*owner);
|
||||
let element: JSRef<Element> = ElementCast::from_ref(owner.r());
|
||||
|
||||
// Step 5
|
||||
for decl in decl_block.normal.iter() {
|
||||
|
@ -281,7 +281,7 @@ impl<'a> CSSStyleDeclarationMethods for JSRef<'a, CSSStyleDeclaration> {
|
|||
|
||||
let document = document_from_node(element).root();
|
||||
let node: JSRef<Node> = NodeCast::from_ref(element);
|
||||
document.content_changed(node, NodeDamage::NodeStyleDamaged);
|
||||
document.r().content_changed(node, NodeDamage::NodeStyleDamaged);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -315,7 +315,7 @@ impl<'a> CSSStyleDeclarationMethods for JSRef<'a, CSSStyleDeclaration> {
|
|||
None => {
|
||||
// Step 5
|
||||
let owner = self.owner.root();
|
||||
let elem: JSRef<Element> = ElementCast::from_ref(*owner);
|
||||
let elem: JSRef<Element> = ElementCast::from_ref(owner.r());
|
||||
elem.remove_inline_style_property(property)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue