Bug 1508013 - Run rustfmt on servo/ports/geckolib/ r=emilio
authorCameron McCormack <cam@mcc.id.au>
Tue, 20 Nov 2018 04:37:53 +0000
changeset 506393 5224409d073fc69dab28b64679e442e5cd8982c9
parent 506392 c77aba624d5406020d5a7e39f40d25183f7bdc3e
child 506394 7f54ae73fcee59e545d56374080d033b3d2e162c
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1508013
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1508013 - Run rustfmt on servo/ports/geckolib/ r=emilio Differential Revision: https://phabricator.services.mozilla.com/D12206
servo/ports/geckolib/error_reporter.rs
servo/ports/geckolib/glue.rs
servo/ports/geckolib/lib.rs
servo/ports/geckolib/stylesheet_loader.rs
servo/ports/geckolib/tests/build.rs
servo/ports/geckolib/tests/lib.rs
servo/ports/geckolib/tests/size_of.rs
--- a/servo/ports/geckolib/error_reporter.rs
+++ b/servo/ports/geckolib/error_reporter.rs
@@ -1,25 +1,25 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 //! Wrapper around Gecko's CSS error reporting mechanism.
 
 #![allow(unsafe_code)]
 
-use cssparser::{CowRcStr, serialize_identifier, ToCss};
-use cssparser::{SourceLocation, ParseError, ParseErrorKind, Token, BasicParseErrorKind};
+use cssparser::{serialize_identifier, CowRcStr, ToCss};
+use cssparser::{BasicParseErrorKind, ParseError, ParseErrorKind, SourceLocation, Token};
 use selectors::parser::SelectorParseErrorKind;
 use std::ffi::CStr;
 use std::ptr;
-use style::error_reporting::{ParseErrorReporter, ContextualParseError};
+use style::error_reporting::{ContextualParseError, ParseErrorReporter};
 use style::gecko_bindings::bindings;
-use style::gecko_bindings::structs::{Loader, StyleSheet as DomStyleSheet, nsIURI};
 use style::gecko_bindings::structs::URLExtraData as RawUrlExtraData;
+use style::gecko_bindings::structs::{nsIURI, Loader, StyleSheet as DomStyleSheet};
 use style::stylesheets::UrlExtraData;
 use style_traits::{StyleParseErrorKind, ValueParseErrorKind};
 
 pub type ErrorKind<'i> = ParseErrorKind<'i, StyleParseErrorKind<'i>>;
 
 /// An error reporter with all the data we need to report errors.
 pub struct ErrorReporter {
     sheet: *const DomStyleSheet,
@@ -35,26 +35,23 @@ impl ErrorReporter {
         loader: *mut Loader,
         extra_data: *mut RawUrlExtraData,
     ) -> Option<Self> {
         if !Self::reporting_enabled(sheet, loader) {
             return None;
         }
 
         let uri = unsafe {
-            extra_data.as_ref()
+            extra_data
+                .as_ref()
                 .map(|d| d.mBaseURI.raw::<nsIURI>())
                 .unwrap_or(ptr::null_mut())
         };
 
-        Some(ErrorReporter {
-            sheet,
-            loader,
-            uri,
-        })
+        Some(ErrorReporter { sheet, loader, uri })
     }
 }
 
 enum ErrorString<'a> {
     Snippet(CowRcStr<'a>),
     Ident(CowRcStr<'a>),
     UnexpectedToken(Token<'a>),
 }
@@ -63,17 +60,17 @@ impl<'a> ErrorString<'a> {
     fn into_str(self) -> CowRcStr<'a> {
         match self {
             ErrorString::Snippet(s) => s,
             ErrorString::UnexpectedToken(t) => t.to_css_string().into(),
             ErrorString::Ident(i) => {
                 let mut s = String::new();
                 serialize_identifier(&i, &mut s).unwrap();
                 s.into()
-            }
+            },
         }
     }
 }
 
 #[derive(Debug)]
 enum Action {
     Nothing,
     Skip,
@@ -85,113 +82,103 @@ trait ErrorHelpers<'a> {
     fn error_params(self) -> ErrorParams<'a>;
     fn to_gecko_message(&self) -> (Option<&'static CStr>, &'static CStr, Action);
 }
 
 fn extract_error_param<'a>(err: ErrorKind<'a>) -> Option<ErrorString<'a>> {
     Some(match err {
         ParseErrorKind::Basic(BasicParseErrorKind::UnexpectedToken(t)) => {
             ErrorString::UnexpectedToken(t)
-        }
+        },
 
         ParseErrorKind::Basic(BasicParseErrorKind::AtRuleInvalid(i)) |
         ParseErrorKind::Custom(StyleParseErrorKind::UnsupportedAtRule(i)) => {
             let mut s = String::from("@");
             serialize_identifier(&i, &mut s).unwrap();
             ErrorString::Snippet(s.into())
-        }
+        },
 
         ParseErrorKind::Custom(StyleParseErrorKind::OtherInvalidValue(property)) => {
             ErrorString::Snippet(property)
-        }
+        },
 
-        ParseErrorKind::Custom(
-            StyleParseErrorKind::SelectorError(
-                SelectorParseErrorKind::UnexpectedIdent(ident)
-            )
-        ) => {
-            ErrorString::Ident(ident)
-        }
+        ParseErrorKind::Custom(StyleParseErrorKind::SelectorError(
+            SelectorParseErrorKind::UnexpectedIdent(ident),
+        )) => ErrorString::Ident(ident),
 
         ParseErrorKind::Custom(StyleParseErrorKind::UnknownProperty(property)) => {
             ErrorString::Ident(property)
-        }
+        },
 
-        ParseErrorKind::Custom(
-            StyleParseErrorKind::UnexpectedTokenWithinNamespace(token)
-        ) => {
+        ParseErrorKind::Custom(StyleParseErrorKind::UnexpectedTokenWithinNamespace(token)) => {
             ErrorString::UnexpectedToken(token)
-        }
+        },
 
         _ => return None,
     })
 }
 
 struct ErrorParams<'a> {
     prefix_param: Option<ErrorString<'a>>,
     main_param: Option<ErrorString<'a>>,
 }
 
 /// If an error parameter is present in the given error, return it. Additionally return
 /// a second parameter if it exists, for use in the prefix for the eventual error message.
 fn extract_error_params<'a>(err: ErrorKind<'a>) -> Option<ErrorParams<'a>> {
     let (main, prefix) = match err {
         ParseErrorKind::Custom(StyleParseErrorKind::InvalidColor(property, token)) |
-        ParseErrorKind::Custom(StyleParseErrorKind::InvalidFilter(property, token)) => {
-            (Some(ErrorString::Snippet(property.into())), Some(ErrorString::UnexpectedToken(token)))
-        }
+        ParseErrorKind::Custom(StyleParseErrorKind::InvalidFilter(property, token)) => (
+            Some(ErrorString::Snippet(property.into())),
+            Some(ErrorString::UnexpectedToken(token)),
+        ),
 
-        ParseErrorKind::Custom(
-            StyleParseErrorKind::MediaQueryExpectedFeatureName(ident)
-        ) => {
+        ParseErrorKind::Custom(StyleParseErrorKind::MediaQueryExpectedFeatureName(ident)) => {
             (Some(ErrorString::Ident(ident)), None)
-        }
+        },
 
         ParseErrorKind::Basic(BasicParseErrorKind::UnexpectedToken(token)) |
-        ParseErrorKind::Custom(
-            StyleParseErrorKind::ValueError(ValueParseErrorKind::InvalidColor(token))
-        ) => {
-            (Some(ErrorString::UnexpectedToken(token)), None)
-        }
+        ParseErrorKind::Custom(StyleParseErrorKind::ValueError(
+            ValueParseErrorKind::InvalidColor(token),
+        )) => (Some(ErrorString::UnexpectedToken(token)), None),
 
         ParseErrorKind::Custom(StyleParseErrorKind::SelectorError(err)) => match err {
             SelectorParseErrorKind::UnexpectedTokenInAttributeSelector(t) |
             SelectorParseErrorKind::BadValueInAttr(t) |
             SelectorParseErrorKind::ExpectedBarInAttr(t) |
             SelectorParseErrorKind::NoQualifiedNameInAttributeSelector(t) |
             SelectorParseErrorKind::InvalidQualNameInAttr(t) |
             SelectorParseErrorKind::ExplicitNamespaceUnexpectedToken(t) |
             SelectorParseErrorKind::PseudoElementExpectedIdent(t) |
             SelectorParseErrorKind::NoIdentForPseudo(t) |
             SelectorParseErrorKind::ClassNeedsIdent(t) |
             SelectorParseErrorKind::PseudoElementExpectedColon(t) => {
                 (None, Some(ErrorString::UnexpectedToken(t)))
-            }
+            },
             SelectorParseErrorKind::ExpectedNamespace(namespace) => {
                 (None, Some(ErrorString::Ident(namespace)))
-            }
+            },
             SelectorParseErrorKind::UnsupportedPseudoClassOrElement(p) => {
                 (None, Some(ErrorString::Ident(p)))
-            }
-            SelectorParseErrorKind::EmptySelector |
-            SelectorParseErrorKind::DanglingCombinator => {
+            },
+            SelectorParseErrorKind::EmptySelector | SelectorParseErrorKind::DanglingCombinator => {
                 (None, None)
-            }
-            SelectorParseErrorKind::EmptyNegation => {
-                (None, Some(ErrorString::Snippet(")".into())))
-            }
-            err => match extract_error_param(ParseErrorKind::Custom(StyleParseErrorKind::SelectorError(err))) {
+            },
+            SelectorParseErrorKind::EmptyNegation => (None, Some(ErrorString::Snippet(")".into()))),
+            err => match extract_error_param(ParseErrorKind::Custom(
+                StyleParseErrorKind::SelectorError(err),
+            )) {
                 Some(e) => (Some(e), None),
                 None => return None,
-            }
+            },
         },
         err => match extract_error_param(err) {
             Some(e) => (Some(e), None),
             None => return None,
-        }
+        },
     };
     Some(ErrorParams {
         main_param: main,
         prefix_param: prefix,
     })
 }
 
 impl<'a> ErrorHelpers<'a> for ContextualParseError<'a> {
@@ -203,205 +190,223 @@ impl<'a> ErrorHelpers<'a> for Contextual
             ContextualParseError::InvalidKeyframeRule(s, err) |
             ContextualParseError::InvalidFontFeatureValuesRule(s, err) |
             ContextualParseError::UnsupportedKeyframePropertyDeclaration(s, err) |
             ContextualParseError::InvalidRule(s, err) |
             ContextualParseError::UnsupportedRule(s, err) |
             ContextualParseError::UnsupportedViewportDescriptorDeclaration(s, err) |
             ContextualParseError::UnsupportedCounterStyleDescriptorDeclaration(s, err) |
             ContextualParseError::InvalidMediaRule(s, err) |
-            ContextualParseError::UnsupportedValue(s, err) => {
-                (s.into(), err.kind)
-            }
+            ContextualParseError::UnsupportedValue(s, err) => (s.into(), err.kind),
             ContextualParseError::InvalidCounterStyleWithoutSymbols(s) |
-            ContextualParseError::InvalidCounterStyleNotEnoughSymbols(s) => {
-                (s.into(), ParseErrorKind::Custom(StyleParseErrorKind::UnspecifiedError.into()))
-            }
+            ContextualParseError::InvalidCounterStyleNotEnoughSymbols(s) => (
+                s.into(),
+                ParseErrorKind::Custom(StyleParseErrorKind::UnspecifiedError.into()),
+            ),
             ContextualParseError::InvalidCounterStyleWithoutAdditiveSymbols |
             ContextualParseError::InvalidCounterStyleExtendsWithSymbols |
-            ContextualParseError::InvalidCounterStyleExtendsWithAdditiveSymbols => {
-                ("".into(), ParseErrorKind::Custom(StyleParseErrorKind::UnspecifiedError.into()))
-            }
+            ContextualParseError::InvalidCounterStyleExtendsWithAdditiveSymbols => (
+                "".into(),
+                ParseErrorKind::Custom(StyleParseErrorKind::UnspecifiedError.into()),
+            ),
         }
     }
 
     fn error_params(self) -> ErrorParams<'a> {
         let (s, error) = self.error_data();
         extract_error_params(error).unwrap_or_else(|| ErrorParams {
             main_param: Some(ErrorString::Snippet(s)),
-            prefix_param: None
+            prefix_param: None,
         })
     }
 
     fn to_gecko_message(&self) -> (Option<&'static CStr>, &'static CStr, Action) {
         let (msg, action): (&CStr, Action) = match *self {
             ContextualParseError::UnsupportedPropertyDeclaration(
-                _, ParseError { kind: ParseErrorKind::Basic(BasicParseErrorKind::UnexpectedToken(_)), .. }
+                _,
+                ParseError {
+                    kind: ParseErrorKind::Basic(BasicParseErrorKind::UnexpectedToken(_)),
+                    ..
+                },
             ) |
             ContextualParseError::UnsupportedPropertyDeclaration(
-                _, ParseError { kind: ParseErrorKind::Basic(BasicParseErrorKind::AtRuleInvalid(_)), .. }
-            ) => {
-                (cstr!("PEParseDeclarationDeclExpected"), Action::Skip)
-            }
+                _,
+                ParseError {
+                    kind: ParseErrorKind::Basic(BasicParseErrorKind::AtRuleInvalid(_)),
+                    ..
+                },
+            ) => (cstr!("PEParseDeclarationDeclExpected"), Action::Skip),
             ContextualParseError::UnsupportedPropertyDeclaration(
-                _, ParseError { kind: ParseErrorKind::Custom(ref err), .. }
-            ) => {
-                match *err {
-                    StyleParseErrorKind::InvalidColor(_, _) => {
-                        return (Some(cstr!("PEColorNotColor")),
-                                cstr!("PEValueParsingError"), Action::Drop)
-                    }
-                    StyleParseErrorKind::InvalidFilter(_, _) => {
-                        return (Some(cstr!("PEExpectedNoneOrURLOrFilterFunction")),
-                                cstr!("PEValueParsingError"), Action::Drop)
-                    }
-                    StyleParseErrorKind::OtherInvalidValue(_) => {
-                        (cstr!("PEValueParsingError"), Action::Drop)
-                    }
-                    _ => (cstr!("PEUnknownProperty"), Action::Drop)
-                }
-            }
-            ContextualParseError::UnsupportedPropertyDeclaration(..) =>
-                (cstr!("PEUnknownProperty"), Action::Drop),
-            ContextualParseError::UnsupportedFontFaceDescriptor(..) =>
-                (cstr!("PEUnknownFontDesc"), Action::Skip),
-            ContextualParseError::InvalidKeyframeRule(..) =>
-                (cstr!("PEKeyframeBadName"), Action::Nothing),
-            ContextualParseError::UnsupportedKeyframePropertyDeclaration(..) =>
-                (cstr!("PEBadSelectorKeyframeRuleIgnored"), Action::Nothing),
+                _,
+                ParseError {
+                    kind: ParseErrorKind::Custom(ref err),
+                    ..
+                },
+            ) => match *err {
+                StyleParseErrorKind::InvalidColor(_, _) => {
+                    return (
+                        Some(cstr!("PEColorNotColor")),
+                        cstr!("PEValueParsingError"),
+                        Action::Drop,
+                    )
+                },
+                StyleParseErrorKind::InvalidFilter(_, _) => {
+                    return (
+                        Some(cstr!("PEExpectedNoneOrURLOrFilterFunction")),
+                        cstr!("PEValueParsingError"),
+                        Action::Drop,
+                    )
+                },
+                StyleParseErrorKind::OtherInvalidValue(_) => {
+                    (cstr!("PEValueParsingError"), Action::Drop)
+                },
+                _ => (cstr!("PEUnknownProperty"), Action::Drop),
+            },
+            ContextualParseError::UnsupportedPropertyDeclaration(..) => {
+                (cstr!("PEUnknownProperty"), Action::Drop)
+            },
+            ContextualParseError::UnsupportedFontFaceDescriptor(..) => {
+                (cstr!("PEUnknownFontDesc"), Action::Skip)
+            },
+            ContextualParseError::InvalidKeyframeRule(..) => {
+                (cstr!("PEKeyframeBadName"), Action::Nothing)
+            },
+            ContextualParseError::UnsupportedKeyframePropertyDeclaration(..) => {
+                (cstr!("PEBadSelectorKeyframeRuleIgnored"), Action::Nothing)
+            },
             ContextualParseError::InvalidRule(
-                _, ParseError { kind: ParseErrorKind::Custom(
-                    StyleParseErrorKind::UnexpectedTokenWithinNamespace(_)
-                ), .. }
-            ) => {
-                (cstr!("PEAtNSUnexpected"), Action::Nothing)
-            }
+                _,
+                ParseError {
+                    kind:
+                        ParseErrorKind::Custom(StyleParseErrorKind::UnexpectedTokenWithinNamespace(_)),
+                    ..
+                },
+            ) => (cstr!("PEAtNSUnexpected"), Action::Nothing),
             ContextualParseError::InvalidRule(
-                _, ParseError { kind: ParseErrorKind::Basic(BasicParseErrorKind::AtRuleInvalid(_)), .. }
+                _,
+                ParseError {
+                    kind: ParseErrorKind::Basic(BasicParseErrorKind::AtRuleInvalid(_)),
+                    ..
+                },
             ) |
             ContextualParseError::InvalidRule(
-                _, ParseError { kind: ParseErrorKind::Custom(
-                    StyleParseErrorKind::UnsupportedAtRule(_)
-                ), .. }
-            ) => {
-                (cstr!("PEUnknownAtRule"), Action::Nothing)
-            }
+                _,
+                ParseError {
+                    kind: ParseErrorKind::Custom(StyleParseErrorKind::UnsupportedAtRule(_)),
+                    ..
+                },
+            ) => (cstr!("PEUnknownAtRule"), Action::Nothing),
             ContextualParseError::InvalidRule(_, ref err) => {
                 let prefix = match err.kind {
-                    ParseErrorKind::Custom(StyleParseErrorKind::SelectorError(ref err)) => match *err {
-                        SelectorParseErrorKind::UnexpectedTokenInAttributeSelector(_) => {
-                            Some(cstr!("PEAttSelUnexpected"))
-                        }
-                        SelectorParseErrorKind::ExpectedBarInAttr(_) => {
-                            Some(cstr!("PEAttSelNoBar"))
-                        }
-                        SelectorParseErrorKind::BadValueInAttr(_) => {
-                            Some(cstr!("PEAttSelBadValue"))
-                        }
-                        SelectorParseErrorKind::NoQualifiedNameInAttributeSelector(_) => {
-                            Some(cstr!("PEAttributeNameOrNamespaceExpected"))
-                        }
-                        SelectorParseErrorKind::InvalidQualNameInAttr(_) => {
-                            Some(cstr!("PEAttributeNameExpected"))
-                        }
-                        SelectorParseErrorKind::ExplicitNamespaceUnexpectedToken(_) => {
-                            Some(cstr!("PETypeSelNotType"))
-                        }
-                        SelectorParseErrorKind::ExpectedNamespace(_) => {
-                           Some(cstr!("PEUnknownNamespacePrefix"))
+                    ParseErrorKind::Custom(StyleParseErrorKind::SelectorError(ref err)) => {
+                        match *err {
+                            SelectorParseErrorKind::UnexpectedTokenInAttributeSelector(_) => {
+                                Some(cstr!("PEAttSelUnexpected"))
+                            },
+                            SelectorParseErrorKind::ExpectedBarInAttr(_) => {
+                                Some(cstr!("PEAttSelNoBar"))
+                            },
+                            SelectorParseErrorKind::BadValueInAttr(_) => {
+                                Some(cstr!("PEAttSelBadValue"))
+                            },
+                            SelectorParseErrorKind::NoQualifiedNameInAttributeSelector(_) => {
+                                Some(cstr!("PEAttributeNameOrNamespaceExpected"))
+                            },
+                            SelectorParseErrorKind::InvalidQualNameInAttr(_) => {
+                                Some(cstr!("PEAttributeNameExpected"))
+                            },
+                            SelectorParseErrorKind::ExplicitNamespaceUnexpectedToken(_) => {
+                                Some(cstr!("PETypeSelNotType"))
+                            },
+                            SelectorParseErrorKind::ExpectedNamespace(_) => {
+                                Some(cstr!("PEUnknownNamespacePrefix"))
+                            },
+                            SelectorParseErrorKind::EmptySelector => {
+                                Some(cstr!("PESelectorGroupNoSelector"))
+                            },
+                            SelectorParseErrorKind::DanglingCombinator => {
+                                Some(cstr!("PESelectorGroupExtraCombinator"))
+                            },
+                            SelectorParseErrorKind::UnsupportedPseudoClassOrElement(_) => {
+                                Some(cstr!("PEPseudoSelUnknown"))
+                            },
+                            SelectorParseErrorKind::PseudoElementExpectedColon(_) => {
+                                Some(cstr!("PEPseudoSelEndOrUserActionPC"))
+                            },
+                            SelectorParseErrorKind::NoIdentForPseudo(_) => {
+                                Some(cstr!("PEPseudoClassArgNotIdent"))
+                            },
+                            SelectorParseErrorKind::PseudoElementExpectedIdent(_) => {
+                                Some(cstr!("PEPseudoSelBadName"))
+                            },
+                            SelectorParseErrorKind::ClassNeedsIdent(_) => {
+                                Some(cstr!("PEClassSelNotIdent"))
+                            },
+                            SelectorParseErrorKind::EmptyNegation => {
+                                Some(cstr!("PENegationBadArg"))
+                            },
+                            _ => None,
                         }
-                        SelectorParseErrorKind::EmptySelector => {
-                            Some(cstr!("PESelectorGroupNoSelector"))
-                        }
-                        SelectorParseErrorKind::DanglingCombinator => {
-                            Some(cstr!("PESelectorGroupExtraCombinator"))
-                        }
-                        SelectorParseErrorKind::UnsupportedPseudoClassOrElement(_) => {
-                            Some(cstr!("PEPseudoSelUnknown"))
-                        }
-                        SelectorParseErrorKind::PseudoElementExpectedColon(_) => {
-                            Some(cstr!("PEPseudoSelEndOrUserActionPC"))
-                        }
-                        SelectorParseErrorKind::NoIdentForPseudo(_) => {
-                            Some(cstr!("PEPseudoClassArgNotIdent"))
-                        }
-                        SelectorParseErrorKind::PseudoElementExpectedIdent(_) => {
-                            Some(cstr!("PEPseudoSelBadName"))
-                        }
-                        SelectorParseErrorKind::ClassNeedsIdent(_) => {
-                            Some(cstr!("PEClassSelNotIdent"))
-                        }
-                        SelectorParseErrorKind::EmptyNegation => {
-                            Some(cstr!("PENegationBadArg"))
-                        }
-                        _ => None,
                     },
                     _ => None,
                 };
                 return (prefix, cstr!("PEBadSelectorRSIgnored"), Action::Nothing);
-            }
+            },
             ContextualParseError::InvalidMediaRule(_, ref err) => {
                 let err: &CStr = match err.kind {
-                    ParseErrorKind::Custom(StyleParseErrorKind::MediaQueryExpectedFeatureName(..)) => {
-                        cstr!("PEMQExpectedFeatureName")
-                    },
+                    ParseErrorKind::Custom(StyleParseErrorKind::MediaQueryExpectedFeatureName(
+                        ..
+                    )) => cstr!("PEMQExpectedFeatureName"),
                     ParseErrorKind::Custom(StyleParseErrorKind::MediaQueryExpectedFeatureValue) => {
                         cstr!("PEMQExpectedFeatureValue")
                     },
                     ParseErrorKind::Custom(StyleParseErrorKind::MediaQueryUnexpectedOperator) => {
                         cstr!("PEMQUnexpectedOperator")
                     },
                     ParseErrorKind::Custom(StyleParseErrorKind::RangedExpressionWithNoValue) => {
                         cstr!("PEMQNoMinMaxWithoutValue")
                     },
-                    _ => {
-                        cstr!("PEMQUnexpectedToken")
-                    },
+                    _ => cstr!("PEMQUnexpectedToken"),
                 };
                 (err, Action::Nothing)
-            }
-            ContextualParseError::UnsupportedRule(..) =>
-                (cstr!("PEDeclDropped"), Action::Nothing),
+            },
+            ContextualParseError::UnsupportedRule(..) => (cstr!("PEDeclDropped"), Action::Nothing),
             ContextualParseError::UnsupportedViewportDescriptorDeclaration(..) |
             ContextualParseError::UnsupportedCounterStyleDescriptorDeclaration(..) |
             ContextualParseError::InvalidCounterStyleWithoutSymbols(..) |
             ContextualParseError::InvalidCounterStyleNotEnoughSymbols(..) |
             ContextualParseError::InvalidCounterStyleWithoutAdditiveSymbols |
             ContextualParseError::InvalidCounterStyleExtendsWithSymbols |
             ContextualParseError::InvalidCounterStyleExtendsWithAdditiveSymbols |
             ContextualParseError::UnsupportedFontFeatureValuesDescriptor(..) |
-            ContextualParseError::InvalidFontFeatureValuesRule(..) =>
-                (cstr!("PEUnknownAtRule"), Action::Skip),
+            ContextualParseError::InvalidFontFeatureValuesRule(..) => {
+                (cstr!("PEUnknownAtRule"), Action::Skip)
+            },
             ContextualParseError::UnsupportedValue(_, ParseError { ref kind, .. }) => {
                 match *kind {
-                    ParseErrorKind::Custom(
-                        StyleParseErrorKind::ValueError(
-                            ValueParseErrorKind::InvalidColor(..)
-                        )
-                    ) => (cstr!("PEColorNotColor"), Action::Nothing),
+                    ParseErrorKind::Custom(StyleParseErrorKind::ValueError(
+                        ValueParseErrorKind::InvalidColor(..),
+                    )) => (cstr!("PEColorNotColor"), Action::Nothing),
                     _ => {
                         // Not the best error message, since we weren't parsing
                         // a declaration, just a value. But we don't produce
                         // UnsupportedValue errors other than InvalidColors
                         // currently.
                         debug_assert!(false, "should use a more specific error message");
                         (cstr!("PEDeclDropped"), Action::Nothing)
-                    }
+                    },
                 }
