aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmltablerowelement.rs
diff options
context:
space:
mode:
authorchansuke <chansuke@georepublic.de>2018-09-18 23:24:15 +0900
committerJosh Matthews <josh@joshmatthews.net>2018-09-19 17:40:47 -0400
commitc37a345dc9f4dda6ea29c42f96f6c7201c42cbac (patch)
tree1f05b49bac02318455a59d5b143c186fd872bdb9 /components/script/dom/htmltablerowelement.rs
parent2ca7a134736bb4759ff209c1bc0b6dc3cc1984c9 (diff)
downloadservo-c37a345dc9f4dda6ea29c42f96f6c7201c42cbac.tar.gz
servo-c37a345dc9f4dda6ea29c42f96f6c7201c42cbac.zip
Format script component
Diffstat (limited to 'components/script/dom/htmltablerowelement.rs')
-rw-r--r--components/script/dom/htmltablerowelement.rs47
1 files changed, 32 insertions, 15 deletions
diff --git a/components/script/dom/htmltablerowelement.rs b/components/script/dom/htmltablerowelement.rs
index 6e8802c2937..8cceb2212a0 100644
--- a/components/script/dom/htmltablerowelement.rs
+++ b/components/script/dom/htmltablerowelement.rs
@@ -41,8 +41,11 @@ pub struct HTMLTableRowElement {
}
impl HTMLTableRowElement {
- fn new_inherited(local_name: LocalName, prefix: Option<Prefix>, document: &Document)
- -> HTMLTableRowElement {
+ fn new_inherited(
+ local_name: LocalName,
+ prefix: Option<Prefix>,
+ document: &Document,
+ ) -> HTMLTableRowElement {
HTMLTableRowElement {
htmlelement: HTMLElement::new_inherited(local_name, prefix, document),
cells: Default::default(),
@@ -50,19 +53,27 @@ impl HTMLTableRowElement {
}
#[allow(unrooted_must_root)]
- pub fn new(local_name: LocalName, prefix: Option<Prefix>, document: &Document)
- -> DomRoot<HTMLTableRowElement> {
- Node::reflect_node(Box::new(HTMLTableRowElement::new_inherited(local_name, prefix, document)),
- document,
- HTMLTableRowElementBinding::Wrap)
+ pub fn new(
+ local_name: LocalName,
+ prefix: Option<Prefix>,
+ document: &Document,
+ ) -> DomRoot<HTMLTableRowElement> {
+ Node::reflect_node(
+ Box::new(HTMLTableRowElement::new_inherited(
+ local_name, prefix, document,
+ )),
+ document,
+ HTMLTableRowElementBinding::Wrap,
+ )
}
/// Determine the index for this `HTMLTableRowElement` within the given
/// `HTMLCollection`. Returns `-1` if not found within collection.
fn row_index(&self, collection: DomRoot<HTMLCollection>) -> i32 {
- collection.elements_iter()
- .position(|elem| (&elem as &Element) == self.upcast())
- .map_or(-1, |i| i as i32)
+ collection
+ .elements_iter()
+ .position(|elem| (&elem as &Element) == self.upcast())
+ .map_or(-1, |i| i as i32)
}
}
@@ -88,7 +99,8 @@ impl HTMLTableRowElementMethods for HTMLTableRowElement {
node.insert_cell_or_row(
index,
|| self.Cells(),
- || HTMLTableDataCellElement::new(local_name!("td"), None, &node.owner_doc()))
+ || HTMLTableDataCellElement::new(local_name!("td"), None, &node.owner_doc()),
+ )
}
// https://html.spec.whatwg.org/multipage/#dom-tr-deletecell
@@ -97,7 +109,8 @@ impl HTMLTableRowElementMethods for HTMLTableRowElement {
node.delete_cell_or_row(
index,
|| self.Cells(),
- |n| n.is::<HTMLTableDataCellElement>())
+ |n| n.is::<HTMLTableDataCellElement>(),
+ )
}
// https://html.spec.whatwg.org/multipage/#dom-tr-rowindex
@@ -116,8 +129,9 @@ impl HTMLTableRowElementMethods for HTMLTableRowElement {
Some(parent) => parent,
None => return -1,
};
- grandparent.downcast::<HTMLTableElement>()
- .map_or(-1, |table| self.row_index(table.Rows()))
+ grandparent
+ .downcast::<HTMLTableElement>()
+ .map_or(-1, |table| self.row_index(table.Rows()))
}
// https://html.spec.whatwg.org/multipage/#dom-tr-sectionrowindex
@@ -161,7 +175,10 @@ impl VirtualMethods for HTMLTableRowElement {
fn parse_plain_attribute(&self, local_name: &LocalName, value: DOMString) -> AttrValue {
match *local_name {
local_name!("bgcolor") => AttrValue::from_legacy_color(value.into()),
- _ => self.super_type().unwrap().parse_plain_attribute(local_name, value),
+ _ => self
+ .super_type()
+ .unwrap()
+ .parse_plain_attribute(local_name, value),
}
}
}