-            }
+            },
         };
         (None, msg, action)
     }
 }
 
 impl ErrorReporter {
-    fn reporting_enabled(
-        sheet: *const DomStyleSheet,
-        loader: *const Loader,
-    ) -> bool {
+    fn reporting_enabled(sheet: *const DomStyleSheet, loader: *const Loader) -> bool {
         unsafe { bindings::Gecko_ErrorReportingEnabled(sheet, loader) }
     }
 
     pub fn report(&self, location: SourceLocation, error: ContextualParseError) {
         debug_assert!(Self::reporting_enabled(self.sheet, self.loader));
 
         let (pre, name, action) = error.to_gecko_message();
         let suffix = match action {
@@ -439,13 +444,13 @@ impl ErrorReporter {
     }
 }
 
 impl ParseErrorReporter for ErrorReporter {
     fn report_error(
         &self,
         _url: &UrlExtraData,
         location: SourceLocation,
-        error: ContextualParseError
+        error: ContextualParseError,
     ) {
         self.report(location, error)
     }
 }
--- a/servo/ports/geckolib/glue.rs
+++ b/servo/ports/geckolib/glue.rs
@@ -1,180 +1,221 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+use super::error_reporter::ErrorReporter;
+use super::stylesheet_loader::{AsyncStylesheetParser, StylesheetLoader};
+use cssparser::ToCss as ParserToCss;
 use cssparser::{ParseErrorKind, Parser, ParserInput, SourceLocation};
-use cssparser::ToCss as ParserToCss;
 use malloc_size_of::MallocSizeOfOps;
 use nsstring::{nsCString, nsStringRepr};
+use selectors::matching::{matches_selector, MatchingContext, MatchingMode};
 use selectors::{NthIndexCache, SelectorList};
-use selectors::matching::{MatchingContext, MatchingMode, matches_selector};
 use servo_arc::{Arc, ArcBorrow, RawOffsetArc};
 use smallvec::SmallVec;
 use std::cell::RefCell;
 use std::collections::BTreeSet;
 use std::fmt::Write;
 use std::iter;
 use std::os::raw::c_void;
 use std::ptr;
 use style::applicable_declarations::ApplicableDeclarationBlock;
 use style::author_styles::AuthorStyles;
+use style::context::ThreadLocalStyleContext;
 use style::context::{CascadeInputs, QuirksMode, SharedStyleContext, StyleContext};
-use style::context::ThreadLocalStyleContext;
 use style::counter_style;
-use style::data::{ElementStyles, self};
+use style::data::{self, ElementStyles};
 use style::dom::{ShowSubtreeData, TDocument, TElement, TNode};
 use style::driver;
 use style::element_state::{DocumentState, ElementState};
 use style::error_reporting::{ContextualParseError, ParseErrorReporter};
-use style::font_metrics::{FontMetricsProvider, get_metrics_provider_for_product};
+use style::font_metrics::{get_metrics_provider_for_product, FontMetricsProvider};
 use style::gecko::data::{GeckoStyleSheet, PerDocumentStyleData, PerDocumentStyleDataImpl};
-use style::gecko::global_style_data::{GLOBAL_STYLE_DATA, GlobalStyleData, STYLE_THREAD_POOL};
+use style::gecko::global_style_data::{GlobalStyleData, GLOBAL_STYLE_DATA, STYLE_THREAD_POOL};
 use style::gecko::restyle_damage::GeckoRestyleDamage;
 use style::gecko::selector_parser::{NonTSPseudoClass, PseudoElement};
 use style::gecko::traversal::RecalcStyleOnly;
 use style::gecko::url::CssUrlData;
 use style::gecko::wrapper::{GeckoElement, GeckoNode};
 use style::gecko_bindings::bindings;
-use style::gecko_bindings::bindings::{RawGeckoElementBorrowed, RawGeckoElementBorrowedOrNull, RawGeckoNodeBorrowed};
-use style::gecko_bindings::bindings::{RawGeckoKeyframeListBorrowed, RawGeckoKeyframeListBorrowedMut};
-use style::gecko_bindings::bindings::RawGeckoPresContextBorrowed;
-use style::gecko_bindings::bindings::RawGeckoURLExtraDataBorrowedMut;
-use style::gecko_bindings::bindings::{RawServoAuthorStyles, RawServoAuthorStylesBorrowed};
-use style::gecko_bindings::bindings::{RawServoAuthorStylesBorrowedMut, RawServoAuthorStylesOwned};
-use style::gecko_bindings::bindings::{RawServoCounterStyleRule, RawServoCounterStyleRuleBorrowed};
-use style::gecko_bindings::bindings::{RawServoDeclarationBlockBorrowed, RawServoDeclarationBlockStrong};
-use style::gecko_bindings::bindings::{RawServoFontFaceRuleBorrowed, RawServoFontFaceRuleStrong};
-use style::gecko_bindings::bindings::{RawServoFontFeatureValuesRule, RawServoFontFeatureValuesRuleBorrowed};
-use style::gecko_bindings::bindings::{RawServoImportRule, RawServoImportRuleBorrowed};
-use style::gecko_bindings::bindings::{RawServoKeyframe, RawServoKeyframeBorrowed, RawServoKeyframeStrong};
-use style::gecko_bindings::bindings::{RawServoKeyframesRule, RawServoKeyframesRuleBorrowed};
-use style::gecko_bindings::bindings::{RawServoMediaListBorrowed, RawServoMediaListStrong};
-use style::gecko_bindings::bindings::{RawServoMediaRule, RawServoMediaRuleBorrowed};
-use style::gecko_bindings::bindings::{RawServoMozDocumentRule, RawServoMozDocumentRuleBorrowed};
-use style::gecko_bindings::bindings::{RawServoNamespaceRule, RawServoNamespaceRuleBorrowed};
-use style::gecko_bindings::bindings::{RawServoPageRule, RawServoPageRuleBorrowed};
-use style::gecko_bindings::bindings::{RawServoQuotesBorrowed, RawServoQuotesStrong};
-use style::gecko_bindings::bindings::{RawServoSelectorListBorrowed, RawServoSelectorListOwned};
-use style::gecko_bindings::bindings::{RawServoSourceSizeListBorrowedOrNull, RawServoSourceSizeListOwned};
-use style::gecko_bindings::bindings::{RawServoStyleSetBorrowed, RawServoStyleSetBorrowedOrNull, RawServoStyleSetOwned};
-use style::gecko_bindings::bindings::{RawServoStyleSheetContentsBorrowed, ServoComputedDataBorrowed};
-use style::gecko_bindings::bindings::{RawServoStyleSheetContentsStrong, ComputedStyleBorrowed};
-use style::gecko_bindings::bindings::{RawServoSupportsRule, RawServoSupportsRuleBorrowed};
-use style::gecko_bindings::bindings::{ServoCssRulesBorrowed, ServoCssRulesStrong};
-use style::gecko_bindings::bindings::{nsACString, nsAString, nsCSSPropertyIDSetBorrowedMut};
+use style::gecko_bindings::bindings::nsACString;
+use style::gecko_bindings::bindings::nsAString;
+use style::gecko_bindings::bindings::nsCSSPropertyIDSetBorrowedMut;
+use style::gecko_bindings::bindings::nsCSSValueBorrowedMut;
+use style::gecko_bindings::bindings::nsTArrayBorrowed_uintptr_t;
+use style::gecko_bindings::bindings::nsTimingFunctionBorrowed;
+use style::gecko_bindings::bindings::nsTimingFunctionBorrowedMut;
+use style::gecko_bindings::bindings::ComputedStyleBorrowed;
 use style::gecko_bindings::bindings::ComputedStyleBorrowedOrNull;
 use style::gecko_bindings::bindings::Gecko_AddPropertyToSet;
 use style::gecko_bindings::bindings::Gecko_AppendPropertyValuePair;
 use style::gecko_bindings::bindings::Gecko_ConstructFontFeatureValueSet;
 use style::gecko_bindings::bindings::Gecko_GetOrCreateFinalKeyframe;
 use style::gecko_bindings::bindings::Gecko_GetOrCreateInitialKeyframe;
 use style::gecko_bindings::bindings::Gecko_GetOrCreateKeyframeAtStart;
 use style::gecko_bindings::bindings::Gecko_HaveSeenPtr;
 use style::gecko_bindings::bindings::Gecko_NewNoneTransform;
 use style::gecko_bindings::bindings::RawGeckoAnimationPropertySegmentBorrowed;
 use style::gecko_bindings::bindings::RawGeckoCSSPropertyIDListBorrowed;
 use style::gecko_bindings::bindings::RawGeckoComputedKeyframeValuesListBorrowedMut;
 use style::gecko_bindings::bindings::RawGeckoComputedTimingBorrowed;
+use style::gecko_bindings::bindings::RawGeckoElementBorrowed;
+use style::gecko_bindings::bindings::RawGeckoElementBorrowedOrNull;
 use style::gecko_bindings::bindings::RawGeckoFontFaceRuleListBorrowedMut;
+use style::gecko_bindings::bindings::RawGeckoKeyframeListBorrowed;
+use style::gecko_bindings::bindings::RawGeckoKeyframeListBorrowedMut;
+use style::gecko_bindings::bindings::RawGeckoNodeBorrowed;
+use style::gecko_bindings::bindings::RawGeckoPresContextBorrowed;
 use style::gecko_bindings::bindings::RawGeckoServoAnimationValueListBorrowedMut;
 use style::gecko_bindings::bindings::RawGeckoServoStyleRuleListBorrowedMut;
+use style::gecko_bindings::bindings::RawGeckoURLExtraDataBorrowedMut;
 use style::gecko_bindings::bindings::RawServoAnimationValueBorrowed;
 use style::gecko_bindings::bindings::RawServoAnimationValueBorrowedOrNull;
 use style::gecko_bindings::bindings::RawServoAnimationValueMapBorrowedMut;
 use style::gecko_bindings::bindings::RawServoAnimationValueStrong;
 use style::gecko_bindings::bindings::RawServoAnimationValueTableBorrowed;
+use style::gecko_bindings::bindings::RawServoAuthorStyles;
+use style::gecko_bindings::bindings::RawServoAuthorStylesBorrowed;
+use style::gecko_bindings::bindings::RawServoAuthorStylesBorrowedMut;
+use style::gecko_bindings::bindings::RawServoAuthorStylesOwned;
+use style::gecko_bindings::bindings::RawServoCounterStyleRule;
+use style::gecko_bindings::bindings::RawServoCounterStyleRuleBorrowed;
 use style::gecko_bindings::bindings::RawServoCssUrlDataBorrowed;
+use style::gecko_bindings::bindings::RawServoDeclarationBlockBorrowed;
 use style::gecko_bindings::bindings::RawServoDeclarationBlockBorrowedOrNull;
+use style::gecko_bindings::bindings::RawServoDeclarationBlockStrong;
+use style::gecko_bindings::bindings::RawServoFontFaceRuleBorrowed;
+use style::gecko_bindings::bindings::RawServoFontFaceRuleStrong;
+use style::gecko_bindings::bindings::RawServoFontFeatureValuesRule;
+use style::gecko_bindings::bindings::RawServoFontFeatureValuesRuleBorrowed;
+use style::gecko_bindings::bindings::RawServoImportRule;
+use style::gecko_bindings::bindings::RawServoImportRuleBorrowed;
+use style::gecko_bindings::bindings::RawServoKeyframe;
+use style::gecko_bindings::bindings::RawServoKeyframeBorrowed;
+use style::gecko_bindings::bindings::RawServoKeyframeStrong;
+use style::gecko_bindings::bindings::RawServoKeyframesRule;
+use style::gecko_bindings::bindings::RawServoKeyframesRuleBorrowed;
+use style::gecko_bindings::bindings::RawServoMediaListBorrowed;
+use style::gecko_bindings::bindings::RawServoMediaListStrong;
+use style::gecko_bindings::bindings::RawServoMediaRule;
+use style::gecko_bindings::bindings::RawServoMediaRuleBorrowed;
+use style::gecko_bindings::bindings::RawServoMozDocumentRule;
+use style::gecko_bindings::bindings::RawServoMozDocumentRuleBorrowed;
+use style::gecko_bindings::bindings::RawServoNamespaceRule;
+use style::gecko_bindings::bindings::RawServoNamespaceRuleBorrowed;
+use style::gecko_bindings::bindings::RawServoPageRule;
+use style::gecko_bindings::bindings::RawServoPageRuleBorrowed;
+use style::gecko_bindings::bindings::RawServoQuotesBorrowed;
+use style::gecko_bindings::bindings::RawServoQuotesStrong;
+use style::gecko_bindings::bindings::RawServoSelectorListBorrowed;
+use style::gecko_bindings::bindings::RawServoSelectorListOwned;
+use style::gecko_bindings::bindings::RawServoSourceSizeListBorrowedOrNull;
+use style::gecko_bindings::bindings::RawServoSourceSizeListOwned;
 use style::gecko_bindings::bindings::RawServoStyleRuleBorrowed;
 use style::gecko_bindings::bindings::RawServoStyleSet;
-use style::gecko_bindings::bindings::nsCSSValueBorrowedMut;
-use style::gecko_bindings::bindings::nsTArrayBorrowed_uintptr_t;
-use style::gecko_bindings::bindings::nsTimingFunctionBorrowed;
-use style::gecko_bindings::bindings::nsTimingFunctionBorrowedMut;
+use style::gecko_bindings::bindings::RawServoStyleSetBorrowed;
+use style::gecko_bindings::bindings::RawServoStyleSetBorrowedOrNull;
+use style::gecko_bindings::bindings::RawServoStyleSetOwned;
+use style::gecko_bindings::bindings::RawServoStyleSheetContentsBorrowed;
+use style::gecko_bindings::bindings::RawServoStyleSheetContentsStrong;
+use style::gecko_bindings::bindings::RawServoSupportsRule;
+use style::gecko_bindings::bindings::RawServoSupportsRuleBorrowed;
+use style::gecko_bindings::bindings::ServoComputedDataBorrowed;
+use style::gecko_bindings::bindings::ServoCssRulesBorrowed;
+use style::gecko_bindings::bindings::ServoCssRulesStrong;
 use style::gecko_bindings::structs;
-use style::gecko_bindings::structs::{CallerType, CSSPseudoElementType, CompositeOperation};
-use style::gecko_bindings::structs::{DeclarationBlockMutationClosure, Loader, LoaderReusableStyleSheets};
-use style::gecko_bindings::structs::{RawServoStyleRule, ComputedStyleStrong};
-use style::gecko_bindings::structs::{SheetParsingMode, nsAtom, nsCSSPropertyID};
-use style::gecko_bindings::structs::{StyleSheet as DomStyleSheet, SheetLoadData, SheetLoadDataHolder};
-use style::gecko_bindings::structs::{nsCSSFontDesc, nsCSSCounterDesc};
-use style::gecko_bindings::structs::{nsRestyleHint, nsChangeHint, PropertyValuePair};
+use style::gecko_bindings::structs::gfxFontFeatureValueSet;
+use style::gecko_bindings::structs::nsAtom;
+use style::gecko_bindings::structs::nsCSSCounterDesc;
+use style::gecko_bindings::structs::nsCSSFontDesc;
+use style::gecko_bindings::structs::nsCSSPropertyID;
+use style::gecko_bindings::structs::nsCSSValueSharedList;
+use style::gecko_bindings::structs::nsChangeHint;
+use style::gecko_bindings::structs::nsCompatibility;
+use style::gecko_bindings::structs::nsIDocument;
+use style::gecko_bindings::structs::nsRestyleHint;
+use style::gecko_bindings::structs::nsStyleTransformMatrix::MatrixTransformOperator;
+use style::gecko_bindings::structs::nsTArray;
+use style::gecko_bindings::structs::nsTimingFunction;
+use style::gecko_bindings::structs::nsresult;
 use style::gecko_bindings::structs::AtomArray;
+use style::gecko_bindings::structs::CSSPseudoElementType;
+use style::gecko_bindings::structs::CallerType;
+use style::gecko_bindings::structs::CompositeOperation;
+use style::gecko_bindings::structs::ComputedStyleStrong;
+use style::gecko_bindings::structs::DeclarationBlockMutationClosure;
 use style::gecko_bindings::structs::IterationCompositeOperation;
+use style::gecko_bindings::structs::Loader;
+use style::gecko_bindings::structs::LoaderReusableStyleSheets;
 use style::gecko_bindings::structs::MallocSizeOf as GeckoMallocSizeOf;
 use style::gecko_bindings::structs::OriginFlags;
 use style::gecko_bindings::structs::OriginFlags_Author;
 use style::gecko_bindings::structs::OriginFlags_User;
 use style::gecko_bindings::structs::OriginFlags_UserAgent;
+use style::gecko_bindings::structs::PropertyValuePair;
 use style::gecko_bindings::structs::RawGeckoGfxMatrix4x4;
 use style::gecko_bindings::structs::RawServoFontFaceRule;
 use style::gecko_bindings::structs::RawServoSelectorList;
 use style::gecko_bindings::structs::RawServoSourceSizeList;
+use style::gecko_bindings::structs::RawServoStyleRule;
 use style::gecko_bindings::structs::SeenPtrs;
 use style::gecko_bindings::structs::ServoElementSnapshotTable;
 use style::gecko_bindings::structs::ServoStyleSetSizes;
 use style::gecko_bindings::structs::ServoTraversalFlags;
+use style::gecko_bindings::structs::SheetLoadData;
+use style::gecko_bindings::structs::SheetLoadDataHolder;
+use style::gecko_bindings::structs::SheetParsingMode;
 use style::gecko_bindings::structs::StyleContentType;
 use style::gecko_bindings::structs::StyleRuleInclusion;
+use style::gecko_bindings::structs::StyleSheet as DomStyleSheet;
 use style::gecko_bindings::structs::URLExtraData;
-use style::gecko_bindings::structs::gfxFontFeatureValueSet;
-use style::gecko_bindings::structs::nsCSSValueSharedList;
-use style::gecko_bindings::structs::nsCompatibility;
-use style::gecko_bindings::structs::nsIDocument;
-use style::gecko_bindings::structs::nsStyleTransformMatrix::MatrixTransformOperator;
-use style::gecko_bindings::structs::nsTArray;
-use style::gecko_bindings::structs::nsTimingFunction;
-use style::gecko_bindings::structs::nsresult;
-use style::gecko_bindings::sugar::ownership::{FFIArcHelpers, HasFFI, HasArcFFI};
+use style::gecko_bindings::sugar::ownership::{FFIArcHelpers, HasArcFFI, HasFFI};
 use style::gecko_bindings::sugar::ownership::{HasSimpleFFI, Strong};
 use style::gecko_bindings::sugar::refptr::RefPtr;
 use style::gecko_properties;
 use style::invalidation::element::restyle_hints;
 use style::media_queries::MediaList;
-use style::parser::{Parse, ParserContext, self};
+use style::parser::{self, Parse, ParserContext};
+use style::properties::animated_properties::AnimationValue;
+use style::properties::{parse_one_declaration_into, parse_style_attribute};
 use style::properties::{ComputedValues, Importance, NonCustomPropertyId};
 use style::properties::{LonghandId, LonghandIdSet, PropertyDeclarationBlock, PropertyId};
 use style::properties::{PropertyDeclarationId, ShorthandId};
 use style::properties::{SourcePropertyDeclaration, StyleBuilder};
-use style::properties::{parse_one_declaration_into, parse_style_attribute};
-use style::properties::animated_properties::AnimationValue;
 use style::rule_cache::RuleCacheConditions;
 use style::rule_tree::{CascadeLevel, StrongRuleNode};
 use style::selector_parser::{PseudoElementCascadeType, SelectorImpl};
-use style::shared_lock::{SharedRwLockReadGuard, StylesheetGuards, ToCssWithGuard, Locked};
+use style::shared_lock::{Locked, SharedRwLockReadGuard, StylesheetGuards, ToCssWithGuard};
 use style::string_cache::{Atom, WeakAtom};
 use style::style_adjuster::StyleAdjuster;
-use style::stylesheets::{CssRule, CssRules, CssRuleType, CssRulesHelpers, CounterStyleRule};
+use style::stylesheets::import_rule::ImportSheet;
+use style::stylesheets::keyframes_rule::{Keyframe, KeyframeSelector, KeyframesStepValue};
+use style::stylesheets::supports_rule::parse_condition_or_declaration;
+use style::stylesheets::StylesheetLoader as StyleStylesheetLoader;
+use style::stylesheets::{CounterStyleRule, CssRule, CssRuleType, CssRules, CssRulesHelpers};
 use style::stylesheets::{DocumentRule, FontFaceRule, FontFeatureValuesRule, ImportRule};
 use style::stylesheets::{KeyframesRule, MediaRule, NamespaceRule, Origin, OriginSet, PageRule};
 use style::stylesheets::{StyleRule, StylesheetContents, SupportsRule, UrlExtraData};
-use style::stylesheets::StylesheetLoader as StyleStylesheetLoader;
-use style::stylesheets::import_rule::ImportSheet;
-use style::stylesheets::keyframes_rule::{Keyframe, KeyframeSelector, KeyframesStepValue};
-use style::stylesheets::supports_rule::parse_condition_or_declaration;
 use style::stylist::{add_size_of_ua_cache, AuthorStylesEnabled, RuleInclusion, Stylist};
 use style::thread_state;
 use style::timer::Timer;
+use style::traversal::resolve_style;
 use style::traversal::DomTraversal;
-use style::traversal::resolve_style;
 use style::traversal_flags::{self, TraversalFlags};
 use style::use_counters::UseCounters;
-use style::values::{CustomIdent, KeyframesName};
 use style::values::animated::{Animate, Procedure, ToAnimatedZero};
 use style::values::computed::{self, Context, QuotePair, ToComputedValue};
 use style::values::distance::ComputeSquaredDistance;
 use style::values::generics::rect::Rect;
 use style::values::specified;
 use style::values::specified::gecko::{IntersectionObserverRootMargin, PixelOrPercentage};
 use style::values::specified::source_size_list::SourceSizeList;
+use style::values::{CustomIdent, KeyframesName};
 use style_traits::{CssType, CssWriter, ParsingMode, StyleParseErrorKind, ToCss};
-use super::error_reporter::ErrorReporter;
-use super::stylesheet_loader::{AsyncStylesheetParser, StylesheetLoader};
 
 trait ClosureHelper {
     fn invoke(&self);
 }
 
 impl ClosureHelper for DeclarationBlockMutationClosure {
     #[inline]
     fn invoke(&self) {
@@ -271,20 +312,17 @@ fn traverse_subtree(
     let shared_style_context = create_shared_context(
         &global_style_data,
         &guard,
         &per_doc_data,
         traversal_flags,
         snapshots,
     );
 
-    let token = RecalcStyleOnly::pre_traverse(
-        element,
-        &shared_style_context,
-    );
+    let token = RecalcStyleOnly::pre_traverse(element, &shared_style_context);
 
     if !token.should_traverse() {
         return;
     }
 
     debug!("Traversing subtree from {:?}", element);
 
     let thread_pool_holder = &*STYLE_THREAD_POOL;
@@ -302,52 +340,54 @@ fn traverse_subtree(
 ///
 /// Returns whether the root was restyled. Whether anything else was restyled or
 /// not can be inferred from the dirty bits in the rest of the tree.
 #[no_mangle]
 pub extern "C" fn Servo_TraverseSubtree(
     root: RawGeckoElementBorrowed,
     raw_data: RawServoStyleSetBorrowed,
     snapshots: *const ServoElementSnapshotTable,
-    raw_flags: ServoTraversalFlags
+    raw_flags: ServoTraversalFlags,
 ) -> bool {
     let traversal_flags = TraversalFlags::from_bits_truncate(raw_flags);
     debug_assert!(!snapshots.is_null());
 
     let element = GeckoElement(root);
 
     debug!("Servo_TraverseSubtree (flags={:?})", traversal_flags);
     debug!("{:?}", ShowSubtreeData(element.as_node()));
 
     if cfg!(debug_assertions) {
         if let Some(parent) = element.traversal_parent() {
-            let data =
-                parent.borrow_data().expect("Styling element with unstyled parent");
+            let data = parent
+                .borrow_data()
+                .expect("Styling element with unstyled parent");
             assert!(
                 !data.styles.is_display_none(),
                 "Styling element with display: none parent"
             );
         }
     }
 
     let needs_animation_only_restyle =
-        element.has_animation_only_dirty_descendants() ||
-        element.has_animation_restyle_hints();
+        element.has_animation_only_dirty_descendants() || element.has_animation_restyle_hints();
 
     let per_doc_data = PerDocumentStyleData::from_ffi(raw_data).borrow();
     debug_assert!(!per_doc_data.stylist.stylesheets_have_changed());
 
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
 
     let was_initial_style = element.get_data().is_none();
 
     if needs_animation_only_restyle {
-        debug!("Servo_TraverseSubtree doing animation-only restyle (aodd={})",
-               element.has_animation_only_dirty_descendants());
+        debug!(
+            "Servo_TraverseSubtree doing animation-only restyle (aodd={})",
+            element.has_animation_only_dirty_descendants()
+        );
         traverse_subtree(
             element,
             &global_style_data,
             &per_doc_data,
             &guard,
             traversal_flags | TraversalFlags::AnimationOnly,
             unsafe { &*snapshots },
         );
@@ -357,29 +397,30 @@ pub extern "C" fn Servo_TraverseSubtree(
         element,
         &global_style_data,
         &per_doc_data,
         &guard,
         traversal_flags,
         unsafe { &*snapshots },
     );
 
-    debug!("Servo_TraverseSubtree complete (dd={}, aodd={}, lfcd={}, lfc={}, data={:?})",
-           element.has_dirty_descendants(),
-           element.has_animation_only_dirty_descendants(),
-           element.descendants_need_frames(),
-           element.needs_frame(),
-           element.borrow_data().unwrap());
+    debug!(
+        "Servo_TraverseSubtree complete (dd={}, aodd={}, lfcd={}, lfc={}, data={:?})",
+        element.has_dirty_descendants(),
+        element.has_animation_only_dirty_descendants(),
+        element.descendants_need_frames(),
+        element.needs_frame(),
+        element.borrow_data().unwrap()
+    );
 
     if was_initial_style {
         debug_assert!(!element.borrow_data().unwrap().contains_restyle_data());
         false
     } else {
-        let element_was_restyled =
-            element.borrow_data().unwrap().contains_restyle_data();
+        let element_was_restyled = element.borrow_data().unwrap().contains_restyle_data();
         element_was_restyled
     }
 }
 
 /// Checks whether the rule tree has crossed its threshold for unused nodes, and
 /// if so, frees them.
 #[no_mangle]
 pub extern "C" fn Servo_MaybeGCRuleTree(raw_data: RawServoStyleSetBorrowed) {
@@ -406,17 +447,19 @@ pub extern "C" fn Servo_AnimationValues_
 
 #[no_mangle]
 pub extern "C" fn Servo_AnimationValues_IsInterpolable(
     from: RawServoAnimationValueBorrowed,
     to: RawServoAnimationValueBorrowed,
 ) -> bool {
     let from_value = AnimationValue::as_arc(&from);
     let to_value = AnimationValue::as_arc(&to);
-    from_value.animate(to_value, Procedure::Interpolate { progress: 0.5 }).is_ok()
+    from_value
+        .animate(to_value, Procedure::Interpolate { progress: 0.5 })
+        .is_ok()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_AnimationValues_Add(
     a: RawServoAnimationValueBorrowed,
     b: RawServoAnimationValueBorrowed,
 ) -> RawServoAnimationValueStrong {
     let a_value = AnimationValue::as_arc(&a);
@@ -459,74 +502,70 @@ pub extern "C" fn Servo_AnimationValues_
 pub extern "C" fn Servo_AnimationValues_ComputeDistance(
     from: RawServoAnimationValueBorrowed,
     to: RawServoAnimationValueBorrowed,
 ) -> f64 {
     let from_value = AnimationValue::as_arc(&from);
     let to_value = AnimationValue::as_arc(&to);
     // If compute_squared_distance() failed, this function will return negative value
     // in order to check whether we support the specified paced animation values.
-    from_value.compute_squared_distance(to_value).map(|d| d.sqrt()).unwrap_or(-1.0)
+    from_value
+        .compute_squared_distance(to_value)
+        .map(|d| d.sqrt())
+        .unwrap_or(-1.0)
 }
 
 /// Compute one of the endpoints for the interpolation interval, compositing it with the
 /// underlying value if needed.
 /// An None returned value means, "Just use endpoint_value as-is."
 /// It is the responsibility of the caller to ensure that |underlying_value| is provided
 /// when it will be used.
 fn composite_endpoint(
     endpoint_value: Option<&RawOffsetArc<AnimationValue>>,
     composite: CompositeOperation,
     underlying_value: Option<&AnimationValue>,
 ) -> Option<AnimationValue> {
     match endpoint_value {
-        Some(endpoint_value) => {
-            match composite {
-                CompositeOperation::Add => {
-                    underlying_value
-                        .expect("We should have an underlying_value")
-                        .animate(endpoint_value, Procedure::Add).ok()
-                },
-                CompositeOperation::Accumulate => {
-                    underlying_value
-                        .expect("We should have an underlying value")
-                        .animate(endpoint_value, Procedure::Accumulate { count: 1 })
-                        .ok()
-                },
-                _ => None,
-            }
+        Some(endpoint_value) => match composite {
+            CompositeOperation::Add => underlying_value
+                .expect("We should have an underlying_value")
+                .animate(endpoint_value, Procedure::Add)
+                .ok(),
+            CompositeOperation::Accumulate => underlying_value
+                .expect("We should have an underlying value")
+                .animate(endpoint_value, Procedure::Accumulate { count: 1 })
+                .ok(),
+            _ => None,
         },
         None => underlying_value.map(|v| v.clone()),
     }
 }
 
 /// Accumulate one of the endpoints of the animation interval.
 /// A returned value of None means, "Just use endpoint_value as-is."
 fn accumulate_endpoint(
     endpoint_value: Option<&RawOffsetArc<AnimationValue>>,
     composited_value: Option<AnimationValue>,
     last_value: &AnimationValue,
-    current_iteration: u64
+    current_iteration: u64,
 ) -> Option<AnimationValue> {
-    debug_assert!(endpoint_value.is_some() || composited_value.is_some(),
-                  "Should have a suitable value to use");
+    debug_assert!(
+        endpoint_value.is_some() || composited_value.is_some(),
+        "Should have a suitable value to use"
+    );
 
     let count = current_iteration;
     match composited_value {
-        Some(endpoint) => {
-            last_value
-                .animate(&endpoint, Procedure::Accumulate { count })
-                .ok()
-                .or(Some(endpoint))
-        },
-        None => {
-            last_value
-                .animate(endpoint_value.unwrap(), Procedure::Accumulate { count })
-                .ok()
-        },
+        Some(endpoint) => last_value
+            .animate(&endpoint, Procedure::Accumulate { count })
+            .ok()
+            .or(Some(endpoint)),
+        None => last_value
+            .animate(endpoint_value.unwrap(), Procedure::Accumulate { count })
+            .ok(),
     }
 }
 
 /// Compose the animation segment. We composite it with the underlying_value and last_value if
 /// needed.
 /// The caller is responsible for providing an underlying value and last value
 /// in all situations where there are needed.
 fn compose_animation_segment(
@@ -550,66 +589,93 @@ fn compose_animation_segment(
     let raw_to_value;
     let keyframe_to_value = if !segment.mToValue.mServo.mRawPtr.is_null() {
         raw_to_value = unsafe { &*segment.mToValue.mServo.mRawPtr };
         Some(AnimationValue::as_arc(&raw_to_value))
     } else {
         None
     };
 
-    let mut composited_from_value = composite_endpoint(keyframe_from_value,
-                                                       segment.mFromComposite,
-                                                       underlying_value);
-    let mut composited_to_value = composite_endpoint(keyframe_to_value,
-                                                     segment.mToComposite,
-                                                     underlying_value);
-
-    debug_assert!(keyframe_from_value.is_some() || composited_from_value.is_some(),
-                  "Should have a suitable from value to use");
-    debug_assert!(keyframe_to_value.is_some() || composited_to_value.is_some(),
-                  "Should have a suitable to value to use");
+    let mut composited_from_value = composite_endpoint(
+        keyframe_from_value,
+        segment.mFromComposite,
+        underlying_value,
+    );
+    let mut composited_to_value =
+        composite_endpoint(keyframe_to_value, segment.mToComposite, underlying_value);
+
+    debug_assert!(
+        keyframe_from_value.is_some() || composited_from_value.is_some(),
+        "Should have a suitable from value to use"
+    );
+    debug_assert!(
+        keyframe_to_value.is_some() || composited_to_value.is_some(),
+        "Should have a suitable to value to use"
+    );
 
     // Apply iteration composite behavior.
     if iteration_composite == IterationCompositeOperation::Accumulate && current_iteration > 0 {
-        let last_value = last_value.unwrap_or_else(|| {
-            underlying_value.expect("Should have a valid underlying value")
-        });
-
-        composited_from_value = accumulate_endpoint(keyframe_from_value,
-                                                    composited_from_value,
-                                                    last_value,
-                                                    current_iteration);
-        composited_to_value = accumulate_endpoint(keyframe_to_value,
-                                                  composited_to_value,
-                                                  last_value,
-                                                  current_iteration);
+        let last_value = last_value
+            .unwrap_or_else(|| underlying_value.expect("Should have a valid underlying value"));
+
+        composited_from_value = accumulate_endpoint(
+            keyframe_from_value,
+            composited_from_value,
+            last_value,
+            current_iteration,
+        );
+        composited_to_value = accumulate_endpoint(
+            keyframe_to_value,
+            composited_to_value,
+            last_value,
+            current_iteration,
+        );
     }
 
     // Use the composited value if there is one, otherwise, use the original keyframe value.
-    let from = composited_from_value.as_ref().unwrap_or_else(|| keyframe_from_value.unwrap());
-    let to   = composited_to_value.as_ref().unwrap_or_else(|| keyframe_to_value.unwrap());
+    let from = composited_from_value
+        .as_ref()
+        .unwrap_or_else(|| keyframe_from_value.unwrap());
+    let to = composited_to_value
+        .as_ref()
+        .unwrap_or_else(|| keyframe_to_value.unwrap());
 
     if segment.mToKey == segment.mFromKey {
-        return if total_progress < 0. { from.clone() } else { to.clone() };
+        return if total_progress < 0. {
+            from.clone()
+        } else {
+            to.clone()
+        };
     }
 
-    match from.animate(to, Procedure::Interpolate { progress: segment_progress }) {
+    match from.animate(
+        to,
+        Procedure::Interpolate {
+            progress: segment_progress,
+        },
+    ) {
         Ok(value) => value,
-        _ => if segment_progress < 0.5 { from.clone() } else { to.clone() },
+        _ => {
+            if segment_progress < 0.5 {
+                from.clone()
+            } else {
+                to.clone()
+            }
+        },
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ComposeAnimationSegment(
     segment: RawGeckoAnimationPropertySegmentBorrowed,
     underlying_value: RawServoAnimationValueBorrowedOrNull,
     last_value: RawServoAnimationValueBorrowedOrNull,
     iteration_composite: IterationCompositeOperation,
     progress: f64,
-    current_iteration: u64
+    current_iteration: u64,
 ) -> RawServoAnimationValueStrong {
     let underlying_value = AnimationValue::arc_from_borrowed(&underlying_value).map(|v| &**v);
     let last_value = AnimationValue::arc_from_borrowed(&last_value).map(|v| &**v);
     let result = compose_animation_segment(
         segment,
         underlying_value,
         last_value,
         iteration_composite,
@@ -655,17 +721,19 @@ pub extern "C" fn Servo_AnimationCompose
     // If either of the segment endpoints are null, get the underlying value to
     // use from the current value in the values map (set by a lower-priority
     // effect), or, if there is no current value, look up the cached base value
     // for this property.
     let underlying_value = if need_underlying_value {
         let previous_composed_value = value_map.get(&property).cloned();
         previous_composed_value.or_else(|| {
             let raw_base_style = unsafe { Gecko_AnimationGetBaseStyle(base_values, css_property) };
-            AnimationValue::arc_from_borrowed(&raw_base_style).map(|v| &**v).cloned()
+            AnimationValue::arc_from_borrowed(&raw_base_style)
+                .map(|v| &**v)
+                .cloned()
         })
     } else {
         None
     };
 
     if need_underlying_value && underlying_value.is_none() {
         warn!("Underlying value should be valid when we expect to use it");
         return;
@@ -699,58 +767,60 @@ pub extern "C" fn Servo_AnimationCompose
     );
     value_map.insert(property, result);
 }
 
 macro_rules! get_property_id_from_nscsspropertyid {
     ($property_id: ident, $ret: expr) => {{
         match PropertyId::from_nscsspropertyid($property_id) {
             Ok(property_id) => property_id,
-            Err(()) => { return $ret; }
+            Err(()) => {
+                return $ret;
+            },
         }
-    }}
+    }};
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_AnimationValue_Serialize(
     value: RawServoAnimationValueBorrowed,
     property: nsCSSPropertyID,
     buffer: *mut nsAString,
 ) {
     let uncomputed_value = AnimationValue::as_arc(&value).uncompute();
     let buffer = unsafe { buffer.as_mut().unwrap() };
     let rv = PropertyDeclarationBlock::with_one(uncomputed_value, Importance::Normal)
-        .single_value_to_css(&get_property_id_from_nscsspropertyid!(property, ()), buffer,
-                             None, None /* No extra custom properties */);
+        .single_value_to_css(
+            &get_property_id_from_nscsspropertyid!(property, ()),
+            buffer,
+            None,
+            None, /* No extra custom properties */
+        );
     debug_assert!(rv.is_ok());
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_AnimationValue_GetOpacity(
-    value: RawServoAnimationValueBorrowed,
-) -> f32 {
+pub extern "C" fn Servo_AnimationValue_GetOpacity(value: RawServoAnimationValueBorrowed) -> f32 {
     let value = AnimationValue::as_arc(&value);
     if let AnimationValue::Opacity(opacity) = **value {
         opacity
     } else {
         panic!("The AnimationValue should be Opacity");
     }
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_AnimationValue_Opacity(
-    opacity: f32
-) -> RawServoAnimationValueStrong {
+pub extern "C" fn Servo_AnimationValue_Opacity(opacity: f32) -> RawServoAnimationValueStrong {
     Arc::new(AnimationValue::Opacity(opacity)).into_strong()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_AnimationValue_GetTransform(
     value: RawServoAnimationValueBorrowed,
-    list: *mut structs::RefPtr<nsCSSValueSharedList>
+    list: *mut structs::RefPtr<nsCSSValueSharedList>,
 ) {
     let value = AnimationValue::as_arc(&value);
     if let AnimationValue::Transform(ref servo_list) = **value {
         let list = unsafe { &mut *list };
         if servo_list.0.is_empty() {
             unsafe {
                 list.set_move(RefPtr::from_addrefed(Gecko_NewNoneTransform()));
             }
@@ -759,17 +829,17 @@ pub extern "C" fn Servo_AnimationValue_G
         }
     } else {
         panic!("The AnimationValue should be transform");
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_AnimationValue_Transform(
-    list: *const nsCSSValueSharedList
+    list: *const nsCSSValueSharedList,
 ) -> RawServoAnimationValueStrong {
     let list = unsafe { (&*list).mHead.as_ref() };
     let transform = gecko_properties::clone_transform_from_list(list);
     Arc::new(AnimationValue::Transform(transform)).into_strong()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_AnimationValue_DeepEqual(
@@ -782,42 +852,52 @@ pub extern "C" fn Servo_AnimationValue_D
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_AnimationValue_Uncompute(
     value: RawServoAnimationValueBorrowed,
 ) -> RawServoDeclarationBlockStrong {
     let value = AnimationValue::as_arc(&value);
     let global_style_data = &*GLOBAL_STYLE_DATA;
-    Arc::new(global_style_data.shared_lock.wrap(
-        PropertyDeclarationBlock::with_one(value.uncompute(), Importance::Normal))).into_strong()
+    Arc::new(
+        global_style_data
+            .shared_lock
+            .wrap(PropertyDeclarationBlock::with_one(
+                value.uncompute(),
+                Importance::Normal,
+            )),
+    )
+    .into_strong()
 }
 
 // Return the ComputedValues by a base ComputedValues and the rules.
 fn resolve_rules_for_element_with_context<'a>(
     element: GeckoElement<'a>,
     mut context: StyleContext<GeckoElement<'a>>,
-    rules: StrongRuleNode
+    rules: StrongRuleNode,
 ) -> Arc<ComputedValues> {
     use style::style_resolver::{PseudoElementResolution, StyleResolverForElement};
 
     // This currently ignores visited styles, which seems acceptable, as
     // existing browsers don't appear to animate visited styles.
-    let inputs =
-        CascadeInputs {
-            rules: Some(rules),
-            visited_rules: None,
-        };
+    let inputs = CascadeInputs {
+        rules: Some(rules),
+        visited_rules: None,
+    };
 
     // Actually `PseudoElementResolution` doesn't matter.
-    StyleResolverForElement::new(element,
-                                 &mut context,
-                                 RuleInclusion::All,
-                                 PseudoElementResolution::IfApplicable)
-        .cascade_style_and_visited_with_default_parents(inputs).0
+    let mut resolver = StyleResolverForElement::new(
+        element,
+        &mut context,
+        RuleInclusion::All,
+        PseudoElementResolution::IfApplicable,
+    );
+    resolver
+        .cascade_style_and_visited_with_default_parents(inputs)
+        .0
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_GetBaseComputedValuesForElement(
     raw_style_set: RawServoStyleSetBorrowed,
     element: RawGeckoElementBorrowed,
     computed_values: ComputedStyleBorrowed,
     snapshots: *const ServoElementSnapshotTable,
@@ -835,21 +915,23 @@ pub extern "C" fn Servo_StyleSet_GetBase
     if without_animations_rules == *rules {
         return computed_values.clone_arc().into();
     }
 
     let element = GeckoElement(element);
 
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
-    let shared = create_shared_context(&global_style_data,
-                                       &guard,
-                                       &doc_data,
-                                       TraversalFlags::empty(),
-                                       unsafe { &*snapshots });
+    let shared = create_shared_context(
+        &global_style_data,
+        &guard,
+        &doc_data,
+        TraversalFlags::empty(),
+        unsafe { &*snapshots },
+    );
     let mut tlc = ThreadLocalStyleContext::new(&shared);
     let context = StyleContext {
         shared: &shared,
         thread_local: &mut tlc,
     };
 
     resolve_rules_for_element_with_context(element, context, without_animations_rules).into()
 }
@@ -871,34 +953,37 @@ pub extern "C" fn Servo_StyleSet_GetComp
 
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     let uncomputed_value = AnimationValue::as_arc(&animation_value).uncompute();
     let doc_data = PerDocumentStyleData::from_ffi(raw_style_set).borrow();
 
     let with_animations_rules = {
         let guards = StylesheetGuards::same(&guard);
-        let declarations =
-            Arc::new(global_style_data.shared_lock.wrap(
-                PropertyDeclarationBlock::with_one(uncomputed_value, Importance::Normal)));
-        doc_data.stylist
+        let declarations = Arc::new(global_style_data.shared_lock.wrap(
+            PropertyDeclarationBlock::with_one(uncomputed_value, Importance::Normal),
+        ));
+        doc_data
+            .stylist
             .rule_tree()
             .add_animation_rules_at_transition_level(rules, declarations, &guards)
     };
 
     let element = GeckoElement(element);
     if element.borrow_data().is_none() {
         return ComputedStyleStrong::null();
     }
 
-    let shared = create_shared_context(&global_style_data,
-                                       &guard,
-                                       &doc_data,
-                                       TraversalFlags::empty(),
-                                       unsafe { &*snapshots });
+    let shared = create_shared_context(
+        &global_style_data,
+        &guard,
+        &doc_data,
+        TraversalFlags::empty(),
+        unsafe { &*snapshots },
+    );
     let mut tlc: ThreadLocalStyleContext<GeckoElement> = ThreadLocalStyleContext::new(&shared);
     let context = StyleContext {
         shared: &shared,
         thread_local: &mut tlc,
     };
 
     resolve_rules_for_element_with_context(element, context, with_animations_rules).into()
 }
@@ -918,21 +1003,22 @@ pub extern "C" fn Servo_ComputedValues_E
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ResolveLogicalProperty(
     property_id: nsCSSPropertyID,
     style: ComputedStyleBorrowed,
 ) -> nsCSSPropertyID {
-    let longhand =
-        LonghandId::from_nscsspropertyid(property_id)
-            .expect("There are no logical shorthands (yet)");
-
-    longhand.to_physical(style.writing_mode).to_nscsspropertyid()
+    let longhand = LonghandId::from_nscsspropertyid(property_id)
+        .expect("There are no logical shorthands (yet)");
+
+    longhand
+        .to_physical(style.writing_mode)
+        .to_nscsspropertyid()
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_Property_LookupEnabledForAllContent(
     prop: *const nsACString,
 ) -> nsCSSPropertyID {
     match PropertyId::parse_enabled_for_all_content((*prop).as_str_unchecked()) {
         Ok(p) => p.to_nscsspropertyid_resolving_aliases(),
@@ -944,64 +1030,62 @@ pub unsafe extern "C" fn Servo_Property_
 pub unsafe extern "C" fn Servo_Property_GetName(
     prop: nsCSSPropertyID,
     out_length: *mut u32,
 ) -> *const u8 {
     let (ptr, len) = match NonCustomPropertyId::from_nscsspropertyid(prop) {
         Ok(p) => {
             let name = p.name();
             (name.as_bytes().as_ptr(), name.len())
-        }
+        },
         Err(..) => (ptr::null(), 0),
     };
 
     *out_length = len as u32;
     ptr
 }
 
 macro_rules! parse_enabled_property_name {
     ($prop_name:ident, $found:ident, $default:expr) => {{
         let prop_name = $prop_name.as_ref().unwrap().as_str_unchecked();
         match PropertyId::parse_enabled_for_all_content(prop_name) {
             Ok(p) => {
                 *$found = true;
                 p
-            }
+            },
             Err(..) => {
                 *$found = false;
                 return $default;
-            }
+            },
         }
-    }}
+    }};
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_Property_IsShorthand(
     prop_name: *const nsACString,
-    found: *mut bool
+    found: *mut bool,
 ) -> bool {
     let prop_id = parse_enabled_property_name!(prop_name, found, false);
     prop_id.is_shorthand()
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn Servo_Property_IsInherited(
-    prop_name: *const nsACString,
-) -> bool {
+pub unsafe extern "C" fn Servo_Property_IsInherited(prop_name: *const nsACString) -> bool {
     let prop_name = prop_name.as_ref().unwrap().as_str_unchecked();
     let prop_id = match PropertyId::parse_enabled_for_all_content(prop_name) {
         Ok(id) => id,
         Err(_) => return false,
     };
     let longhand_id = match prop_id {
         PropertyId::Custom(_) => return true,
-        PropertyId::Longhand(id) |
-        PropertyId::LonghandAlias(id, _) => id,
-        PropertyId::Shorthand(id) |
-        PropertyId::ShorthandAlias(id, _) => id.longhands().next().unwrap(),
+        PropertyId::Longhand(id) | PropertyId::LonghandAlias(id, _) => id,
+        PropertyId::Shorthand(id) | PropertyId::ShorthandAlias(id, _) => {
+            id.longhands().next().unwrap()
+        },
     };
     longhand_id.inherited()
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_Property_SupportsType(
     prop_name: *const nsACString,
     ty: u32,
@@ -1045,22 +1129,26 @@ pub unsafe extern "C" fn Servo_Property_
 
     for (src, dest) in extras.iter().chain(values.iter()).zip(result.iter_mut()) {
         dest.write_str(src).unwrap();
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_Property_IsAnimatable(prop: nsCSSPropertyID) -> bool {
-    NonCustomPropertyId::from_nscsspropertyid(prop).ok().map_or(false, |p| p.is_animatable())
+    NonCustomPropertyId::from_nscsspropertyid(prop)
+        .ok()
+        .map_or(false, |p| p.is_animatable())
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_Property_IsTransitionable(prop: nsCSSPropertyID) -> bool {
-    NonCustomPropertyId::from_nscsspropertyid(prop).ok().map_or(false, |p| p.is_transitionable())
+    NonCustomPropertyId::from_nscsspropertyid(prop)
+        .ok()
+        .map_or(false, |p| p.is_transitionable())
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_Property_IsDiscreteAnimatable(property: nsCSSPropertyID) -> bool {
     match LonghandId::from_nscsspropertyid(property) {
         Ok(longhand) => longhand.is_discrete_animatable(),
         Err(()) => return false,
     }
@@ -1081,130 +1169,148 @@ pub extern "C" fn Servo_Element_SizeOfEx
     malloc_size_of: GeckoMallocSizeOf,
     malloc_enclosing_size_of: GeckoMallocSizeOf,
     seen_ptrs: *mut SeenPtrs,
     element: RawGeckoElementBorrowed,
 ) -> usize {
     let element = GeckoElement(element);
     let borrow = element.borrow_data();
     if let Some(data) = borrow {
-        let have_seen_ptr = move |ptr| { unsafe { Gecko_HaveSeenPtr(seen_ptrs, ptr) } };
+        let have_seen_ptr = move |ptr| unsafe { Gecko_HaveSeenPtr(seen_ptrs, ptr) };
         let mut ops = MallocSizeOfOps::new(
             malloc_size_of.unwrap(),
             Some(malloc_enclosing_size_of.unwrap()),
             Some(Box::new(have_seen_ptr)),
         );
         (*data).size_of_excluding_cvs(&mut ops)
     } else {
         0
     }
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_Element_HasPrimaryComputedValues(element: RawGeckoElementBorrowed) -> bool
-{
+pub extern "C" fn Servo_Element_HasPrimaryComputedValues(element: RawGeckoElementBorrowed) -> bool {
     let element = GeckoElement(element);
-    let data = element.borrow_data().expect("Looking for CVs on unstyled element");
+    let data = element
+        .borrow_data()
+        .expect("Looking for CVs on unstyled element");
     data.has_styles()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_Element_GetPrimaryComputedValues(
     element: RawGeckoElementBorrowed,
 ) -> ComputedStyleStrong {
     let element = GeckoElement(element);
-    let data = element.borrow_data().expect("Getting CVs on unstyled element");
+    let data = element
+        .borrow_data()
+        .expect("Getting CVs on unstyled element");
     data.styles.primary().clone().into()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_Element_HasPseudoComputedValues(
     element: RawGeckoElementBorrowed,
     index: usize,
 ) -> bool {
     let element = GeckoElement(element);
-    let data = element.borrow_data().expect("Looking for CVs on unstyled element");
+    let data = element
+        .borrow_data()
+        .expect("Looking for CVs on unstyled element");
     data.styles.pseudos.as_array()[index].is_some()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_Element_GetPseudoComputedValues(
     element: RawGeckoElementBorrowed,
     index: usize,
 ) -> ComputedStyleStrong {
     let element = GeckoElement(element);
-    let data = element.borrow_data().expect("Getting CVs that aren't present");
-    data.styles.pseudos.as_array()[index].as_ref().expect("Getting CVs that aren't present")
-        .clone().into()
-}
-
-#[no_mangle]
-pub extern "C" fn Servo_Element_IsDisplayNone(
-    element: RawGeckoElementBorrowed,
-) -> bool {
+    let data = element
+        .borrow_data()
+        .expect("Getting CVs that aren't present");
+    data.styles.pseudos.as_array()[index]
+        .as_ref()
+        .expect("Getting CVs that aren't present")
+        .clone()
+        .into()
+}
+
+#[no_mangle]
+pub extern "C" fn Servo_Element_IsDisplayNone(element: RawGeckoElementBorrowed) -> bool {
     let element = GeckoElement(element);
-    let data = element.get_data()
+    let data = element
+        .get_data()
         .expect("Invoking Servo_Element_IsDisplayNone on unstyled element");
 
     // This function is hot, so we bypass the AtomicRefCell.
     //
     // It would be nice to also assert that we're not in the servo traversal,
     // but this function is called at various intermediate checkpoints when
     // managing the traversal on the Gecko side.
     debug_assert!(is_main_thread());
     unsafe { &*data.as_ptr() }.styles.is_display_none()
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_Element_IsDisplayContents(
-    element: RawGeckoElementBorrowed,
-) -> bool {
+pub extern "C" fn Servo_Element_IsDisplayContents(element: RawGeckoElementBorrowed) -> bool {
     let element = GeckoElement(element);
-    let data = element.get_data()
+    let data = element
+        .get_data()
         .expect("Invoking Servo_Element_IsDisplayContents on unstyled element");
 
     debug_assert!(is_main_thread());
-    unsafe { &*data.as_ptr() }.styles.primary().get_box().clone_display().is_contents()
-}
-
-#[no_mangle]
-pub extern "C" fn Servo_Element_IsPrimaryStyleReusedViaRuleNode(element: RawGeckoElementBorrowed) -> bool {
+    unsafe { &*data.as_ptr() }
+        .styles
+        .primary()
+        .get_box()
+        .clone_display()
+        .is_contents()
+}
+
+#[no_mangle]
+pub extern "C" fn Servo_Element_IsPrimaryStyleReusedViaRuleNode(
+    element: RawGeckoElementBorrowed,
+) -> bool {
     let element = GeckoElement(element);
-    let data = element.borrow_data()
-                      .expect("Invoking Servo_Element_IsPrimaryStyleReusedViaRuleNode on unstyled element");
-    data.flags.contains(data::ElementDataFlags::PRIMARY_STYLE_REUSED_VIA_RULE_NODE)
+    let data = element
+        .borrow_data()
+        .expect("Invoking Servo_Element_IsPrimaryStyleReusedViaRuleNode on unstyled element");
+    data.flags
+        .contains(data::ElementDataFlags::PRIMARY_STYLE_REUSED_VIA_RULE_NODE)
 }
 
 fn mode_to_origin(mode: SheetParsingMode) -> Origin {
     match mode {
         SheetParsingMode::eAuthorSheetFeatures => Origin::Author,
         SheetParsingMode::eUserSheetFeatures => Origin::User,
         SheetParsingMode::eAgentSheetFeatures => Origin::UserAgent,
         SheetParsingMode::eSafeAgentSheetFeatures => Origin::UserAgent,
     }
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_StyleSheet_Empty(mode: SheetParsingMode) -> RawServoStyleSheetContentsStrong {
+pub extern "C" fn Servo_StyleSheet_Empty(
+    mode: SheetParsingMode,
+) -> RawServoStyleSheetContentsStrong {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let origin = mode_to_origin(mode);
     let shared_lock = &global_style_data.shared_lock;
-    Arc::new(
-        StylesheetContents::from_str(
-            "",
-            unsafe { dummy_url_data() }.clone(),
-            origin,
-            shared_lock,
-            /* loader = */ None,
-            None,
-            QuirksMode::NoQuirks,
-            0,
-            /* use_counters = */ None,
-        )
-    ).into_strong()
+    Arc::new(StylesheetContents::from_str(
+        "",
+        unsafe { dummy_url_data() }.clone(),
+        origin,
+        shared_lock,
+        /* loader = */ None,
+        None,
+        QuirksMode::NoQuirks,
+        0,
+        /* use_counters = */ None,
+    ))
+    .into_strong()
 }
 
 /// Note: The load_data corresponds to this sheet, and is passed as the parent
 /// load data for child sheet loads. It may be null for certain cases where we
 /// know we won't have child loads.
 #[no_mangle]
 pub extern "C" fn Servo_StyleSheet_FromUTF8Bytes(
     loader: *mut Loader,
@@ -1221,17 +1327,22 @@ pub extern "C" fn Servo_StyleSheet_FromU
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let input: &str = unsafe { (*bytes).as_str_unchecked() };
 
     let reporter = ErrorReporter::new(stylesheet, loader, extra_data);
     let url_data = unsafe { UrlExtraData::from_ptr_ref(&extra_data) };
     let loader = if loader.is_null() {
         None
     } else {
-        Some(StylesheetLoader::new(loader, stylesheet, load_data, reusable_sheets))
+        Some(StylesheetLoader::new(
+            loader,
+            stylesheet,
+            load_data,
+            reusable_sheets,
+        ))
     };
 
     // FIXME(emilio): loader.as_ref() doesn't typecheck for some reason?
     let loader: Option<&StyleStylesheetLoader> = match loader {
         None => None,
         Some(ref s) => Some(s),
     };
 
@@ -1240,17 +1351,18 @@ pub extern "C" fn Servo_StyleSheet_FromU
         url_data.clone(),
         mode_to_origin(mode),
         &global_style_data.shared_lock,
         loader,
         reporter.as_ref().map(|r| r as &ParseErrorReporter),
         quirks_mode.into(),
         line_number_offset,
         use_counters.map(UseCounters::from_ffi),
-    )).into_strong()
+    ))
+    .into_strong()
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_StyleSheet_FromUTF8BytesAsync(
     load_data: *mut SheetLoadDataHolder,
     extra_data: *mut URLExtraData,
     bytes: *const nsACString,
     mode: SheetParsingMode,
@@ -1297,19 +1409,17 @@ pub extern "C" fn Servo_StyleSet_AppendS
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_AuthorStyles_Create() -> *mut RawServoAuthorStyles {
     Box::into_raw(Box::new(AuthorStyles::<GeckoStyleSheet>::new())) as *mut _
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_AuthorStyles_Drop(
-    styles: RawServoAuthorStylesOwned,
-) {
+pub extern "C" fn Servo_AuthorStyles_Drop(styles: RawServoAuthorStylesOwned) {
     let _ = styles.into_box::<AuthorStyles<_>>();
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_AuthorStyles_AppendStyleSheet(
     styles: RawServoAuthorStylesBorrowedMut,
     sheet: *const DomStyleSheet,
 ) {
@@ -1343,27 +1453,23 @@ pub unsafe extern "C" fn Servo_AuthorSty
 pub unsafe extern "C" fn Servo_AuthorStyles_RemoveStyleSheet(
     styles: RawServoAuthorStylesBorrowedMut,
     sheet: *const DomStyleSheet,
 ) {
     let styles = AuthorStyles::<GeckoStyleSheet>::from_ffi_mut(styles);
 
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
-    styles.stylesheets.remove_stylesheet(
-        None,
-        GeckoStyleSheet::new(sheet),
-        &guard,
-    );
-}
-
-#[no_mangle]
-pub unsafe extern "C" fn Servo_AuthorStyles_ForceDirty(
-    styles: RawServoAuthorStylesBorrowedMut,
-) {
+    styles
+        .stylesheets
+        .remove_stylesheet(None, GeckoStyleSheet::new(sheet), &guard);
+}
+
+#[no_mangle]
+pub unsafe extern "C" fn Servo_AuthorStyles_ForceDirty(styles: RawServoAuthorStylesBorrowedMut) {
     let styles = AuthorStyles::<GeckoStyleSheet>::from_ffi_mut(styles);
     styles.stylesheets.force_dirty();
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_AuthorStyles_Flush(
     styles: RawServoAuthorStylesBorrowedMut,
     document_set: RawServoStyleSetBorrowed,
@@ -1372,47 +1478,45 @@ pub unsafe extern "C" fn Servo_AuthorSty
     // Try to avoid the atomic borrow below if possible.
     if !styles.stylesheets.dirty() {
         return;
     }
 
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
 
-    let document_data =
-        PerDocumentStyleData::from_ffi(document_set).borrow();
+    let document_data = PerDocumentStyleData::from_ffi(document_set).borrow();
 
     let stylist = &document_data.stylist;
 
     // TODO(emilio): This is going to need an element or something to do proper
     // invalidation in Shadow roots.
-    styles.flush::<GeckoElement>(
-        stylist.device(),
-        stylist.quirks_mode(),
-        &guard,
-    );
+    styles.flush::<GeckoElement>(stylist.device(), stylist.quirks_mode(), &guard);
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_AuthorStyles_SizeOfIncludingThis(
     malloc_size_of: GeckoMallocSizeOf,
     malloc_enclosing_size_of: GeckoMallocSizeOf,
     styles: RawServoAuthorStylesBorrowed,
 ) -> usize {
     // We cannot `use` MallocSizeOf at the top level, otherwise the compiler
     // would complain in `Servo_StyleSheet_SizeOfIncludingThis` for `size_of`
     // there.
     use malloc_size_of::MallocSizeOf;
     let malloc_size_of = malloc_size_of.unwrap();
-    let malloc_size_of_this = malloc_size_of(styles as *const RawServoAuthorStyles as *const c_void);
+    let malloc_size_of_this =
+        malloc_size_of(styles as *const RawServoAuthorStyles as *const c_void);
 
     let styles = AuthorStyles::<GeckoStyleSheet>::from_ffi(styles);
-    let mut ops = MallocSizeOfOps::new(malloc_size_of,
-                                       Some(malloc_enclosing_size_of.unwrap()),
-                                       None);
+    let mut ops = MallocSizeOfOps::new(
+        malloc_size_of,
+        Some(malloc_enclosing_size_of.unwrap()),
+        None,
+    );
     malloc_size_of_this + styles.size_of(&mut ops)
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_StyleSet_MediumFeaturesChanged(
     document_set: RawServoStyleSetBorrowed,
     non_document_styles: *mut nsTArray<RawServoAuthorStylesBorrowedMut>,
     may_affect_default_style: bool,
@@ -1422,55 +1526,52 @@ pub unsafe extern "C" fn Servo_StyleSet_
 
     // NOTE(emilio): We don't actually need to flush the stylist here and ensure
     // it's up to date.
     //
     // In case it isn't we would trigger a rebuild + restyle as needed too.
     //
     // We need to ensure the default computed values are up to date though,
     // because those can influence the result of media query evaluation.
-    let mut document_data =
-        PerDocumentStyleData::from_ffi(document_set).borrow_mut();
+    let mut document_data = PerDocumentStyleData::from_ffi(document_set).borrow_mut();
 
     if may_affect_default_style {
         document_data.stylist.device_mut().reset_computed_values();
     }
     let guards = StylesheetGuards::same(&guard);
 
-    let origins_in_which_rules_changed =
-        document_data.stylist.media_features_change_changed_style(
-            &guards,
-            document_data.stylist.device(),
-        );
+    let origins_in_which_rules_changed = document_data
+        .stylist
+        .media_features_change_changed_style(&guards, document_data.stylist.device());
 
     let affects_document_rules = !origins_in_which_rules_changed.is_empty();
     if affects_document_rules {
-        document_data.stylist.force_stylesheet_origins_dirty(origins_in_which_rules_changed);
+        document_data
+            .stylist
+            .force_stylesheet_origins_dirty(origins_in_which_rules_changed);
     }
 
     let mut affects_non_document_rules = false;
     for author_styles in &mut **non_document_styles {
-        let author_styles =
-            AuthorStyles::<GeckoStyleSheet>::from_ffi_mut(&mut *author_styles);
+        let author_styles = AuthorStyles::<GeckoStyleSheet>::from_ffi_mut(&mut *author_styles);
         let affected_style = author_styles.stylesheets.iter().any(|sheet| {
             !author_styles.data.media_feature_affected_matches(
                 sheet,
                 &guards.author,
                 document_data.stylist.device(),
                 document_data.stylist.quirks_mode(),
             )
         });
         if affected_style {
             affects_non_document_rules = true;
             author_styles.stylesheets.force_dirty();
         }
     }
 
-    let uses_viewport_units =
-        document_data.stylist.device().used_viewport_size();
+    let uses_viewport_units = document_data.stylist.device().used_viewport_size();
 
     structs::MediumFeaturesChangedResult {
         mAffectsDocumentRules: affects_document_rules,
         mAffectsNonDocumentRules: affects_non_document_rules,
         mUsesViewportUnits: uses_viewport_units,
     }
 }
 
@@ -1486,34 +1587,34 @@ pub extern "C" fn Servo_StyleSet_Prepend
     let sheet = unsafe { GeckoStyleSheet::new(sheet) };
     data.stylist.prepend_stylesheet(sheet, &guard);
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_InsertStyleSheetBefore(
     raw_data: RawServoStyleSetBorrowed,
     sheet: *const DomStyleSheet,
-    before_sheet: *const DomStyleSheet
+    before_sheet: *const DomStyleSheet,
 ) {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
     let data = &mut *data;
     let guard = global_style_data.shared_lock.read();
     let sheet = unsafe { GeckoStyleSheet::new(sheet) };
     data.stylist.insert_stylesheet_before(
         sheet,
         unsafe { GeckoStyleSheet::new(before_sheet) },
         &guard,
     );
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_RemoveStyleSheet(
     raw_data: RawServoStyleSetBorrowed,
-    sheet: *const DomStyleSheet
+    sheet: *const DomStyleSheet,
 ) {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
     let data = &mut *data;
     let guard = global_style_data.shared_lock.read();
     let sheet = unsafe { GeckoStyleSheet::new(sheet) };
     data.stylist.remove_stylesheet(sheet, &guard);
 }
@@ -1524,130 +1625,132 @@ pub unsafe extern "C" fn Servo_StyleSet_
     doc_element: RawGeckoElementBorrowedOrNull,
     snapshots: *const ServoElementSnapshotTable,
 ) {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
     let doc_element = doc_element.map(GeckoElement);
 
-    let have_invalidations =
-        data.flush_stylesheets(&guard, doc_element, snapshots.as_ref());
+    let have_invalidations = data.flush_stylesheets(&guard, doc_element, snapshots.as_ref());
 
     if have_invalidations && doc_element.is_some() {
         // The invalidation machinery propagates the bits up, but we still need
         // to tell the Gecko restyle root machinery about it.
         bindings::Gecko_NoteDirtySubtreeForInvalidation(doc_element.unwrap().0);
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_NoteStyleSheetsChanged(
     raw_data: RawServoStyleSetBorrowed,
     changed_origins: OriginFlags,
 ) {
     let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
-    data.stylist.force_stylesheet_origins_dirty(OriginSet::from(changed_origins));
+    data.stylist
+        .force_stylesheet_origins_dirty(OriginSet::from(changed_origins));
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_SetAuthorStyleDisabled(
     raw_data: RawServoStyleSetBorrowed,
     author_style_disabled: bool,
 ) {
     let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
-    let enabled =
-        if author_style_disabled {
-            AuthorStylesEnabled::No
-        } else {
-            AuthorStylesEnabled::Yes
-        };
+    let enabled = if author_style_disabled {
+        AuthorStylesEnabled::No
+    } else {
+        AuthorStylesEnabled::Yes
+    };
     data.stylist.set_author_styles_enabled(enabled);
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSheet_HasRules(
-    raw_contents: RawServoStyleSheetContentsBorrowed
+    raw_contents: RawServoStyleSheetContentsBorrowed,
 ) -> bool {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     !StylesheetContents::as_arc(&raw_contents)
-        .rules.read_with(&guard).0.is_empty()
+        .rules
+        .read_with(&guard)
+        .0
+        .is_empty()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSheet_GetRules(
-    sheet: RawServoStyleSheetContentsBorrowed
+    sheet: RawServoStyleSheetContentsBorrowed,
 ) -> ServoCssRulesStrong {
-    StylesheetContents::as_arc(&sheet).rules.clone().into_strong()
+    StylesheetContents::as_arc(&sheet)
+        .rules
+        .clone()
+        .into_strong()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSheet_Clone(
     raw_sheet: RawServoStyleSheetContentsBorrowed,
     reference_sheet: *const DomStyleSheet,
 ) -> RawServoStyleSheetContentsStrong {
     use style::shared_lock::{DeepCloneParams, DeepCloneWithLock};
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     let contents = StylesheetContents::as_arc(&raw_sheet);
     let params = DeepCloneParams { reference_sheet };
 
-    Arc::new(contents.deep_clone_with_lock(
-        &global_style_data.shared_lock,
-        &guard,
-        &params,
-    )).into_strong()
+    Arc::new(contents.deep_clone_with_lock(&global_style_data.shared_lock, &guard, &params))
+        .into_strong()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSheet_SizeOfIncludingThis(
     malloc_size_of: GeckoMallocSizeOf,
     malloc_enclosing_size_of: GeckoMallocSizeOf,
-    sheet: RawServoStyleSheetContentsBorrowed
+    sheet: RawServoStyleSheetContentsBorrowed,
 ) -> usize {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
-    let mut ops = MallocSizeOfOps::new(malloc_size_of.unwrap(),
-                                       Some(malloc_enclosing_size_of.unwrap()),
-                                       None);
+    let mut ops = MallocSizeOfOps::new(
+        malloc_size_of.unwrap(),
+        Some(malloc_enclosing_size_of.unwrap()),
+        None,
+    );
     StylesheetContents::as_arc(&sheet).size_of(&guard, &mut ops)
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_StyleSheet_GetOrigin(
-    sheet: RawServoStyleSheetContentsBorrowed,
-) -> u8 {
+pub extern "C" fn Servo_StyleSheet_GetOrigin(sheet: RawServoStyleSheetContentsBorrowed) -> u8 {
     let origin = match StylesheetContents::as_arc(&sheet).origin {
         Origin::UserAgent => OriginFlags_UserAgent,
         Origin::User => OriginFlags_User,
         Origin::Author => OriginFlags_Author,
     };
     // We'd like to return `OriginFlags` here, but bindgen bitfield enums don't
     // work as return values with the Linux 32-bit ABI at the moment because
     // they wrap the value in a struct, so for now just unwrap it.
     origin.0
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSheet_GetSourceMapURL(
     sheet: RawServoStyleSheetContentsBorrowed,
-    result: *mut nsAString
+    result: *mut nsAString,
 ) {
     let contents = StylesheetContents::as_arc(&sheet);
     let url_opt = contents.source_map_url.read();
     if let Some(ref url) = *url_opt {
         write!(unsafe { &mut *result }, "{}", url).unwrap();
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSheet_GetSourceURL(
     sheet: RawServoStyleSheetContentsBorrowed,
-    result: *mut nsAString
+    result: *mut nsAString,
 ) {
     let contents = StylesheetContents::as_arc(&sheet);
     let url_opt = contents.source_url.read();
     if let Some(ref url) = *url_opt {
         write!(unsafe { &mut *result }, "{}", url).unwrap();
     }
 }
 
@@ -1658,46 +1761,50 @@ where
 {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     func(Locked::<T>::as_arc(&raw).read_with(&guard))
 }
 
 #[cfg(debug_assertions)]
 unsafe fn read_locked_arc_unchecked<T, R, F>(raw: &<Locked<T> as HasFFI>::FFIType, func: F) -> R
-    where Locked<T>: HasArcFFI, F: FnOnce(&T) -> R
+where
+    Locked<T>: HasArcFFI,
+    F: FnOnce(&T) -> R,
 {
     debug_assert!(is_main_thread() && !is_in_servo_traversal());
     read_locked_arc(raw, func)
 }
 
 #[cfg(not(debug_assertions))]
 unsafe fn read_locked_arc_unchecked<T, R, F>(raw: &<Locked<T> as HasFFI>::FFIType, func: F) -> R
-    where Locked<T>: HasArcFFI, F: FnOnce(&T) -> R
+where
+    Locked<T>: HasArcFFI,
+    F: FnOnce(&T) -> R,
 {
     func(Locked::<T>::as_arc(&raw).read_unchecked())
 }
 
 fn write_locked_arc<T, R, F>(raw: &<Locked<T> as HasFFI>::FFIType, func: F) -> R
-    where Locked<T>: HasArcFFI, F: FnOnce(&mut T) -> R
+where
+    Locked<T>: HasArcFFI,
+    F: FnOnce(&mut T) -> R,
 {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let mut guard = global_style_data.shared_lock.write();
     func(Locked::<T>::as_arc(&raw).write_with(&mut guard))
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_CssRules_ListTypes(
     rules: ServoCssRulesBorrowed,
     result: nsTArrayBorrowed_uintptr_t,
 ) {
     read_locked_arc(rules, |rules: &CssRules| {
-        result.assign_from_iter_pod(
-            rules.0.iter().map(|rule| rule.rule_type() as usize)
-        );
+        result.assign_from_iter_pod(rules.0.iter().map(|rule| rule.rule_type() as usize));
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_CssRules_InsertRule(
     rules: ServoCssRulesBorrowed,
     contents: RawServoStyleSheetContentsBorrowed,
     rule: *const nsACString,
@@ -1705,50 +1812,54 @@ pub extern "C" fn Servo_CssRules_InsertR
     nested: bool,
     loader: *mut Loader,
     gecko_stylesheet: *mut DomStyleSheet,
     rule_type: *mut u16,
 ) -> nsresult {
     let loader = if loader.is_null() {
         None
     } else {
-        Some(StylesheetLoader::new(loader, gecko_stylesheet, ptr::null_mut(), ptr::null_mut()))
+        Some(StylesheetLoader::new(
+            loader,
+            gecko_stylesheet,
+            ptr::null_mut(),
+            ptr::null_mut(),
+        ))
     };
-    let loader = loader.as_ref().map(|loader| loader as &StyleStylesheetLoader);
+    let loader = loader
+        .as_ref()
+        .map(|loader| loader as &StyleStylesheetLoader);
     let rule = unsafe { rule.as_ref().unwrap().as_str_unchecked() };
 
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let contents = StylesheetContents::as_arc(&contents);
     let result = Locked::<CssRules>::as_arc(&rules).insert_rule(
         &global_style_data.shared_lock,
         rule,
         contents,
         index as usize,
         nested,
-        loader
+        loader,
     );
 
     match result {
         Ok(new_rule) => {
             *unsafe { rule_type.as_mut().unwrap() } = new_rule.rule_type() as u16;
             nsresult::NS_OK
-        }
+        },
         Err(err) => err.into(),
     }
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_CssRules_DeleteRule(
-    rules: ServoCssRulesBorrowed,
-    index: u32
-) -> nsresult {
+pub extern "C" fn Servo_CssRules_DeleteRule(rules: ServoCssRulesBorrowed, index: u32) -> nsresult {
     write_locked_arc(rules, |rules: &mut CssRules| {
         match rules.remove_rule(index as usize) {
             Ok(_) => nsresult::NS_OK,
-            Err(err) => err.into()
+            Err(err) => err.into(),
         }
     })
 }
 
 macro_rules! impl_basic_rule_funcs_without_getter {
     { ($rule_type:ty, $raw_type:ty),
         debug: $debug:ident,
         to_css: $to_css:ident,
@@ -1905,68 +2016,80 @@ impl_basic_rule_funcs! { (FontFace, Font
 
 impl_basic_rule_funcs! { (CounterStyle, CounterStyleRule, RawServoCounterStyleRule),
     getter: Servo_CssRules_GetCounterStyleRuleAt,
     debug: Servo_CounterStyleRule_Debug,
     to_css: Servo_CounterStyleRule_GetCssText,
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_StyleRule_GetStyle(rule: RawServoStyleRuleBorrowed) -> RawServoDeclarationBlockStrong {
-    read_locked_arc(rule, |rule: &StyleRule| {
-        rule.block.clone().into_strong()
-    })
-}
-
-#[no_mangle]
-pub extern "C" fn Servo_StyleRule_SetStyle(rule: RawServoStyleRuleBorrowed,
-                                           declarations: RawServoDeclarationBlockBorrowed) {
+pub extern "C" fn Servo_StyleRule_GetStyle(
+    rule: RawServoStyleRuleBorrowed,
+) -> RawServoDeclarationBlockStrong {
+    read_locked_arc(rule, |rule: &StyleRule| rule.block.clone().into_strong())
+}
+
+#[no_mangle]
+pub extern "C" fn Servo_StyleRule_SetStyle(
+    rule: RawServoStyleRuleBorrowed,
+    declarations: RawServoDeclarationBlockBorrowed,
+) {
     let declarations = Locked::<PropertyDeclarationBlock>::as_arc(&declarations);
     write_locked_arc(rule, |rule: &mut StyleRule| {
         rule.block = declarations.clone_arc();
     })
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_StyleRule_GetSelectorText(rule: RawServoStyleRuleBorrowed, result: *mut nsAString) {
+pub extern "C" fn Servo_StyleRule_GetSelectorText(
+    rule: RawServoStyleRuleBorrowed,
+    result: *mut nsAString,
+) {
     read_locked_arc(rule, |rule: &StyleRule| {
-        rule.selectors.to_css(unsafe { result.as_mut().unwrap() }).unwrap();
+        rule.selectors
+            .to_css(unsafe { result.as_mut().unwrap() })
+            .unwrap();
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleRule_GetSelectorTextAtIndex(
     rule: RawServoStyleRuleBorrowed,
     index: u32,
     result: *mut nsAString,
 ) {
     read_locked_arc(rule, |rule: &StyleRule| {
         let index = index as usize;
         if index >= rule.selectors.0.len() {
             return;
         }
-        rule.selectors.0[index].to_css(unsafe { result.as_mut().unwrap() }).unwrap();
+        rule.selectors.0[index]
+            .to_css(unsafe { result.as_mut().unwrap() })
+            .unwrap();
     })
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_StyleRule_GetSelectorCount(rule: RawServoStyleRuleBorrowed, count: *mut u32) {
+pub extern "C" fn Servo_StyleRule_GetSelectorCount(
+    rule: RawServoStyleRuleBorrowed,
+    count: *mut u32,
+) {
     read_locked_arc(rule, |rule: &StyleRule| {
         *unsafe { count.as_mut().unwrap() } = rule.selectors.0.len() as u32;
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleRule_GetSpecificityAtIndex(
     rule: RawServoStyleRuleBorrowed,
     index: u32,
-    specificity: *mut u64
+    specificity: *mut u64,
 ) {
     read_locked_arc(rule, |rule: &StyleRule| {
-        let specificity =  unsafe { specificity.as_mut().unwrap() };
+        let specificity = unsafe { specificity.as_mut().unwrap() };
         let index = index as usize;
         if index >= rule.selectors.0.len() {
             *specificity = 0;
             return;
         }
         *specificity = rule.selectors.0[index].specificity() as u64;
     })
 }
@@ -2004,18 +2127,17 @@ pub extern "C" fn Servo_StyleRule_Select
                 if selector.has_pseudo_element() {
                     return false;
                 }
             },
         };
 
         let element = GeckoElement(element);
         let quirks_mode = element.as_node().owner_doc().quirks_mode();
-        let mut ctx =
-            MatchingContext::new(matching_mode, None, None, quirks_mode);
+        let mut ctx = MatchingContext::new(matching_mode, None, None, quirks_mode);
         matches_selector(selector, 0, None, &element, &mut ctx, &mut |_, _| {})
     })
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_StyleRule_SetSelectorText(
     sheet: RawServoStyleSheetContentsBorrowed,
     rule: RawServoStyleRuleBorrowed,
@@ -2035,17 +2157,17 @@ pub unsafe extern "C" fn Servo_StyleRule
             url_data: Some(&url_data),
         };
 
         let mut parser_input = ParserInput::new(&value_str);
         match SelectorList::parse(&parser, &mut Parser::new(&mut parser_input)) {
             Ok(selectors) => {
                 rule.selectors = selectors;
                 true
-            }
+            },
             Err(_) => false,
         }
     })
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_SelectorList_Closest(
     element: RawGeckoElementBorrowed,
@@ -2053,57 +2175,51 @@ pub unsafe extern "C" fn Servo_SelectorL
 ) -> *const structs::RawGeckoElement {
     use std::borrow::Borrow;
     use style::dom_apis;
 
     let element = GeckoElement(element);
     let quirks_mode = element.as_node().owner_doc().quirks_mode();
     let selectors = ::selectors::SelectorList::from_ffi(selectors).borrow();
 
-    dom_apis::element_closest(element, &selectors, quirks_mode)
-        .map_or(ptr::null(), |e| e.0)
+    dom_apis::element_closest(element, &selectors, quirks_mode).map_or(ptr::null(), |e| e.0)
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_SelectorList_Matches(
     element: RawGeckoElementBorrowed,
     selectors: RawServoSelectorListBorrowed,
 ) -> bool {
     use std::borrow::Borrow;
     use style::dom_apis;
 
     let element = GeckoElement(element);
     let quirks_mode = element.as_node().owner_doc().quirks_mode();
     let selectors = ::selectors::SelectorList::from_ffi(selectors).borrow();
-    dom_apis::element_matches(
-        &element,
-        &selectors,
-        quirks_mode,
-    )
+    dom_apis::element_matches(&element, &selectors, quirks_mode)
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_SelectorList_QueryFirst(
     node: RawGeckoNodeBorrowed,
     selectors: RawServoSelectorListBorrowed,
     may_use_invalidation: bool,
 ) -> *const structs::RawGeckoElement {
     use std::borrow::Borrow;
     use style::dom_apis::{self, MayUseInvalidation, QueryFirst};
 
     let node = GeckoNode(node);
     let selectors = ::selectors::SelectorList::from_ffi(selectors).borrow();
     let mut result = None;
 
-    let may_use_invalidation =
-        if may_use_invalidation {
-            MayUseInvalidation::Yes
-        } else {
-            MayUseInvalidation::No
-        };
+    let may_use_invalidation = if may_use_invalidation {
+        MayUseInvalidation::Yes
+    } else {
+        MayUseInvalidation::No
+    };
 
     dom_apis::query_selector::<GeckoElement, QueryFirst>(
         node,
         &selectors,
         &mut result,
         may_use_invalidation,
     );
 
@@ -2119,22 +2235,21 @@ pub unsafe extern "C" fn Servo_SelectorL
 ) {
     use std::borrow::Borrow;
     use style::dom_apis::{self, MayUseInvalidation, QueryAll};
 
     let node = GeckoNode(node);
     let selectors = ::selectors::SelectorList::from_ffi(selectors).borrow();
     let mut result = SmallVec::new();
 
-    let may_use_invalidation =
-        if may_use_invalidation {
-            MayUseInvalidation::Yes
-        } else {
-            MayUseInvalidation::No
-        };
+    let may_use_invalidation = if may_use_invalidation {
+        MayUseInvalidation::Yes
+    } else {
+        MayUseInvalidation::No
+    };
 
     dom_apis::query_selector::<GeckoElement, QueryAll>(
         node,
         &selectors,
         &mut result,
         may_use_invalidation,
     );
 
@@ -2145,17 +2260,20 @@ pub unsafe extern "C" fn Servo_SelectorL
             content_list,
             result.as_ptr() as *mut *const _,
             result.len(),
         )
     }
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_ImportRule_GetHref(rule: RawServoImportRuleBorrowed, result: *mut nsAString) {
+pub extern "C" fn Servo_ImportRule_GetHref(
+    rule: RawServoImportRuleBorrowed,
+    result: *mut nsAString,
+) {
     read_locked_arc(rule, |rule: &ImportRule| {
         write!(unsafe { &mut *result }, "{}", rule.url.as_str()).unwrap();
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ImportRule_GetSheet(
     rule: RawServoImportRuleBorrowed,
@@ -2174,58 +2292,73 @@ pub extern "C" fn Servo_ImportRule_SetSh
         let sheet = unsafe { GeckoStyleSheet::new(sheet) };
         rule.stylesheet = ImportSheet::new(sheet);
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_Keyframe_GetKeyText(
     keyframe: RawServoKeyframeBorrowed,
-    result: *mut nsAString
+    result: *mut nsAString,
 ) {
     read_locked_arc(keyframe, |keyframe: &Keyframe| {
-        keyframe.selector.to_css(&mut CssWriter::new(unsafe { result.as_mut().unwrap() })).unwrap()
+        keyframe
+            .selector
+            .to_css(&mut CssWriter::new(unsafe { result.as_mut().unwrap() }))
+            .unwrap()
     })
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_Keyframe_SetKeyText(keyframe: RawServoKeyframeBorrowed, text: *const nsACString) -> bool {
+pub extern "C" fn Servo_Keyframe_SetKeyText(
+    keyframe: RawServoKeyframeBorrowed,
+    text: *const nsACString,
+) -> bool {
     let text = unsafe { text.as_ref().unwrap().as_str_unchecked() };
     let mut input = ParserInput::new(&text);
     if let Ok(selector) = Parser::new(&mut input).parse_entirely(KeyframeSelector::parse) {
         write_locked_arc(keyframe, |keyframe: &mut Keyframe| {
             keyframe.selector = selector;
         });
         true
     } else {
         false
     }
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_Keyframe_GetStyle(keyframe: RawServoKeyframeBorrowed) -> RawServoDeclarationBlockStrong {
-    read_locked_arc(keyframe, |keyframe: &Keyframe| keyframe.block.clone().into_strong())
-}
-
-#[no_mangle]
-pub extern "C" fn Servo_Keyframe_SetStyle(keyframe: RawServoKeyframeBorrowed,
-                                          declarations: RawServoDeclarationBlockBorrowed) {
+pub extern "C" fn Servo_Keyframe_GetStyle(
+    keyframe: RawServoKeyframeBorrowed,
+) -> RawServoDeclarationBlockStrong {
+    read_locked_arc(keyframe, |keyframe: &Keyframe| {
+        keyframe.block.clone().into_strong()
+    })
+}
+
+#[no_mangle]
+pub extern "C" fn Servo_Keyframe_SetStyle(
+    keyframe: RawServoKeyframeBorrowed,
+    declarations: RawServoDeclarationBlockBorrowed,
+) {
     let declarations = Locked::<PropertyDeclarationBlock>::as_arc(&declarations);
     write_locked_arc(keyframe, |keyframe: &mut Keyframe| {
         keyframe.block = declarations.clone_arc();
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_KeyframesRule_GetName(rule: RawServoKeyframesRuleBorrowed) -> *mut nsAtom {
     read_locked_arc(rule, |rule: &KeyframesRule| rule.name.as_atom().as_ptr())
 }
 
 #[no_mangle]
-pub unsafe extern "C" fn Servo_KeyframesRule_SetName(rule: RawServoKeyframesRuleBorrowed, name: *mut nsAtom) {
+pub unsafe extern "C" fn Servo_KeyframesRule_SetName(
+    rule: RawServoKeyframesRuleBorrowed,
+    name: *mut nsAtom,
+) {
     write_locked_arc(rule, |rule: &mut KeyframesRule| {
         rule.name = KeyframesName::Ident(CustomIdent(Atom::from_addrefed(name)));
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_KeyframesRule_GetCount(rule: RawServoKeyframesRuleBorrowed) -> u32 {
     read_locked_arc(rule, |rule: &KeyframesRule| rule.keyframes.len() as u32)
@@ -2235,89 +2368,97 @@ pub extern "C" fn Servo_KeyframesRule_Ge
 pub extern "C" fn Servo_KeyframesRule_GetKeyframeAt(
     rule: RawServoKeyframesRuleBorrowed,
     index: u32,
     line: *mut u32,
     column: *mut u32,
 ) -> RawServoKeyframeStrong {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
-    let key = Locked::<KeyframesRule>::as_arc(&rule).read_with(&guard)
-                  .keyframes[index as usize].clone();
+    let key = Locked::<KeyframesRule>::as_arc(&rule)
+        .read_with(&guard)
+        .keyframes[index as usize]
+        .clone();
     let location = key.read_with(&guard).source_location;
     *unsafe { line.as_mut().unwrap() } = location.line as u32;
     *unsafe { column.as_mut().unwrap() } = location.column as u32;
     key.into_strong()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_KeyframesRule_FindRule(
     rule: RawServoKeyframesRuleBorrowed,
     key: *const nsACString,
 ) -> u32 {
     let key = unsafe { key.as_ref().unwrap().as_str_unchecked() };
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
-    Locked::<KeyframesRule>::as_arc(&rule).read_with(&guard)
-        .find_rule(&guard, key).map(|index| index as u32)
+    Locked::<KeyframesRule>::as_arc(&rule)
+        .read_with(&guard)
+        .find_rule(&guard, key)
+        .map(|index| index as u32)
         .unwrap_or(u32::max_value())
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_KeyframesRule_AppendRule(
     rule: RawServoKeyframesRuleBorrowed,
     contents: RawServoStyleSheetContentsBorrowed,
-    css: *const nsACString
+    css: *const nsACString,
 ) -> bool {
     let css = unsafe { css.as_ref().unwrap().as_str_unchecked() };
     let contents = StylesheetContents::as_arc(&contents);
     let global_style_data = &*GLOBAL_STYLE_DATA;
 
     match Keyframe::parse(css, &contents, &global_style_data.shared_lock) {
         Ok(keyframe) => {
             write_locked_arc(rule, |rule: &mut KeyframesRule| {
                 rule.keyframes.push(keyframe);
             });
             true
-        }
+        },
         Err(..) => false,
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_KeyframesRule_DeleteRule(rule: RawServoKeyframesRuleBorrowed, index: u32) {
     write_locked_arc(rule, |rule: &mut KeyframesRule| {
         rule.keyframes.remove(index as usize);
     })
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_MediaRule_GetMedia(rule: RawServoMediaRuleBorrowed) -> RawServoMediaListStrong {
+pub extern "C" fn Servo_MediaRule_GetMedia(
+    rule: RawServoMediaRuleBorrowed,
+) -> RawServoMediaListStrong {
     read_locked_arc(rule, |rule: &MediaRule| {
         rule.media_queries.clone().into_strong()
     })
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_NamespaceRule_GetPrefix(rule: RawServoNamespaceRuleBorrowed) -> *mut nsAtom {
+pub extern "C" fn Servo_NamespaceRule_GetPrefix(
+    rule: RawServoNamespaceRuleBorrowed,
+) -> *mut nsAtom {
     read_locked_arc(rule, |rule: &NamespaceRule| {
         rule.prefix.as_ref().unwrap_or(&atom!("")).as_ptr()
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_NamespaceRule_GetURI(rule: RawServoNamespaceRuleBorrowed) -> *mut nsAtom {
     read_locked_arc(rule, |rule: &NamespaceRule| rule.url.0.as_ptr())
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_PageRule_GetStyle(rule: RawServoPageRuleBorrowed) -> RawServoDeclarationBlockStrong {
-    read_locked_arc(rule, |rule: &PageRule| {
-        rule.block.clone().into_strong()
-    })
+pub extern "C" fn Servo_PageRule_GetStyle(
+    rule: RawServoPageRuleBorrowed,
+) -> RawServoDeclarationBlockStrong {
+    read_locked_arc(rule, |rule: &PageRule| rule.block.clone().into_strong())
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_PageRule_SetStyle(
     rule: RawServoPageRuleBorrowed,
     declarations: RawServoDeclarationBlockBorrowed,
 ) {
     let declarations = Locked::<PropertyDeclarationBlock>::as_arc(&declarations);
@@ -2327,61 +2468,69 @@ pub extern "C" fn Servo_PageRule_SetStyl
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_SupportsRule_GetConditionText(
     rule: RawServoSupportsRuleBorrowed,
     result: *mut nsAString,
 ) {
     read_locked_arc(rule, |rule: &SupportsRule| {
-        rule.condition.to_css(&mut CssWriter::new(unsafe { result.as_mut().unwrap() })).unwrap();
+        rule.condition
+            .to_css(&mut CssWriter::new(unsafe { result.as_mut().unwrap() }))
+            .unwrap();
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_MozDocumentRule_GetConditionText(
     rule: RawServoMozDocumentRuleBorrowed,
     result: *mut nsAString,
 ) {
     read_locked_arc(rule, |rule: &DocumentRule| {
-        rule.condition.to_css(&mut CssWriter::new(unsafe { result.as_mut().unwrap() })).unwrap();
+        rule.condition
+            .to_css(&mut CssWriter::new(unsafe { result.as_mut().unwrap() }))
+            .unwrap();
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_FontFeatureValuesRule_GetFontFamily(
     rule: RawServoFontFeatureValuesRuleBorrowed,
     result: *mut nsAString,
 ) {
     read_locked_arc(rule, |rule: &FontFeatureValuesRule| {
-        rule.font_family_to_css(&mut CssWriter::new(unsafe { result.as_mut().unwrap() })).unwrap();
+        rule.font_family_to_css(&mut CssWriter::new(unsafe { result.as_mut().unwrap() }))
+            .unwrap();
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_FontFeatureValuesRule_GetValueText(
     rule: RawServoFontFeatureValuesRuleBorrowed,
     result: *mut nsAString,
 ) {
     read_locked_arc(rule, |rule: &FontFeatureValuesRule| {
-        rule.value_to_css(&mut CssWriter::new(unsafe { result.as_mut().unwrap() })).unwrap();
+        rule.value_to_css(&mut CssWriter::new(unsafe { result.as_mut().unwrap() }))
+            .unwrap();
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_FontFaceRule_CreateEmpty() -> RawServoFontFaceRuleStrong {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     // XXX This is not great. We should split FontFace descriptor data
     // from the rule, so that we don't need to create the rule like this
     // and the descriptor data itself can be hold in UniquePtr from the
     // Gecko side. See bug 1450904.
-    Arc::new(global_style_data.shared_lock.wrap(FontFaceRule::empty(SourceLocation {
-        line: 0,
-        column: 0,
-    }))).into_strong()
+    Arc::new(
+        global_style_data
+            .shared_lock
+            .wrap(FontFaceRule::empty(SourceLocation { line: 0, column: 0 })),
+    )
+    .into_strong()
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_FontFaceRule_Clone(
     rule: RawServoFontFaceRuleBorrowed,
 ) -> RawServoFontFaceRuleStrong {
     let clone = read_locked_arc(rule, |rule: &FontFaceRule| rule.clone());
     let global_style_data = &*GLOBAL_STYLE_DATA;
@@ -2416,23 +2565,21 @@ macro_rules! apply_font_desc_list {
                 eCSSFontDesc_FontLanguageOverride => language_override,
                 eCSSFontDesc_Display => display,
             ]
             invalid: [
                 eCSSFontDesc_UNKNOWN,
                 eCSSFontDesc_COUNT,
             ]
         }
-    }
-}
-
-#[no_mangle]
-pub unsafe extern "C" fn Servo_FontFaceRule_Length(
-    rule: RawServoFontFaceRuleBorrowed,
-) -> u32 {
+    };
+}
+
+#[no_mangle]
+pub unsafe extern "C" fn Servo_FontFaceRule_Length(rule: RawServoFontFaceRuleBorrowed) -> u32 {
     read_locked_arc(rule, |rule: &FontFaceRule| {
         let mut result = 0;
         macro_rules! count_values {
             (
                 valid: [$($v_enum_name:ident => $field:ident,)*]
                 invalid: [$($i_enum_name:ident,)*]
             ) => {
                 $(if rule.$field.is_some() {
@@ -2475,49 +2622,75 @@ pub unsafe extern "C" fn Servo_FontFaceR
     rule: RawServoFontFaceRuleBorrowed,
     result: *mut nsAString,
 ) {
     read_locked_arc(rule, |rule: &FontFaceRule| {
         rule.decl_to_css(result.as_mut().unwrap()).unwrap();
     })
 }
 
-
 macro_rules! simple_font_descriptor_getter {
     ($function_name:ident, $gecko_type:ident, $field:ident, $compute:ident) => {
         #[no_mangle]
         pub unsafe extern "C" fn $function_name(
             rule: RawServoFontFaceRuleBorrowed,
             out: *mut structs::$gecko_type,
         ) -> bool {
             read_locked_arc(rule, |rule: &FontFaceRule| {
                 match rule.$field {
                     None => return false,
                     Some(ref f) => *out = f.$compute(),
                 }
                 true
             })
         }
-    }
-}
-
-simple_font_descriptor_getter!(Servo_FontFaceRule_GetFontWeight, StyleComputedFontWeightRange, weight, compute);
-simple_font_descriptor_getter!(Servo_FontFaceRule_GetFontStretch, StyleComputedFontStretchRange, stretch, compute);
-simple_font_descriptor_getter!(Servo_FontFaceRule_GetFontStyle, StyleComputedFontStyleDescriptor, style, compute);
-simple_font_descriptor_getter!(Servo_FontFaceRule_GetFontDisplay, StyleFontDisplay, display, clone);
-simple_font_descriptor_getter!(Servo_FontFaceRule_GetFontLanguageOverride, StyleFontLanguageOverride, language_override, compute_non_system);
+    };
+}
+
+simple_font_descriptor_getter!(
+    Servo_FontFaceRule_GetFontWeight,
+    StyleComputedFontWeightRange,
+    weight,
+    compute
+);
+simple_font_descriptor_getter!(
+    Servo_FontFaceRule_GetFontStretch,
+    StyleComputedFontStretchRange,
+    stretch,
+    compute
+);
+simple_font_descriptor_getter!(
+    Servo_FontFaceRule_GetFontStyle,
+    StyleComputedFontStyleDescriptor,
+    style,
+    compute
+);
+simple_font_descriptor_getter!(
+    Servo_FontFaceRule_GetFontDisplay,
+    StyleFontDisplay,
+    display,
+    clone
+);
+simple_font_descriptor_getter!(
+    Servo_FontFaceRule_GetFontLanguageOverride,
+    StyleFontLanguageOverride,
+    language_override,
+    compute_non_system
+);
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_FontFaceRule_GetFamilyName(
     rule: RawServoFontFaceRuleBorrowed,
 ) -> *mut nsAtom {
     read_locked_arc(rule, |rule: &FontFaceRule| {
         // TODO(emilio): font-family is a mandatory descriptor, can't we unwrap
         // here, and remove the null-checks in Gecko?
-        rule.family.as_ref().map_or(ptr::null_mut(), |f| f.name.as_ptr())
+        rule.family
+            .as_ref()
+            .map_or(ptr::null_mut(), |f| f.name.as_ptr())
     })
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_FontFaceRule_GetUnicodeRanges(
     rule: RawServoFontFaceRuleBorrowed,
     out_len: *mut usize,
 ) -> *const structs::StyleUnicodeRange {
@@ -2532,17 +2705,17 @@ pub unsafe extern "C" fn Servo_FontFaceR
     })
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_FontFaceRule_GetSources(
     rule: RawServoFontFaceRuleBorrowed,
     out: *mut nsTArray<structs::StyleFontFaceSourceListComponent>,
 ) {
-    use style::font_face::{Source, FontFaceSourceListComponent};
+    use style::font_face::{FontFaceSourceListComponent, Source};
     let out = &mut *out;
     read_locked_arc(rule, |rule: &FontFaceRule| {
         let sources = match rule.sources {
             Some(ref s) => s,
             None => return,
         };
         let len = sources.iter().fold(0, |acc, src| {
             acc + match *src {
@@ -2566,20 +2739,20 @@ pub unsafe extern "C" fn Servo_FontFaceR
                     Source::Url(ref url) => {
                         set_next(FontFaceSourceListComponent::Url(url.url.url_value.get()));
                         for hint in url.format_hints.iter() {
                             set_next(FontFaceSourceListComponent::FormatHint {
                                 length: hint.len(),
                                 utf8_bytes: hint.as_ptr(),
                             });
                         }
-                    }
+                    },
                     Source::Local(ref name) => {
                         set_next(FontFaceSourceListComponent::Local(name.name.as_ptr()));
-                    }
+                    },
                 }
             }
         }
 
         assert!(iter.next().is_none(), "miscalculated");
     })
 }
 
@@ -2729,45 +2902,41 @@ pub unsafe extern "C" fn Servo_FontFaceR
         apply_font_desc_list!(reset_desc)
     })
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_CounterStyleRule_GetName(
     rule: RawServoCounterStyleRuleBorrowed,
 ) -> *mut nsAtom {
-    read_locked_arc(rule, |rule: &CounterStyleRule| {
-        rule.name().0.as_ptr()
-    })
+    read_locked_arc(rule, |rule: &CounterStyleRule| rule.name().0.as_ptr())
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_CounterStyleRule_SetName(
     rule: RawServoCounterStyleRuleBorrowed,
     value: *const nsACString,
 ) -> bool {
     let value = value.as_ref().unwrap().as_str_unchecked();
     let mut input = ParserInput::new(&value);
     let mut parser = Parser::new(&mut input);
     match parser.parse_entirely(counter_style::parse_counter_style_name_definition) {
         Ok(name) => {
             write_locked_arc(rule, |rule: &mut CounterStyleRule| rule.set_name(name));
             true
-        }
+        },
         Err(_) => false,
     }
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_CounterStyleRule_GetGeneration(
     rule: RawServoCounterStyleRuleBorrowed,
 ) -> u32 {
-    read_locked_arc(rule, |rule: &CounterStyleRule| {
-        rule.generation()
-    })
+    read_locked_arc(rule, |rule: &CounterStyleRule| rule.generation())
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_CounterStyleRule_GetSystem(
     rule: RawServoCounterStyleRuleBorrowed,
 ) -> u8 {
     use style::counter_style::System;
     read_locked_arc(rule, |rule: &CounterStyleRule| {
@@ -2788,34 +2957,34 @@ pub unsafe extern "C" fn Servo_CounterSt
     rule: RawServoCounterStyleRuleBorrowed,
 ) -> *mut nsAtom {
     read_locked_arc(rule, |rule: &CounterStyleRule| {
         match *rule.resolved_system() {
             counter_style::System::Extends(ref name) => name.0.as_ptr(),
             _ => {
                 debug_assert!(false, "Not extends system");
                 ptr::null_mut()
-            }
+            },
         }
     })
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_CounterStyleRule_GetFixedFirstValue(
     rule: RawServoCounterStyleRuleBorrowed,
 ) -> i32 {
     read_locked_arc(rule, |rule: &CounterStyleRule| {
         match *rule.resolved_system() {
             counter_style::System::Fixed { first_symbol_value } => {
                 first_symbol_value.map_or(1, |v| v.value())
-            }
+            },
             _ => {
                 debug_assert!(false, "Not fixed system");
                 0
-            }
+            },
         }
     })
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_CounterStyleRule_GetFallback(
     rule: RawServoCounterStyleRuleBorrowed,
 ) -> *mut nsAtom {
@@ -2930,18 +3099,17 @@ pub unsafe extern "C" fn Servo_ComputedV
     pseudo_tag: *mut nsAtom,
     raw_data: RawServoStyleSetBorrowed,
 ) -> ComputedStyleStrong {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     let guards = StylesheetGuards::same(&guard);
     let data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
     let atom = Atom::from_raw(pseudo_tag);
-    let pseudo = PseudoElement::from_anon_box_atom(&atom)
-        .expect("Not an anon box pseudo?");
+    let pseudo = PseudoElement::from_anon_box_atom(&atom).expect("Not an anon box pseudo?");
 
     let metrics = get_metrics_provider_for_product();
 
     // If the pseudo element is PageContent, we should append the precomputed
     // pseudo element declerations with specified page rules.
     let page_decls = match pseudo {
         PseudoElement::PageContent => {
             let mut declarations = vec![];
@@ -2950,53 +3118,57 @@ pub unsafe extern "C" fn Servo_ComputedV
                 let level = match origin {
                     Origin::UserAgent => CascadeLevel::UANormal,
                     Origin::User => CascadeLevel::UserNormal,
                     Origin::Author => CascadeLevel::SameTreeAuthorNormal,
                 };
                 for rule in data.pages.iter() {
                     declarations.push(ApplicableDeclarationBlock::from_declarations(
                         rule.read_with(level.guard(&guards)).block.clone(),
-                        level
+                        level,
                     ));
                 }
             }
             Some(declarations)
         },
         _ => None,
     };
 
-    let rule_node = data.stylist.rule_node_for_precomputed_pseudo(
-        &guards,
-        &pseudo,
-        page_decls,
-    );
-
-    data.stylist.precomputed_values_for_pseudo_with_rule_node::<GeckoElement>(
-        &guards,
-        &pseudo,
-        parent_style_or_null.map(|x| &*x),
-        &metrics,
-        rule_node
-    ).into()
+    let rule_node = data
+        .stylist
+        .rule_node_for_precomputed_pseudo(&guards, &pseudo, page_decls);
+
+    data.stylist
+        .precomputed_values_for_pseudo_with_rule_node::<GeckoElement>(
+            &guards,
+            &pseudo,
+            parent_style_or_null.map(|x| &*x),
+            &metrics,
+            rule_node,
+        )
+        .into()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ResolvePseudoStyle(
     element: RawGeckoElementBorrowed,
     pseudo_type: CSSPseudoElementType,
     is_probe: bool,
     inherited_style: ComputedStyleBorrowedOrNull,
     raw_data: RawServoStyleSetBorrowed,
 ) -> ComputedStyleStrong {
     let element = GeckoElement(element);
     let doc_data = PerDocumentStyleData::from_ffi(raw_data).borrow();
 
-    debug!("Servo_ResolvePseudoStyle: {:?} {:?}, is_probe: {}",
-           element, PseudoElement::from_pseudo_type(pseudo_type), is_probe);
+    debug!(
+        "Servo_ResolvePseudoStyle: {:?} {:?}, is_probe: {}",
+        element,
+        PseudoElement::from_pseudo_type(pseudo_type),
+        is_probe
+    );
 
     let data = element.borrow_data();
 
     let data = match data.as_ref() {
         Some(data) if data.has_styles() => data,
         _ => {
             // FIXME(bholley, emilio): Assert against this.
             //
@@ -3006,21 +3178,21 @@ pub extern "C" fn Servo_ResolvePseudoSty
             // Bug 1403865 tracks fixing it, and potentially adding an assert
             // here instead.
             warn!("Calling Servo_ResolvePseudoStyle on unstyled element");
             return if is_probe {
                 Strong::null()
             } else {
                 doc_data.default_computed_values().clone().into()
             };
-        }
+        },
     };
 
     let pseudo = PseudoElement::from_pseudo_type(pseudo_type)
-                    .expect("ResolvePseudoStyle with a non-pseudo?");
+        .expect("ResolvePseudoStyle with a non-pseudo?");
 
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     let style = get_pseudo_style(
         &guard,
         element,
         &pseudo,
         RuleInclusion::All,
@@ -3031,17 +3203,17 @@ pub extern "C" fn Servo_ResolvePseudoSty
         /* matching_func = */ None,
     );
 
     match style {
         Some(s) => s.into(),
         None => {
             debug_assert!(is_probe);
             Strong::null()
-        }
+        },
     }
 }
 
 fn debug_atom_array(atoms: &AtomArray) -> String {
     let mut result = String::from("[");
     for atom in atoms.iter() {
         if atom.mRawPtr.is_null() {
             result += "(null), ";
@@ -3055,54 +3227,63 @@ fn debug_atom_array(atoms: &AtomArray) -
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ComputedValues_ResolveXULTreePseudoStyle(
     element: RawGeckoElementBorrowed,
     pseudo_tag: *mut nsAtom,
     inherited_style: ComputedStyleBorrowed,
     input_word: *const AtomArray,
-    raw_data: RawServoStyleSetBorrowed
+    raw_data: RawServoStyleSetBorrowed,
 ) -> ComputedStyleStrong {
     let element = GeckoElement(element);
-    let data = element.borrow_data()
+    let data = element
+        .borrow_data()
         .expect("Calling ResolveXULTreePseudoStyle on unstyled element?");
 
     let pseudo = unsafe {
         Atom::with(pseudo_tag, |atom| {
             PseudoElement::from_tree_pseudo_atom(atom, Box::new([]))
-        }).expect("ResolveXULTreePseudoStyle with a non-tree pseudo?")
+        })
+        .expect("ResolveXULTreePseudoStyle with a non-tree pseudo?")
     };
     let input_word = unsafe { input_word.as_ref().unwrap() };
 
     let doc_data = PerDocumentStyleData::from_ffi(raw_data).borrow();
 
-    debug!("ResolveXULTreePseudoStyle: {:?} {:?} {}",
-           element, pseudo, debug_atom_array(input_word));
+    debug!(
+        "ResolveXULTreePseudoStyle: {:?} {:?} {}",
+        element,
+        pseudo,
+        debug_atom_array(input_word)
+    );
 
     let matching_fn = |pseudo: &PseudoElement| {
-        let args = pseudo.tree_pseudo_args().expect("Not a tree pseudo-element?");
-        args.iter().all(|atom| {
-            input_word.iter().any(|item| atom.as_ptr() == item.mRawPtr)
-        })
+        let args = pseudo
+            .tree_pseudo_args()
+            .expect("Not a tree pseudo-element?");
+        args.iter()
+            .all(|atom| input_word.iter().any(|item| atom.as_ptr() == item.mRawPtr))
     };
 
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     get_pseudo_style(
         &guard,
         element,
         &pseudo,
         RuleInclusion::All,
         &data.styles,
         Some(inherited_style),
         &*doc_data,
         /* is_probe = */ false,
         Some(&matching_fn),
-    ).unwrap().into()
+    )
+    .unwrap()
+    .into()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_SetExplicitStyle(
     element: RawGeckoElementBorrowed,
     style: ComputedStyleBorrowed,
 ) {
     let element = GeckoElement(element);
@@ -3123,21 +3304,23 @@ pub extern "C" fn Servo_HasAuthorSpecifi
     author_colors_allowed: bool,
 ) -> bool {
     let element = GeckoElement(element);
     let pseudo = PseudoElement::from_pseudo_type(pseudo_type);
 
     let guard = (*GLOBAL_STYLE_DATA).shared_lock.read();
     let guards = StylesheetGuards::same(&guard);
 
-    style.rules().has_author_specified_rules(element,
-                                             pseudo,
-                                             &guards,
-                                             rule_type_mask,
-                                             author_colors_allowed)
+    style.rules().has_author_specified_rules(
+        element,
+        pseudo,
+        &guards,
+        rule_type_mask,
+        author_colors_allowed,
+    )
 }
 
 fn get_pseudo_style(
     guard: &SharedRwLockReadGuard,
     element: GeckoElement,
     pseudo: &PseudoElement,
     rule_inclusion: RuleInclusion,
     styles: &ElementStyles,
@@ -3151,18 +3334,17 @@ fn get_pseudo_style(
             match *pseudo {
                 PseudoElement::FirstLetter => {
                     styles.pseudos.get(&pseudo).map(|pseudo_styles| {
                         // inherited_styles can be None when doing lazy resolution
                         // (e.g. for computed style) or when probing.  In that case
                         // we just inherit from our element, which is what Gecko
                         // does in that situation.  What should actually happen in
                         // the computed style case is a bit unclear.
-                        let inherited_styles =
-                            inherited_styles.unwrap_or(styles.primary());
+                        let inherited_styles = inherited_styles.unwrap_or(styles.primary());
                         let guards = StylesheetGuards::same(guard);
                         let metrics = get_metrics_provider_for_product();
                         let inputs = CascadeInputs::new_from_style(pseudo_styles);
                         doc_data.stylist.compute_pseudo_element_style_with_inputs(
                             inputs,
                             pseudo,
                             &guards,
                             Some(inherited_styles),
@@ -3191,22 +3373,23 @@ fn get_pseudo_style(
                     // cases in which there's a mismatch go ahead and reparent
                     // styles again as needed to make sure the ::first-line
                     // affects all the things it should affect.  But it makes it
                     // impossible to assert anything about the two styles
                     // matching here, unfortunately.
                     styles.pseudos.get(&pseudo).cloned()
                 },
             }
-        }
+        },
         PseudoElementCascadeType::Precomputed => unreachable!("No anonymous boxes"),
         PseudoElementCascadeType::Lazy => {
-            debug_assert!(inherited_styles.is_none() ||
-                          ptr::eq(inherited_styles.unwrap(),
-                                  &**styles.primary()));
+            debug_assert!(
+                inherited_styles.is_none() ||
+                    ptr::eq(inherited_styles.unwrap(), &**styles.primary())
+            );
             let base = if pseudo.inherits_from_default_values() {
                 doc_data.default_computed_values()
             } else {
                 styles.primary()
             };
             let guards = StylesheetGuards::same(guard);
             let metrics = get_metrics_provider_for_product();
             doc_data.stylist.lazily_compute_pseudo_element_style(
@@ -3226,39 +3409,36 @@ fn get_pseudo_style(
         return style;
     }
 
     Some(style.unwrap_or_else(|| {
         StyleBuilder::for_inheritance(
             doc_data.stylist.device(),
             Some(styles.primary()),
             Some(pseudo),
-        ).build()
+        )
+        .build()
     }))
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_ComputedValues_Inherit(
     raw_data: RawServoStyleSetBorrowed,
     pseudo_tag: *mut nsAtom,
     parent_style_context: ComputedStyleBorrowedOrNull,
-    target: structs::InheritTarget
+    target: structs::InheritTarget,
 ) -> ComputedStyleStrong {
     let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
 
     let for_text = target == structs::InheritTarget::Text;
     let atom = Atom::from_raw(pseudo_tag);
-    let pseudo = PseudoElement::from_anon_box_atom(&atom)
-        .expect("Not an anon-box? Gah!");
-
-    let mut style = StyleBuilder::for_inheritance(
-        data.stylist.device(),
-        parent_style_context,
-        Some(&pseudo)
-    );
+    let pseudo = PseudoElement::from_anon_box_atom(&atom).expect("Not an anon-box? Gah!");
+
+    let mut style =
+        StyleBuilder::for_inheritance(data.stylist.device(), parent_style_context, Some(&pseudo));
 
     if for_text {
         StyleAdjuster::new(&mut style).adjust_for_text();
     }
 
     style.build().into()
 }
 
@@ -3292,17 +3472,17 @@ pub extern "C" fn Servo_ComputedValues_S
 ) -> bool {
     let b = values.get_box();
     b.specifies_animations() || b.specifies_transitions()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ComputedValues_EqualCustomProperties(
     first: ServoComputedDataBorrowed,
-    second: ServoComputedDataBorrowed
+    second: ServoComputedDataBorrowed,
 ) -> bool {
     first.custom_properties == second.custom_properties
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ComputedValues_GetStyleRuleList(
     values: ComputedStyleBorrowed,
     rules: RawGeckoServoStyleRuleListBorrowedMut,
@@ -3327,19 +3507,17 @@ pub extern "C" fn Servo_ComputedValues_G
             continue;
         }
 
         result.push(style_rule);
     }
 
     rules.assign_from_iter_pod(result.into_iter().map(|src| {
         src.with_arc(|a| {
-            a.with_raw_offset_arc(|arc| {
-                *Locked::<StyleRule>::arc_as_borrowed(arc) as *const _
-            })
+            a.with_raw_offset_arc(|arc| *Locked::<StyleRule>::arc_as_borrowed(arc) as *const _)
         })
     }))
 }
 
 /// See the comment in `Device` to see why it's ok to pass an owned reference to
 /// the pres context (hint: the context outlives the StyleSet, that holds the
 /// device alive).
 #[no_mangle]
@@ -3359,19 +3537,24 @@ pub extern "C" fn Servo_StyleSet_Rebuild
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_Drop(data: RawServoStyleSetOwned) {
     let _ = data.into_box::<PerDocumentStyleData>();
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_StyleSet_CompatModeChanged(raw_data: RawServoStyleSetBorrowed) {
     let mut data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
-    let doc =
-        &*data.stylist.device().pres_context().mDocument.raw::<nsIDocument>();
-    data.stylist.set_quirks_mode(QuirksMode::from(doc.mCompatMode));
+    let doc = &*data
+        .stylist
+        .device()
+        .pres_context()
+        .mDocument
+        .raw::<nsIDocument>();
+    data.stylist
+        .set_quirks_mode(QuirksMode::from(doc.mCompatMode));
 }
 
 fn parse_property_into(
     declarations: &mut SourcePropertyDeclaration,
     property_id: PropertyId,
     value: *const nsACString,
     data: *mut URLExtraData,
     parsing_mode: structs::ParsingMode,
@@ -3391,55 +3574,53 @@ fn parse_property_into(
         reporter,
         parsing_mode,
         quirks_mode,
     )
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ParseProperty(
-    property: nsCSSPropertyID, value: *const nsACString,
+    property: nsCSSPropertyID,
+    value: *const nsACString,
     data: *mut URLExtraData,
     parsing_mode: structs::ParsingMode,
     quirks_mode: nsCompatibility,
     loader: *mut Loader,
 ) -> RawServoDeclarationBlockStrong {
-    let id = get_property_id_from_nscsspropertyid!(property,
-                                                   RawServoDeclarationBlockStrong::null());
+    let id =
+        get_property_id_from_nscsspropertyid!(property, RawServoDeclarationBlockStrong::null());
     let mut declarations = SourcePropertyDeclaration::new();
     let reporter = ErrorReporter::new(ptr::null_mut(), loader, data);
     let result = parse_property_into(
         &mut declarations,
         id,
         value,
         data,
         parsing_mode,
         quirks_mode.into(),
         reporter.as_ref().map(|r| r as &ParseErrorReporter),
     );
 
     match result {
         Ok(()) => {
             let global_style_data = &*GLOBAL_STYLE_DATA;
             let mut block = PropertyDeclarationBlock::new();
-            block.extend(
-                declarations.drain(),
-                Importance::Normal,
-            );
+            block.extend(declarations.drain(), Importance::Normal);
             Arc::new(global_style_data.shared_lock.wrap(block)).into_strong()
-        }
-        Err(_) => RawServoDeclarationBlockStrong::null()
+        },
+        Err(_) => RawServoDeclarationBlockStrong::null(),
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ParseEasing(
     easing: *const nsAString,
     data: *mut URLExtraData,
-    output: nsTimingFunctionBorrowedMut
+    output: nsTimingFunctionBorrowedMut,
 ) -> bool {
     use style::properties::longhands::transition_timing_function;
 
     // FIXME Dummy URL data would work fine here.
     let url_data = unsafe { UrlExtraData::from_ptr_ref(&data) };
     let context = ParserContext::new(
         Origin::Author,
         url_data,
@@ -3455,76 +3636,89 @@ pub extern "C" fn Servo_ParseEasing(
     let result =
         parser.parse_entirely(|p| transition_timing_function::single_value::parse(&context, p));
     match result {
         Ok(parsed_easing) => {
             // We store as computed value in nsTimingFunction.
             (*output).mTiming = parsed_easing.to_computed_value_without_context();
             true
         },
-        Err(_) => false
+        Err(_) => false,
     }
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_SerializeEasing(
     easing: nsTimingFunctionBorrowed,
     output: *mut nsAString,
 ) {
-    easing.mTiming.to_css(&mut CssWriter::new(&mut *output)).unwrap();
+    easing
+        .mTiming
+        .to_css(&mut CssWriter::new(&mut *output))
+        .unwrap();
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_GetProperties_Overriding_Animation(
     element: RawGeckoElementBorrowed,
     list: RawGeckoCSSPropertyIDListBorrowed,
     set: nsCSSPropertyIDSetBorrowedMut,
 ) {
     let element = GeckoElement(element);
     let element_data = match element.borrow_data() {
         Some(data) => data,
-        None => return
+        None => return,
     };
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     let guards = StylesheetGuards::same(&guard);
-    let (overridden, custom) =
-        element_data.styles.primary().rules().get_properties_overriding_animations(&guards);
+    let (overridden, custom) = element_data
+        .styles
+        .primary()
+        .rules()
+        .get_properties_overriding_animations(&guards);
     for p in list.iter() {
         match PropertyId::from_nscsspropertyid(*p) {
             Ok(property) => {
                 if let PropertyId::Longhand(id) = property {
                     if overridden.contains(id) {
                         unsafe { Gecko_AddPropertyToSet(set, *p) };
                     }
                 }
             },
             Err(_) => {
                 if *p == nsCSSPropertyID::eCSSPropertyExtra_variable && custom {
                     unsafe { Gecko_AddPropertyToSet(set, *p) };
                 }
-            }
+            },
         }
     }
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_MatrixTransform_Operate(matrix_operator: MatrixTransformOperator,
-                                                from: *const RawGeckoGfxMatrix4x4,
-                                                to: *const RawGeckoGfxMatrix4x4,
-                                                progress: f64,
-                                                output: *mut RawGeckoGfxMatrix4x4) {
+pub extern "C" fn Servo_MatrixTransform_Operate(
+    matrix_operator: MatrixTransformOperator,
+    from: *const RawGeckoGfxMatrix4x4,
+    to: *const RawGeckoGfxMatrix4x4,
+    progress: f64,
+    output: *mut RawGeckoGfxMatrix4x4,
+) {
     use self::MatrixTransformOperator::{Accumulate, Interpolate};
     use style::values::computed::transform::Matrix3D;
 
     let from = Matrix3D::from(unsafe { from.as_ref() }.expect("not a valid 'from' matrix"));
     let to = Matrix3D::from(unsafe { to.as_ref() }.expect("not a valid 'to' matrix"));
     let result = match matrix_operator {
         Interpolate => from.animate(&to, Procedure::Interpolate { progress }),
-        Accumulate => from.animate(&to, Procedure::Accumulate { count: progress as u64 }),
+        Accumulate => from.animate(
+            &to,
+            Procedure::Accumulate {
+                count: progress as u64,
+            },
+        ),
     };
 
     let output = unsafe { output.as_mut() }.expect("not a valid 'output' matrix");
     if let Ok(result) = result {
         *output = result.into();
     } else if progress < 0.5 {
         *output = from.clone().into();
     } else {
@@ -3538,79 +3732,92 @@ pub unsafe extern "C" fn Servo_ParseStyl
     raw_extra_data: *mut URLExtraData,
     quirks_mode: nsCompatibility,
     loader: *mut Loader,
 ) -> RawServoDeclarationBlockStrong {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let value = (*data).as_str_unchecked();
     let reporter = ErrorReporter::new(ptr::null_mut(), loader, raw_extra_data);
     let url_data = UrlExtraData::from_ptr_ref(&raw_extra_data);
-    Arc::new(global_style_data.shared_lock.wrap(
-        parse_style_attribute(
-            value,
-            url_data,
-            reporter.as_ref().map(|r| r as &ParseErrorReporter),
-            quirks_mode.into(),
-        )
-    )).into_strong()
+    Arc::new(global_style_data.shared_lock.wrap(parse_style_attribute(
+        value,
+        url_data,
+        reporter.as_ref().map(|r| r as &ParseErrorReporter),
+        quirks_mode.into(),
+    )))
+    .into_strong()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_CreateEmpty() -> RawServoDeclarationBlockStrong {
     let global_style_data = &*GLOBAL_STYLE_DATA;
-    Arc::new(global_style_data.shared_lock.wrap(PropertyDeclarationBlock::new())).into_strong()
+    Arc::new(
+        global_style_data
+            .shared_lock
+            .wrap(PropertyDeclarationBlock::new()),
+    )
+    .into_strong()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_Clone(
     declarations: RawServoDeclarationBlockBorrowed,
 ) -> RawServoDeclarationBlockStrong {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     let declarations = Locked::<PropertyDeclarationBlock>::as_arc(&declarations);
-    Arc::new(global_style_data.shared_lock.wrap(
-        declarations.read_with(&guard).clone()
-    )).into_strong()
+    Arc::new(
+        global_style_data
+            .shared_lock
+            .wrap(declarations.read_with(&guard).clone()),
+    )
+    .into_strong()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_Equals(
     a: RawServoDeclarationBlockBorrowed,
     b: RawServoDeclarationBlockBorrowed,
 ) -> bool {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
-    *Locked::<PropertyDeclarationBlock>::as_arc(&a).read_with(&guard).declarations() ==
-    *Locked::<PropertyDeclarationBlock>::as_arc(&b).read_with(&guard).declarations()
+    *Locked::<PropertyDeclarationBlock>::as_arc(&a)
+        .read_with(&guard)
+        .declarations() ==
+        *Locked::<PropertyDeclarationBlock>::as_arc(&b)
+            .read_with(&guard)
+            .declarations()
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_DeclarationBlock_GetCssText(
     declarations: RawServoDeclarationBlockBorrowed,
     result: *mut nsAString,
 ) {
     read_locked_arc(declarations, |decls: &PropertyDeclarationBlock| {
         decls.to_css(&mut *result).unwrap()
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_SerializeOneValue(
     declarations: RawServoDeclarationBlockBorrowed,
-    property_id: nsCSSPropertyID, buffer: *mut nsAString,
+    property_id: nsCSSPropertyID,
+    buffer: *mut nsAString,
     computed_values: ComputedStyleBorrowedOrNull,
     custom_properties: RawServoDeclarationBlockBorrowedOrNull,
 ) {
     let property_id = get_property_id_from_nscsspropertyid!(property_id, ());
 
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     let decls = Locked::<PropertyDeclarationBlock>::as_arc(&declarations).read_with(&guard);
 
-    let custom_properties = Locked::<PropertyDeclarationBlock>::arc_from_borrowed(&custom_properties);
+    let custom_properties =
+        Locked::<PropertyDeclarationBlock>::arc_from_borrowed(&custom_properties);
     let custom_properties = custom_properties.map(|block| block.read_with(&guard));
     let buffer = unsafe { buffer.as_mut().unwrap() };
     let rv = decls.single_value_to_css(&property_id, buffer, computed_values, custom_properties);
     debug_assert!(rv.is_ok());
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_SerializeFontValueForCanvas(
@@ -3619,26 +3826,28 @@ pub unsafe extern "C" fn Servo_Serialize
 ) {
     use style::properties::shorthands::font;
     read_locked_arc(declarations, |decls: &PropertyDeclarationBlock| {
         let longhands = match font::LonghandsToSerialize::from_iter(decls.declarations().iter()) {
             Ok(l) => l,
             Err(()) => {
                 warn!("Unexpected property!");
                 return;
-            }
+            },
         };
 
         let rv = longhands.to_css(&mut CssWriter::new(&mut *buffer));
         debug_assert!(rv.is_ok());
     })
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_DeclarationBlock_Count(declarations: RawServoDeclarationBlockBorrowed) -> u32 {
+pub extern "C" fn Servo_DeclarationBlock_Count(
+    declarations: RawServoDeclarationBlockBorrowed,
+) -> u32 {
     read_locked_arc(declarations, |decls: &PropertyDeclarationBlock| {
         decls.declarations().len() as u32
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_GetNthProperty(
     declarations: RawServoDeclarationBlockBorrowed,
@@ -3658,29 +3867,31 @@ pub extern "C" fn Servo_DeclarationBlock
 
 macro_rules! get_property_id_from_property {
     ($property: ident, $ret: expr) => {{
         let property = $property.as_ref().unwrap().as_str_unchecked();
         match PropertyId::parse_enabled_for_all_content(property) {
             Ok(property_id) => property_id,
             Err(_) => return $ret,
         }
-    }}
+    }};
 }
 
 unsafe fn get_property_value(
     declarations: RawServoDeclarationBlockBorrowed,
     property_id: PropertyId,
     value: *mut nsAString,
 ) {
     // This callsite is hot enough that the lock acquisition shows up in profiles.
     // Using an unchecked read here improves our performance by ~10% on the
     // microbenchmark in bug 1355599.
     read_locked_arc_unchecked(declarations, |decls: &PropertyDeclarationBlock| {
-        decls.property_value_to_css(&property_id, value.as_mut().unwrap()).unwrap();
+        decls
+            .property_value_to_css(&property_id, value.as_mut().unwrap())
+            .unwrap();
     })
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_DeclarationBlock_GetPropertyValue(
     declarations: RawServoDeclarationBlockBorrowed,
     property: *const nsACString,
     value: *mut nsAString,
@@ -3693,17 +3904,21 @@ pub unsafe extern "C" fn Servo_Declarati
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_DeclarationBlock_GetPropertyValueById(
     declarations: RawServoDeclarationBlockBorrowed,
     property: nsCSSPropertyID,
     value: *mut nsAString,
 ) {
-    get_property_value(declarations, get_property_id_from_nscsspropertyid!(property, ()), value)
+    get_property_value(
+        declarations,
+        get_property_id_from_nscsspropertyid!(property, ()),
+        value,
+    )
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_DeclarationBlock_GetPropertyIsImportant(
     declarations: RawServoDeclarationBlockBorrowed,
     property: *const nsACString,
 ) -> bool {
     let property_id = get_property_id_from_property!(property, false);
@@ -3734,17 +3949,21 @@ fn set_property(
         quirks_mode,
         reporter.as_ref().map(|r| r as &ParseErrorReporter),
     );
 
     if result.is_err() {
         return false;
     }
 
-    let importance = if is_important { Importance::Important } else { Importance::Normal };
+    let importance = if is_important {
+        Importance::Important
+    } else {
+        Importance::Normal
+    };
     let mut updates = Default::default();
     let will_change = read_locked_arc(declarations, |decls: &PropertyDeclarationBlock| {
         decls.prepare_for_update(&source_declarations, importance, &mut updates)
     });
     if !will_change {
         return false;
     }
 
@@ -3818,20 +4037,19 @@ pub unsafe extern "C" fn Servo_Declarati
     )
 }
 
 fn remove_property(
     declarations: RawServoDeclarationBlockBorrowed,
     property_id: PropertyId,
     before_change_closure: DeclarationBlockMutationClosure,
 ) -> bool {
-    let first_declaration =
-        read_locked_arc(declarations, |decls: &PropertyDeclarationBlock| {
-            decls.first_declaration_to_remove(&property_id)
-        });
+    let first_declaration = read_locked_arc(declarations, |decls: &PropertyDeclarationBlock| {
+        decls.first_declaration_to_remove(&property_id)
+    });
 
     let first_declaration = match first_declaration {
         Some(i) => i,
         None => return false,
     };
 
     before_change_closure.invoke();
     write_locked_arc(declarations, |decls: &mut PropertyDeclarationBlock| {
@@ -3869,32 +4087,36 @@ pub extern "C" fn Servo_DeclarationBlock
 
 #[no_mangle]
 pub extern "C" fn Servo_MediaList_Create() -> RawServoMediaListStrong {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     Arc::new(global_style_data.shared_lock.wrap(MediaList::empty())).into_strong()
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_MediaList_DeepClone(list: RawServoMediaListBorrowed) -> RawServoMediaListStrong {
+pub extern "C" fn Servo_MediaList_DeepClone(
+    list: RawServoMediaListBorrowed,
+) -> RawServoMediaListStrong {
     let global_style_data = &*GLOBAL_STYLE_DATA;
     read_locked_arc(list, |list: &MediaList| {
-        Arc::new(global_style_data.shared_lock.wrap(list.clone()))
-            .into_strong()
+        Arc::new(global_style_data.shared_lock.wrap(list.clone())).into_strong()
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_MediaList_Matches(
     list: RawServoMediaListBorrowed,
     raw_data: RawServoStyleSetBorrowed,
 ) -> bool {
     let per_doc_data = PerDocumentStyleData::from_ffi(raw_data).borrow();
     read_locked_arc(list, |list: &MediaList| {
-        list.evaluate(per_doc_data.stylist.device(), per_doc_data.stylist.quirks_mode())
+        list.evaluate(
+            per_doc_data.stylist.device(),
+            per_doc_data.stylist.quirks_mode(),
+        )
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_HasCSSWideKeyword(
     declarations: RawServoDeclarationBlockBorrowed,
     property: nsCSSPropertyID,
 ) -> bool {
@@ -3902,17 +4124,18 @@ pub extern "C" fn Servo_DeclarationBlock
     read_locked_arc(declarations, |decls: &PropertyDeclarationBlock| {
         decls.has_css_wide_keyword(&property_id)
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_MediaList_GetText(list: RawServoMediaListBorrowed, result: *mut nsAString) {
     read_locked_arc(list, |list: &MediaList| {
-        list.to_css(&mut CssWriter::new(unsafe { result.as_mut().unwrap() })).unwrap();
+        list.to_css(&mut CssWriter::new(unsafe { result.as_mut().unwrap() }))
+            .unwrap();
     })
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_MediaList_SetText(
     list: RawServoMediaListBorrowed,
     text: *const nsACString,
     caller_type: CallerType,
@@ -3957,17 +4180,19 @@ pub extern "C" fn Servo_MediaList_GetLen
 #[no_mangle]
 pub extern "C" fn Servo_MediaList_GetMediumAt(
     list: RawServoMediaListBorrowed,
     index: u32,
     result: *mut nsAString,
 ) -> bool {
     read_locked_arc(list, |list: &MediaList| {
         if let Some(media_query) = list.media_queries.get(index as usize) {
-            media_query.to_css(&mut CssWriter::new(unsafe { result.as_mut().unwrap() })).unwrap();
+            media_query
+                .to_css(&mut CssWriter::new(unsafe { result.as_mut().unwrap() }))
+                .unwrap();
             true
         } else {
             false
         }
     })
 }
 
 #[no_mangle]
@@ -4000,17 +4225,19 @@ pub extern "C" fn Servo_MediaList_Delete
     let context = ParserContext::new_for_cssom(
         url_data,
         Some(CssRuleType::Media),
         ParsingMode::DEFAULT,
         QuirksMode::NoQuirks,
         None,
         None,
     );
-    write_locked_arc(list, |list: &mut MediaList| list.delete_medium(&context, old_medium))
+    write_locked_arc(list, |list: &mut MediaList| {
+        list.delete_medium(&context, old_medium)
+    })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_MediaList_SizeOfIncludingThis(
     malloc_size_of: GeckoMallocSizeOf,
     malloc_enclosing_size_of: GeckoMallocSizeOf,
     list: RawServoMediaListBorrowed,
 ) -> usize {
@@ -4018,34 +4245,34 @@ pub extern "C" fn Servo_MediaList_SizeOf
     use malloc_size_of::MallocUnconditionalShallowSizeOf;
 
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
 
     let mut ops = MallocSizeOfOps::new(
         malloc_size_of.unwrap(),
         Some(malloc_enclosing_size_of.unwrap()),
-        None
+        None,
     );
 
     Locked::<MediaList>::as_arc(&list).with_arc(|list| {
         let mut n = 0;
         n += list.unconditional_shallow_size_of(&mut ops);
         n += list.read_with(&guard).size_of(&mut ops);
         n
     })
 }
 
 macro_rules! get_longhand_from_id {
     ($id:expr) => {
         match PropertyId::from_nscsspropertyid($id) {
             Ok(PropertyId::Longhand(long)) => long,
             _ => {
                 panic!("stylo: unknown presentation property with id");
-            }
+            },
         }
     };
 }
 
 macro_rules! match_wrap_declared {
     ($longhand:ident, $($property:ident => $inner:expr,)*) => (
         match $longhand {
             $(
@@ -4069,42 +4296,42 @@ pub extern "C" fn Servo_DeclarationBlock
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_DeclarationBlock_SetIdentStringValue(
     declarations: RawServoDeclarationBlockBorrowed,
     property: nsCSSPropertyID,
     value: *mut nsAtom,
 ) {
-    use style::properties::{PropertyDeclaration, LonghandId};
     use style::properties::longhands::_x_lang::computed_value::T as Lang;
+    use style::properties::{LonghandId, PropertyDeclaration};
 
     let long = get_longhand_from_id!(property);
     let prop = match_wrap_declared! { long,
         XLang => Lang(Atom::from_raw(value)),
     };
     write_locked_arc(declarations, |decls: &mut PropertyDeclarationBlock| {
         decls.push(prop, Importance::Normal);
     })
 }
 
 #[no_mangle]
 #[allow(unreachable_code)]
 pub extern "C" fn Servo_DeclarationBlock_SetKeywordValue(
     declarations: RawServoDeclarationBlockBorrowed,
     property: nsCSSPropertyID,
-    value: i32
+    value: i32,
 ) {
     use num_traits::FromPrimitive;
-    use style::properties::{PropertyDeclaration, LonghandId};
     use style::properties::longhands;
+    use style::properties::{LonghandId, PropertyDeclaration};
+    use style::values::generics::font::FontStyle;
     use style::values::specified::BorderStyle;
     use style::values::specified::Display;
     use style::values::specified::{Clear, Float};
-    use style::values::generics::font::FontStyle;
 
     let long = get_longhand_from_id!(property);
     let value = value as u32;
 
     let prop = match_wrap_declared! { long,
         MozUserModify => longhands::_moz_user_modify::SpecifiedValue::from_gecko_keyword(value),
         Direction => longhands::direction::SpecifiedValue::from_gecko_keyword(value),
         Display => Display::from_u32(value).unwrap(),
@@ -4163,44 +4390,44 @@ pub extern "C" fn Servo_DeclarationBlock
         decls.push(prop, Importance::Normal);
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_SetIntValue(
     declarations: RawServoDeclarationBlockBorrowed,
     property: nsCSSPropertyID,
-    value: i32
+    value: i32,
 ) {
-    use style::properties::{PropertyDeclaration, LonghandId};
     use style::properties::longhands::_moz_script_level::SpecifiedValue as MozScriptLevel;
     use style::properties::longhands::_x_span::computed_value::T as Span;
+    use style::properties::{LonghandId, PropertyDeclaration};
 
     let long = get_longhand_from_id!(property);
     let prop = match_wrap_declared! { long,
         XSpan => Span(value),
         // Gecko uses Integer values to signal that it is relative
         MozScriptLevel => MozScriptLevel::Relative(value),
     };
     write_locked_arc(declarations, |decls: &mut PropertyDeclarationBlock| {
         decls.push(prop, Importance::Normal);
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_SetPixelValue(
     declarations: RawServoDeclarationBlockBorrowed,
     property: nsCSSPropertyID,
-    value: f32
+    value: f32,
 ) {
-    use style::properties::{PropertyDeclaration, LonghandId};
     use style::properties::longhands::border_spacing::SpecifiedValue as BorderSpacing;
+    use style::properties::{LonghandId, PropertyDeclaration};
     use style::values::generics::length::MozLength;
-    use style::values::specified::{BorderSideWidth, BorderCornerRadius};
-    use style::values::specified::length::{NoCalcLength, NonNegativeLength, LengthOrPercentage};
+    use style::values::specified::length::{LengthOrPercentage, NoCalcLength, NonNegativeLength};
+    use style::values::specified::{BorderCornerRadius, BorderSideWidth};
 
     let long = get_longhand_from_id!(property);
     let nocalc = NoCalcLength::from_px(value);
 
     let prop = match_wrap_declared! { long,
         Height => MozLength::LengthOrPercentageOrAuto(nocalc.into()),
         Width => MozLength::LengthOrPercentageOrAuto(nocalc.into()),
         BorderTopWidth => BorderSideWidth::Length(nocalc.into()),
@@ -4236,42 +4463,49 @@ pub extern "C" fn Servo_DeclarationBlock
             Box::new(BorderCornerRadius::new(length.clone(), length))
         },
     };
     write_locked_arc(declarations, |decls: &mut PropertyDeclarationBlock| {
         decls.push(prop, Importance::Normal);
     })
 }
 
-
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_SetLengthValue(
     declarations: RawServoDeclarationBlockBorrowed,
     property: nsCSSPropertyID,
     value: f32,
     unit: structs::nsCSSUnit,
 ) {
-    use style::properties::{PropertyDeclaration, LonghandId};
     use style::properties::longhands::_moz_script_min_size::SpecifiedValue as MozScriptMinSize;
+    use style::properties::{LonghandId, PropertyDeclaration};
     use style::values::generics::length::MozLength;
     use style::values::specified::length::{AbsoluteLength, FontRelativeLength};
     use style::values::specified::length::{LengthOrPercentage, NoCalcLength};
 
     let long = get_longhand_from_id!(property);
     let nocalc = match unit {
-        structs::nsCSSUnit::eCSSUnit_EM => NoCalcLength::FontRelative(FontRelativeLength::Em(value)),
-        structs::nsCSSUnit::eCSSUnit_XHeight => NoCalcLength::FontRelative(FontRelativeLength::Ex(value)),
+        structs::nsCSSUnit::eCSSUnit_EM => {
+            NoCalcLength::FontRelative(FontRelativeLength::Em(value))
+        },
+        structs::nsCSSUnit::eCSSUnit_XHeight => {
+            NoCalcLength::FontRelative(FontRelativeLength::Ex(value))
+        },
         structs::nsCSSUnit::eCSSUnit_Pixel => NoCalcLength::Absolute(AbsoluteLength::Px(value)),
         structs::nsCSSUnit::eCSSUnit_Inch => NoCalcLength::Absolute(AbsoluteLength::In(value)),
-        structs::nsCSSUnit::eCSSUnit_Centimeter => NoCalcLength::Absolute(AbsoluteLength::Cm(value)),
-        structs::nsCSSUnit::eCSSUnit_Millimeter => NoCalcLength::Absolute(AbsoluteLength::Mm(value)),
+        structs::nsCSSUnit::eCSSUnit_Centimeter => {
+            NoCalcLength::Absolute(AbsoluteLength::Cm(value))
+        },
+        structs::nsCSSUnit::eCSSUnit_Millimeter => {
+            NoCalcLength::Absolute(AbsoluteLength::Mm(value))
+        },
         structs::nsCSSUnit::eCSSUnit_Point => NoCalcLength::Absolute(AbsoluteLength::Pt(value)),
         structs::nsCSSUnit::eCSSUnit_Pica => NoCalcLength::Absolute(AbsoluteLength::Pc(value)),
         structs::nsCSSUnit::eCSSUnit_Quarter => NoCalcLength::Absolute(AbsoluteLength::Q(value)),
-        _ => unreachable!("Unknown unit passed to SetLengthValue")
+        _ => unreachable!("Unknown unit passed to SetLengthValue"),
     };
 
     let prop = match_wrap_declared! { long,
         Width => MozLength::LengthOrPercentageOrAuto(nocalc.into()),
         FontSize => LengthOrPercentage::from(nocalc).into(),
         MozScriptMinSize => MozScriptMinSize(nocalc),
     };
     write_locked_arc(declarations, |decls: &mut PropertyDeclarationBlock| {
@@ -4280,19 +4514,19 @@ pub extern "C" fn Servo_DeclarationBlock
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_SetNumberValue(
     declarations: RawServoDeclarationBlockBorrowed,
     property: nsCSSPropertyID,
     value: f32,
 ) {
-    use style::properties::{PropertyDeclaration, LonghandId};
     use style::properties::longhands::_moz_script_level::SpecifiedValue as MozScriptLevel;
     use style::properties::longhands::_moz_script_size_multiplier::SpecifiedValue as MozScriptSizeMultiplier;
+    use style::properties::{LonghandId, PropertyDeclaration};
 
     let long = get_longhand_from_id!(property);
 
     let prop = match_wrap_declared! { long,
         MozScriptSizeMultiplier => MozScriptSizeMultiplier(value),
         // Gecko uses Number values to signal that it is absolute
         MozScriptLevel => MozScriptLevel::MozAbsolute(value as i32),
     };
@@ -4302,17 +4536,17 @@ pub extern "C" fn Servo_DeclarationBlock
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_SetPercentValue(
     declarations: RawServoDeclarationBlockBorrowed,
     property: nsCSSPropertyID,
     value: f32,
 ) {
-    use style::properties::{PropertyDeclaration, LonghandId};
+    use style::properties::{LonghandId, PropertyDeclaration};
     use style::values::computed::Percentage;
     use style::values::generics::length::MozLength;
     use style::values::specified::length::LengthOrPercentage;
 
     let long = get_longhand_from_id!(property);
     let pc = Percentage(value);
 
     let prop = match_wrap_declared! { long,
@@ -4329,17 +4563,17 @@ pub extern "C" fn Servo_DeclarationBlock
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_SetAutoValue(
     declarations: RawServoDeclarationBlockBorrowed,
     property: nsCSSPropertyID,
 ) {
-    use style::properties::{PropertyDeclaration, LonghandId};
+    use style::properties::{LonghandId, PropertyDeclaration};
     use style::values::specified::{LengthOrPercentageOrAuto, MozLength};
 
     let long = get_longhand_from_id!(property);
     let auto = LengthOrPercentageOrAuto::Auto;
 
     let prop = match_wrap_declared! { long,
         Height => MozLength::auto(),
         Width => MozLength::auto(),
@@ -4353,17 +4587,17 @@ pub extern "C" fn Servo_DeclarationBlock
     })
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_SetCurrentColor(
     declarations: RawServoDeclarationBlockBorrowed,
     property: nsCSSPropertyID,
 ) {
-    use style::properties::{PropertyDeclaration, LonghandId};
+    use style::properties::{LonghandId, PropertyDeclaration};
     use style::values::specified::Color;
 
     let long = get_longhand_from_id!(property);
     let cc = Color::currentcolor();
 
     let prop = match_wrap_declared! { long,
         BorderTopColor => cc,
         BorderRightColor => cc,
@@ -4377,18 +4611,18 @@ pub extern "C" fn Servo_DeclarationBlock
 
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_SetColorValue(
     declarations: RawServoDeclarationBlockBorrowed,
     property: nsCSSPropertyID,
     value: structs::nscolor,
 ) {
     use style::gecko::values::convert_nscolor_to_rgba;
-    use style::properties::{PropertyDeclaration, LonghandId};
     use style::properties::longhands;
+    use style::properties::{LonghandId, PropertyDeclaration};
     use style::values::specified::Color;
 
     let long = get_longhand_from_id!(property);
     let rgba = convert_nscolor_to_rgba(value);
     let color = Color::rgba(rgba);
 
     let prop = match_wrap_declared! { long,
         BorderTopColor => color,
@@ -4404,18 +4638,18 @@ pub extern "C" fn Servo_DeclarationBlock
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_SetFontFamily(
     declarations: RawServoDeclarationBlockBorrowed,
     value: *const nsAString,
 ) {
     use cssparser::{Parser, ParserInput};
+    use style::properties::longhands::font_family::SpecifiedValue as FontFamily;
     use style::properties::PropertyDeclaration;
-    use style::properties::longhands::font_family::SpecifiedValue as FontFamily;
 
     let string = unsafe { (*value).to_string() };
     let mut input = ParserInput::new(&string);
     let mut parser = Parser::new(&mut input);
     let result = FontFamily::parse_specified(&mut parser);
     if let Ok(family) = result {
         if parser.is_exhausted() {
             let decl = PropertyDeclaration::FontFamily(family);
@@ -4427,37 +4661,37 @@ pub extern "C" fn Servo_DeclarationBlock
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_SetBackgroundImage(
     declarations: RawServoDeclarationBlockBorrowed,
     value: *const nsAString,
     raw_extra_data: *mut URLExtraData,
 ) {
+    use style::properties::longhands::background_image::SpecifiedValue as BackgroundImage;
     use style::properties::PropertyDeclaration;
-    use style::properties::longhands::background_image::SpecifiedValue as BackgroundImage;
-    use style::values::Either;
     use style::values::generics::image::Image;
     use style::values::specified::url::SpecifiedImageUrl;
+    use style::values::Either;
 
     let url_data = unsafe { UrlExtraData::from_ptr_ref(&raw_extra_data) };
     let string = unsafe { (*value).to_string() };
     let context = ParserContext::new(
         Origin::Author,
         url_data,
         Some(CssRuleType::Style),
         ParsingMode::DEFAULT,
         QuirksMode::NoQuirks,
         None,
         None,
     );
     let url = SpecifiedImageUrl::parse_from_string(string.into(), &context);
-    let decl = PropertyDeclaration::BackgroundImage(BackgroundImage(
-        vec![Either::Second(Image::Url(url))]
-    ));
+    let decl = PropertyDeclaration::BackgroundImage(BackgroundImage(vec![Either::Second(
+        Image::Url(url),
+    )]));
     write_locked_arc(declarations, |decls: &mut PropertyDeclarationBlock| {
         decls.push(decl, Importance::Normal);
     });
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_DeclarationBlock_SetTextDecorationColorOverride(
     declarations: RawServoDeclarationBlockBorrowed,
@@ -4484,17 +4718,18 @@ pub unsafe extern "C" fn Servo_CSSSuppor
     parse_property_into(
         &mut declarations,
         id,
         value,
         DUMMY_URL_DATA,
         structs::ParsingMode_Default,
         QuirksMode::NoQuirks,
         None,
-    ).is_ok()
+    )
+    .is_ok()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_CSSSupports(cond: *const nsACString) -> bool {
     let condition = unsafe { cond.as_ref().unwrap().as_str_unchecked() };
     let mut input = ParserInput::new(&condition);
     let mut input = Parser::new(&mut input);
     let cond = match input.parse_entirely(parse_condition_or_declaration) {
@@ -4528,53 +4763,58 @@ pub unsafe extern "C" fn Servo_NoteExpli
     GeckoElement(element).note_explicit_hints(restyle_hint, change_hint);
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_TakeChangeHint(
     element: RawGeckoElementBorrowed,
     was_restyled: *mut bool,
 ) -> u32 {
-    let was_restyled =  unsafe { was_restyled.as_mut().unwrap() };
+    let was_restyled = unsafe { was_restyled.as_mut().unwrap() };
     let element = GeckoElement(element);
 
     let damage = match element.mutate_data() {
         Some(mut data) => {
             *was_restyled = data.is_restyle();
 
             let damage = data.damage;
             data.clear_restyle_state();
             damage
-        }
+        },
         None => {
             warn!("Trying to get change hint from unstyled element");
             *was_restyled = false;
             GeckoRestyleDamage::empty()
-        }
+        },
     };
 
     debug!("Servo_TakeChangeHint: {:?}, damage={:?}", element, damage);
     // We'd like to return `nsChangeHint` here, but bindgen bitfield enums don't
     // work as return values with the Linux 32-bit ABI at the moment because
     // they wrap the value in a struct, so for now just unwrap it.
     damage.as_change_hint().0
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ResolveStyle(
     element: RawGeckoElementBorrowed,
     _raw_data: RawServoStyleSetBorrowed,
 ) -> ComputedStyleStrong {
     let element = GeckoElement(element);
     debug!("Servo_ResolveStyle: {:?}", element);
-    let data =
-        element.borrow_data().expect("Resolving style on unstyled element");
-
-    debug_assert!(element.has_current_styles(&*data),
-                  "Resolving style on {:?} without current styles: {:?}", element, data);
+    let data = element
+        .borrow_data()
+        .expect("Resolving style on unstyled element");
+
+    debug_assert!(
+        element.has_current_styles(&*data),
+        "Resolving style on {:?} without current styles: {:?}",
+        element,
+        data
+    );
     data.styles.primary().clone().into()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ResolveStyleLazily(
     element: RawGeckoElementBorrowed,
     pseudo_type: CSSPseudoElementType,
     rule_inclusion: StyleRuleInclusion,
@@ -4598,17 +4838,17 @@ pub extern "C" fn Servo_ResolveStyleLazi
                     pseudo,
                     rule_inclusion,
                     styles,
                     /* inherited_styles = */ None,
                     &*data,
                     is_probe,
                     /* matching_func = */ None,
                 )
-            }
+            },
             None => Some(styles.primary().clone()),
         }
     };
 
     let is_before_or_after = pseudo.as_ref().map_or(false, |p| p.is_before_or_after());
 
     // In the common case we already have the style. Check that before setting
     // up all the computation machinery.
@@ -4625,33 +4865,30 @@ pub extern "C" fn Servo_ResolveStyleLazi
             }
         });
         if let Some(result) = styles {
             return result.into();
         }
     }
 
     // We don't have the style ready. Go ahead and compute it as necessary.
-    let shared = create_shared_context(&global_style_data,
-                                       &guard,
-                                       &data,
-                                       TraversalFlags::empty(),
-                                       unsafe { &*snapshots });
+    let shared = create_shared_context(
+        &global_style_data,
+        &guard,
+        &data,
+        TraversalFlags::empty(),
+        unsafe { &*snapshots },
+    );
     let mut tlc = ThreadLocalStyleContext::new(&shared);
     let mut context = StyleContext {
         shared: &shared,
         thread_local: &mut tlc,
     };
 
-    let styles = resolve_style(
-        &mut context,
-        element,
-        rule_inclusion,
-        pseudo.as_ref()
-    );
+    let styles = resolve_style(&mut context, element, rule_inclusion, pseudo.as_ref());
 
     finish(&styles, /* is_probe = */ false)
         .expect("We're not probing, so we should always get a style back")
         .into()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ReparentStyle(
@@ -4665,28 +4902,31 @@ pub extern "C" fn Servo_ReparentStyle(
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     let doc_data = PerDocumentStyleData::from_ffi(raw_data).borrow();
     let inputs = CascadeInputs::new_from_style(style_to_reparent);
     let metrics = get_metrics_provider_for_product();
     let pseudo = style_to_reparent.pseudo();
     let element = element.map(GeckoElement);
 
-    doc_data.stylist.cascade_style_and_visited(
-        element,
-        pseudo.as_ref(),
-        inputs,
-        &StylesheetGuards::same(&guard),
-        Some(parent_style),
-        Some(parent_style_ignoring_first_line),
-        Some(layout_parent_style),
-        &metrics,
-        /* rule_cache = */ None,
-        &mut RuleCacheConditions::default(),
-    ).into()
+    doc_data
+        .stylist
+        .cascade_style_and_visited(
+            element,
+            pseudo.as_ref(),
+            inputs,
+            &StylesheetGuards::same(&guard),
+            Some(parent_style),
+            Some(parent_style_ignoring_first_line),
+            Some(layout_parent_style),
+            &metrics,
+            /* rule_cache = */ None,
+            &mut RuleCacheConditions::default(),
+        )
+        .into()
 }
 
 #[cfg(feature = "gecko_debug")]
 fn simulate_compute_values_failure(property: &PropertyValuePair) -> bool {
     let p = property.mProperty;
     let id = get_property_id_from_nscsspropertyid!(p, false);
     id.as_shorthand().is_ok() && property.mSimulateComputeValuesFailure
 }
@@ -4701,21 +4941,17 @@ fn create_context_for_animation<'a>(
     font_metrics_provider: &'a FontMetricsProvider,
     style: &'a ComputedValues,
     parent_style: Option<&'a ComputedValues>,
     for_smil_animation: bool,
     rule_cache_conditions: &'a mut RuleCacheConditions,
 ) -> Context<'a> {
     Context {
         is_root_element: false,
-        builder: StyleBuilder::for_animation(
-            per_doc_data.stylist.device(),
-            style,
-            parent_style,
-        ),
+        builder: StyleBuilder::for_animation(per_doc_data.stylist.device(), style, parent_style),
         font_metrics_provider: font_metrics_provider,
         cached_system_font: None,
         in_media_query: false,
         quirks_mode: per_doc_data.stylist.quirks_mode(),
         for_smil_animation,
         for_non_inherited_property: None,
         rule_cache_conditions: RefCell::new(rule_cache_conditions),
     }
@@ -4734,63 +4970,68 @@ struct PrioritizedPropertyIter<'a> {
 
 impl<'a> PrioritizedPropertyIter<'a> {
     fn new(properties: &'a [PropertyValuePair]) -> PrioritizedPropertyIter {
         use style::values::animated::compare_property_priority;
 
         // If we fail to convert a nsCSSPropertyID into a PropertyId we
         // shouldn't fail outright but instead by treating that property as the
         // 'all' property we make it sort last.
-        let mut sorted_property_indices: Vec<PropertyAndIndex> =
-            properties.iter().enumerate().map(|(index, pair)| {
-                let property =
-                    PropertyId::from_nscsspropertyid(pair.mProperty)
-                        .unwrap_or(PropertyId::Shorthand(ShorthandId::All));
+        let mut sorted_property_indices: Vec<PropertyAndIndex> = properties
+            .iter()
+            .enumerate()
+            .map(|(index, pair)| {
+                let property = PropertyId::from_nscsspropertyid(pair.mProperty)
+                    .unwrap_or(PropertyId::Shorthand(ShorthandId::All));
 
                 PropertyAndIndex { property, index }
-            }).collect();
+            })
+            .collect();
         sorted_property_indices.sort_by(|a, b| compare_property_priority(&a.property, &b.property));
 
         PrioritizedPropertyIter {
             properties,
             sorted_property_indices,
             curr: 0,
         }
     }
 }
 
 impl<'a> Iterator for PrioritizedPropertyIter<'a> {
     type Item = &'a PropertyValuePair;
 
     fn next(&mut self) -> Option<&'a PropertyValuePair> {
         if self.curr >= self.sorted_property_indices.len() {
-            return None
+            return None;
         }
         self.curr += 1;
         Some(&self.properties[self.sorted_property_indices[self.curr - 1].index])
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_GetComputedKeyframeValues(
     keyframes: RawGeckoKeyframeListBorrowed,
     element: RawGeckoElementBorrowed,
     style: ComputedStyleBorrowed,
     raw_data: RawServoStyleSetBorrowed,
-    computed_keyframes: RawGeckoComputedKeyframeValuesListBorrowedMut
+    computed_keyframes: RawGeckoComputedKeyframeValuesListBorrowedMut,
 ) {
     use style::properties::LonghandIdSet;
 
     let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
     let metrics = get_metrics_provider_for_product();
 
     let element = GeckoElement(element);
     let parent_element = element.inheritance_parent();
     let parent_data = parent_element.as_ref().and_then(|e| e.borrow_data());
-    let parent_style = parent_data.as_ref().map(|d| d.styles.primary()).map(|x| &**x);
+    let parent_style = parent_data
+        .as_ref()
+        .map(|d| d.styles.primary())
+        .map(|x| &**x);
 
     let mut conditions = Default::default();
     let mut context = create_context_for_animation(
         &data,
         &metrics,
         &style,
         parent_style,
         /* for_smil_animation = */ false,
@@ -4802,61 +5043,65 @@ pub extern "C" fn Servo_GetComputedKeyfr
     let default_values = data.default_computed_values();
 
     let mut raw_custom_properties_block; // To make the raw block alive in the scope.
     for (index, keyframe) in keyframes.iter().enumerate() {
         let mut custom_properties = None;
         for property in keyframe.mPropertyValues.iter() {
             // Find the block for custom properties first.
             if property.mProperty == nsCSSPropertyID::eCSSPropertyExtra_variable {
-                raw_custom_properties_block = unsafe {
-                    &*property.mServoDeclarationBlock.mRawPtr.clone()
-                };
-                let guard = Locked::<PropertyDeclarationBlock>::as_arc(
-                    &raw_custom_properties_block).read_with(&guard);
+                raw_custom_properties_block =
+                    unsafe { &*property.mServoDeclarationBlock.mRawPtr.clone() };
+                let guard =
+                    Locked::<PropertyDeclarationBlock>::as_arc(&raw_custom_properties_block)
+                        .read_with(&guard);
                 custom_properties = guard.cascade_custom_properties_with_context(&context);
                 // There should be one PropertyDeclarationBlock for custom properties.
                 break;
             }
         }
 
         let ref mut animation_values = computed_keyframes[index];
 
         let mut seen = LonghandIdSet::new();
 
         let mut property_index = 0;
         for property in PrioritizedPropertyIter::new(&keyframe.mPropertyValues) {
             if simulate_compute_values_failure(property) {
                 continue;
             }
 
-            let mut maybe_append_animation_value = |property: LonghandId, value: Option<AnimationValue>| {
-                debug_assert!(!property.is_logical());
-                if seen.contains(property) {
-                    return;
-                }
-                seen.insert(property);
-
-                // This is safe since we immediately write to the uninitialized values.
-                unsafe { animation_values.set_len((property_index + 1) as u32) };
-                animation_values[property_index].mProperty = property.to_nscsspropertyid();
-                match value {
-                    Some(v) => {
-                        animation_values[property_index].mValue.mServo.set_arc_leaky(Arc::new(v));
-                    },
-                    None => {
-                        animation_values[property_index].mValue.mServo.mRawPtr = ptr::null_mut();
-                    },
-                }
-                property_index += 1;
-            };
+            let mut maybe_append_animation_value =
+                |property: LonghandId, value: Option<AnimationValue>| {
+                    debug_assert!(!property.is_logical());
+                    if seen.contains(property) {
+                        return;
+                    }
+                    seen.insert(property);
+
+                    // This is safe since we immediately write to the uninitialized values.
+                    unsafe { animation_values.set_len((property_index + 1) as u32) };
+                    animation_values[property_index].mProperty = property.to_nscsspropertyid();
+                    match value {
+                        Some(v) => {
+                            animation_values[property_index]
+                                .mValue
+                                .mServo
+                                .set_arc_leaky(Arc::new(v));
+                        },
+                        None => {
+                            animation_values[property_index].mValue.mServo.mRawPtr =
+                                ptr::null_mut();
+                        },
+                    }
+                    property_index += 1;
+                };
 
             if property.mServoDeclarationBlock.mRawPtr.is_null() {
-                let property =
-                    LonghandId::from_nscsspropertyid(property.mProperty);
+                let property = LonghandId::from_nscsspropertyid(property.mProperty);
                 if let Ok(prop) = property {
                     maybe_append_animation_value(prop, None);
                 }
                 continue;
             }
 
             let declarations = unsafe { &*property.mServoDeclarationBlock.mRawPtr.clone() };
             let declarations = Locked::<PropertyDeclarationBlock>::as_arc(&declarations);
@@ -4884,17 +5129,20 @@ pub extern "C" fn Servo_GetAnimationValu
     animation_values: RawGeckoServoAnimationValueListBorrowedMut,
 ) {
     let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
     let metrics = get_metrics_provider_for_product();
 
     let element = GeckoElement(element);
     let parent_element = element.inheritance_parent();
     let parent_data = parent_element.as_ref().and_then(|e| e.borrow_data());
-    let parent_style = parent_data.as_ref().map(|d| d.styles.primary()).map(|x| &**x);
+    let parent_style = parent_data
+        .as_ref()
+        .map(|d| d.styles.primary())
+        .map(|x| &**x);
 
     let mut conditions = Default::default();
     let mut context = create_context_for_animation(
         &data,
         &metrics,
         &style,
         parent_style,
         /* for_smil_animation = */ true,
@@ -4926,63 +5174,74 @@ pub extern "C" fn Servo_AnimationValue_C
     raw_data: RawServoStyleSetBorrowed,
 ) -> RawServoAnimationValueStrong {
     let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
     let metrics = get_metrics_provider_for_product();
 
     let element = GeckoElement(element);
     let parent_element = element.inheritance_parent();
     let parent_data = parent_element.as_ref().and_then(|e| e.borrow_data());
-    let parent_style = parent_data.as_ref().map(|d| d.styles.primary()).map(|x| &**x);
+    let parent_style = parent_data
+        .as_ref()
+        .map(|d| d.styles.primary())
+        .map(|x| &**x);
 
     let mut conditions = Default::default();
     let mut context = create_context_for_animation(
         &data,
         &metrics,
         style,
         parent_style,
         /* for_smil_animation = */ false,
         &mut conditions,
     );
 
     let default_values = data.default_computed_values();
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     let declarations = Locked::<PropertyDeclarationBlock>::as_arc(&declarations);
     // We only compute the first element in declarations.
-    match declarations.read_with(&guard).declaration_importance_iter().next() {
+    match declarations
+        .read_with(&guard)
+        .declaration_importance_iter()
+        .next()
+    {
         Some((decl, imp)) if imp == Importance::Normal => {
             let animation = AnimationValue::from_declaration(
                 decl,
                 &mut context,
                 None, // No extra custom properties for devtools.
                 default_values,
             );
             animation.map_or(RawServoAnimationValueStrong::null(), |value| {
                 Arc::new(value).into_strong()
             })
         },
-        _ => RawServoAnimationValueStrong::null()
+        _ => RawServoAnimationValueStrong::null(),
     }
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_AssertTreeIsClean(root: RawGeckoElementBorrowed) {
     if !cfg!(feature = "gecko_debug") {
         panic!("Calling Servo_AssertTreeIsClean in release build");
     }
 
     let root = GeckoElement(root);
     debug!("Servo_AssertTreeIsClean: ");
     debug!("{:?}", ShowSubtreeData(root.as_node()));
 
     fn assert_subtree_is_clean<'le>(el: GeckoElement<'le>) {
-        debug_assert!(!el.has_dirty_descendants() && !el.has_animation_only_dirty_descendants(),
-                      "{:?} has still dirty bit {:?} or animation-only dirty bit {:?}",
-                      el, el.has_dirty_descendants(), el.has_animation_only_dirty_descendants());
+        debug_assert!(
+            !el.has_dirty_descendants() && !el.has_animation_only_dirty_descendants(),
+            "{:?} has still dirty bit {:?} or animation-only dirty bit {:?}",
+            el,
+            el.has_dirty_descendants(),
+            el.has_animation_only_dirty_descendants()
+        );
         for child in el.traversal_children() {
             if let Some(child) = child.as_element() {
                 assert_subtree_is_clean(child);
             }
         }
     }
 
     assert_subtree_is_clean(root);
@@ -4990,47 +5249,43 @@ pub extern "C" fn Servo_AssertTreeIsClea
 
 #[no_mangle]
 pub extern "C" fn Servo_IsWorkerThread() -> bool {
     thread_state::get().is_worker()
 }
 
 enum Offset {
     Zero,
-    One
+    One,
 }
 
 fn fill_in_missing_keyframe_values(
     all_properties: &LonghandIdSet,
     timing_function: nsTimingFunctionBorrowed,
     longhands_at_offset: &LonghandIdSet,
     offset: Offset,
     keyframes: RawGeckoKeyframeListBorrowedMut,
 ) {
     // Return early if all animated properties are already set.
     if longhands_at_offset.contains_all(all_properties) {
         return;
     }
 
     let keyframe = match offset {
-        Offset::Zero => unsafe {
-            Gecko_GetOrCreateInitialKeyframe(keyframes, timing_function)
-        },
-        Offset::One => unsafe {
-            Gecko_GetOrCreateFinalKeyframe(keyframes, timing_function)
-        },
+        Offset::Zero => unsafe { Gecko_GetOrCreateInitialKeyframe(keyframes, timing_function) },
+        Offset::One => unsafe { Gecko_GetOrCreateFinalKeyframe(keyframes, timing_function) },
     };
 
     // Append properties that have not been set at this offset.
     for property in all_properties.iter() {
         if !longhands_at_offset.contains(property) {
             unsafe {
                 Gecko_AppendPropertyValuePair(
                     &mut (*keyframe).mPropertyValues,
-                    property.to_nscsspropertyid()
+                    property.to_nscsspropertyid(),
                 );
             }
         }
     }
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_StyleSet_GetKeyframesForName(
@@ -5073,17 +5328,17 @@ pub unsafe extern "C" fn Servo_StyleSet_
             current_offset = step.start_percentage.0;
         }
 
         // Override timing_function if the keyframe has an animation-timing-function.
         let timing_function = nsTimingFunction {
             mTiming: match step.get_animation_timing_function(&guard) {
                 Some(val) => val.to_computed_value_without_context(),
                 None => (*inherited_timing_function).mTiming,
-            }
+            },
         };
 
         // Look for an existing keyframe with the same offset and timing
         // function or else add a new keyframe at the beginning of the keyframe
         // array.
         let keyframe = Gecko_GetOrCreateKeyframeAtStart(
             keyframes,
             step.start_percentage.0 as f32,
@@ -5138,60 +5393,57 @@ pub unsafe extern "C" fn Servo_StyleSet_
                                 continue;
                             }
 
                             if !id.is_animatable() {
                                 continue;
                             }
 
                             id.to_physical(writing_mode)
-                        }
+                        },
                         PropertyDeclarationId::Custom(..) => {
-                            custom_properties.push(
-                                declaration.clone(),
-                                Importance::Normal,
-                            );
+                            custom_properties.push(declaration.clone(), Importance::Normal);
                             continue;
-                        }
+                        },
                     };
 
                     if properties_set_at_current_offset.contains(id) {
                         continue;
                     }
 
                     let pair = Gecko_AppendPropertyValuePair(
                         &mut (*keyframe).mPropertyValues,
                         id.to_nscsspropertyid(),
                     );
 
-                    (*pair).mServoDeclarationBlock.set_arc_leaky(
-                        Arc::new(global_style_data.shared_lock.wrap(
-                            PropertyDeclarationBlock::with_one(
+                    (*pair).mServoDeclarationBlock.set_arc_leaky(Arc::new(
+                        global_style_data
+                            .shared_lock
+                            .wrap(PropertyDeclarationBlock::with_one(
                                 declaration.to_physical(writing_mode),
                                 Importance::Normal,
-                            )
-                        ))
-                    );
+                            )),
+                    ));
 
                     if current_offset == 0.0 {
                         properties_set_at_start.insert(id);
                     } else if current_offset == 1.0 {
                         properties_set_at_end.insert(id);
                     }
                     properties_set_at_current_offset.insert(id);
                 }
 
                 if custom_properties.any_normal() {
                     let pair = Gecko_AppendPropertyValuePair(
                         &mut (*keyframe).mPropertyValues,
                         nsCSSPropertyID::eCSSPropertyExtra_variable,
                     );
 
                     (*pair).mServoDeclarationBlock.set_arc_leaky(Arc::new(
-                        global_style_data.shared_lock.wrap(custom_properties)
+                        global_style_data.shared_lock.wrap(custom_properties),
                     ));
                 }
             },
         }
     }
 
     let mut properties_changed = LonghandIdSet::new();
     for property in animation.properties_changed.iter() {
@@ -5271,29 +5523,29 @@ pub unsafe extern "C" fn Servo_StyleSet_
 pub extern "C" fn Servo_StyleSet_BuildFontFeatureValueSet(
     raw_data: RawServoStyleSetBorrowed,
 ) -> *mut gfxFontFeatureValueSet {
     let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
 
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
 
-    let has_rule =
-        data.stylist
-            .iter_extra_data_origins()
-            .any(|(d, _)| !d.font_feature_values.is_empty());
+    let has_rule = data
+        .stylist
+        .iter_extra_data_origins()
+        .any(|(d, _)| !d.font_feature_values.is_empty());
 
     if !has_rule {
-      return ptr::null_mut();
+        return ptr::null_mut();
     }
 
-    let font_feature_values_iter =
-        data.stylist
-            .iter_extra_data_origins_rev()
-            .flat_map(|(d, _)| d.font_feature_values.iter());
+    let font_feature_values_iter = data
+        .stylist
+        .iter_extra_data_origins_rev()
+        .flat_map(|(d, _)| d.font_feature_values.iter());
 
     let set = unsafe { Gecko_ConstructFontFeatureValueSet() };
     for src in font_feature_values_iter {
         let rule = src.read_with(&guard);
         rule.set_at_rules(set);
     }
     set
 }
@@ -5311,47 +5563,50 @@ pub extern "C" fn Servo_StyleSet_Resolve
 
     let parent_style = match parent_style_context {
         Some(parent) => &*parent,
         None => doc_data.default_computed_values(),
     };
 
     let declarations = Locked::<PropertyDeclarationBlock>::as_arc(&declarations);
 
-    doc_data.stylist.compute_for_declarations::<GeckoElement>(
-        &guards,
-        parent_style,
-        declarations.clone_arc(),
-    ).into()
+    doc_data
+        .stylist
+        .compute_for_declarations::<GeckoElement>(&guards, parent_style, declarations.clone_arc())
+        .into()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_AddSizeOfExcludingThis(
     malloc_size_of: GeckoMallocSizeOf,
     malloc_enclosing_size_of: GeckoMallocSizeOf,
     sizes: *mut ServoStyleSetSizes,
-    raw_data: RawServoStyleSetBorrowed
+    raw_data: RawServoStyleSetBorrowed,
 ) {
     let data = PerDocumentStyleData::from_ffi(raw_data).borrow_mut();
-    let mut ops = MallocSizeOfOps::new(malloc_size_of.unwrap(),
-                                       Some(malloc_enclosing_size_of.unwrap()),
-                                       None);
+    let mut ops = MallocSizeOfOps::new(
+        malloc_size_of.unwrap(),
+        Some(malloc_enclosing_size_of.unwrap()),
+        None,
+    );
     let sizes = unsafe { sizes.as_mut() }.unwrap();
     data.add_size_of(&mut ops, sizes);
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_UACache_AddSizeOf(
     malloc_size_of: GeckoMallocSizeOf,
     malloc_enclosing_size_of: GeckoMallocSizeOf,
-    sizes: *mut ServoStyleSetSizes
+    sizes: *mut ServoStyleSetSizes,
 ) {
-    let mut ops = MallocSizeOfOps::new(malloc_size_of.unwrap(),
-                                       Some(malloc_enclosing_size_of.unwrap()),
-                                       None);
+    let mut ops = MallocSizeOfOps::new(
+        malloc_size_of.unwrap(),
+        Some(malloc_enclosing_size_of.unwrap()),
+        None,
+    );
     let sizes = unsafe { sizes.as_mut() }.unwrap();
     add_size_of_ua_cache(&mut ops, sizes);
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_MightHaveAttributeDependency(
     raw_data: RawServoStyleSetBorrowed,
     element: RawGeckoElementBorrowed,
@@ -5375,19 +5630,18 @@ pub extern "C" fn Servo_StyleSet_HasStat
     element: RawGeckoElementBorrowed,
     state: u64,
 ) -> bool {
     let element = GeckoElement(element);
 
     let state = ElementState::from_bits_truncate(state);
     let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
 
-    data.stylist.any_applicable_rule_data(element, |data| {
-        data.has_state_dependency(state)
-    })
+    data.stylist
+        .any_applicable_rule_data(element, |data| data.has_state_dependency(state))
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_StyleSet_HasDocumentStateDependency(
     raw_data: RawServoStyleSetBorrowed,
     state: u64,
 ) -> bool {
     let state = DocumentState::from_bits_truncate(state);
@@ -5401,47 +5655,51 @@ pub unsafe extern "C" fn Servo_GetProper
     style: ComputedStyleBorrowed,
     prop: nsCSSPropertyID,
     value: *mut nsAString,
 ) {
     use style::properties::PropertyFlags;
 
     if let Ok(longhand) = LonghandId::from_nscsspropertyid(prop) {
         debug_assert!(
-            !longhand.flags().contains(PropertyFlags::GETCS_NEEDS_LAYOUT_FLUSH),
+            !longhand
+                .flags()
+                .contains(PropertyFlags::GETCS_NEEDS_LAYOUT_FLUSH),
             "We're not supposed to serialize layout-dependent properties"
         );
-        style.get_longhand_property_value(
-            longhand,
-            &mut CssWriter::new(&mut *value),
-        ).unwrap();
+        style
+            .get_longhand_property_value(longhand, &mut CssWriter::new(&mut *value))
+            .unwrap();
         return;
     }
 
-    let shorthand = ShorthandId::from_nscsspropertyid(prop)
-        .expect("Not a shorthand nor a longhand?");
+    let shorthand =
+        ShorthandId::from_nscsspropertyid(prop).expect("Not a shorthand nor a longhand?");
     let mut block = PropertyDeclarationBlock::new();
     // NOTE(emilio): We reuse the animation value machinery to avoid blowing up
     // code size, but may need to come up with something different if ever care
     // about supporting the cases that assert below. Fortunately we don't right
     // now.
     for longhand in shorthand.longhands() {
         debug_assert!(
             !longhand.is_logical(),
             "This won't quite do the right thing if we want to serialize \
              logical shorthands"
         );
         debug_assert!(
-            !longhand.flags().contains(PropertyFlags::GETCS_NEEDS_LAYOUT_FLUSH),
+            !longhand
+                .flags()
+                .contains(PropertyFlags::GETCS_NEEDS_LAYOUT_FLUSH),
             "Layout-dependent properties shouldn't get here"
         );
-        let animated = AnimationValue::from_computed_values(longhand, style)
-            .expect("Somebody tried to serialize a shorthand with \
-                     non-animatable properties, would need more code \
-                     to do this");
+        let animated = AnimationValue::from_computed_values(longhand, style).expect(
+            "Somebody tried to serialize a shorthand with \
+             non-animatable properties, would need more code \
+             to do this",
+        );
         block.push(animated.uncompute(), Importance::Normal);
     }
     block.shorthand_to_css(shorthand, &mut *value).unwrap();
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_GetCustomPropertyValue(
     computed_values: ComputedStyleBorrowed,
@@ -5454,17 +5712,19 @@ pub unsafe extern "C" fn Servo_GetCustom
     };
 
     let name = Atom::from(&*name);
     let computed_value = match custom_properties.get(&name) {
         Some(v) => v,
         None => return false,
     };
 
-    computed_value.to_css(&mut CssWriter::new(&mut *value)).unwrap();
+    computed_value
+        .to_css(&mut CssWriter::new(&mut *value))
+        .unwrap();
     true
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_GetCustomPropertiesCount(computed_values: ComputedStyleBorrowed) -> u32 {
     match computed_values.custom_properties() {
         Some(p) => p.len() as u32,
         None => 0,
@@ -5508,19 +5768,17 @@ pub unsafe extern "C" fn Servo_CssUrlDat
 #[no_mangle]
 pub extern "C" fn Servo_CssUrlData_GetExtraData(
     url: RawServoCssUrlDataBorrowed,
 ) -> RawGeckoURLExtraDataBorrowedMut {
     unsafe { &mut *CssUrlData::as_arc(&url).extra_data.0.get() }
 }
 
 #[no_mangle]
-pub extern "C" fn Servo_CssUrlData_IsLocalRef(
-    url: RawServoCssUrlDataBorrowed
-) -> bool {
+pub extern "C" fn Servo_CssUrlData_IsLocalRef(url: RawServoCssUrlDataBorrowed) -> bool {
     CssUrlData::as_arc(&url).is_fragment()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ProcessInvalidations(
     set: RawServoStyleSetBorrowed,
     element: RawGeckoElementBorrowed,
     snapshots: *const ServoElementSnapshotTable,
@@ -5532,35 +5790,39 @@ pub extern "C" fn Servo_ProcessInvalidat
     debug_assert!(!element.handled_snapshot());
 
     let mut data = element.mutate_data();
     debug_assert!(data.is_some());
 
     let global_style_data = &*GLOBAL_STYLE_DATA;
     let guard = global_style_data.shared_lock.read();
     let per_doc_data = PerDocumentStyleData::from_ffi(set).borrow();
-    let shared_style_context = create_shared_context(&global_style_data,
-                                                     &guard,
-                                                     &per_doc_data,
-                                                     TraversalFlags::empty(),
-                                                     unsafe { &*snapshots });
+    let shared_style_context = create_shared_context(
+        &global_style_data,
+        &guard,
+        &per_doc_data,
+        TraversalFlags::empty(),
+        unsafe { &*snapshots },
+    );
     let mut data = data.as_mut().map(|d| &mut **d);
 
     if let Some(ref mut data) = data {
         // FIXME(emilio): Ideally we could share the nth-index-cache across all
         // the elements?
         let result = data.invalidate_style_if_needed(
             element,
             &shared_style_context,
             None,
             &mut NthIndexCache::default(),
         );
 
         if result.has_invalidated_siblings() {
-            let parent = element.traversal_parent().expect("How could we invalidate siblings without a common parent?");
+            let parent = element
+                .traversal_parent()
+                .expect("How could we invalidate siblings without a common parent?");
             unsafe {
                 parent.set_dirty_descendants();
                 bindings::Gecko_NoteDirtySubtreeForInvalidation(parent.0);
             }
         } else if result.has_invalidated_descendants() {
             unsafe { bindings::Gecko_NoteDirtySubtreeForInvalidation(element.0) };
         } else if result.has_invalidated_self() {
             unsafe { bindings::Gecko_NoteDirtyElement(element.0) };
@@ -5629,40 +5891,40 @@ fn parse_color(
         Some(CssRuleType::Style),
         ParsingMode::DEFAULT,
         QuirksMode::NoQuirks,
         error_reporter,
         None,
     );
 
     let start_position = parser.position();
-    parser.parse_entirely(|i| specified::Color::parse(&context, i)).map_err(|err| {
-        if error_reporter.is_some() {
-            match err.kind {
-                ParseErrorKind::Custom(StyleParseErrorKind::ValueError(..)) => {
-                    let location = err.location.clone();
-                    let error = ContextualParseError::UnsupportedValue(
-                        parser.slice_from(start_position),
-                        err,
-                    );
-                    context.log_css_error(location, error);
+    parser
+        .parse_entirely(|i| specified::Color::parse(&context, i))
+        .map_err(|err| {
+            if error_reporter.is_some() {
+                match err.kind {
+                    ParseErrorKind::Custom(StyleParseErrorKind::ValueError(..)) => {
+                        let location = err.location.clone();
+                        let error = ContextualParseError::UnsupportedValue(
+                            parser.slice_from(start_position),
+                            err,
+                        );
+                        context.log_css_error(location, error);
+                    },
+                    // Ignore other kinds of errors that might be reported, such as
+                    // ParseErrorKind::Basic(BasicParseErrorKind::UnexpectedToken),
+                    // since Gecko doesn't report those to the error console.
+                    _ => {},
                 }
-                // Ignore other kinds of errors that might be reported, such as
-                // ParseErrorKind::Basic(BasicParseErrorKind::UnexpectedToken),
-                // since Gecko doesn't report those to the error console.
-                _ => {}
             }
-        }
-    })
-}
-
-#[no_mangle]
-pub extern "C" fn Servo_IsValidCSSColor(
-    value: *const nsAString,
-) -> bool {
+        })
+}
+
+#[no_mangle]
+pub extern "C" fn Servo_IsValidCSSColor(value: *const nsAString) -> bool {
     let value = unsafe { (*value).to_string() };
     parse_color(&value, None).is_ok()
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ComputeColor(
     raw_data: RawServoStyleSetBorrowedOrNull,
     current_color: structs::nscolor,
@@ -5687,36 +5949,34 @@ pub extern "C" fn Servo_ComputeColor(
             let computed_color = match raw_data {
                 Some(raw_data) => {
                     let data = PerDocumentStyleData::from_ffi(raw_data).borrow();
                     let device = data.stylist.device();
                     let quirks_mode = data.stylist.quirks_mode();
                     Context::for_media_query_evaluation(device, quirks_mode, |context| {
                         specified_color.to_computed_color(Some(&context))
                     })
-                }
-                None => {
-                    specified_color.to_computed_color(None)
-                }
+                },
+                None => specified_color.to_computed_color(None),
             };
 
             match computed_color {
                 Some(computed_color) => {
                     let rgba = computed_color.to_rgba(current_color);
                     *result_color = gecko::values::convert_rgba_to_nscolor(&rgba);
                     if !was_current_color.is_null() {
                         unsafe {
                             *was_current_color = computed_color.is_currentcolor();
                         }
                     }
                     true
-                }
+                },
                 None => false,
             }
-        }
+        },
         Err(_) => false,
     }
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_IntersectionObserverRootMargin_Parse(
     value: *const nsAString,
     result: *mut structs::nsStyleSides,
@@ -5733,45 +5993,42 @@ pub unsafe extern "C" fn Servo_Intersect
         url_data,
         Some(CssRuleType::Style),
         ParsingMode::DEFAULT,
         QuirksMode::NoQuirks,
         None,
         None,
     );
 
-    let margin = parser.parse_entirely(|p| {
-        IntersectionObserverRootMargin::parse(&context, p)
-    });
+    let margin = parser.parse_entirely(|p| IntersectionObserverRootMargin::parse(&context, p));
     match margin {
         Ok(margin) => {
             margin.0.to_gecko_rect(result);
             true
-        }
+        },
         Err(..) => false,
     }
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_IntersectionObserverRootMargin_ToString(
     rect: *const structs::nsStyleSides,
     result: *mut nsAString,
 ) {
-    let rect = Rect::<PixelOrPercentage>::
-        from_gecko_rect(rect.as_ref().unwrap()).unwrap();
+    let rect = Rect::<PixelOrPercentage>::from_gecko_rect(rect.as_ref().unwrap()).unwrap();
     let root_margin = IntersectionObserverRootMargin(rect);
     let mut writer = CssWriter::new(result.as_mut().unwrap());
     root_margin.to_css(&mut writer).unwrap();
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_ParseTransformIntoMatrix(
     value: *const nsAString,
     contain_3d: *mut bool,
-    result: *mut RawGeckoGfxMatrix4x4
+    result: *mut RawGeckoGfxMatrix4x4,
 ) -> bool {
     use style::properties::longhands::transform;
 
     let string = unsafe { (*value).to_string() };
     let mut input = ParserInput::new(&string);
     let mut parser = Parser::new(&mut input);
     let context = ParserContext::new(
         Origin::Author,
@@ -5806,19 +6063,21 @@ pub unsafe extern "C" fn Servo_ParseFont
     data: *mut URLExtraData,
     family: *mut structs::RefPtr<structs::SharedFontList>,
     style: *mut structs::StyleComputedFontStyleDescriptor,
     stretch: *mut f32,
     weight: *mut f32,
 ) -> bool {
     use style::font_face::ComputedFontStyleDescriptor;
     use style::properties::shorthands::font;
+    use style::values::computed::font::FontWeight as ComputedFontWeight;
     use style::values::generics::font::FontStyle as GenericFontStyle;
-    use style::values::computed::font::FontWeight as ComputedFontWeight;
-    use style::values::specified::font::{FontFamily, FontWeight, FontStretch, FontStyle, SpecifiedFontStyle};
+    use style::values::specified::font::{
+        FontFamily, FontStretch, FontStyle, FontWeight, SpecifiedFontStyle,
+    };
 
     let string = (*value).to_string();
     let mut input = ParserInput::new(&string);
     let mut parser = Parser::new(&mut input);
     let url_data = UrlExtraData::from_ptr_ref(&data);
     let context = ParserContext::new(
         Origin::Author,
         url_data,
@@ -5846,17 +6105,17 @@ pub unsafe extern "C" fn Servo_ParseFont
         FontStyle::System(_) => return false,
     };
     *style = ::std::mem::transmute(match *specified_font_style {
         GenericFontStyle::Normal => ComputedFontStyleDescriptor::Normal,
         GenericFontStyle::Italic => ComputedFontStyleDescriptor::Italic,
         GenericFontStyle::Oblique(ref angle) => {
             let angle = SpecifiedFontStyle::compute_angle_degrees(angle);
             ComputedFontStyleDescriptor::Oblique(angle, angle)
-        }
+        },
     });
 
     *stretch = match font.font_stretch {
         FontStretch::Keyword(ref k) => k.compute().0,
         FontStretch::Stretch(ref p) => p.get(),
         FontStretch::System(_) => return false,
     };
 
@@ -5900,22 +6159,18 @@ pub unsafe extern "C" fn Servo_SourceSiz
     raw_data: RawServoStyleSetBorrowed,
     list: RawServoSourceSizeListBorrowedOrNull,
 ) -> i32 {
     let doc_data = PerDocumentStyleData::from_ffi(raw_data).borrow();
     let device = doc_data.stylist.device();
     let quirks_mode = doc_data.stylist.quirks_mode();
 
     let result = match list {
-        Some(list) => {
-            SourceSizeList::from_ffi(list).evaluate(device, quirks_mode)
-        }
-        None => {
-            SourceSizeList::empty().evaluate(device, quirks_mode)
-        }
+        Some(list) => SourceSizeList::from_ffi(list).evaluate(device, quirks_mode),
+        None => SourceSizeList::empty().evaluate(device, quirks_mode),
     };
 
     result.0
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_SourceSizeList_Drop(list: RawServoSourceSizeListOwned) {
     let _ = list.into_box::<SourceSizeList>();
@@ -5928,35 +6183,35 @@ pub unsafe extern "C" fn Servo_Invalidat
     non_document_styles: *const nsTArray<RawServoAuthorStylesBorrowed>,
     states_changed: u64,
 ) {
     use style::invalidation::element::document_state::DocumentStateInvalidationProcessor;
     use style::invalidation::element::invalidator::TreeStyleInvalidator;
 
     let document_data = PerDocumentStyleData::from_ffi(document_style).borrow();
 
-    let iter =
-        document_data.stylist.iter_origins().map(|(data, _origin)| data)
+    let iter = document_data
+        .stylist
+        .iter_origins()
+        .map(|(data, _origin)| data)
         .chain((*non_document_styles).iter().map(|author_styles| {
             let styles: &_ = AuthorStyles::<GeckoStyleSheet>::from_ffi(author_styles);
             &styles.data
         }));
 
     let root = GeckoElement(root);
     let mut processor = DocumentStateInvalidationProcessor::new(
         iter,
         DocumentState::from_bits_truncate(states_changed),
         root.as_node().owner_doc().quirks_mode(),
     );
 
-    let result = TreeStyleInvalidator::new(
-        root,
-        /* stack_limit_checker = */ None,
-        &mut processor,
-    ).invalidate();
+    let result =
+        TreeStyleInvalidator::new(root, /* stack_limit_checker = */ None, &mut processor)
+            .invalidate();
 
     debug_assert!(!result.has_invalidated_siblings(), "How in the world?");
     if result.has_invalidated_descendants() {
         bindings::Gecko_NoteDirtySubtreeForInvalidation(root.0);
     } else if result.has_invalidated_self() {
         bindings::Gecko_NoteDirtyElement(root.0);
     }
 }
@@ -5997,29 +6252,31 @@ pub unsafe extern "C" fn Servo_IsCssProp
     known_prop: *mut bool,
 ) -> bool {
     let prop_id = parse_enabled_property_name!(property, known_prop, false);
     let non_custom_id = match prop_id.non_custom_id() {
         Some(id) => id,
         None => return false,
     };
 
-    UseCounters::from_ffi(use_counters).non_custom_properties.recorded(non_custom_id)
+    UseCounters::from_ffi(use_counters)
+        .non_custom_properties
+        .recorded(non_custom_id)
 }
 
 #[no_mangle]
 pub extern "C" fn Servo_Quotes_GetInitialValue() -> RawServoQuotesStrong {
-    computed::Quotes::get_initial_value().0.clone().into_strong()
-}
-
-#[no_mangle]
-pub extern "C" fn Servo_Quotes_Equal(
-    a: RawServoQuotesBorrowed,
-    b: RawServoQuotesBorrowed,
-) -> bool {
+    computed::Quotes::get_initial_value()
+        .0
+        .clone()
+        .into_strong()
+}
+
+#[no_mangle]
+pub extern "C" fn Servo_Quotes_Equal(a: RawServoQuotesBorrowed, b: RawServoQuotesBorrowed) -> bool {
     let a = Box::<[QuotePair]>::as_arc(&a);
     let b = Box::<[QuotePair]>::as_arc(&b);
 
     a == b
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_Quotes_GetQuote(
--- a/servo/ports/geckolib/lib.rs
+++ b/servo/ports/geckolib/lib.rs
@@ -1,26 +1,30 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-
 extern crate cssparser;
-#[macro_use] extern crate cstr;
+#[macro_use]
+extern crate cstr;
 extern crate libc;
-#[macro_use] extern crate log;
+#[macro_use]
+extern crate log;
 extern crate malloc_size_of;
 extern crate nsstring;
 extern crate num_traits;
 extern crate selectors;
 extern crate servo_arc;
 extern crate smallvec;
-#[macro_use] extern crate style;
+#[macro_use]
+extern crate style;
 extern crate style_traits;
 
 mod error_reporter;
 #[allow(non_snake_case)]
 pub mod glue;
 mod stylesheet_loader;
 
 // FIXME(bholley): This should probably go away once we harmonize the allocators.
 #[no_mangle]
-pub extern "C" fn je_malloc_usable_size(_: *const ::libc::c_void) -> ::libc::size_t { 0 }
+pub extern "C" fn je_malloc_usable_size(_: *const ::libc::c_void) -> ::libc::size_t {
+    0
+}
--- a/servo/ports/geckolib/stylesheet_loader.rs
+++ b/servo/ports/geckolib/stylesheet_loader.rs
@@ -6,29 +6,36 @@ use cssparser::SourceLocation;
 use nsstring::nsCString;
 use servo_arc::Arc;
 use style::context::QuirksMode;
 use style::gecko::data::GeckoStyleSheet;
 use style::gecko::global_style_data::GLOBAL_STYLE_DATA;
 use style::gecko_bindings::bindings;
 use style::gecko_bindings::bindings::Gecko_LoadStyleSheet;
 use style::gecko_bindings::structs::{Loader, LoaderReusableStyleSheets};
-use style::gecko_bindings::structs::{StyleSheet as DomStyleSheet, SheetLoadData, SheetLoadDataHolder};
+use style::gecko_bindings::structs::{
+    SheetLoadData, SheetLoadDataHolder, StyleSheet as DomStyleSheet,
+};
 use style::gecko_bindings::sugar::ownership::{FFIArcHelpers, HasBoxFFI, OwnedOrNull};
 use style::gecko_bindings::sugar::refptr::RefPtr;
 use style::media_queries::MediaList;
 use style::parser::ParserContext;
 use style::shared_lock::{Locked, SharedRwLock};
+use style::stylesheets::import_rule::ImportSheet;
 use style::stylesheets::{ImportRule, Origin, StylesheetLoader as StyleStylesheetLoader};
 use style::stylesheets::{StylesheetContents, UrlExtraData};
-use style::stylesheets::import_rule::ImportSheet;
 use style::use_counters::UseCounters;
 use style::values::CssUrl;
 
-pub struct StylesheetLoader(*mut Loader, *mut DomStyleSheet, *mut SheetLoadData, *mut LoaderReusableStyleSheets);
+pub struct StylesheetLoader(
+    *mut Loader,
+    *mut DomStyleSheet,
+    *mut SheetLoadData,
+    *mut LoaderReusableStyleSheets,
+);
 
 impl StylesheetLoader {
     pub fn new(
         loader: *mut Loader,
         parent: *mut DomStyleSheet,
         parent_load_data: *mut SheetLoadData,
         reusable_sheets: *mut LoaderReusableStyleSheets,
     ) -> Self {
@@ -46,29 +53,37 @@ impl StyleStylesheetLoader for Styleshee
         media: Arc<Locked<MediaList>>,
     ) -> Arc<Locked<ImportRule>> {
         // After we get this raw pointer ImportRule will be moved into a lock and Arc
         // and so the Arc<Url> pointer inside will also move,
         // but the Url it points to or the allocating backing the String inside that Url won’t,
         // so this raw pointer will still be valid.
 
         let child_sheet = unsafe {
-            Gecko_LoadStyleSheet(self.0,
-                                 self.1,
-                                 self.2,
-                                 self.3,
-                                 url.0.clone().into_strong(),
-                                 media.into_strong())
+            Gecko_LoadStyleSheet(
+                self.0,
+                self.1,
+                self.2,
+                self.3,
+                url.0.clone().into_strong(),
+                media.into_strong(),
+            )
         };
 
-        debug_assert!(!child_sheet.is_null(),
-                      "Import rules should always have a strong sheet");
+        debug_assert!(
+            !child_sheet.is_null(),
+            "Import rules should always have a strong sheet"
+        );
         let sheet = unsafe { GeckoStyleSheet::from_addrefed(child_sheet) };
         let stylesheet = ImportSheet::new(sheet);
-        Arc::new(lock.wrap(ImportRule { url, source_location, stylesheet }))
+        Arc::new(lock.wrap(ImportRule {
+            url,
+            source_location,
+            stylesheet,
+        }))
     }
 }
 
 pub struct AsyncStylesheetParser {
     load_data: RefPtr<SheetLoadDataHolder>,
     extra_data: UrlExtraData,
     bytes: nsCString,
     origin: Origin,
@@ -99,19 +114,19 @@ impl AsyncStylesheetParser {
     }
 
     pub fn parse(self) {
         let global_style_data = &*GLOBAL_STYLE_DATA;
         let input: &str = unsafe { (*self.bytes).as_str_unchecked() };
 
         let use_counters = if self.should_record_use_counters {
             Some(Box::new(UseCounters::default()))
-         } else {
-             None
-         };
+        } else {
+            None
+        };
 
         // Note: Parallel CSS parsing doesn't report CSS errors. When errors are
         // being logged, Gecko prevents the parallel parsing path from running.
         let sheet = Arc::new(StylesheetContents::from_str(
             input,
             self.extra_data.clone(),
             self.origin,
             &global_style_data.shared_lock,
@@ -142,22 +157,26 @@ impl StyleStylesheetLoader for AsyncStyl
         &self,
         url: CssUrl,
         source_location: SourceLocation,
         _context: &ParserContext,
         lock: &SharedRwLock,
         media: Arc<Locked<MediaList>>,
     ) -> Arc<Locked<ImportRule>> {
         let stylesheet = ImportSheet::new_pending(self.origin, self.quirks_mode);
-        let rule = Arc::new(lock.wrap(ImportRule { url: url.clone(), source_location, stylesheet }));
+        let rule = Arc::new(lock.wrap(ImportRule {
+            url: url.clone(),
+            source_location,
+            stylesheet,
+        }));
 
         unsafe {
             bindings::Gecko_LoadStyleSheetAsync(
                 self.load_data.get(),
                 url.0.into_strong(),
                 media.into_strong(),
-                rule.clone().into_strong()
+                rule.clone().into_strong(),
             );
         }
 
         rule
     }
 }
--- a/servo/ports/geckolib/tests/build.rs
+++ b/servo/ports/geckolib/tests/build.rs
@@ -7,18 +7,21 @@ extern crate regex;
 use regex::Regex;
 use std::env;
 use std::fs::File;
 use std::io::{BufRead, BufReader, Write};
 use std::path::Path;
 
 fn main() {
     // https://github.com/rust-lang/cargo/issues/3544
-    let style_out_dir = env::var_os("DEP_FOR SOME REASON THE LINKS KEY IS REQUIRED \
-                                     TO PASS DATA AROUND BETWEEN BUILD SCRIPTS_OUT_DIR").unwrap();
+    let style_out_dir = env::var_os(
+        "DEP_FOR SOME REASON THE LINKS KEY IS REQUIRED \
+         TO PASS DATA AROUND BETWEEN BUILD SCRIPTS_OUT_DIR",
+    )
+    .unwrap();
     let root_path = Path::new("../../../");
     let bindings_file = Path::new(&style_out_dir).join("gecko/bindings.rs");
     let glue_file = root_path.join("ports/geckolib/glue.rs");
 
     println!("cargo:rerun-if-changed=build.rs");
     println!("cargo:rerun-if-changed={}", glue_file.display());
     println!("cargo:rerun-if-changed={}", bindings_file.display());
 
@@ -56,39 +59,50 @@ fn main() {
                 // order in ServoBindings.h. We have the same problem for
                 // ComputedStyle_{AddRef / Release}, we just don't hit it
                 // because they're included later...
                 if &cap[1] == "InvalidateStyleForDocStateChanges" ||
                     &cap[1] == "Element_IsDisplayContents"
                 {
                     continue;
                 }
-                w.write_all(format!("    [ Servo_{0}, bindings::Servo_{0} ];\n", &cap[1]).as_bytes()).unwrap();
+                w.write_all(
+                    format!("    [ Servo_{0}, bindings::Servo_{0} ];\n", &cap[1]).as_bytes(),
+                )
+                .unwrap();
             }
         }
 
         w.write_all(b"}\n").unwrap();
     }
 
     {
         let output = out_dir.join("glue.rs");
         let r = BufReader::new(File::open(glue_file).unwrap());
         let mut w = File::create(output).unwrap();
 
-        w.write_all(b"pub use style::gecko::arc_types::*;\n").unwrap();
+        w.write_all(b"pub use style::gecko::arc_types::*;\n")
+            .unwrap();
 
         for line in r.lines() {
-            let s = line.unwrap().replace("pub extern \"C\" fn", "pub unsafe extern \"C\" fn");
+            let s = line
+                .unwrap()
+                .replace("pub extern \"C\" fn", "pub unsafe extern \"C\" fn");
             w.write_all(s.as_bytes()).unwrap();
             w.write_all(b"\n").unwrap();
         }
     }
 
     File::create(out_dir.join("bindings.rs"))
         .unwrap()
-        .write_all(format!("include!(concat!({:?}, \"/gecko/structs.rs\"));",
-                           style_out_dir).as_bytes())
+        .write_all(
+            format!(
+                "include!(concat!({:?}, \"/gecko/structs.rs\"));",
+                style_out_dir
+            )
+            .as_bytes(),
+        )
         .unwrap();
 
     if env::var_os("MOZ_SRC").is_some() {
         println!("cargo:rustc-cfg=linking_with_gecko")
     }
 }
--- a/servo/ports/geckolib/tests/lib.rs
+++ b/servo/ports/geckolib/tests/lib.rs
@@ -8,25 +8,29 @@
 //
 // On Linux and OS X linking succeeds anyway.
 // Presumably these symbol declarations don’t need to be resolved
 // as they’re not used in any code called from this crate.
 #![cfg(any(linking_with_gecko, not(windows)))]
 
 extern crate atomic_refcell;
 extern crate cssparser;
-#[macro_use] extern crate cstr;
+#[macro_use]
+extern crate cstr;
 extern crate geckoservo;
-#[macro_use] extern crate log;
+#[macro_use]
+extern crate log;
 extern crate malloc_size_of;
 extern crate num_traits;
 extern crate selectors;
 extern crate smallvec;
-#[macro_use] extern crate size_of_test;
-#[macro_use] extern crate style;
+#[macro_use]
+extern crate size_of_test;
+#[macro_use]
+extern crate style;
 extern crate style_traits;
 
 #[cfg(target_pointer_width = "64")]
 mod size_of;
 mod specified_values;
 
 mod servo_function_signatures;
 
--- a/servo/ports/geckolib/tests/size_of.rs
+++ b/servo/ports/geckolib/tests/size_of.rs
@@ -8,44 +8,72 @@ use style;
 use style::applicable_declarations::ApplicableDeclarationBlock;
 use style::data::{ElementData, ElementStyles};
 use style::gecko::selector_parser::{self, SelectorImpl};
 use style::properties::ComputedValues;
 use style::rule_tree::{RuleNode, StrongRuleNode};
 use style::values::computed;
 use style::values::specified;
 
-size_of_test!(size_of_selector, selectors::parser::Selector<SelectorImpl>, 8);
+size_of_test!(
+    size_of_selector,
+    selectors::parser::Selector<SelectorImpl>,
+    8
+);
 size_of_test!(size_of_pseudo_element, selector_parser::PseudoElement, 16);
 
-size_of_test!(size_of_component, selectors::parser::Component<SelectorImpl>, 24);
+size_of_test!(
+    size_of_component,
+    selectors::parser::Component<SelectorImpl>,
+    24
+);
 size_of_test!(size_of_pseudo_class, selector_parser::NonTSPseudoClass, 16);
 
 // The size of this is critical to performance on the bloom-basic microbenchmark.
 // When iterating over a large Rule array, we want to be able to fast-reject
 // selectors (with the inline hashes) with as few cache misses as possible.
 size_of_test!(test_size_of_rule, style::stylist::Rule, 32);
 
 // Large pages generate tens of thousands of ComputedValues.
 size_of_test!(test_size_of_cv, ComputedValues, 248);
 
 size_of_test!(test_size_of_option_arc_cv, Option<Arc<ComputedValues>>, 8);
 size_of_test!(test_size_of_option_rule_node, Option<StrongRuleNode>, 8);
 
 size_of_test!(test_size_of_element_styles, ElementStyles, 16);
 size_of_test!(test_size_of_element_data, ElementData, 24);
 
-size_of_test!(test_size_of_property_declaration, style::properties::PropertyDeclaration, 32);
+size_of_test!(
+    test_size_of_property_declaration,
+    style::properties::PropertyDeclaration,
+    32
+);
 
-size_of_test!(test_size_of_application_declaration_block, ApplicableDeclarationBlock, 16);
+size_of_test!(
+    test_size_of_application_declaration_block,
+    ApplicableDeclarationBlock,
+    16
+);
 size_of_test!(test_size_of_rule_node, RuleNode, 72);
 
 // This is huge, but we allocate it on the stack and then never move it,
 // we only pass `&mut SourcePropertyDeclaration` references around.
-size_of_test!(test_size_of_parsed_declaration, style::properties::SourcePropertyDeclaration, 608);
+size_of_test!(
+    test_size_of_parsed_declaration,
+    style::properties::SourcePropertyDeclaration,
+    608
+);
 
 size_of_test!(test_size_of_computed_image, computed::image::Image, 24);
 size_of_test!(test_size_of_specified_image, specified::image::Image, 24);
 
 // FIXME(bz): These can shrink if we move the None_ value inside the
 // enum instead of paying an extra word for the Either discriminant.
-size_of_test!(test_size_of_computed_image_layer, computed::image::ImageLayer, 24);
-size_of_test!(test_size_of_specified_image_layer, specified::image::ImageLayer, 24);
+size_of_test!(
+    test_size_of_computed_image_layer,
+    computed::image::ImageLayer,
+    24
+);
+size_of_test!(
+    test_size_of_specified_image_layer,
+    specified::image::ImageLayer,
+    24
+);