Merge mozilla-central to autoland
authorSebastian Hengst <archaeopteryx@coole-files.de>
Wed, 23 Jan 2019 11:31:44 +0200
changeset 514974 1c2d27a85d17c93d89deeb1e0cd1bcfe2a7a97bf
parent 514960 f8a0a0a3cce80f473f3c9d579dc369069168a2f2 (current diff)
parent 514967 c60e6c0c2e2318295d1bec96e95ec7eaa9b48087 (diff)
child 515084 10b57d0ee380c486e5d5e5a22b54f9d9da572577
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone66.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
Merge mozilla-central to autoland
browser/base/content/tabbrowser.js
python/mozbuild/mozbuild/mach_commands.py
toolkit/mozapps/update/tests/browser/browser_updatesBackgroundWindow.js
toolkit/mozapps/update/tests/browser/browser_updatesBackgroundWindowFailures.js
toolkit/mozapps/update/tests/browser/browser_updatesBasicPrompt.js
toolkit/mozapps/update/tests/browser/browser_updatesBasicPromptNoStaging.js
toolkit/mozapps/update/tests/browser/browser_updatesCantApply.js
toolkit/mozapps/update/tests/browser/browser_updatesCompleteAndPartialPatchesWithBadCompleteSize.js
toolkit/mozapps/update/tests/browser/browser_updatesCompleteAndPartialPatchesWithBadPartialSize.js
toolkit/mozapps/update/tests/browser/browser_updatesCompleteAndPartialPatchesWithBadSizes.js
toolkit/mozapps/update/tests/browser/browser_updatesCompletePatchApplyFailure.js
toolkit/mozapps/update/tests/browser/browser_updatesCompletePatchWithBadCompleteSize.js
toolkit/mozapps/update/tests/browser/browser_updatesDownloadFailures.js
toolkit/mozapps/update/tests/browser/browser_updatesMalformedXml.js
toolkit/mozapps/update/tests/browser/browser_updatesPartialPatchApplyFailure.js
toolkit/mozapps/update/tests/browser/browser_updatesPartialPatchApplyFailureWithCompleteAvailable.js
toolkit/mozapps/update/tests/browser/browser_updatesPartialPatchApplyFailureWithCompleteValidationFailure.js
toolkit/mozapps/update/tests/browser/browser_updatesPartialPatchWithBadPartialSize.js
toolkit/mozapps/update/tests/data/shared.js
xpcom/threads/CooperativeThreadPool.cpp
xpcom/threads/CooperativeThreadPool.h
xpcom/threads/LabeledEventQueue.cpp
xpcom/threads/Scheduler.h
--- a/accessible/mac/AccessibleWrap.mm
+++ b/accessible/mac/AccessibleWrap.mm
@@ -15,96 +15,76 @@
 #import "mozActionElements.h"
 #import "mozHTMLAccessible.h"
 #import "mozTableAccessible.h"
 #import "mozTextAccessible.h"
 
 using namespace mozilla;
 using namespace mozilla::a11y;
 
-AccessibleWrap::
-  AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) :
-  Accessible(aContent, aDoc), mNativeObject(nil),
-  mNativeInited(false)
-{
-}
+AccessibleWrap::AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc)
+    : Accessible(aContent, aDoc), mNativeObject(nil), mNativeInited(false) {}
 
-AccessibleWrap::~AccessibleWrap()
-{
-}
+AccessibleWrap::~AccessibleWrap() {}
 
-mozAccessible*
-AccessibleWrap::GetNativeObject()
-{
+mozAccessible* AccessibleWrap::GetNativeObject() {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   if (!mNativeInited && !mNativeObject && !IsDefunct() && !AncestorIsFlat()) {
     uintptr_t accWrap = reinterpret_cast<uintptr_t>(this);
     mNativeObject = [[GetNativeType() alloc] initWithAccessible:accWrap];
   }
 
   mNativeInited = true;
 
   return mNativeObject;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
-void
-AccessibleWrap::GetNativeInterface(void** aOutInterface)
-{
+void AccessibleWrap::GetNativeInterface(void** aOutInterface) {
   *aOutInterface = static_cast<void*>(GetNativeObject());
 }
 
 // overridden in subclasses to create the right kind of object. by default we create a generic
 // 'mozAccessible' node.
-Class
-AccessibleWrap::GetNativeType ()
-{
+Class AccessibleWrap::GetNativeType() {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
-  if (IsXULTabpanels())
-    return [mozPaneAccessible class];
+  if (IsXULTabpanels()) return [mozPaneAccessible class];
 
-  if (IsTable())
-    return [mozTableAccessible class];
+  if (IsTable()) return [mozTableAccessible class];
 
-  if (IsTableRow())
-    return [mozTableRowAccessible class];
+  if (IsTableRow()) return [mozTableRowAccessible class];
 
-  if (IsTableCell())
-    return [mozTableCellAccessible class];
+  if (IsTableCell()) return [mozTableCellAccessible class];
 
   return GetTypeFromRole(Role());
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
 // this method is very important. it is fired when an accessible object "dies". after this point
 // the object might still be around (because some 3rd party still has a ref to it), but it is
 // in fact 'dead'.
-void
-AccessibleWrap::Shutdown ()
-{
+void AccessibleWrap::Shutdown() {
   // this ensure we will not try to re-create the native object.
   mNativeInited = true;
 
   // we really intend to access the member directly.
   if (mNativeObject) {
     [mNativeObject expire];
     [mNativeObject release];
     mNativeObject = nil;
   }
 
   Accessible::Shutdown();
 }
 
-nsresult
-AccessibleWrap::HandleAccEvent(AccEvent* aEvent)
-{
+nsresult AccessibleWrap::HandleAccEvent(AccEvent* aEvent) {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
   nsresult rv = Accessible::HandleAccEvent(aEvent);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (IPCAccessibilityActive()) {
     return NS_OK;
   }
@@ -119,77 +99,65 @@ AccessibleWrap::HandleAccEvent(AccEvent*
       eventType != nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED &&
       eventType != nsIAccessibleEvent::EVENT_TEXT_SELECTION_CHANGED &&
       eventType != nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE)
     return NS_OK;
 
   Accessible* accessible = aEvent->GetAccessible();
   NS_ENSURE_STATE(accessible);
 
-  mozAccessible *nativeAcc = nil;
+  mozAccessible* nativeAcc = nil;
   accessible->GetNativeInterface((void**)&nativeAcc);
-  if (!nativeAcc)
-    return NS_ERROR_FAILURE;
+  if (!nativeAcc) return NS_ERROR_FAILURE;
 
   FireNativeEvent(nativeAcc, eventType);
 
   return NS_OK;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
-bool
-AccessibleWrap::InsertChildAt(uint32_t aIdx, Accessible* aAccessible)
-{
+bool AccessibleWrap::InsertChildAt(uint32_t aIdx, Accessible* aAccessible) {
   bool inserted = Accessible::InsertChildAt(aIdx, aAccessible);
-  if (inserted && mNativeObject)
-    [mNativeObject appendChild:aAccessible];
+  if (inserted && mNativeObject) [mNativeObject appendChild:aAccessible];
 
   return inserted;
 }
 
-bool
-AccessibleWrap::RemoveChild(Accessible* aAccessible)
-{
+bool AccessibleWrap::RemoveChild(Accessible* aAccessible) {
   bool removed = Accessible::RemoveChild(aAccessible);
 
-  if (removed && mNativeObject)
-    [mNativeObject invalidateChildren];
+  if (removed && mNativeObject) [mNativeObject invalidateChildren];
 
   return removed;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // AccessibleWrap protected
 
-bool
-AccessibleWrap::AncestorIsFlat()
-{
+bool AccessibleWrap::AncestorIsFlat() {
   // We don't create a native object if we're child of a "flat" accessible;
   // for example, on OS X buttons shouldn't have any children, because that
   // makes the OS confused.
   //
   // To maintain a scripting environment where the XPCOM accessible hierarchy
   // look the same on all platforms, we still let the C++ objects be created
   // though.
 
   Accessible* parent = Parent();
   while (parent) {
-    if (nsAccUtils::MustPrune(parent))
-      return true;
+    if (nsAccUtils::MustPrune(parent)) return true;
 
     parent = parent->Parent();
   }
   // no parent was flat
   return false;
 }
 
-void
-a11y::FireNativeEvent(mozAccessible* aNativeAcc, uint32_t aEventType)
-{
+void a11y::FireNativeEvent(mozAccessible* aNativeAcc, uint32_t aEventType) {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   // Under headless mode we don't have access to a native window, so we skip
   // dispatching native events.
   if (gfxPlatform::IsHeadless()) {
     return;
   }
 
@@ -208,28 +176,25 @@ a11y::FireNativeEvent(mozAccessible* aNa
     case nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE:
       [aNativeAcc documentLoadComplete];
       break;
   }
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
-Class
-a11y::GetTypeFromRole(roles::Role aRole)
-{
+Class a11y::GetTypeFromRole(roles::Role aRole) {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   switch (aRole) {
     case roles::COMBOBOX:
     case roles::PUSHBUTTON:
     case roles::SPLITBUTTON:
-    case roles::TOGGLE_BUTTON:
-    {
-        return [mozButtonAccessible class];
+    case roles::TOGGLE_BUTTON: {
+      return [mozButtonAccessible class];
     }
 
     case roles::PAGETAB:
       return [mozButtonAccessible class];
 
     case roles::CHECKBUTTON:
       return [mozCheckboxAccessible class];
 
--- a/accessible/mac/DocAccessibleWrap.mm
+++ b/accessible/mac/DocAccessibleWrap.mm
@@ -4,18 +4,12 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "DocAccessibleWrap.h"
 
 #import "mozAccessible.h"
 
 using namespace mozilla::a11y;
 
-DocAccessibleWrap::
-  DocAccessibleWrap(mozilla::dom::Document* aDocument, nsIPresShell* aPresShell) :
-  DocAccessible(aDocument, aPresShell)
-{
-}
+DocAccessibleWrap::DocAccessibleWrap(mozilla::dom::Document* aDocument, nsIPresShell* aPresShell)
+    : DocAccessible(aDocument, aPresShell) {}
 
-DocAccessibleWrap::~DocAccessibleWrap()
-{
-}
-
+DocAccessibleWrap::~DocAccessibleWrap() {}
--- a/accessible/mac/MacUtils.mm
+++ b/accessible/mac/MacUtils.mm
@@ -13,19 +13,17 @@
 namespace mozilla {
 namespace a11y {
 namespace utils {
 
 /**
  * Get a localized string from the a11y string bundle.
  * Return nil if not found.
  */
-NSString*
-LocalizedString(const nsString& aString)
-{
+NSString* LocalizedString(const nsString& aString) {
   nsString text;
 
   Accessible::TranslateString(aString, text);
 
   return text.IsEmpty() ? nil : nsCocoaUtils::ToNSString(text);
 }
 
 }
--- a/accessible/mac/Platform.mm
+++ b/accessible/mac/Platform.mm
@@ -14,36 +14,27 @@
 #include "nsAppShell.h"
 
 namespace mozilla {
 namespace a11y {
 
 // Mac a11y whitelisting
 static bool sA11yShouldBeEnabled = false;
 
-bool
-ShouldA11yBeEnabled()
-{
+bool ShouldA11yBeEnabled() {
   EPlatformDisabledState disabledState = PlatformDisabledState();
-  return (disabledState == ePlatformIsForceEnabled) || ((disabledState == ePlatformIsEnabled) && sA11yShouldBeEnabled);
+  return (disabledState == ePlatformIsForceEnabled) ||
+         ((disabledState == ePlatformIsEnabled) && sA11yShouldBeEnabled);
 }
 
-void
-PlatformInit()
-{
-}
+void PlatformInit() {}
 
-void
-PlatformShutdown()
-{
-}
+void PlatformShutdown() {}
 
-void
-ProxyCreated(ProxyAccessible* aProxy, uint32_t)
-{
+void ProxyCreated(ProxyAccessible* aProxy, uint32_t) {
   // Pass in dummy state for now as retrieving proxy state requires IPC.
   // Note that we can use ProxyAccessible::IsTable* functions here because they
   // do not use IPC calls but that might change after bug 1210477.
   Class type;
   if (aProxy->IsTable())
     type = [mozTableAccessible class];
   else if (aProxy->IsTableRow())
     type = [mozTableRowAccessible class];
@@ -71,19 +62,17 @@ ProxyCreated(ProxyAccessible* aProxy, ui
     NS_ASSERTION(parent, "a non-top-level proxy is missing a parent?");
   }
 
   if (nativeParent) {
     [nativeParent invalidateChildren];
   }
 }
 
-void
-ProxyDestroyed(ProxyAccessible* aProxy)
-{
+void ProxyDestroyed(ProxyAccessible* aProxy) {
   mozAccessible* nativeParent = nil;
   if (aProxy->IsDoc() && aProxy->AsDoc()->IsTopLevel()) {
     // Invalidate native parent in parent process's children on proxy destruction
     Accessible* outerDoc = aProxy->OuterDocOfRemoteBrowser();
     if (outerDoc) {
       nativeParent = GetNativeFromGeckoAccessible(outerDoc);
     }
   } else {
@@ -103,73 +92,53 @@ ProxyDestroyed(ProxyAccessible* aProxy)
   [wrapper release];
   aProxy->SetWrapper(0);
 
   if (nativeParent) {
     [nativeParent invalidateChildren];
   }
 }
 
-void
-ProxyEvent(ProxyAccessible* aProxy, uint32_t aEventType)
-{
+void ProxyEvent(ProxyAccessible* aProxy, uint32_t aEventType) {
   // ignore everything but focus-changed, value-changed, caret and selection
   // events for now.
   if (aEventType != nsIAccessibleEvent::EVENT_FOCUS &&
       aEventType != nsIAccessibleEvent::EVENT_VALUE_CHANGE &&
       aEventType != nsIAccessibleEvent::EVENT_TEXT_VALUE_CHANGE &&
       aEventType != nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED &&
       aEventType != nsIAccessibleEvent::EVENT_TEXT_SELECTION_CHANGED)
     return;
 
   mozAccessible* wrapper = GetNativeFromProxy(aProxy);
-  if (wrapper)
-    FireNativeEvent(wrapper, aEventType);
+  if (wrapper) FireNativeEvent(wrapper, aEventType);
 }
 
-void
-ProxyStateChangeEvent(ProxyAccessible* aProxy, uint64_t, bool)
-{
+void ProxyStateChangeEvent(ProxyAccessible* aProxy, uint64_t, bool) {
   // mac doesn't care about state change events
 }
 
-void
-ProxyCaretMoveEvent(ProxyAccessible* aTarget, int32_t aOffset)
-{
+void ProxyCaretMoveEvent(ProxyAccessible* aTarget, int32_t aOffset) {
   mozAccessible* wrapper = GetNativeFromProxy(aTarget);
-  if (wrapper)
-    [wrapper selectedTextDidChange];
-}
-
-void
-ProxyTextChangeEvent(ProxyAccessible*, const nsString&, int32_t, uint32_t,
-                     bool, bool)
-{
+  if (wrapper) [wrapper selectedTextDidChange];
 }
 
-void
-ProxyShowHideEvent(ProxyAccessible*, ProxyAccessible*, bool, bool)
-{
-}
+void ProxyTextChangeEvent(ProxyAccessible*, const nsString&, int32_t, uint32_t, bool, bool) {}
+
+void ProxyShowHideEvent(ProxyAccessible*, ProxyAccessible*, bool, bool) {}
 
-void
-ProxySelectionEvent(ProxyAccessible*, ProxyAccessible*, uint32_t)
-{
-}
-} // namespace a11y
-} // namespace mozilla
+void ProxySelectionEvent(ProxyAccessible*, ProxyAccessible*, uint32_t) {}
+}  // namespace a11y
+}  // namespace mozilla
 
-@interface GeckoNSApplication(a11y)
--(void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute;
+@interface GeckoNSApplication (a11y)
+- (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute;
 @end
 
-@implementation GeckoNSApplication(a11y)
+@implementation GeckoNSApplication (a11y)
 
--(void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute
-{
+- (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute {
   if ([attribute isEqualToString:@"AXEnhancedUserInterface"])
     mozilla::a11y::sA11yShouldBeEnabled = ([value intValue] == 1);
 
   return [super accessibilitySetValue:value forAttribute:attribute];
 }
 
 @end
-
--- a/accessible/mac/RootAccessibleWrap.mm
+++ b/accessible/mac/RootAccessibleWrap.mm
@@ -10,44 +10,35 @@
 #include "nsCOMPtr.h"
 #include "nsObjCExceptions.h"
 #include "nsIFrame.h"
 #include "nsView.h"
 #include "nsIWidget.h"
 
 using namespace mozilla::a11y;
 
-RootAccessibleWrap::
-  RootAccessibleWrap(mozilla::dom::Document* aDocument, nsIPresShell* aPresShell) :
-  RootAccessible(aDocument, aPresShell)
-{
-}
+RootAccessibleWrap::RootAccessibleWrap(mozilla::dom::Document* aDocument, nsIPresShell* aPresShell)
+    : RootAccessible(aDocument, aPresShell) {}
 
-RootAccessibleWrap::~RootAccessibleWrap()
-{
-}
+RootAccessibleWrap::~RootAccessibleWrap() {}
 
-Class
-RootAccessibleWrap::GetNativeType()
-{
+Class RootAccessibleWrap::GetNativeType() {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   return [mozRootAccessible class];
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
-void
-RootAccessibleWrap::GetNativeWidget(void** aOutView)
-{
-  nsIFrame *frame = GetFrame();
+void RootAccessibleWrap::GetNativeWidget(void** aOutView) {
+  nsIFrame* frame = GetFrame();
   if (frame) {
-    nsView *view = frame->GetView();
+    nsView* view = frame->GetView();
     if (view) {
-      nsIWidget *widget = view->GetWidget();
+      nsIWidget* widget = view->GetWidget();
       if (widget) {
-        *aOutView = (void**)widget->GetNativeData (NS_NATIVE_WIDGET);
-        NS_ASSERTION (*aOutView,
-                      "Couldn't get the native NSView parent we need to connect the accessibility hierarchy!");
+        *aOutView = (void**)widget->GetNativeData(NS_NATIVE_WIDGET);
+        NS_ASSERTION(*aOutView, "Couldn't get the native NSView parent we need to connect the "
+                                "accessibility hierarchy!");
       }
     }
   }
 }
--- a/accessible/mac/mozAccessible.mm
+++ b/accessible/mac/mozAccessible.mm
@@ -46,104 +46,91 @@ using namespace mozilla::a11y;
 // XXX WebKit also defines the following attributes.
 // See bugs 1176970 and 1176983.
 // - NSAccessibilityMathFencedOpenAttribute @"AXMathFencedOpen"
 // - NSAccessibilityMathFencedCloseAttribute @"AXMathFencedClose"
 // - NSAccessibilityMathPrescriptsAttribute @"AXMathPrescripts"
 // - NSAccessibilityMathPostscriptsAttribute @"AXMathPostscripts"
 
 // convert an array of Gecko accessibles to an NSArray of native accessibles
-static inline NSMutableArray*
-ConvertToNSArray(nsTArray<Accessible*>& aArray)
-{
+static inline NSMutableArray* ConvertToNSArray(nsTArray<Accessible*>& aArray) {
   NSMutableArray* nativeArray = [[NSMutableArray alloc] init];
 
   // iterate through the list, and get each native accessible.
   size_t totalCount = aArray.Length();
   for (size_t i = 0; i < totalCount; i++) {
     Accessible* curAccessible = aArray.ElementAt(i);
     mozAccessible* curNative = GetNativeFromGeckoAccessible(curAccessible);
-    if (curNative)
-      [nativeArray addObject:GetObjectOrRepresentedView(curNative)];
+    if (curNative) [nativeArray addObject:GetObjectOrRepresentedView(curNative)];
   }
 
   return nativeArray;
 }
 
 // convert an array of Gecko proxy accessibles to an NSArray of native accessibles
-static inline NSMutableArray*
-ConvertToNSArray(nsTArray<ProxyAccessible*>& aArray)
-{
+static inline NSMutableArray* ConvertToNSArray(nsTArray<ProxyAccessible*>& aArray) {
   NSMutableArray* nativeArray = [[NSMutableArray alloc] init];
 
   // iterate through the list, and get each native accessible.
   size_t totalCount = aArray.Length();
   for (size_t i = 0; i < totalCount; i++) {
     ProxyAccessible* curAccessible = aArray.ElementAt(i);
     mozAccessible* curNative = GetNativeFromProxy(curAccessible);
-    if (curNative)
-      [nativeArray addObject:GetObjectOrRepresentedView(curNative)];
+    if (curNative) [nativeArray addObject:GetObjectOrRepresentedView(curNative)];
   }
 
   return nativeArray;
 }
 
 #pragma mark -
 
 @implementation mozAccessible
 
-- (id)initWithAccessible:(uintptr_t)aGeckoAccessible
-{
+- (id)initWithAccessible:(uintptr_t)aGeckoAccessible {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   if ((self = [super init])) {
     mGeckoAccessible = aGeckoAccessible;
     if (aGeckoAccessible & IS_PROXY)
-      mRole = [self getProxyAccessible]->Role();
+      mRole = [self getProxyAccessible] -> Role();
     else
-      mRole = [self getGeckoAccessible]->Role();
+      mRole = [self getGeckoAccessible] -> Role();
   }
 
   return self;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
-- (void)dealloc
-{
+- (void)dealloc {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   [mChildren release];
   [super dealloc];
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
-- (mozilla::a11y::AccessibleWrap*)getGeckoAccessible
-{
+- (mozilla::a11y::AccessibleWrap*)getGeckoAccessible {
   // Check if mGeckoAccessible points at a proxy
-  if (mGeckoAccessible & IS_PROXY)
-    return nil;
+  if (mGeckoAccessible & IS_PROXY) return nil;
 
   return reinterpret_cast<AccessibleWrap*>(mGeckoAccessible);
 }
 
-- (mozilla::a11y::ProxyAccessible*)getProxyAccessible
-{
+- (mozilla::a11y::ProxyAccessible*)getProxyAccessible {
   // Check if mGeckoAccessible points at a proxy
-  if (!(mGeckoAccessible & IS_PROXY))
-    return nil;
+  if (!(mGeckoAccessible & IS_PROXY)) return nil;
 
   return reinterpret_cast<ProxyAccessible*>(mGeckoAccessible & ~IS_PROXY);
 }
 
 #pragma mark -
 
-- (BOOL)accessibilityIsIgnored
-{
+- (BOOL)accessibilityIsIgnored {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
 
   // unknown (either unimplemented, or irrelevant) elements are marked as ignored
   // as well as expired elements.
 
   bool noRole = [[self role] isEqualToString:NSAccessibilityUnknownRole];
   if (AccessibleWrap* accWrap = [self getGeckoAccessible])
     return (noRole && !(accWrap->InteractiveState() & states::FOCUSABLE));
@@ -151,18 +138,17 @@ ConvertToNSArray(nsTArray<ProxyAccessibl
   if (ProxyAccessible* proxy = [self getProxyAccessible])
     return (noRole && !(proxy->State() & states::FOCUSABLE));
 
   return true;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(NO);
 }
 
-- (NSArray*)additionalAccessibilityAttributeNames
-{
+- (NSArray*)additionalAccessibilityAttributeNames {
   NSMutableArray* additional = [NSMutableArray array];
   [additional addObject:NSAccessibilityDOMIdentifierAttribute];
   switch (mRole) {
     case roles::MATHML_ROOT:
       [additional addObject:NSAccessibilityMathRootIndexAttribute];
       [additional addObject:NSAccessibilityMathRootRadicandAttribute];
       break;
     case roles::MATHML_SQUARE_ROOT:
@@ -197,634 +183,535 @@ ConvertToNSArray(nsTArray<ProxyAccessibl
     // - NSAccessibilityMathFencedCloseAttribute
     default:
       break;
   }
 
   return additional;
 }
 
-- (NSArray*)accessibilityAttributeNames
-{
+- (NSArray*)accessibilityAttributeNames {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   // if we're expired, we don't support any attributes.
   AccessibleWrap* accWrap = [self getGeckoAccessible];
   ProxyAccessible* proxy = [self getProxyAccessible];
-  if (!accWrap && !proxy)
-    return [NSArray array];
+  if (!accWrap && !proxy) return [NSArray array];
 
   static NSArray* generalAttributes = nil;
 
   if (!generalAttributes) {
     // standard attributes that are shared and supported by all generic elements.
-    generalAttributes = [[NSArray alloc] initWithObjects:  NSAccessibilityChildrenAttribute,
-                                                           NSAccessibilityParentAttribute,
-                                                           NSAccessibilityRoleAttribute,
-                                                           NSAccessibilityTitleAttribute,
-                                                           NSAccessibilityValueAttribute,
-                                                           NSAccessibilitySubroleAttribute,
-                                                           NSAccessibilityRoleDescriptionAttribute,
-                                                           NSAccessibilityPositionAttribute,
-                                                           NSAccessibilityEnabledAttribute,
-                                                           NSAccessibilitySizeAttribute,
-                                                           NSAccessibilityWindowAttribute,
-                                                           NSAccessibilityFocusedAttribute,
-                                                           NSAccessibilityHelpAttribute,
-                                                           NSAccessibilityTitleUIElementAttribute,
-                                                           NSAccessibilityTopLevelUIElementAttribute,
+    generalAttributes = [[NSArray alloc]
+        initWithObjects:NSAccessibilityChildrenAttribute, NSAccessibilityParentAttribute,
+                        NSAccessibilityRoleAttribute, NSAccessibilityTitleAttribute,
+                        NSAccessibilityValueAttribute, NSAccessibilitySubroleAttribute,
+                        NSAccessibilityRoleDescriptionAttribute, NSAccessibilityPositionAttribute,
+                        NSAccessibilityEnabledAttribute, NSAccessibilitySizeAttribute,
+                        NSAccessibilityWindowAttribute, NSAccessibilityFocusedAttribute,
+                        NSAccessibilityHelpAttribute, NSAccessibilityTitleUIElementAttribute,
+                        NSAccessibilityTopLevelUIElementAttribute,
 #if DEBUG
-                                                           @"AXMozDescription",
+                        @"AXMozDescription",
 #endif
-                                                           nil];
+                        nil];
   }
 
   NSArray* objectAttributes = generalAttributes;
 
   NSArray* additionalAttributes = [self additionalAccessibilityAttributeNames];
   if ([additionalAttributes count])
     objectAttributes = [objectAttributes arrayByAddingObjectsFromArray:additionalAttributes];
 
   return objectAttributes;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
-- (id)childAt:(uint32_t)i
-{
+- (id)childAt:(uint32_t)i {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   if (AccessibleWrap* accWrap = [self getGeckoAccessible]) {
     Accessible* child = accWrap->GetChildAt(i);
     return child ? GetNativeFromGeckoAccessible(child) : nil;
   } else if (ProxyAccessible* proxy = [self getProxyAccessible]) {
     ProxyAccessible* child = proxy->ChildAt(i);
     return child ? GetNativeFromProxy(child) : nil;
   }
 
   return nil;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
-- (id)accessibilityAttributeValue:(NSString*)attribute
-{
+- (id)accessibilityAttributeValue:(NSString*)attribute {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   AccessibleWrap* accWrap = [self getGeckoAccessible];
   ProxyAccessible* proxy = [self getProxyAccessible];
-  if (!accWrap && !proxy)
-    return nil;
+  if (!accWrap && !proxy) return nil;
 
 #if DEBUG
   if ([attribute isEqualToString:@"AXMozDescription"])
     return [NSString stringWithFormat:@"role = %u native = %@", mRole, [self class]];
 #endif
 
-  if ([attribute isEqualToString:NSAccessibilityChildrenAttribute])
-    return [self children];
-  if ([attribute isEqualToString:NSAccessibilityParentAttribute])
-    return [self parent];
+  if ([attribute isEqualToString:NSAccessibilityChildrenAttribute]) return [self children];
+  if ([attribute isEqualToString:NSAccessibilityParentAttribute]) return [self parent];
 
 #ifdef DEBUG_hakan
-  NSLog (@"(%@ responding to attr %@)", self, attribute);
+  NSLog(@"(%@ responding to attr %@)", self, attribute);
 #endif
 
-  if ([attribute isEqualToString:NSAccessibilityRoleAttribute])
-    return [self role];
-  if ([attribute isEqualToString:NSAccessibilityPositionAttribute])
-    return [self position];
-  if ([attribute isEqualToString:NSAccessibilitySubroleAttribute])
-    return [self subrole];
+  if ([attribute isEqualToString:NSAccessibilityRoleAttribute]) return [self role];
+  if ([attribute isEqualToString:NSAccessibilityPositionAttribute]) return [self position];
+  if ([attribute isEqualToString:NSAccessibilitySubroleAttribute]) return [self subrole];
   if ([attribute isEqualToString:NSAccessibilityEnabledAttribute])
     return [NSNumber numberWithBool:[self isEnabled]];
-  if ([attribute isEqualToString:NSAccessibilityValueAttribute])
-    return [self value];
+  if ([attribute isEqualToString:NSAccessibilityValueAttribute]) return [self value];
   if ([attribute isEqualToString:NSAccessibilityRoleDescriptionAttribute])
     return [self roleDescription];
   if ([attribute isEqualToString:NSAccessibilityFocusedAttribute])
     return [NSNumber numberWithBool:[self isFocused]];
-  if ([attribute isEqualToString:NSAccessibilitySizeAttribute])
-    return [self size];
-  if ([attribute isEqualToString:NSAccessibilityWindowAttribute])
-    return [self window];
-  if ([attribute isEqualToString:NSAccessibilityTopLevelUIElementAttribute])
-    return [self window];
-  if ([attribute isEqualToString:NSAccessibilityTitleAttribute])
-    return [self title];
+  if ([attribute isEqualToString:NSAccessibilitySizeAttribute]) return [self size];
+  if ([attribute isEqualToString:NSAccessibilityWindowAttribute]) return [self window];
+  if ([attribute isEqualToString:NSAccessibilityTopLevelUIElementAttribute]) return [self window];
+  if ([attribute isEqualToString:NSAccessibilityTitleAttribute]) return [self title];
   if ([attribute isEqualToString:NSAccessibilityTitleUIElementAttribute]) {
     if (accWrap) {
       Relation rel = accWrap->RelationByType(RelationType::LABELLED_BY);
       Accessible* tempAcc = rel.Next();
       return tempAcc ? GetNativeFromGeckoAccessible(tempAcc) : nil;
     }
     nsTArray<ProxyAccessible*> rel = proxy->RelationByType(RelationType::LABELLED_BY);
     ProxyAccessible* tempProxy = rel.SafeElementAt(0);
     return tempProxy ? GetNativeFromProxy(tempProxy) : nil;
   }
-  if ([attribute isEqualToString:NSAccessibilityHelpAttribute])
-    return [self help];
-  if ([attribute isEqualToString:NSAccessibilityOrientationAttribute])
-    return [self orientation];
+  if ([attribute isEqualToString:NSAccessibilityHelpAttribute]) return [self help];
+  if ([attribute isEqualToString:NSAccessibilityOrientationAttribute]) return [self orientation];
 
   if ([attribute isEqualToString:NSAccessibilityDOMIdentifierAttribute]) {
     nsAutoString id;
     if (accWrap)
       nsCoreUtils::GetID(accWrap->GetContent(), id);
     else
       proxy->DOMNodeID(id);
     return nsCocoaUtils::ToNSString(id);
   }
 
   switch (mRole) {
-  case roles::MATHML_ROOT:
-    if ([attribute isEqualToString:NSAccessibilityMathRootRadicandAttribute])
-      return [self childAt:0];
-    if ([attribute isEqualToString:NSAccessibilityMathRootIndexAttribute])
-      return [self childAt:1];
-    break;
-  case roles::MATHML_SQUARE_ROOT:
-    if ([attribute isEqualToString:NSAccessibilityMathRootRadicandAttribute])
-      return [self childAt:0];
-    break;
-  case roles::MATHML_FRACTION:
-    if ([attribute isEqualToString:NSAccessibilityMathFractionNumeratorAttribute])
-      return [self childAt:0];
-    if ([attribute isEqualToString:NSAccessibilityMathFractionDenominatorAttribute])
-      return [self childAt:1];
-    if ([attribute isEqualToString:NSAccessibilityMathLineThicknessAttribute]) {
-      // WebKit sets line thickness to some logical value parsed in the
-      // renderer object of the <mfrac> element. It's not clear whether the
-      // exact value is relevant to assistive technologies. From a semantic
-      // point of view, the only important point is to distinguish between
-      // <mfrac> elements that have a fraction bar and those that do not.
-      // Per the MathML 3 spec, the latter happens iff the linethickness
-      // attribute is of the form [zero-float][optional-unit]. In that case we
-      // set line thickness to zero and in the other cases we set it to one.
-      nsAutoString thickness;
-      if (accWrap) {
-        nsCOMPtr<nsIPersistentProperties> attributes = accWrap->Attributes();
-        nsAccUtils::GetAccAttr(attributes, nsGkAtoms::linethickness_, thickness);
-      } else {
-        AutoTArray<Attribute, 10> attrs;
-        proxy->Attributes(&attrs);
-        for (size_t i = 0 ; i < attrs.Length() ; i++) {
-          if (attrs.ElementAt(i).Name() == "thickness") {
-            thickness = attrs.ElementAt(i).Value();
-            break;
+    case roles::MATHML_ROOT:
+      if ([attribute isEqualToString:NSAccessibilityMathRootRadicandAttribute])
+        return [self childAt:0];
+      if ([attribute isEqualToString:NSAccessibilityMathRootIndexAttribute])
+        return [self childAt:1];
+      break;
+    case roles::MATHML_SQUARE_ROOT:
+      if ([attribute isEqualToString:NSAccessibilityMathRootRadicandAttribute])
+        return [self childAt:0];
+      break;
+    case roles::MATHML_FRACTION:
+      if ([attribute isEqualToString:NSAccessibilityMathFractionNumeratorAttribute])
+        return [self childAt:0];
+      if ([attribute isEqualToString:NSAccessibilityMathFractionDenominatorAttribute])
+        return [self childAt:1];
+      if ([attribute isEqualToString:NSAccessibilityMathLineThicknessAttribute]) {
+        // WebKit sets line thickness to some logical value parsed in the
+        // renderer object of the <mfrac> element. It's not clear whether the
+        // exact value is relevant to assistive technologies. From a semantic
+        // point of view, the only important point is to distinguish between
+        // <mfrac> elements that have a fraction bar and those that do not.
+        // Per the MathML 3 spec, the latter happens iff the linethickness
+        // attribute is of the form [zero-float][optional-unit]. In that case we
+        // set line thickness to zero and in the other cases we set it to one.
+        nsAutoString thickness;
+        if (accWrap) {
+          nsCOMPtr<nsIPersistentProperties> attributes = accWrap->Attributes();
+          nsAccUtils::GetAccAttr(attributes, nsGkAtoms::linethickness_, thickness);
+        } else {
+          AutoTArray<Attribute, 10> attrs;
+          proxy->Attributes(&attrs);
+          for (size_t i = 0; i < attrs.Length(); i++) {
+            if (attrs.ElementAt(i).Name() == "thickness") {
+              thickness = attrs.ElementAt(i).Value();
+              break;
+            }
           }
         }
+        double value = 1.0;
+        if (!thickness.IsEmpty())
+          value = PR_strtod(NS_LossyConvertUTF16toASCII(thickness).get(), nullptr);
+        return [NSNumber numberWithInteger:(value ? 1 : 0)];
       }
-      double value = 1.0;
-      if (!thickness.IsEmpty())
-        value = PR_strtod(NS_LossyConvertUTF16toASCII(thickness).get(),
-                          nullptr);
-      return [NSNumber numberWithInteger:(value ? 1 : 0)];
-    }
-    break;
-  case roles::MATHML_SUB:
-    if ([attribute isEqualToString:NSAccessibilityMathBaseAttribute])
-      return [self childAt:0];
-    if ([attribute isEqualToString:NSAccessibilityMathSubscriptAttribute])
-      return [self childAt:1];
+      break;
+    case roles::MATHML_SUB:
+      if ([attribute isEqualToString:NSAccessibilityMathBaseAttribute]) return [self childAt:0];
+      if ([attribute isEqualToString:NSAccessibilityMathSubscriptAttribute])
+        return [self childAt:1];
 #ifdef DEBUG
-    if ([attribute isEqualToString:NSAccessibilityMathSuperscriptAttribute])
-      return nil;
+      if ([attribute isEqualToString:NSAccessibilityMathSuperscriptAttribute]) return nil;
 #endif
-    break;
-  case roles::MATHML_SUP:
-    if ([attribute isEqualToString:NSAccessibilityMathBaseAttribute])
-      return [self childAt:0];
+      break;
+    case roles::MATHML_SUP:
+      if ([attribute isEqualToString:NSAccessibilityMathBaseAttribute]) return [self childAt:0];
 #ifdef DEBUG
-    if ([attribute isEqualToString:NSAccessibilityMathSubscriptAttribute])
-      return nil;
+      if ([attribute isEqualToString:NSAccessibilityMathSubscriptAttribute]) return nil;
 #endif
-    if ([attribute isEqualToString:NSAccessibilityMathSuperscriptAttribute])
-      return [self childAt:1];
-    break;
-  case roles::MATHML_SUB_SUP:
-    if ([attribute isEqualToString:NSAccessibilityMathBaseAttribute])
-      return [self childAt:0];
-    if ([attribute isEqualToString:NSAccessibilityMathSubscriptAttribute])
-      return [self childAt:1];
-    if ([attribute isEqualToString:NSAccessibilityMathSuperscriptAttribute])
-      return [self childAt:2];
-    break;
-  case roles::MATHML_UNDER:
-    if ([attribute isEqualToString:NSAccessibilityMathBaseAttribute])
-      return [self childAt:0];
-    if ([attribute isEqualToString:NSAccessibilityMathUnderAttribute])
-      return [self childAt:1];
+      if ([attribute isEqualToString:NSAccessibilityMathSuperscriptAttribute])
+        return [self childAt:1];
+      break;
+    case roles::MATHML_SUB_SUP:
+      if ([attribute isEqualToString:NSAccessibilityMathBaseAttribute]) return [self childAt:0];
+      if ([attribute isEqualToString:NSAccessibilityMathSubscriptAttribute])
+        return [self childAt:1];
+      if ([attribute isEqualToString:NSAccessibilityMathSuperscriptAttribute])
+        return [self childAt:2];
+      break;
+    case roles::MATHML_UNDER:
+      if ([attribute isEqualToString:NSAccessibilityMathBaseAttribute]) return [self childAt:0];
+      if ([attribute isEqualToString:NSAccessibilityMathUnderAttribute]) return [self childAt:1];
 #ifdef DEBUG
-    if ([attribute isEqualToString:NSAccessibilityMathOverAttribute])
-      return nil;
+      if ([attribute isEqualToString:NSAccessibilityMathOverAttribute]) return nil;
 #endif
-    break;
-  case roles::MATHML_OVER:
-    if ([attribute isEqualToString:NSAccessibilityMathBaseAttribute])
-      return [self childAt:0];
+      break;
+    case roles::MATHML_OVER:
+      if ([attribute isEqualToString:NSAccessibilityMathBaseAttribute]) return [self childAt:0];
 #ifdef DEBUG
-    if ([attribute isEqualToString:NSAccessibilityMathUnderAttribute])
-      return nil;
+      if ([attribute isEqualToString:NSAccessibilityMathUnderAttribute]) return nil;
 #endif
-    if ([attribute isEqualToString:NSAccessibilityMathOverAttribute])
-      return [self childAt:1];
-    break;
-  case roles::MATHML_UNDER_OVER:
-    if ([attribute isEqualToString:NSAccessibilityMathBaseAttribute])
-      return [self childAt:0];
-    if ([attribute isEqualToString:NSAccessibilityMathUnderAttribute])
-      return [self childAt:1];
-    if ([attribute isEqualToString:NSAccessibilityMathOverAttribute])
-      return [self childAt:2];
-    break;
-  // XXX bug 1176983
-  // roles::MATHML_MULTISCRIPTS should also have the following attributes:
-  // - NSAccessibilityMathPrescriptsAttribute
-  // - NSAccessibilityMathPostscriptsAttribute
-  // XXX bug 1176970
-  // roles::MATHML_FENCED should also have the following attributes:
-  // - NSAccessibilityMathFencedOpenAttribute
-  // - NSAccessibilityMathFencedCloseAttribute
-  default:
-    break;
+      if ([attribute isEqualToString:NSAccessibilityMathOverAttribute]) return [self childAt:1];
+      break;
+    case roles::MATHML_UNDER_OVER:
+      if ([attribute isEqualToString:NSAccessibilityMathBaseAttribute]) return [self childAt:0];
+      if ([attribute isEqualToString:NSAccessibilityMathUnderAttribute]) return [self childAt:1];
+      if ([attribute isEqualToString:NSAccessibilityMathOverAttribute]) return [self childAt:2];
+      break;
+    // XXX bug 1176983
+    // roles::MATHML_MULTISCRIPTS should also have the following attributes:
+    // - NSAccessibilityMathPrescriptsAttribute
+    // - NSAccessibilityMathPostscriptsAttribute
+    // XXX bug 1176970
+    // roles::MATHML_FENCED should also have the following attributes:
+    // - NSAccessibilityMathFencedOpenAttribute
+    // - NSAccessibilityMathFencedCloseAttribute
+    default:
+      break;
   }
 
 #ifdef DEBUG
- NSLog (@"!!! %@ can't respond to attribute %@", self, attribute);
+  NSLog(@"!!! %@ can't respond to attribute %@", self, attribute);
 #endif
   return nil;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
-- (BOOL)accessibilityIsAttributeSettable:(NSString*)attribute
-{
+- (BOOL)accessibilityIsAttributeSettable:(NSString*)attribute {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
 
-  if ([attribute isEqualToString:NSAccessibilityFocusedAttribute])
-    return [self canBeFocused];
+  if ([attribute isEqualToString:NSAccessibilityFocusedAttribute]) return [self canBeFocused];
 
   return NO;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(NO);
 }
 
-- (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute
-{
+- (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
 #ifdef DEBUG_hakan
-  NSLog (@"[%@] %@='%@'", self, attribute, value);
+  NSLog(@"[%@] %@='%@'", self, attribute, value);
 #endif
 
   // we only support focusing elements so far.
   if ([attribute isEqualToString:NSAccessibilityFocusedAttribute] && [value boolValue])
     [self focus];
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
-- (id)accessibilityHitTest:(NSPoint)point
-{
+- (id)accessibilityHitTest:(NSPoint)point {
   AccessibleWrap* accWrap = [self getGeckoAccessible];
   ProxyAccessible* proxy = [self getProxyAccessible];
-  if (!accWrap && !proxy)
-    return nil;
+  if (!accWrap && !proxy) return nil;
 
   // Convert the given screen-global point in the cocoa coordinate system (with
   // origin in the bottom-left corner of the screen) into point in the Gecko
   // coordinate system (with origin in a top-left screen point).
   NSScreen* mainView = [[NSScreen screens] objectAtIndex:0];
-  NSPoint tmpPoint = NSMakePoint(point.x,
-                                 [mainView frame].size.height - point.y);
-  LayoutDeviceIntPoint geckoPoint = nsCocoaUtils::
-    CocoaPointsToDevPixels(tmpPoint, nsCocoaUtils::GetBackingScaleFactor(mainView));
+  NSPoint tmpPoint = NSMakePoint(point.x, [mainView frame].size.height - point.y);
+  LayoutDeviceIntPoint geckoPoint =
+      nsCocoaUtils::CocoaPointsToDevPixels(tmpPoint, nsCocoaUtils::GetBackingScaleFactor(mainView));
 
   mozAccessible* nativeChild = nil;
   if (accWrap) {
-    Accessible* child = accWrap->ChildAtPoint(geckoPoint.x, geckoPoint.y,
-                                  Accessible::eDeepestChild);
-    if (child)
-      nativeChild = GetNativeFromGeckoAccessible(child);
+    Accessible* child =
+        accWrap->ChildAtPoint(geckoPoint.x, geckoPoint.y, Accessible::eDeepestChild);
+    if (child) nativeChild = GetNativeFromGeckoAccessible(child);
   } else if (proxy) {
-    ProxyAccessible* child = proxy->ChildAtPoint(geckoPoint.x, geckoPoint.y,
-                                  Accessible::eDeepestChild);
-    if (child)
-      nativeChild = GetNativeFromProxy(child);
+    ProxyAccessible* child =
+        proxy->ChildAtPoint(geckoPoint.x, geckoPoint.y, Accessible::eDeepestChild);
+    if (child) nativeChild = GetNativeFromProxy(child);
   }
 
-  if (nativeChild)
-    return nativeChild;
+  if (nativeChild) return nativeChild;
 
   // if we didn't find anything, return ourself or child view.
   return GetObjectOrRepresentedView(self);
 }
 
-- (NSArray*)accessibilityActionNames
-{
+- (NSArray*)accessibilityActionNames {
   return nil;
 }
 
-- (NSString*)accessibilityActionDescription:(NSString*)action
-{
+- (NSString*)accessibilityActionDescription:(NSString*)action {
   // by default we return whatever the MacOS API know about.
   // if you have custom actions, override.
   return NSAccessibilityActionDescription(action);
 }
 
-- (void)accessibilityPerformAction:(NSString*)action
-{
+- (void)accessibilityPerformAction:(NSString*)action {
 }
 
-- (id)accessibilityFocusedUIElement
-{
+- (id)accessibilityFocusedUIElement {
   AccessibleWrap* accWrap = [self getGeckoAccessible];
   ProxyAccessible* proxy = [self getProxyAccessible];
-  if (!accWrap && !proxy)
-    return nil;
+  if (!accWrap && !proxy) return nil;
 
   mozAccessible* focusedChild = nil;
   if (accWrap) {
     Accessible* focusedGeckoChild = accWrap->FocusedChild();
-    if (focusedGeckoChild)
-      focusedChild = GetNativeFromGeckoAccessible(focusedGeckoChild);
+    if (focusedGeckoChild) focusedChild = GetNativeFromGeckoAccessible(focusedGeckoChild);
   } else if (proxy) {
     ProxyAccessible* focusedGeckoChild = proxy->FocusedChild();
-    if (focusedGeckoChild)
-      focusedChild = GetNativeFromProxy(focusedGeckoChild);
+    if (focusedGeckoChild) focusedChild = GetNativeFromProxy(focusedGeckoChild);
   }
 
-  if (focusedChild)
-    return GetObjectOrRepresentedView(focusedChild);
+  if (focusedChild) return GetObjectOrRepresentedView(focusedChild);
 
   // return ourself if we can't get a native focused child.
   return GetObjectOrRepresentedView(self);
 }
 
 #pragma mark -
 
-- (id <mozAccessible>)parent
-{
+- (id<mozAccessible>)parent {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   id nativeParent = nil;
   if (AccessibleWrap* accWrap = [self getGeckoAccessible]) {
     Accessible* accessibleParent = accWrap->Parent();
-    if (accessibleParent)
-      nativeParent = GetNativeFromGeckoAccessible(accessibleParent);
-    if (nativeParent)
-      return GetObjectOrRepresentedView(nativeParent);
+    if (accessibleParent) nativeParent = GetNativeFromGeckoAccessible(accessibleParent);
+    if (nativeParent) return GetObjectOrRepresentedView(nativeParent);
 
     // Return native of root accessible if we have no direct parent
     nativeParent = GetNativeFromGeckoAccessible(accWrap->RootAccessible());
   } else if (ProxyAccessible* proxy = [self getProxyAccessible]) {
     if (ProxyAccessible* proxyParent = proxy->Parent()) {
       nativeParent = GetNativeFromProxy(proxyParent);
     }
 
-    if (nativeParent)
-      return GetObjectOrRepresentedView(nativeParent);
+    if (nativeParent) return GetObjectOrRepresentedView(nativeParent);
 
     Accessible* outerDoc = proxy->OuterDocOfRemoteBrowser();
-    nativeParent = outerDoc ?
-      GetNativeFromGeckoAccessible(outerDoc) : nil;
+    nativeParent = outerDoc ? GetNativeFromGeckoAccessible(outerDoc) : nil;
   } else {
     return nil;
   }
 
-  NSAssert1 (nativeParent, @"!!! we can't find a parent for %@", self);
+  NSAssert1(nativeParent, @"!!! we can't find a parent for %@", self);
 
   return GetObjectOrRepresentedView(nativeParent);
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
-- (BOOL)hasRepresentedView
-{
+- (BOOL)hasRepresentedView {
   return NO;
 }
 
-- (id)representedView
-{
+- (id)representedView {
   return nil;
 }
 
-- (BOOL)isRoot
-{
+- (BOOL)isRoot {
   return NO;
 }
 
 // gets our native children lazily.
 // returns nil when there are no children.
-- (NSArray*)children
-{
+- (NSArray*)children {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
-  if (mChildren)
-    return mChildren;
+  if (mChildren) return mChildren;
 
   // get the array of children.
   mChildren = [[NSMutableArray alloc] init];
 
   AccessibleWrap* accWrap = [self getGeckoAccessible];
   if (accWrap) {
     uint32_t childCount = accWrap->ChildCount();
     for (uint32_t childIdx = 0; childIdx < childCount; childIdx++) {
       mozAccessible* nativeChild = GetNativeFromGeckoAccessible(accWrap->GetChildAt(childIdx));
-      if (nativeChild)
-        [mChildren addObject:nativeChild];
+      if (nativeChild) [mChildren addObject:nativeChild];
     }
 
     // children from child if this is an outerdoc
     OuterDocAccessible* docOwner = accWrap->AsOuterDoc();
     if (docOwner) {
       if (ProxyAccessible* proxyDoc = docOwner->RemoteChildDoc()) {
         mozAccessible* nativeRemoteChild = GetNativeFromProxy(proxyDoc);
         [mChildren insertObject:nativeRemoteChild atIndex:0];
-        NSAssert1 (nativeRemoteChild, @"%@ found a child remote doc missing a native\n", self);
+        NSAssert1(nativeRemoteChild, @"%@ found a child remote doc missing a native\n", self);
       }
     }
   } else if (ProxyAccessible* proxy = [self getProxyAccessible]) {
-      uint32_t childCount = proxy->ChildrenCount();
-      for (uint32_t childIdx = 0; childIdx < childCount; childIdx++) {
-        mozAccessible* nativeChild = GetNativeFromProxy(proxy->ChildAt(childIdx));
-        if (nativeChild)
-          [mChildren addObject:nativeChild];
-      }
-
+    uint32_t childCount = proxy->ChildrenCount();
+    for (uint32_t childIdx = 0; childIdx < childCount; childIdx++) {
+      mozAccessible* nativeChild = GetNativeFromProxy(proxy->ChildAt(childIdx));
+      if (nativeChild) [mChildren addObject:nativeChild];
+    }
   }
 
   return mChildren;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
-- (NSValue*)position
-{
+- (NSValue*)position {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   nsIntRect rect;
   if (AccessibleWrap* accWrap = [self getGeckoAccessible])
     rect = accWrap->Bounds();
   else if (ProxyAccessible* proxy = [self getProxyAccessible])
     rect = proxy->Bounds();
   else
     return nil;
 
   NSScreen* mainView = [[NSScreen screens] objectAtIndex:0];
   CGFloat scaleFactor = nsCocoaUtils::GetBackingScaleFactor(mainView);
-  NSPoint p = NSMakePoint(static_cast<CGFloat>(rect.x) / scaleFactor,
-                         [mainView frame].size.height - static_cast<CGFloat>(rect.y + rect.height) / scaleFactor);
+  NSPoint p = NSMakePoint(
+      static_cast<CGFloat>(rect.x) / scaleFactor,
+      [mainView frame].size.height - static_cast<CGFloat>(rect.y + rect.height) / scaleFactor);
 
   return [NSValue valueWithPoint:p];
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
-- (NSValue*)size
-{
+- (NSValue*)size {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   nsIntRect rect;
   if (AccessibleWrap* accWrap = [self getGeckoAccessible])
     rect = accWrap->Bounds();
   else if (ProxyAccessible* proxy = [self getProxyAccessible])
     rect = proxy->Bounds();
   else
     return nil;
 
-  CGFloat scaleFactor =
-    nsCocoaUtils::GetBackingScaleFactor([[NSScreen screens] objectAtIndex:0]);
+  CGFloat scaleFactor = nsCocoaUtils::GetBackingScaleFactor([[NSScreen screens] objectAtIndex:0]);
   return [NSValue valueWithSize:NSMakeSize(static_cast<CGFloat>(rect.width) / scaleFactor,
                                            static_cast<CGFloat>(rect.height) / scaleFactor)];
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
-- (NSString*)role
-{
+- (NSString*)role {
   AccessibleWrap* accWrap = [self getGeckoAccessible];
   if (accWrap) {
-    #ifdef DEBUG_A11Y
-      NS_ASSERTION(nsAccUtils::IsTextInterfaceSupportCorrect(accWrap),
-                   "Does not support Text when it should");
-    #endif
+#ifdef DEBUG_A11Y
+    NS_ASSERTION(nsAccUtils::IsTextInterfaceSupportCorrect(accWrap),
+                 "Does not support Text when it should");
+#endif
   } else if (![self getProxyAccessible]) {
     return nil;
   }
 
 #define ROLE(geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role, androidClass, nameRule) \
-  case roles::geckoRole: \
+  case roles::geckoRole:                                                                         \
     return macRole;
 
   switch (mRole) {
 #include "RoleMap.h"
     default:
       MOZ_ASSERT_UNREACHABLE("Unknown role.");
       return NSAccessibilityUnknownRole;
   }
 
 #undef ROLE
 }
 
-- (NSString*)subrole
-{
+- (NSString*)subrole {
   AccessibleWrap* accWrap = [self getGeckoAccessible];
   ProxyAccessible* proxy = [self getProxyAccessible];
 
   // Deal with landmarks first
   nsAtom* landmark = nullptr;
   if (accWrap)
     landmark = accWrap->LandmarkRole();
   else if (proxy)
     landmark = proxy->LandmarkRole();
 
   // HTML Elements treated as landmarks
   // XXX bug 1371712
   if (landmark) {
-    if (landmark == nsGkAtoms::application)
-      return @"AXLandmarkApplication";
-    if (landmark == nsGkAtoms::banner)
-      return @"AXLandmarkBanner";
-    if (landmark == nsGkAtoms::complementary)
-      return @"AXLandmarkComplementary";
-    if (landmark == nsGkAtoms::contentinfo)
-      return @"AXLandmarkContentInfo";
-    if (landmark == nsGkAtoms::form)
-      return @"AXLandmarkForm";
-    if (landmark == nsGkAtoms::main)
-      return @"AXLandmarkMain";
-    if (landmark == nsGkAtoms::navigation)
-      return @"AXLandmarkNavigation";
-    if (landmark == nsGkAtoms::search)
-      return @"AXLandmarkSearch";
-    if (landmark == nsGkAtoms::searchbox)
-      return @"AXSearchField";
+    if (landmark == nsGkAtoms::application) return @"AXLandmarkApplication";
+    if (landmark == nsGkAtoms::banner) return @"AXLandmarkBanner";
+    if (landmark == nsGkAtoms::complementary) return @"AXLandmarkComplementary";
+    if (landmark == nsGkAtoms::contentinfo) return @"AXLandmarkContentInfo";
+    if (landmark == nsGkAtoms::form) return @"AXLandmarkForm";
+    if (landmark == nsGkAtoms::main) return @"AXLandmarkMain";
+    if (landmark == nsGkAtoms::navigation) return @"AXLandmarkNavigation";
+    if (landmark == nsGkAtoms::search) return @"AXLandmarkSearch";
+    if (landmark == nsGkAtoms::searchbox) return @"AXSearchField";
   }
 
   // macOS groups the specific landmark types of DPub ARIA into two broad
   // categories with corresponding subroles: Navigation and region/container.
-  if (mRole == roles::NAVIGATION)
-    return @"AXLandmarkNavigation";
-  if (mRole == roles::LANDMARK)
-    return @"AXLandmarkRegion";
+  if (mRole == roles::NAVIGATION) return @"AXLandmarkNavigation";
+  if (mRole == roles::LANDMARK) return @"AXLandmarkRegion";
 
   // Now, deal with widget roles
   nsStaticAtom* roleAtom = nullptr;
   if (accWrap && accWrap->HasARIARole()) {
     const nsRoleMapEntry* roleMap = accWrap->ARIARoleMap();
     roleAtom = roleMap->roleAtom;
   }
-  if (proxy)
-    roleAtom = proxy->ARIARoleAtom();
+  if (proxy) roleAtom = proxy->ARIARoleAtom();
 
   if (roleAtom) {
-    if (roleAtom == nsGkAtoms::alert)
-      return @"AXApplicationAlert";
-    if (roleAtom == nsGkAtoms::alertdialog)
-      return @"AXApplicationAlertDialog";
-    if (roleAtom == nsGkAtoms::article)
-      return @"AXDocumentArticle";
-    if (roleAtom == nsGkAtoms::dialog)
-      return @"AXApplicationDialog";
-    if (roleAtom == nsGkAtoms::document)
-      return @"AXDocument";
-    if (roleAtom == nsGkAtoms::log_)
-      return @"AXApplicationLog";
-    if (roleAtom == nsGkAtoms::marquee)
-      return @"AXApplicationMarquee";
-    if (roleAtom == nsGkAtoms::math)
-      return @"AXDocumentMath";
-    if (roleAtom == nsGkAtoms::note_)
-      return @"AXDocumentNote";
-    if (roleAtom == nsGkAtoms::region)
-      return mRole == roles::REGION ? @"AXLandmarkRegion" : nil;
-    if (roleAtom == nsGkAtoms::status)
-      return @"AXApplicationStatus";
-    if (roleAtom == nsGkAtoms::tabpanel)
-      return @"AXTabPanel";
-    if (roleAtom == nsGkAtoms::timer)
-      return @"AXApplicationTimer";
-    if (roleAtom == nsGkAtoms::tooltip)
-      return @"AXUserInterfaceTooltip";
+    if (roleAtom == nsGkAtoms::alert) return @"AXApplicationAlert";
+    if (roleAtom == nsGkAtoms::alertdialog) return @"AXApplicationAlertDialog";
+    if (roleAtom == nsGkAtoms::article) return @"AXDocumentArticle";
+    if (roleAtom == nsGkAtoms::dialog) return @"AXApplicationDialog";
+    if (roleAtom == nsGkAtoms::document) return @"AXDocument";
+    if (roleAtom == nsGkAtoms::log_) return @"AXApplicationLog";
+    if (roleAtom == nsGkAtoms::marquee) return @"AXApplicationMarquee";
+    if (roleAtom == nsGkAtoms::math) return @"AXDocumentMath";
+    if (roleAtom == nsGkAtoms::note_) return @"AXDocumentNote";
+    if (roleAtom == nsGkAtoms::region) return mRole == roles::REGION ? @"AXLandmarkRegion" : nil;
+    if (roleAtom == nsGkAtoms::status) return @"AXApplicationStatus";
+    if (roleAtom == nsGkAtoms::tabpanel) return @"AXTabPanel";
+    if (roleAtom == nsGkAtoms::timer) return @"AXApplicationTimer";
+    if (roleAtom == nsGkAtoms::tooltip) return @"AXUserInterfaceTooltip";
   }
 
   switch (mRole) {
     case roles::LIST:
-      return @"AXContentList"; // 10.6+ NSAccessibilityContentListSubrole;
+      return @"AXContentList";  // 10.6+ NSAccessibilityContentListSubrole;
 
     case roles::ENTRY:
-      if ((accWrap && accWrap->IsSearchbox()) ||
-          (proxy && proxy->IsSearchbox()))
+      if ((accWrap && accWrap->IsSearchbox()) || (proxy && proxy->IsSearchbox()))
         return @"AXSearchField";
       break;
 
     case roles::DEFINITION_LIST:
-      return @"AXDefinitionList"; // 10.6+ NSAccessibilityDefinitionListSubrole;
+      return @"AXDefinitionList";  // 10.6+ NSAccessibilityDefinitionListSubrole;
 
     case roles::TERM:
       return @"AXTerm";
 
     case roles::DEFINITION:
       return @"AXDefinition";
 
     case roles::MATHML_MATH:
@@ -919,396 +806,356 @@ ConvertToNSArray(nsTArray<ProxyAccessibl
     case roles::NON_NATIVE_DOCUMENT:
       return @"AXDocument";
 
     // macOS added an AXSubrole value to distinguish generic AXGroup objects
     // from those which are AXGroups as a result of an explicit ARIA role,
     // such as the non-landmark, non-listitem text containers in DPub ARIA.
     case roles::FOOTNOTE:
     case roles::SECTION:
-      if (roleAtom)
-        return @"AXApplicationGroup";
+      if (roleAtom) return @"AXApplicationGroup";
       break;
 
     case roles::CONTENT_DELETION:
       return @"AXDeleteStyleGroup";
 
     case roles::CONTENT_INSERTION:
       return @"AXInsertStyleGroup";
 
     default:
       break;
   }
 
   return nil;
 }
 
-struct RoleDescrMap
-{
+struct RoleDescrMap {
   NSString* role;
   const nsString description;
 };
 
 static const RoleDescrMap sRoleDescrMap[] = {
-  { @"AXApplicationAlert", NS_LITERAL_STRING("alert") },
-  { @"AXApplicationAlertDialog", NS_LITERAL_STRING("alertDialog") },
-  { @"AXApplicationLog", NS_LITERAL_STRING("log") },
-  { @"AXApplicationMarquee", NS_LITERAL_STRING("marquee") },
-  { @"AXApplicationStatus", NS_LITERAL_STRING("status") },
-  { @"AXApplicationTimer", NS_LITERAL_STRING("timer") },
-  { @"AXContentSeparator", NS_LITERAL_STRING("separator") },
-  { @"AXDefinition", NS_LITERAL_STRING("definition") },
-  { @"AXDocument", NS_LITERAL_STRING("document") },
-  { @"AXDocumentArticle", NS_LITERAL_STRING("article") },
-  { @"AXDocumentMath", NS_LITERAL_STRING("math") },
-  { @"AXDocumentNote", NS_LITERAL_STRING("note") },
-  { @"AXLandmarkApplication", NS_LITERAL_STRING("application") },
-  { @"AXLandmarkBanner", NS_LITERAL_STRING("banner") },
-  { @"AXLandmarkComplementary", NS_LITERAL_STRING("complementary") },
-  { @"AXLandmarkContentInfo", NS_LITERAL_STRING("content") },
-  { @"AXLandmarkMain", NS_LITERAL_STRING("main") },
-  { @"AXLandmarkNavigation", NS_LITERAL_STRING("navigation") },
-  { @"AXLandmarkRegion", NS_LITERAL_STRING("region") },
-  { @"AXLandmarkSearch", NS_LITERAL_STRING("search") },
-  { @"AXSearchField", NS_LITERAL_STRING("searchTextField") },
-  { @"AXTabPanel", NS_LITERAL_STRING("tabPanel") },
-  { @"AXTerm", NS_LITERAL_STRING("term") },
-  { @"AXUserInterfaceTooltip", NS_LITERAL_STRING("tooltip") }
+    {@"AXApplicationAlert", NS_LITERAL_STRING("alert")},
+    {@"AXApplicationAlertDialog", NS_LITERAL_STRING("alertDialog")},
+    {@"AXApplicationLog", NS_LITERAL_STRING("log")},
+    {@"AXApplicationMarquee", NS_LITERAL_STRING("marquee")},
+    {@"AXApplicationStatus", NS_LITERAL_STRING("status")},
+    {@"AXApplicationTimer", NS_LITERAL_STRING("timer")},
+    {@"AXContentSeparator", NS_LITERAL_STRING("separator")},
+    {@"AXDefinition", NS_LITERAL_STRING("definition")},
+    {@"AXDocument", NS_LITERAL_STRING("document")},
+    {@"AXDocumentArticle", NS_LITERAL_STRING("article")},
+    {@"AXDocumentMath", NS_LITERAL_STRING("math")},
+    {@"AXDocumentNote", NS_LITERAL_STRING("note")},
+    {@"AXLandmarkApplication", NS_LITERAL_STRING("application")},
+    {@"AXLandmarkBanner", NS_LITERAL_STRING("banner")},
+    {@"AXLandmarkComplementary", NS_LITERAL_STRING("complementary")},
+    {@"AXLandmarkContentInfo", NS_LITERAL_STRING("content")},
+    {@"AXLandmarkMain", NS_LITERAL_STRING("main")},
+    {@"AXLandmarkNavigation", NS_LITERAL_STRING("navigation")},
+    {@"AXLandmarkRegion", NS_LITERAL_STRING("region")},
+    {@"AXLandmarkSearch", NS_LITERAL_STRING("search")},
+    {@"AXSearchField", NS_LITERAL_STRING("searchTextField")},
+    {@"AXTabPanel", NS_LITERAL_STRING("tabPanel")},
+    {@"AXTerm", NS_LITERAL_STRING("term")},
+    {@"AXUserInterfaceTooltip", NS_LITERAL_STRING("tooltip")}};
+
+struct RoleDescrComparator {
+  const NSString* mRole;
+  explicit RoleDescrComparator(const NSString* aRole) : mRole(aRole) {}
+  int operator()(const RoleDescrMap& aEntry) const { return [mRole compare:aEntry.role]; }
 };
 
-struct RoleDescrComparator
-{
-  const NSString* mRole;
-  explicit RoleDescrComparator(const NSString* aRole) : mRole(aRole) {}
-  int operator()(const RoleDescrMap& aEntry) const {
-    return [mRole compare:aEntry.role];
-  }
-};
+- (NSString*)roleDescription {
+  if (mRole == roles::DOCUMENT) return utils::LocalizedString(NS_LITERAL_STRING("htmlContent"));
 
-- (NSString*)roleDescription
-{
-  if (mRole == roles::DOCUMENT)
-    return utils::LocalizedString(NS_LITERAL_STRING("htmlContent"));
+  if (mRole == roles::FIGURE) return utils::LocalizedString(NS_LITERAL_STRING("figure"));
 
-  if (mRole == roles::FIGURE)
-    return utils::LocalizedString(NS_LITERAL_STRING("figure"));
-
-  if (mRole == roles::HEADING)
-    return utils::LocalizedString(NS_LITERAL_STRING("heading"));
+  if (mRole == roles::HEADING) return utils::LocalizedString(NS_LITERAL_STRING("heading"));
 
   NSString* subrole = [self subrole];
 
   if (subrole) {
     size_t idx = 0;
-    if (BinarySearchIf(sRoleDescrMap, 0, ArrayLength(sRoleDescrMap),
-                       RoleDescrComparator(subrole), &idx)) {
+    if (BinarySearchIf(sRoleDescrMap, 0, ArrayLength(sRoleDescrMap), RoleDescrComparator(subrole),
+                       &idx)) {
       return utils::LocalizedString(sRoleDescrMap[idx].description);
     }
   }
 
   return NSAccessibilityRoleDescription([self role], subrole);
 }
 
-- (NSString*)title
-{
+- (NSString*)title {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   nsAutoString title;
   if (AccessibleWrap* accWrap = [self getGeckoAccessible])
     accWrap->Name(title);
   else if (ProxyAccessible* proxy = [self getProxyAccessible])
     proxy->Name(title);
 
   return nsCocoaUtils::ToNSString(title);
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
-- (id)value
-{
+- (id)value {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   nsAutoString value;
   if (AccessibleWrap* accWrap = [self getGeckoAccessible])
     accWrap->Value(value);
   else if (ProxyAccessible* proxy = [self getProxyAccessible])
     proxy->Value(value);
 
   return nsCocoaUtils::ToNSString(value);
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
-- (void)valueDidChange
-{
+- (void)valueDidChange {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
 #ifdef DEBUG_hakan
   NSLog(@"%@'s value changed!", self);
 #endif
-  // sending out a notification is expensive, so we don't do it other than for really important objects,
-  // like mozTextAccessible.
+  // sending out a notification is expensive, so we don't do it other than for really important
+  // objects, like mozTextAccessible.
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
-- (void)selectedTextDidChange
-{
+- (void)selectedTextDidChange {
   // Do nothing. mozTextAccessible will.
 }
 
-- (void)documentLoadComplete
-{
+- (void)documentLoadComplete {
   id realSelf = GetObjectOrRepresentedView(self);
   NSAccessibilityPostNotification(realSelf, NSAccessibilityFocusedUIElementChangedNotification);
   NSAccessibilityPostNotification(realSelf, @"AXLoadComplete");
   NSAccessibilityPostNotification(realSelf, @"AXLayoutComplete");
 }
 
-- (NSString*)help
-{
+- (NSString*)help {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   // What needs to go here is actually the accDescription of an item.
   // The MSAA acc_help method has nothing to do with this one.
   nsAutoString helpText;
   if (AccessibleWrap* accWrap = [self getGeckoAccessible])
     accWrap->Description(helpText);
   else if (ProxyAccessible* proxy = [self getProxyAccessible])
     proxy->Description(helpText);
 
   return nsCocoaUtils::ToNSString(helpText);
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
-- (NSString*)orientation
-{
+- (NSString*)orientation {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   uint64_t state;
   if (AccessibleWrap* accWrap = [self getGeckoAccessible])
     state = accWrap->InteractiveState();
   else if (ProxyAccessible* proxy = [self getProxyAccessible])
     state = proxy->State();
   else
     state = 0;
 
-  if (state & states::HORIZONTAL)
-    return NSAccessibilityHorizontalOrientationValue;
-  if (state & states::VERTICAL)
-    return NSAccessibilityVerticalOrientationValue;
+  if (state & states::HORIZONTAL) return NSAccessibilityHorizontalOrientationValue;
+  if (state & states::VERTICAL) return NSAccessibilityVerticalOrientationValue;
 
   return NSAccessibilityUnknownOrientationValue;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
 // objc-style description (from NSObject); not to be confused with the accessible description above.
-- (NSString*)description
-{
+- (NSString*)description {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   return [NSString stringWithFormat:@"(%p) %@", self, [self role]];
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
-- (BOOL)isFocused
-{
+- (BOOL)isFocused {
   if (AccessibleWrap* accWrap = [self getGeckoAccessible]) {
     return FocusMgr()->IsFocused(accWrap);
   }
 
-  return false; //XXX: proxy implementation is needed.
+  return false;  // XXX: proxy implementation is needed.
 }
 
-- (BOOL)canBeFocused
-{
+- (BOOL)canBeFocused {
   if (AccessibleWrap* accWrap = [self getGeckoAccessible])
-      return accWrap->InteractiveState() & states::FOCUSABLE;
+    return accWrap->InteractiveState() & states::FOCUSABLE;
 
-  if (ProxyAccessible* proxy = [self getProxyAccessible])
-    return proxy->State() & states::FOCUSABLE;
+  if (ProxyAccessible* proxy = [self getProxyAccessible]) return proxy->State() & states::FOCUSABLE;
 
   return false;
 }
 
-- (BOOL)focus
-{
+- (BOOL)focus {
   if (AccessibleWrap* accWrap = [self getGeckoAccessible])
     accWrap->TakeFocus();
   else if (ProxyAccessible* proxy = [self getProxyAccessible])
     proxy->TakeFocus();
   else
     return NO;
 
   return YES;
 }
 
-- (BOOL)isEnabled
-{
+- (BOOL)isEnabled {
   if (AccessibleWrap* accWrap = [self getGeckoAccessible])
     return ((accWrap->InteractiveState() & states::UNAVAILABLE) == 0);
 
   if (ProxyAccessible* proxy = [self getProxyAccessible])
     return ((proxy->State() & states::UNAVAILABLE) == 0);
 
   return false;
 }
 
 // The root accessible calls this when the focused node was
 // changed to us.
-- (void)didReceiveFocus
-{
+- (void)didReceiveFocus {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
 #ifdef DEBUG_hakan
-  NSLog (@"%@ received focus!", self);
+  NSLog(@"%@ received focus!", self);
 #endif
   NSAccessibilityPostNotification(GetObjectOrRepresentedView(self),
                                   NSAccessibilityFocusedUIElementChangedNotification);
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
-- (NSWindow*)window
-{
+- (NSWindow*)window {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   // Get a pointer to the native window (NSWindow) we reside in.
-  NSWindow *nativeWindow = nil;
+  NSWindow* nativeWindow = nil;
   DocAccessible* docAcc = nullptr;
   if (AccessibleWrap* accWrap = [self getGeckoAccessible]) {
     docAcc = accWrap->Document();
   } else if (ProxyAccessible* proxy = [self getProxyAccessible]) {
     Accessible* outerDoc = proxy->OuterDocOfRemoteBrowser();
-    if (outerDoc)
-      docAcc = outerDoc->Document();
+    if (outerDoc) docAcc = outerDoc->Document();
   }
 
-  if (docAcc)
-    nativeWindow = static_cast<NSWindow*>(docAcc->GetNativeWindow());
+  if (docAcc) nativeWindow = static_cast<NSWindow*>(docAcc->GetNativeWindow());
 
   NSAssert1(nativeWindow, @"Could not get native window for %@", self);
   return nativeWindow;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
-- (void)invalidateChildren
-{
+- (void)invalidateChildren {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   // make room for new children
   [mChildren release];
   mChildren = nil;
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
-- (void)appendChild:(Accessible*)aAccessible
-{
+- (void)appendChild:(Accessible*)aAccessible {
   // if mChildren is nil, then we don't even need to bother
-  if (!mChildren)
-    return;
+  if (!mChildren) return;
 
-  mozAccessible *curNative = GetNativeFromGeckoAccessible(aAccessible);
-  if (curNative)
-    [mChildren addObject:curNative];
+  mozAccessible* curNative = GetNativeFromGeckoAccessible(aAccessible);
+  if (curNative) [mChildren addObject:curNative];
 }
 
-- (void)expire
-{
+- (void)expire {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   [self invalidateChildren];
 
   mGeckoAccessible = 0;
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
-- (BOOL)isExpired
-{
+- (BOOL)isExpired {
   return ![self getGeckoAccessible] && ![self getProxyAccessible];
 }
 
 #pragma mark -
 #pragma mark Debug methods
 #pragma mark -
 
 #ifdef DEBUG
 
 // will check that our children actually reference us as their
 // parent.
-- (void)sanityCheckChildren:(NSArray *)children
-{
+- (void)sanityCheckChildren:(NSArray*)children {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
-  NSEnumerator *iter = [children objectEnumerator];
-  mozAccessible *curObj = nil;
+  NSEnumerator* iter = [children objectEnumerator];
+  mozAccessible* curObj = nil;
 
   NSLog(@"sanity checking %@", self);
 
   while ((curObj = [iter nextObject])) {
     id realSelf = GetObjectOrRepresentedView(self);
     NSLog(@"checking %@", realSelf);
     NSAssert2([curObj parent] == realSelf,
-              @"!!! %@ not returning %@ as AXParent, even though it is a AXChild of it!", curObj, realSelf);
+              @"!!! %@ not returning %@ as AXParent, even though it is a AXChild of it!", curObj,
+              realSelf);
   }
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
-- (void)sanityCheckChildren
-{
+- (void)sanityCheckChildren {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   [self sanityCheckChildren:[self children]];
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
-- (void)printHierarchy
-{
+- (void)printHierarchy {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   [self printHierarchyWithLevel:0];
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
-- (void)printHierarchyWithLevel:(unsigned)level
-{
+- (void)printHierarchyWithLevel:(unsigned)level {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   NSAssert(![self isExpired], @"!!! trying to print hierarchy of expired object!");
 
   // print this node
-  NSMutableString *indent = [NSMutableString stringWithCapacity:level];
-  unsigned i=0;
-  for (;i<level;i++)
-    [indent appendString:@" "];
+  NSMutableString* indent = [NSMutableString stringWithCapacity:level];
+  unsigned i = 0;
+  for (; i < level; i++) [indent appendString:@" "];
 
-  NSLog (@"%@(#%i) %@", indent, level, self);
+  NSLog(@"%@(#%i) %@", indent, level, self);
 
   // use |children| method to make sure our children are lazily fetched first.
-  NSArray *children = [self children];
-  if (!children)
-    return;
+  NSArray* children = [self children];
+  if (!children) return;
 
   [self sanityCheckChildren];
 
-  NSEnumerator *iter = [children objectEnumerator];
-  mozAccessible *object = nil;
+  NSEnumerator* iter = [children objectEnumerator];
+  mozAccessible* object = nil;
 
   while (iter && (object = [iter nextObject]))
     // print every child node's subtree, increasing the indenting
     // by two for every level.
-    [object printHierarchyWithLevel:(level+1)];
+    [object printHierarchyWithLevel:(level + 1)];
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 #endif /* DEBUG */
 
 @end
--- a/accessible/mac/mozActionElements.mm
+++ b/accessible/mac/mozActionElements.mm
@@ -19,241 +19,215 @@ enum CheckboxValue {
   // these constants correspond to the values in the OS
   kUnchecked = 0,
   kChecked = 1,
   kMixed = 2
 };
 
 @implementation mozButtonAccessible
 
-- (NSArray*)accessibilityAttributeNames
-{
+- (NSArray*)accessibilityAttributeNames {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
-  static NSArray *attributes = nil;
+  static NSArray* attributes = nil;
   if (!attributes) {
-    attributes = [[NSArray alloc] initWithObjects:NSAccessibilityParentAttribute, // required
-                                                  NSAccessibilityRoleAttribute, // required
-                                                  NSAccessibilityRoleDescriptionAttribute,
-                                                  NSAccessibilityPositionAttribute, // required
-                                                  NSAccessibilitySizeAttribute, // required
-                                                  NSAccessibilityWindowAttribute, // required
-                                                  NSAccessibilityPositionAttribute, // required
-                                                  NSAccessibilityTopLevelUIElementAttribute, // required
-                                                  NSAccessibilityHelpAttribute,
-                                                  NSAccessibilityEnabledAttribute, // required
-                                                  NSAccessibilityFocusedAttribute, // required
-                                                  NSAccessibilityTitleAttribute, // required
-                                                  NSAccessibilityChildrenAttribute,
-                                                  NSAccessibilityDescriptionAttribute,
+    attributes = [[NSArray alloc]
+        initWithObjects:NSAccessibilityParentAttribute,  // required
+                        NSAccessibilityRoleAttribute,    // required
+                        NSAccessibilityRoleDescriptionAttribute,
+                        NSAccessibilityPositionAttribute,           // required
+                        NSAccessibilitySizeAttribute,               // required
+                        NSAccessibilityWindowAttribute,             // required
+                        NSAccessibilityPositionAttribute,           // required
+                        NSAccessibilityTopLevelUIElementAttribute,  // required
+                        NSAccessibilityHelpAttribute,
+                        NSAccessibilityEnabledAttribute,  // required
+                        NSAccessibilityFocusedAttribute,  // required
+                        NSAccessibilityTitleAttribute,    // required
+                        NSAccessibilityChildrenAttribute, NSAccessibilityDescriptionAttribute,
 #if DEBUG
-                                                  @"AXMozDescription",
+                        @"AXMozDescription",
 #endif
-                                                  nil];
+                        nil];
   }
   return attributes;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
-- (id)accessibilityAttributeValue:(NSString *)attribute
-{
+- (id)accessibilityAttributeValue:(NSString*)attribute {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   if ([attribute isEqualToString:NSAccessibilityChildrenAttribute]) {
-    if ([self hasPopup])
-      return [self children];
+    if ([self hasPopup]) return [self children];
     return nil;
   }
 
   if ([attribute isEqualToString:NSAccessibilityRoleDescriptionAttribute]) {
-    if ([self isTab])
-      return utils::LocalizedString(NS_LITERAL_STRING("tab"));
+    if ([self isTab]) return utils::LocalizedString(NS_LITERAL_STRING("tab"));
 
     return NSAccessibilityRoleDescription([self role], nil);
   }
 
   return [super accessibilityAttributeValue:attribute];
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
-- (BOOL)accessibilityIsIgnored
-{
+- (BOOL)accessibilityIsIgnored {
   return ![self getGeckoAccessible] && ![self getProxyAccessible];
 }
 
-- (NSArray*)accessibilityActionNames
-{
+- (NSArray*)accessibilityActionNames {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   if ([self isEnabled]) {
     if ([self hasPopup])
-      return [NSArray arrayWithObjects:NSAccessibilityPressAction,
-              NSAccessibilityShowMenuAction,
-              nil];
+      return
+          [NSArray arrayWithObjects:NSAccessibilityPressAction, NSAccessibilityShowMenuAction, nil];
     return [NSArray arrayWithObject:NSAccessibilityPressAction];
   }
   return nil;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
-- (NSString*)accessibilityActionDescription:(NSString*)action
-{
+- (NSString*)accessibilityActionDescription:(NSString*)action {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   if ([action isEqualToString:NSAccessibilityPressAction]) {
-    if ([self isTab])
-      return utils::LocalizedString(NS_LITERAL_STRING("switch"));
+    if ([self isTab]) return utils::LocalizedString(NS_LITERAL_STRING("switch"));
 
-    return @"press button"; // XXX: localize this later?
+    return @"press button";  // XXX: localize this later?
   }
 
   if ([self hasPopup]) {
-    if ([action isEqualToString:NSAccessibilityShowMenuAction])
-      return @"show menu";
+    if ([action isEqualToString:NSAccessibilityShowMenuAction]) return @"show menu";
   }
 
   return nil;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
-- (void)accessibilityPerformAction:(NSString*)action
-{
+- (void)accessibilityPerformAction:(NSString*)action {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   if ([self isEnabled] && [action isEqualToString:NSAccessibilityPressAction]) {
     // TODO: this should bring up the menu, but currently doesn't.
     //       once msaa and atk have merged better, they will implement
     //       the action needed to show the menu.
     [self click];
   }
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
-- (void)click
-{
+- (void)click {
   // both buttons and checkboxes have only one action. we should really stop using arbitrary
   // arrays with actions, and define constants for these actions.
   if (AccessibleWrap* accWrap = [self getGeckoAccessible])
     accWrap->DoAction(0);
   else if (ProxyAccessible* proxy = [self getProxyAccessible])
     proxy->DoAction(0);
 }
 
-- (BOOL)isTab
-{
-  if (AccessibleWrap* accWrap = [self getGeckoAccessible])
-    return accWrap->Role() == roles::PAGETAB;
+- (BOOL)isTab {
+  if (AccessibleWrap* accWrap = [self getGeckoAccessible]) return accWrap->Role() == roles::PAGETAB;
 
-  if (ProxyAccessible* proxy = [self getProxyAccessible])
-    return proxy->Role() == roles::PAGETAB;
+  if (ProxyAccessible* proxy = [self getProxyAccessible]) return proxy->Role() == roles::PAGETAB;
 
   return false;
 }
 
-- (BOOL)hasPopup
-{
+- (BOOL)hasPopup {
   if (AccessibleWrap* accWrap = [self getGeckoAccessible])
     return accWrap->NativeState() & states::HASPOPUP;
 
   if (ProxyAccessible* proxy = [self getProxyAccessible])
     return proxy->NativeState() & states::HASPOPUP;
 
   return false;
 }
 
 @end
 
 @implementation mozCheckboxAccessible
 
-- (NSString*)accessibilityActionDescription:(NSString*)action
-{
+- (NSString*)accessibilityActionDescription:(NSString*)action {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   if ([action isEqualToString:NSAccessibilityPressAction]) {
-    if ([self isChecked] != kUnchecked)
-      return @"uncheck checkbox"; // XXX: localize this later?
+    if ([self isChecked] != kUnchecked) return @"uncheck checkbox";  // XXX: localize this later?
 
-    return @"check checkbox"; // XXX: localize this later?
+    return @"check checkbox";  // XXX: localize this later?
   }
 
   return nil;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
-- (int)isChecked
-{
+- (int)isChecked {
   uint64_t state = 0;
   if (AccessibleWrap* accWrap = [self getGeckoAccessible])
     state = accWrap->NativeState();
   else if (ProxyAccessible* proxy = [self getProxyAccessible])
     state = proxy->NativeState();
 
   // check if we're checked or in a mixed state
   if (state & states::CHECKED) {
     return (state & states::MIXED) ? kMixed : kChecked;
   }
 
   return kUnchecked;
 }
 
-- (id)value
-{
+- (id)value {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   return [NSNumber numberWithInt:[self isChecked]];
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
 @end
 
 @implementation mozTabsAccessible
 
-- (void)dealloc
-{
+- (void)dealloc {
   [mTabs release];
 
   [super dealloc];
 }
 
-- (NSArray*)accessibilityAttributeNames
-{
+- (NSArray*)accessibilityAttributeNames {
   // standard attributes that are shared and supported by root accessible (AXMain) elements.
   static NSMutableArray* attributes = nil;
 
   if (!attributes) {
     attributes = [[super accessibilityAttributeNames] mutableCopy];
     [attributes addObject:NSAccessibilityContentsAttribute];
     [attributes addObject:NSAccessibilityTabsAttribute];
   }
 
   return attributes;
 }
 
-- (id)accessibilityAttributeValue:(NSString *)attribute
-{
-  if ([attribute isEqualToString:NSAccessibilityContentsAttribute])
-    return [super children];
-  if ([attribute isEqualToString:NSAccessibilityTabsAttribute])
-    return [self tabs];
+- (id)accessibilityAttributeValue:(NSString*)attribute {
+  if ([attribute isEqualToString:NSAccessibilityContentsAttribute]) return [super children];
+  if ([attribute isEqualToString:NSAccessibilityTabsAttribute]) return [self tabs];
 
   return [super accessibilityAttributeValue:attribute];
 }
 
 /**
  * Returns the selected tab (the mozAccessible)
  */
-- (id)value
-{
+- (id)value {
   mozAccessible* nativeAcc = nil;
   if (AccessibleWrap* accWrap = [self getGeckoAccessible]) {
     if (Accessible* accTab = accWrap->GetSelectedItem(0)) {
       accTab->GetNativeInterface((void**)&nativeAcc);
     }
   } else if (ProxyAccessible* proxy = [self getProxyAccessible]) {
     if (ProxyAccessible* proxyTab = proxy->GetSelectedItem(0)) {
       nativeAcc = GetNativeFromProxy(proxyTab);
@@ -261,80 +235,70 @@ enum CheckboxValue {
   }
 
   return nativeAcc;
 }
 
 /**
  * Return the mozAccessibles that are the tabs.
  */
-- (id)tabs
-{
-  if (mTabs)
-    return mTabs;
+- (id)tabs {
+  if (mTabs) return mTabs;
 
   NSArray* children = [self children];
   NSEnumerator* enumerator = [children objectEnumerator];
   mTabs = [[NSMutableArray alloc] init];
 
   id obj;
   while ((obj = [enumerator nextObject]))
-    if ([obj isTab])
-      [mTabs addObject:obj];
+    if ([obj isTab]) [mTabs addObject:obj];
 
   return mTabs;
 }
 
-- (void)invalidateChildren
-{
+- (void)invalidateChildren {
   [super invalidateChildren];
 
   [mTabs release];
   mTabs = nil;
 }
 
 @end
 
 @implementation mozPaneAccessible
 
-- (NSUInteger)accessibilityArrayAttributeCount:(NSString*)attribute
-{
+- (NSUInteger)accessibilityArrayAttributeCount:(NSString*)attribute {
   AccessibleWrap* accWrap = [self getGeckoAccessible];
   ProxyAccessible* proxy = [self getProxyAccessible];
-  if (!accWrap && !proxy)
-    return 0;
+  if (!accWrap && !proxy) return 0;
 
   // By default this calls -[[mozAccessible children] count].
   // Since we don't cache mChildren. This is faster.
   if ([attribute isEqualToString:NSAccessibilityChildrenAttribute]) {
-    if (accWrap)
-      return accWrap->ChildCount() ? 1 : 0;
+    if (accWrap) return accWrap->ChildCount() ? 1 : 0;
 
     return proxy->ChildrenCount() ? 1 : 0;
   }
 
   return [super accessibilityArrayAttributeCount:attribute];
 }
 
-- (NSArray*)children
-{
-  if (![self getGeckoAccessible])
-    return nil;
+- (NSArray*)children {
+  if (![self getGeckoAccessible]) return nil;
 
-  nsDeckFrame* deckFrame = do_QueryFrame([self getGeckoAccessible]->GetFrame());
+  nsDeckFrame* deckFrame = do_QueryFrame([self getGeckoAccessible] -> GetFrame());
   nsIFrame* selectedFrame = deckFrame ? deckFrame->GetSelectedBox() : nullptr;
 
   Accessible* selectedAcc = nullptr;
   if (selectedFrame) {
     nsINode* node = selectedFrame->GetContent();
-    selectedAcc = [self getGeckoAccessible]->Document()->GetAccessible(node);
+    selectedAcc = [self getGeckoAccessible] -> Document() -> GetAccessible(node);
   }
 
   if (selectedAcc) {
-    mozAccessible *curNative = GetNativeFromGeckoAccessible(selectedAcc);
-    if (curNative)
-      return [NSArray arrayWithObjects:GetObjectOrRepresentedView(curNative), nil];
+    mozAccessible* curNative = GetNativeFromGeckoAccessible(selectedAcc);
+    if (curNative) return [NSArray arrayWithObjects:GetObjectOrRepresentedView(curNative), nil];
   }
 
   return nil;
 }
 
 @end
--- a/accessible/mac/mozDocAccessible.mm
+++ b/accessible/mac/mozDocAccessible.mm
@@ -9,103 +9,90 @@
 
 #import "mozView.h"
 
 // This must be included last:
 #include "nsObjCExceptions.h"
 
 using namespace mozilla::a11y;
 
-static id <mozAccessible, mozView>
-getNativeViewFromRootAccessible(Accessible* aAccessible)
-{
-  RootAccessibleWrap* root =
-    static_cast<RootAccessibleWrap*>(aAccessible->AsRoot());
-  id <mozAccessible, mozView> nativeView = nil;
-  root->GetNativeWidget ((void**)&nativeView);
+static id<mozAccessible, mozView> getNativeViewFromRootAccessible(Accessible* aAccessible) {
+  RootAccessibleWrap* root = static_cast<RootAccessibleWrap*>(aAccessible->AsRoot());
+  id<mozAccessible, mozView> nativeView = nil;
+  root->GetNativeWidget((void**)&nativeView);
   return nativeView;
 }
 
 #pragma mark -
 
 @implementation mozRootAccessible
 
-- (NSArray*)accessibilityAttributeNames
-{
+- (NSArray*)accessibilityAttributeNames {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   // if we're expired, we don't support any attributes.
-  if (![self getGeckoAccessible])
-    return [NSArray array];
+  if (![self getGeckoAccessible]) return [NSArray array];
 
   // standard attributes that are shared and supported by root accessible (AXMain) elements.
   static NSMutableArray* attributes = nil;
 
   if (!attributes) {
     attributes = [[super accessibilityAttributeNames] mutableCopy];
     [attributes addObject:NSAccessibilityMainAttribute];
     [attributes addObject:NSAccessibilityMinimizedAttribute];
   }
 
   return attributes;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
-- (id)accessibilityAttributeValue:(NSString *)attribute
-{
+- (id)accessibilityAttributeValue:(NSString*)attribute {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   if ([attribute isEqualToString:NSAccessibilityMainAttribute])
     return [NSNumber numberWithBool:[[self window] isMainWindow]];
   if ([attribute isEqualToString:NSAccessibilityMinimizedAttribute])
     return [NSNumber numberWithBool:[[self window] isMiniaturized]];
 
   return [super accessibilityAttributeValue:attribute];
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
-
 // return the AXParent that our parallell NSView tells us about.
-- (id)parent
-{
+- (id)parent {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
-  if (!mParallelView)
-    mParallelView = (id<mozView, mozAccessible>)[self representedView];
+  if (!mParallelView) mParallelView = (id<mozView, mozAccessible>)[self representedView];
 
   if (mParallelView)
     return [mParallelView accessibilityAttributeValue:NSAccessibilityParentAttribute];
 
   NSAssert(mParallelView, @"we're a root accessible w/o native view?");
   return [super parent];
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
-- (BOOL)hasRepresentedView
-{
+- (BOOL)hasRepresentedView {
   return YES;
 }
 
 // this will return our parallell NSView. see mozDocAccessible.h
-- (id)representedView
-{
+- (id)representedView {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
-  if (mParallelView)
-    return (id)mParallelView;
+  if (mParallelView) return (id)mParallelView;
 
-  mParallelView = getNativeViewFromRootAccessible ([self getGeckoAccessible]);
+  mParallelView = getNativeViewFromRootAccessible([self getGeckoAccessible]);
 
   NSAssert(mParallelView, @"can't return root accessible's native parallel view.");
   return mParallelView;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
-- (BOOL)isRoot
-{
+- (BOOL)isRoot {
   return YES;
 }
 
 @end
--- a/accessible/mac/mozHTMLAccessible.mm
+++ b/accessible/mac/mozHTMLAccessible.mm
@@ -9,131 +9,116 @@
 
 #import "Accessible-inl.h"
 #import "HyperTextAccessible.h"
 
 #import "nsCocoaUtils.h"
 
 @implementation mozHeadingAccessible
 
-- (NSString*)title
-{
+- (NSString*)title {
   nsAutoString title;
   if (AccessibleWrap* accWrap = [self getGeckoAccessible]) {
     mozilla::ErrorResult rv;
     // XXX use the flattening API when there are available
     // see bug 768298
     accWrap->GetContent()->GetTextContent(title, rv);
   } else if (ProxyAccessible* proxy = [self getProxyAccessible]) {
     proxy->Title(title);
   }
 
   return nsCocoaUtils::ToNSString(title);
 }
 
-- (id)value
-{
+- (id)value {
   uint32_t level = 0;
   if (AccessibleWrap* accWrap = [self getGeckoAccessible]) {
     level = accWrap->GetLevelInternal();
   } else if (ProxyAccessible* proxy = [self getProxyAccessible]) {
     level = proxy->GetLevelInternal();
   }
 
   return [NSNumber numberWithInt:level];
 }
 
 @end
 
 @interface mozLinkAccessible ()
--(NSURL*)url;
+- (NSURL*)url;
 @end
 
 @implementation mozLinkAccessible
 
-- (NSArray*)accessibilityAttributeNames
-{
+- (NSArray*)accessibilityAttributeNames {
   // if we're expired, we don't support any attributes.
-  if (![self getGeckoAccessible] && ![self getProxyAccessible])
-    return [NSArray array];
+  if (![self getGeckoAccessible] && ![self getProxyAccessible]) return [NSArray array];
 
   static NSMutableArray* attributes = nil;
 
   if (!attributes) {
     attributes = [[super accessibilityAttributeNames] mutableCopy];
     [attributes addObject:NSAccessibilityURLAttribute];
   }
 
   return attributes;
 }
 
-- (id)accessibilityAttributeValue:(NSString *)attribute
-{
-  if ([attribute isEqualToString:NSAccessibilityURLAttribute])
-    return [self url];
+- (id)accessibilityAttributeValue:(NSString*)attribute {
+  if ([attribute isEqualToString:NSAccessibilityURLAttribute]) return [self url];
 
   return [super accessibilityAttributeValue:attribute];
 }
 
-- (NSArray*)accessibilityActionNames
-{
-    // if we're expired, we don't support any attributes.
-  if (![self getGeckoAccessible] && ![self getProxyAccessible])
-    return [NSArray array];
+- (NSArray*)accessibilityActionNames {
+  // if we're expired, we don't support any attributes.
+  if (![self getGeckoAccessible] && ![self getProxyAccessible]) return [NSArray array];
 
   static NSArray* actionNames = nil;
 
   if (!actionNames) {
-    actionNames = [[NSArray alloc] initWithObjects:NSAccessibilityPressAction,
-                                   nil];
+    actionNames = [[NSArray alloc] initWithObjects:NSAccessibilityPressAction, nil];
   }
 
   return actionNames;
 }
 
-- (void)accessibilityPerformAction:(NSString*)action
-{
+- (void)accessibilityPerformAction:(NSString*)action {
   AccessibleWrap* accWrap = [self getGeckoAccessible];
   ProxyAccessible* proxy = [self getProxyAccessible];
   if (!accWrap && !proxy) {
     return;
   }
 
   if ([action isEqualToString:NSAccessibilityPressAction]) {
     if (accWrap) {
       accWrap->DoAction(0);
     } else if (proxy) {
       proxy->DoAction(0);
     }
     return;
   }
 
   [super accessibilityPerformAction:action];
-
 }
 
-- (NSString*)customDescription
-{
+- (NSString*)customDescription {
   return @"";
 }
 
-- (NSString*)value
-{
+- (NSString*)value {
   return @"";
 }
 
-- (NSURL*)url
-{
+- (NSURL*)url {
   nsAutoString value;
   if (AccessibleWrap* accWrap = [self getGeckoAccessible]) {
     accWrap->Value(value);
   } else if (ProxyAccessible* proxy = [self getProxyAccessible]) {
     proxy->Value(value);
   }
 
   NSString* urlString = value.IsEmpty() ? nil : nsCocoaUtils::ToNSString(value);
-  if (!urlString)
-    return nil;
+  if (!urlString) return nil;
 
   return [NSURL URLWithString:urlString];
 }
 
 @end
--- a/accessible/mac/mozTableAccessible.mm
+++ b/accessible/mac/mozTableAccessible.mm
@@ -28,25 +28,23 @@
       }
       proxy = proxy->Parent();
     }
   }
 
   return false;
 }
 
-- (NSString*)role
-{
+- (NSString*)role {
   return [self isLayoutTablePart] ? NSAccessibilityGroupRole : [super role];
 }
 @end
 
 @implementation mozTableAccessible
-- (NSArray*)additionalAccessibilityAttributeNames
-{
+- (NSArray*)additionalAccessibilityAttributeNames {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   NSArray* additionalAttributes = [super additionalAccessibilityAttributeNames];
   if ([self isLayoutTablePart]) {
     return additionalAttributes;
   }
 
   static NSArray* tableAttrs = nil;
@@ -59,66 +57,59 @@
     [tempArray release];
   }
 
   return [additionalAttributes arrayByAddingObjectsFromArray:tableAttrs];
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
-- (id)accessibilityAttributeValue:(NSString*)attribute
-{
+- (id)accessibilityAttributeValue:(NSString*)attribute {
   if (AccessibleWrap* accWrap = [self getGeckoAccessible]) {
     TableAccessible* table = accWrap->AsTable();
-    if ([attribute isEqualToString:NSAccessibilityRowCountAttribute])
-      return @(table->RowCount());
+    if ([attribute isEqualToString:NSAccessibilityRowCountAttribute]) return @(table->RowCount());
     if ([attribute isEqualToString:NSAccessibilityColumnCountAttribute])
       return @(table->ColCount());
     if ([attribute isEqualToString:NSAccessibilityRowsAttribute]) {
       // Create a new array with the list of table rows.
       NSMutableArray* nativeArray = [[NSMutableArray alloc] init];
       uint32_t totalCount = accWrap->ChildCount();
       for (uint32_t i = 0; i < totalCount; i++) {
         if (accWrap->GetChildAt(i)->IsTableRow()) {
-          mozAccessible* curNative =
-            GetNativeFromGeckoAccessible(accWrap->GetChildAt(i));
-          if (curNative)
-            [nativeArray addObject:GetObjectOrRepresentedView(curNative)];
+          mozAccessible* curNative = GetNativeFromGeckoAccessible(accWrap->GetChildAt(i));
+          if (curNative) [nativeArray addObject:GetObjectOrRepresentedView(curNative)];
         }
       }
       return nativeArray;
     }
   } else if (ProxyAccessible* proxy = [self getProxyAccessible]) {
     if ([attribute isEqualToString:NSAccessibilityRowCountAttribute])
       return @(proxy->TableRowCount());
     if ([attribute isEqualToString:NSAccessibilityColumnCountAttribute])
       return @(proxy->TableColumnCount());
     if ([attribute isEqualToString:NSAccessibilityRowsAttribute]) {
       // Create a new array with the list of table rows.
       NSMutableArray* nativeArray = [[NSMutableArray alloc] init];
       uint32_t totalCount = proxy->ChildrenCount();
       for (uint32_t i = 0; i < totalCount; i++) {
         if (proxy->ChildAt(i)->IsTableRow()) {
-          mozAccessible* curNative =
-            GetNativeFromProxy(proxy->ChildAt(i));
-          if (curNative)
-            [nativeArray addObject:GetObjectOrRepresentedView(curNative)];
+          mozAccessible* curNative = GetNativeFromProxy(proxy->ChildAt(i));
+          if (curNative) [nativeArray addObject:GetObjectOrRepresentedView(curNative)];
         }
       }
       return nativeArray;
     }
   }
 
   return [super accessibilityAttributeValue:attribute];
 }
 @end
 
 @implementation mozTableRowAccessible
-- (NSArray*)additionalAccessibilityAttributeNames
-{
+- (NSArray*)additionalAccessibilityAttributeNames {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   NSArray* additionalAttributes = [super additionalAccessibilityAttributeNames];
   if ([self isLayoutTablePart]) {
     return additionalAttributes;
   }
 
   static NSArray* tableRowAttrs = nil;
@@ -129,18 +120,17 @@
     [tempArray release];
   }
 
   return [additionalAttributes arrayByAddingObjectsFromArray:tableRowAttrs];
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
-- (id)accessibilityAttributeValue:(NSString*)attribute
-{
+- (id)accessibilityAttributeValue:(NSString*)attribute {
   if (AccessibleWrap* accWrap = [self getGeckoAccessible]) {
     if ([attribute isEqualToString:NSAccessibilityIndexAttribute]) {
       // Count the number of rows before that one to obtain the row index.
       uint32_t index = 0;
       Accessible* parent = accWrap->Parent();
       if (parent) {
         for (int32_t i = accWrap->IndexInParent() - 1; i >= 0; i--) {
           if (parent->GetChildAt(i)->IsTableRow()) {
@@ -166,18 +156,17 @@
     }
   }
 
   return [super accessibilityAttributeValue:attribute];
 }
 @end
 
 @implementation mozTableCellAccessible
-- (NSArray*)additionalAccessibilityAttributeNames
-{
+- (NSArray*)additionalAccessibilityAttributeNames {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   NSArray* additionalAttributes = [super additionalAccessibilityAttributeNames];
   if ([self isLayoutTablePart]) {
     return additionalAttributes;
   }
 
   static NSArray* tableCellAttrs = nil;
@@ -191,43 +180,38 @@
     [tempArray release];
   }
 
   return [additionalAttributes arrayByAddingObjectsFromArray:tableCellAttrs];
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
-- (id)accessibilityAttributeValue:(NSString*)attribute
-{
+- (id)accessibilityAttributeValue:(NSString*)attribute {
   if (AccessibleWrap* accWrap = [self getGeckoAccessible]) {
     TableCellAccessible* cell = accWrap->AsTableCell();
     if ([attribute isEqualToString:NSAccessibilityRowIndexRangeAttribute])
-      return [NSValue valueWithRange:NSMakeRange(cell->RowIdx(),
-                                                 cell->RowExtent())];
+      return [NSValue valueWithRange:NSMakeRange(cell->RowIdx(), cell->RowExtent())];
     if ([attribute isEqualToString:NSAccessibilityColumnIndexRangeAttribute])
-      return [NSValue valueWithRange:NSMakeRange(cell->ColIdx(),
-                                                 cell->ColExtent())];
+      return [NSValue valueWithRange:NSMakeRange(cell->ColIdx(), cell->ColExtent())];
     if ([attribute isEqualToString:NSAccessibilityRowHeaderUIElementsAttribute]) {
       AutoTArray<Accessible*, 10> headerCells;
       cell->RowHeaderCells(&headerCells);
       return ConvertToNSArray(headerCells);
     }
     if ([attribute isEqualToString:NSAccessibilityColumnHeaderUIElementsAttribute]) {
       AutoTArray<Accessible*, 10> headerCells;
       cell->ColHeaderCells(&headerCells);
       return ConvertToNSArray(headerCells);
     }
   } else if (ProxyAccessible* proxy = [self getProxyAccessible]) {
     if ([attribute isEqualToString:NSAccessibilityRowIndexRangeAttribute])
-      return [NSValue valueWithRange:NSMakeRange(proxy->RowIdx(),
-                                                 proxy->RowExtent())];
+      return [NSValue valueWithRange:NSMakeRange(proxy->RowIdx(), proxy->RowExtent())];
     if ([attribute isEqualToString:NSAccessibilityColumnIndexRangeAttribute])
-      return [NSValue valueWithRange:NSMakeRange(proxy->ColIdx(),
-                                                 proxy->ColExtent())];
+      return [NSValue valueWithRange:NSMakeRange(proxy->ColIdx(), proxy->ColExtent())];
     if ([attribute isEqualToString:NSAccessibilityRowHeaderUIElementsAttribute]) {
       nsTArray<ProxyAccessible*> headerCells;
       proxy->RowHeaderCells(&headerCells);
       return ConvertToNSArray(headerCells);
     }
     if ([attribute isEqualToString:NSAccessibilityColumnHeaderUIElementsAttribute]) {
       nsTArray<ProxyAccessible*> headerCells;
       proxy->ColHeaderCells(&headerCells);
--- a/accessible/mac/mozTextAccessible.mm
+++ b/accessible/mac/mozTextAccessible.mm
@@ -9,33 +9,29 @@
 
 #include "nsCocoaUtils.h"
 #include "nsObjCExceptions.h"
 
 #import "mozTextAccessible.h"
 
 using namespace mozilla::a11y;
 
-inline bool
-ToNSRange(id aValue, NSRange* aRange)
-{
+inline bool ToNSRange(id aValue, NSRange* aRange) {
   MOZ_ASSERT(aRange, "aRange is nil");
 
   if ([aValue isKindOfClass:[NSValue class]] &&
       strcmp([(NSValue*)aValue objCType], @encode(NSRange)) == 0) {
     *aRange = [aValue rangeValue];
     return true;
   }
 
   return false;
 }
 
-inline NSString*
-ToNSString(id aValue)
-{
+inline NSString* ToNSString(id aValue) {
   if ([aValue isKindOfClass:[NSString class]]) {
     return aValue;
   }
 
   return nil;
 }
 
 @interface mozTextAccessible ()
@@ -48,63 +44,55 @@ ToNSString(id aValue)
 - (NSNumber*)caretLineNumber;
 - (void)setText:(NSString*)newText;
 - (NSString*)text;
 - (NSString*)stringFromRange:(NSRange*)range;
 @end
 
 @implementation mozTextAccessible
 
-- (BOOL)accessibilityIsIgnored
-{
+- (BOOL)accessibilityIsIgnored {
   return ![self getGeckoAccessible] && ![self getProxyAccessible];
 }
 
-- (NSArray*)accessibilityAttributeNames
-{
+- (NSArray*)accessibilityAttributeNames {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   static NSMutableArray* supportedAttributes = nil;
   if (!supportedAttributes) {
     // text-specific attributes to supplement the standard one
-    supportedAttributes = [[NSMutableArray alloc] initWithObjects:
-      NSAccessibilitySelectedTextAttribute, // required
-      NSAccessibilitySelectedTextRangeAttribute, // required
-      NSAccessibilityNumberOfCharactersAttribute, // required
-      NSAccessibilityVisibleCharacterRangeAttribute, // required
-      NSAccessibilityInsertionPointLineNumberAttribute,
-      @"AXRequired",
-      @"AXInvalid",
-      nil
-    ];
+    supportedAttributes = [[NSMutableArray alloc]
+        initWithObjects:NSAccessibilitySelectedTextAttribute,           // required
+                        NSAccessibilitySelectedTextRangeAttribute,      // required
+                        NSAccessibilityNumberOfCharactersAttribute,     // required
+                        NSAccessibilityVisibleCharacterRangeAttribute,  // required
+                        NSAccessibilityInsertionPointLineNumberAttribute, @"AXRequired",
+                        @"AXInvalid", nil];
     [supportedAttributes addObjectsFromArray:[super accessibilityAttributeNames]];
   }
   return supportedAttributes;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
-- (id)accessibilityAttributeValue:(NSString*)attribute
-{
+- (id)accessibilityAttributeValue:(NSString*)attribute {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   if ([attribute isEqualToString:NSAccessibilityNumberOfCharactersAttribute])
     return [NSNumber numberWithInt:[self textLength]];
 
   if ([attribute isEqualToString:NSAccessibilityInsertionPointLineNumberAttribute])
     return [self caretLineNumber];
 
   if ([attribute isEqualToString:NSAccessibilitySelectedTextRangeAttribute])
     return [self selectedTextRange];
 
-  if ([attribute isEqualToString:NSAccessibilitySelectedTextAttribute])
-    return [self selectedText];
+  if ([attribute isEqualToString:NSAccessibilitySelectedTextAttribute]) return [self selectedText];
 
-  if ([attribute isEqualToString:NSAccessibilityTitleAttribute])
-    return @"";
+  if ([attribute isEqualToString:NSAccessibilityTitleAttribute]) return @"";
 
   if ([attribute isEqualToString:NSAccessibilityValueAttribute]) {
     // Apple's SpeechSynthesisServer expects AXValue to return an AXStaticText
     // object's AXSelectedText attribute. See bug 674612 for details.
     // Also if there is no selected text, we return the full text.
     // See bug 369710 for details.
     if ([[self role] isEqualToString:NSAccessibilityStaticTextRole]) {
       NSString* selectedText = [self selectedText];
@@ -136,47 +124,43 @@ ToNSString(id aValue)
     return [self visibleCharacterRange];
 
   // let mozAccessible handle all other attributes
   return [super accessibilityAttributeValue:attribute];
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
-- (NSArray*)accessibilityParameterizedAttributeNames
-{
+- (NSArray*)accessibilityParameterizedAttributeNames {
   static NSArray* supportedParametrizedAttributes = nil;
   // text specific parametrized attributes
   if (!supportedParametrizedAttributes) {
-    supportedParametrizedAttributes = [[NSArray alloc] initWithObjects:
-      NSAccessibilityStringForRangeParameterizedAttribute,
-      NSAccessibilityLineForIndexParameterizedAttribute,
-      NSAccessibilityRangeForLineParameterizedAttribute,
-      NSAccessibilityAttributedStringForRangeParameterizedAttribute,
-      NSAccessibilityBoundsForRangeParameterizedAttribute,
+    supportedParametrizedAttributes = [[NSArray alloc]
+        initWithObjects:NSAccessibilityStringForRangeParameterizedAttribute,
+                        NSAccessibilityLineForIndexParameterizedAttribute,
+                        NSAccessibilityRangeForLineParameterizedAttribute,
+                        NSAccessibilityAttributedStringForRangeParameterizedAttribute,
+                        NSAccessibilityBoundsForRangeParameterizedAttribute,
 #if DEBUG
-      NSAccessibilityRangeForPositionParameterizedAttribute,
-      NSAccessibilityRangeForIndexParameterizedAttribute,
-      NSAccessibilityRTFForRangeParameterizedAttribute,
-      NSAccessibilityStyleRangeForIndexParameterizedAttribute,
+                        NSAccessibilityRangeForPositionParameterizedAttribute,
+                        NSAccessibilityRangeForIndexParameterizedAttribute,
+                        NSAccessibilityRTFForRangeParameterizedAttribute,
+                        NSAccessibilityStyleRangeForIndexParameterizedAttribute,
 #endif
-      nil
-    ];
+                        nil];
   }
   return supportedParametrizedAttributes;
 }
 
-- (id)accessibilityAttributeValue:(NSString*)attribute forParameter:(id)parameter
-{
+- (id)accessibilityAttributeValue:(NSString*)attribute forParameter:(id)parameter {
   AccessibleWrap* accWrap = [self getGeckoAccessible];
   ProxyAccessible* proxy = [self getProxyAccessible];
 
-  HyperTextAccessible* textAcc = accWrap? accWrap->AsHyperText() : nullptr;
-  if (!textAcc && !proxy)
-    return nil;
+  HyperTextAccessible* textAcc = accWrap ? accWrap->AsHyperText() : nullptr;
+  if (!textAcc && !proxy) return nil;
 
   if ([attribute isEqualToString:NSAccessibilityStringForRangeParameterizedAttribute]) {
     NSRange range;
     if (!ToNSRange(parameter, &range)) {
 #if DEBUG
       NSLog(@"%@: range not set", attribute);
 #endif
       return @"";
@@ -215,71 +199,64 @@ ToNSString(id aValue)
 #endif
       return nil;
     }
 
     int32_t start = range.location;
     int32_t end = start + range.length;
     DesktopIntRect bounds;
     if (textAcc) {
-      bounds =
-        DesktopIntRect::FromUnknownRect(textAcc->TextBounds(start, end));
+      bounds = DesktopIntRect::FromUnknownRect(textAcc->TextBounds(start, end));
     } else if (proxy) {
-      bounds =
-        DesktopIntRect::FromUnknownRect(proxy->TextBounds(start, end));
+      bounds = DesktopIntRect::FromUnknownRect(proxy->TextBounds(start, end));
     }
 
     return [NSValue valueWithRect:nsCocoaUtils::GeckoRectToCocoaRect(bounds)];
   }
 
 #if DEBUG
   NSLog(@"unhandled attribute:%@ forParameter:%@", attribute, parameter);
 #endif
 
   return nil;
 }
 
-- (BOOL)accessibilityIsAttributeSettable:(NSString*)attribute
-{
+- (BOOL)accessibilityIsAttributeSettable:(NSString*)attribute {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
 
-  if ([attribute isEqualToString:NSAccessibilityValueAttribute])
-    return ![self isReadOnly];
+  if ([attribute isEqualToString:NSAccessibilityValueAttribute]) return ![self isReadOnly];
 
   if ([attribute isEqualToString:NSAccessibilitySelectedTextAttribute] ||
       [attribute isEqualToString:NSAccessibilitySelectedTextRangeAttribute] ||
       [attribute isEqualToString:NSAccessibilityVisibleCharacterRangeAttribute])
     return YES;
 
   return [super accessibilityIsAttributeSettable:attribute];
 
   NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(NO);
 }
 
-- (void)accessibilitySetValue:(id)value forAttribute:(NSString *)attribute
-{
+- (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   AccessibleWrap* accWrap = [self getGeckoAccessible];
   ProxyAccessible* proxy = [self getProxyAccessible];
 
-  HyperTextAccessible* textAcc = accWrap? accWrap->AsHyperText() : nullptr;
-  if (!textAcc && !proxy)
-    return;
+  HyperTextAccessible* textAcc = accWrap ? accWrap->AsHyperText() : nullptr;
+  if (!textAcc && !proxy) return;
 
   if ([attribute isEqualToString:NSAccessibilityValueAttribute]) {
     [self setText:ToNSString(value)];
 
     return;
   }
 
   if ([attribute isEqualToString:NSAccessibilitySelectedTextAttribute]) {
     NSString* stringValue = ToNSString(value);
-    if (!stringValue)
-      return;
+    if (!stringValue) return;
 
     int32_t start = 0, end = 0;
     nsString text;
     if (textAcc) {
       textAcc->SelectionBoundsAt(0, &start, &end);
       textAcc->DeleteText(start, end - start);
       nsCocoaUtils::GetStringForNSString(stringValue, text);
       textAcc->InsertText(text, start);
@@ -289,180 +266,160 @@ ToNSString(id aValue)
       proxy->DeleteText(start, end - start);
       nsCocoaUtils::GetStringForNSString(stringValue, text);
       proxy->InsertText(text, start);
     }
   }
 
   if ([attribute isEqualToString:NSAccessibilitySelectedTextRangeAttribute]) {
     NSRange range;
-    if (!ToNSRange(value, &range))
-      return;
+    if (!ToNSRange(value, &range)) return;
 
     if (textAcc) {
-      textAcc->SetSelectionBoundsAt(0, range.location,
-                                    range.location + range.length);
+      textAcc->SetSelectionBoundsAt(0, range.location, range.location + range.length);
     } else if (proxy) {
-      proxy->SetSelectionBoundsAt(0, range.location,
-                                  range.location + range.length);
+      proxy->SetSelectionBoundsAt(0, range.location, range.location + range.length);
     }
     return;
   }
 
   if ([attribute isEqualToString:NSAccessibilityVisibleCharacterRangeAttribute]) {
     NSRange range;
-    if (!ToNSRange(value, &range))
-      return;
+    if (!ToNSRange(value, &range)) return;
 
     if (textAcc) {
       textAcc->ScrollSubstringTo(range.location, range.location + range.length,
                                  nsIAccessibleScrollType::SCROLL_TYPE_TOP_EDGE);
     } else if (proxy) {
       proxy->ScrollSubstringTo(range.location, range.location + range.length,
                                nsIAccessibleScrollType::SCROLL_TYPE_TOP_EDGE);
     }
     return;
   }
 
   [super accessibilitySetValue:value forAttribute:attribute];
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
-- (NSString*)subrole
-{
-  if(mRole == roles::PASSWORD_TEXT)
-    return NSAccessibilitySecureTextFieldSubrole;
+- (NSString*)subrole {
+  if (mRole == roles::PASSWORD_TEXT) return NSAccessibilitySecureTextFieldSubrole;
 
   return nil;
 }
 
 #pragma mark -
 
-- (BOOL)isReadOnly
-{
+- (BOOL)isReadOnly {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
 
-  if ([[self role] isEqualToString:NSAccessibilityStaticTextRole])
-    return YES;
+  if ([[self role] isEqualToString:NSAccessibilityStaticTextRole]) return YES;
 
   AccessibleWrap* accWrap = [self getGeckoAccessible];
-  HyperTextAccessible* textAcc = accWrap? accWrap->AsHyperText() : nullptr;
-  if (textAcc)
-    return (accWrap->State() & states::READONLY) == 0;
+  HyperTextAccessible* textAcc = accWrap ? accWrap->AsHyperText() : nullptr;
+  if (textAcc) return (accWrap->State() & states::READONLY) == 0;
 
   if (ProxyAccessible* proxy = [self getProxyAccessible])
     return (proxy->State() & states::READONLY) == 0;
 
   return NO;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(NO);
 }
 
-- (NSNumber*)caretLineNumber
-{
+- (NSNumber*)caretLineNumber {
   AccessibleWrap* accWrap = [self getGeckoAccessible];
-  HyperTextAccessible* textAcc = accWrap? accWrap->AsHyperText() : nullptr;
+  HyperTextAccessible* textAcc = accWrap ? accWrap->AsHyperText() : nullptr;
 
   int32_t lineNumber = -1;
   if (textAcc) {
     lineNumber = textAcc->CaretLineNumber() - 1;
   } else if (ProxyAccessible* proxy = [self getProxyAccessible]) {
     lineNumber = proxy->CaretLineNumber() - 1;
   }
 
   return (lineNumber >= 0) ? [NSNumber numberWithInt:lineNumber] : nil;
 }
 
-- (void)setText:(NSString*)aNewString
-{
+- (void)setText:(NSString*)aNewString {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   AccessibleWrap* accWrap = [self getGeckoAccessible];
-  HyperTextAccessible* textAcc = accWrap? accWrap->AsHyperText() : nullptr;
+  HyperTextAccessible* textAcc = accWrap ? accWrap->AsHyperText() : nullptr;
 
   nsString text;
   nsCocoaUtils::GetStringForNSString(aNewString, text);
   if (textAcc) {
     textAcc->ReplaceText(text);
   } else if (ProxyAccessible* proxy = [self getProxyAccessible]) {
     proxy->ReplaceText(text);
   }
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
-- (NSString*)text
-{
+- (NSString*)text {
   AccessibleWrap* accWrap = [self getGeckoAccessible];
   ProxyAccessible* proxy = [self getProxyAccessible];
-  HyperTextAccessible* textAcc = accWrap? accWrap->AsHyperText() : nullptr;
-  if (!textAcc && !proxy)
-    return nil;
+  HyperTextAccessible* textAcc = accWrap ? accWrap->AsHyperText() : nullptr;
+  if (!textAcc && !proxy) return nil;
 
   // A password text field returns an empty value
-  if (mRole == roles::PASSWORD_TEXT)
-    return @"";
+  if (mRole == roles::PASSWORD_TEXT) return @"";
 
   nsAutoString text;
   if (textAcc) {
     textAcc->TextSubstring(0, nsIAccessibleText::TEXT_OFFSET_END_OF_TEXT, text);
   } else if (proxy) {
     proxy->TextSubstring(0, nsIAccessibleText::TEXT_OFFSET_END_OF_TEXT, text);
   }
 
   return nsCocoaUtils::ToNSString(text);
 }
 
-- (long)textLength
-{
+- (long)textLength {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
 
   AccessibleWrap* accWrap = [self getGeckoAccessible];
   ProxyAccessible* proxy = [self getProxyAccessible];
-  HyperTextAccessible* textAcc = accWrap? accWrap->AsHyperText() : nullptr;
-  if (!textAcc && !proxy)
-    return 0;
+  HyperTextAccessible* textAcc = accWrap ? accWrap->AsHyperText() : nullptr;
+  if (!textAcc && !proxy) return 0;
 
   return textAcc ? textAcc->CharacterCount() : proxy->CharacterCount();
 
   NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(0);
 }
 
-- (long)selectedTextLength
-{
+- (long)selectedTextLength {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
 
   AccessibleWrap* accWrap = [self getGeckoAccessible];
   ProxyAccessible* proxy = [self getProxyAccessible];
-  HyperTextAccessible* textAcc = accWrap? accWrap->AsHyperText() : nullptr;
-  if (!textAcc && !proxy)
-    return 0;
+  HyperTextAccessible* textAcc = accWrap ? accWrap->AsHyperText() : nullptr;
+  if (!textAcc && !proxy) return 0;
 
   int32_t start = 0, end = 0;
   if (textAcc) {
     textAcc->SelectionBoundsAt(0, &start, &end);
   } else if (proxy) {
     nsString data;
     proxy->SelectionBoundsAt(0, data, &start, &end);
   }
   return (end - start);
 
   NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(0);
 }
 
-- (NSString*)selectedText
-{
+- (NSString*)selectedText {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   AccessibleWrap* accWrap = [self getGeckoAccessible];
   ProxyAccessible* proxy = [self getProxyAccessible];
-  HyperTextAccessible* textAcc = accWrap? accWrap->AsHyperText() : nullptr;
-  if (!textAcc && !proxy)
-    return nil;
+  HyperTextAccessible* textAcc = accWrap ? accWrap->AsHyperText() : nullptr;
+  if (!textAcc && !proxy) return nil;
 
   int32_t start = 0, end = 0;
   nsAutoString selText;
   if (textAcc) {
     textAcc->SelectionBoundsAt(0, &start, &end);
     if (start != end) {
       textAcc->TextSubstring(start, end, selText);
     }
@@ -470,23 +427,22 @@ ToNSString(id aValue)
     proxy->SelectionBoundsAt(0, selText, &start, &end);
   }
 
   return nsCocoaUtils::ToNSString(selText);
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
-- (NSValue*)selectedTextRange
-{
+- (NSValue*)selectedTextRange {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   AccessibleWrap* accWrap = [self getGeckoAccessible];
   ProxyAccessible* proxy = [self getProxyAccessible];
-  HyperTextAccessible* textAcc = accWrap? accWrap->AsHyperText() : nullptr;
+  HyperTextAccessible* textAcc = accWrap ? accWrap->AsHyperText() : nullptr;
 
   int32_t start = 0;
   int32_t end = 0;
   int32_t count = 0;
   if (textAcc) {
     count = textAcc->SelectionCount();
     if (count) {
       textAcc->SelectionBoundsAt(0, &start, &end);
@@ -509,112 +465,97 @@ ToNSString(id aValue)
     return [NSValue valueWithRange:NSMakeRange(start != -1 ? start : 0, 0)];
   }
 
   return [NSValue valueWithRange:NSMakeRange(0, 0)];
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
-- (NSValue*)visibleCharacterRange
-{
+- (NSValue*)visibleCharacterRange {
   // XXX this won't work with Textarea and such as we actually don't give
   // the visible character range.
   AccessibleWrap* accWrap = [self getGeckoAccessible];
   ProxyAccessible* proxy = [self getProxyAccessible];
-  HyperTextAccessible* textAcc = accWrap? accWrap->AsHyperText() : nullptr;
-  if (!textAcc && !proxy)
-    return 0;
+  HyperTextAccessible* textAcc = accWrap ? accWrap->AsHyperText() : nullptr;
+  if (!textAcc && !proxy) return 0;
 
-  return [NSValue valueWithRange:
-    NSMakeRange(0, textAcc ?
-                textAcc->CharacterCount() : proxy->CharacterCount())];
+  return [NSValue
+      valueWithRange:NSMakeRange(0, textAcc ? textAcc->CharacterCount() : proxy->CharacterCount())];
 }
 
-- (void)valueDidChange
-{
+- (void)valueDidChange {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   NSAccessibilityPostNotification(GetObjectOrRepresentedView(self),
                                   NSAccessibilityValueChangedNotification);
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
-- (void)selectedTextDidChange
-{
+- (void)selectedTextDidChange {
   NSAccessibilityPostNotification(GetObjectOrRepresentedView(self),
                                   NSAccessibilitySelectedTextChangedNotification);
 }
 
-- (NSString*)stringFromRange:(NSRange*)range
-{
+- (NSString*)stringFromRange:(NSRange*)range {
   MOZ_ASSERT(range, "no range");
 
   AccessibleWrap* accWrap = [self getGeckoAccessible];
   ProxyAccessible* proxy = [self getProxyAccessible];
-  HyperTextAccessible* textAcc = accWrap? accWrap->AsHyperText() : nullptr;
-  if (!textAcc && !proxy)
-    return nil;
+  HyperTextAccessible* textAcc = accWrap ? accWrap->AsHyperText() : nullptr;
+  if (!textAcc && !proxy) return nil;
 
   nsAutoString text;
   if (textAcc) {
-    textAcc->TextSubstring(range->location,
-                           range->location + range->length, text);
+    textAcc->TextSubstring(range->location, range->location + range->length, text);
   } else if (proxy) {
-    proxy->TextSubstring(range->location,
-                           range->location + range->length, text);
+    proxy->TextSubstring(range->location, range->location + range->length, text);
   }
 
   return nsCocoaUtils::ToNSString(text);
 }
 
 @end
 
 @implementation mozTextLeafAccessible
 
-- (NSArray*)accessibilityAttributeNames
-{
+- (NSArray*)accessibilityAttributeNames {
   static NSMutableArray* supportedAttributes = nil;
   if (!supportedAttributes) {
     supportedAttributes = [[super accessibilityAttributeNames] mutableCopy];
     [supportedAttributes removeObject:NSAccessibilityChildrenAttribute];
   }
 
   return supportedAttributes;
 }
 
-- (id)accessibilityAttributeValue:(NSString*)attribute
-{
-  if ([attribute isEqualToString:NSAccessibilityTitleAttribute])
-    return @"";
+- (id)accessibilityAttributeValue:(NSString*)attribute {
+  if ([attribute isEqualToString:NSAccessibilityTitleAttribute]) return @"";
 
-  if ([attribute isEqualToString:NSAccessibilityValueAttribute])
-    return [self text];
+  if ([attribute isEqualToString:NSAccessibilityValueAttribute]) return [self text];
 
   return [super accessibilityAttributeValue:attribute];
 }
 
-- (NSString*)text
-{
+- (NSString*)text {
   if (AccessibleWrap* accWrap = [self getGeckoAccessible]) {
     return nsCocoaUtils::ToNSString(accWrap->AsTextLeaf()->Text());
   }
 
   if (ProxyAccessible* proxy = [self getProxyAccessible]) {
     nsString text;
     proxy->Text(&text);
     return nsCocoaUtils::ToNSString(text);
   }
 
   return nil;
 }
 
-- (long)textLength
-{
+- (long)textLength {
   if (AccessibleWrap* accWrap = [self getGeckoAccessible]) {
     return accWrap->AsTextLeaf()->Text().Length();
   }
 
   if (ProxyAccessible* proxy = [self getProxyAccessible]) {
     nsString text;
     proxy->Text(&text);
     return text.Length();
--- a/browser/base/content/tabbrowser.js
+++ b/browser/base/content/tabbrowser.js
@@ -5191,17 +5191,17 @@ class TabProgressListener {
         let tabCacheIndex = gBrowser._tabLayerCache.indexOf(this.mTab);
         if (tabCacheIndex != -1) {
           gBrowser._tabLayerCache.splice(tabCacheIndex, 1);
           gBrowser._getSwitcher().cleanUpTabAfterEviction(this.mTab);
         }
       }
     }
 
-    if (!this.mBlank) {
+    if (!this.mBlank || this.mBrowser.hasContentOpener) {
       this._callProgressListeners("onLocationChange",
                                   [aWebProgress, aRequest, aLocation, aFlags]);
       if (topLevel && !isSameDocument) {
         // Include the true final argument to indicate that this event is
         // simulated (instead of being observed by the webProgressListener).
         this._callProgressListeners("onContentBlockingEvent",
                                     [aWebProgress, null, 0, true]);
       }
--- a/browser/components/urlbar/tests/browser/browser.ini
+++ b/browser/components/urlbar/tests/browser/browser.ini
@@ -35,16 +35,18 @@ skip-if = os != "mac" # Mac only feature
 [browser_page_action_menu_share_win.js]
 support-files =
   browser_page_action_menu_share_win.html
 skip-if = os != "win" # Windows only feature
 [browser_populateAfterPushState.js]
 [browser_urlbar_blanking.js]
 support-files =
   file_blank_but_not_blank.html
+[browser_urlbar_content_opener.js]
+skip-if = debug # Bug 1521835 - shutdown leaks
 [browser_urlbar_locationchange_urlbar_edit_dos.js]
 support-files =
   file_urlbar_edit_dos.html
 [browser_urlbar_remoteness_switch.js]
 run-if = e10s
 [browser_urlbar_searchsettings.js]
 [browser_urlbar_whereToOpen.js]
 [browser_urlbarCopying.js]
new file mode 100644
--- /dev/null
+++ b/browser/components/urlbar/tests/browser/browser_urlbar_content_opener.js
@@ -0,0 +1,18 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+const TEST_PATH = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "https://example.com");
+
+add_task(async function() {
+  await BrowserTestUtils.withNewTab(TEST_PATH + "dummy_page.html", async function(browser) {
+    let windowOpenedPromise = BrowserTestUtils.waitForNewWindow();
+    await ContentTask.spawn(browser, null, function() {
+      content.window.open("", "_BLANK", "toolbar=no,height=300,width=500");
+    });
+    let newWin = await windowOpenedPromise;
+    is(newWin.gURLBar.value, "about:blank", "Should be displaying about:blank for the opened window.");
+    await BrowserTestUtils.closeWindow(newWin);
+  });
+});
--- a/devtools/client/inspector/reducers.js
+++ b/devtools/client/inspector/reducers.js
@@ -5,16 +5,17 @@
 "use strict";
 
 // This file exposes the Redux reducers of the box model, grid and grid highlighter
 // settings.
 
 exports.animations = require("devtools/client/inspector/animation/reducers/animations");
 exports.boxModel = require("devtools/client/inspector/boxmodel/reducers/box-model");
 exports.changes = require("devtools/client/inspector/changes/reducers/changes");
+exports.classList = require("devtools/client/inspector/rules/reducers/class-list");
 exports.extensionsSidebar = require("devtools/client/inspector/extensions/reducers/sidebar");
 exports.flexbox = require("devtools/client/inspector/flexbox/reducers/flexbox");
 exports.fontOptions = require("devtools/client/inspector/fonts/reducers/font-options");
 exports.fontData = require("devtools/client/inspector/fonts/reducers/fonts");
 exports.fontEditor = require("devtools/client/inspector/fonts/reducers/font-editor");
 exports.grids = require("devtools/client/inspector/grids/reducers/grids");
 exports.highlighterSettings = require("devtools/client/inspector/grids/reducers/highlighter-settings");
 exports.pseudoClasses = require("devtools/client/inspector/rules/reducers/pseudo-classes");
new file mode 100644
--- /dev/null
+++ b/devtools/client/inspector/rules/actions/class-list.js
@@ -0,0 +1,40 @@
+/* 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 strict";
+
+const {
+  UPDATE_CLASSES,
+  UPDATE_CLASS_PANEL_EXPANDED,
+} = require("./index");
+
+module.exports = {
+
+  /**
+   * Updates the entire class list state with the new list of classes.
+   *
+   * @param  {Array<Object>} classes
+   *         Array of CSS classes object applied to the element.
+   */
+  updateClasses(classes) {
+    return {
+      type: UPDATE_CLASSES,
+      classes,
+    };
+  },
+
+  /**
+   * Updates whether or not the class list panel is expanded.
+   *
+   * @param  {Boolean} isClassPanelExpanded
+   *         Whether or not the class list panel is expanded.
+   */
+  updateClassPanelExpanded(isClassPanelExpanded) {
+    return {
+      type: UPDATE_CLASS_PANEL_EXPANDED,
+      isClassPanelExpanded,
+    };
+  },
+
+};
--- a/devtools/client/inspector/rules/actions/index.js
+++ b/devtools/client/inspector/rules/actions/index.js
@@ -14,15 +14,21 @@ createEnum([
 
   // Sets the entire pseudo class state with the new list of applied pseudo-class
   // locks.
   "SET_PSEUDO_CLASSES",
 
   // Toggles on or off the given pseudo class value for the current selected element.
   "TOGGLE_PSEUDO_CLASS",
 
+  // Updates the entire class list state with the new list of classes.
+  "UPDATE_CLASSES",
+
+  // Updates whether or not the class list panel is expanded.
+  "UPDATE_CLASS_PANEL_EXPANDED",
+
   // Updates the highlighted selector.
   "UPDATE_HIGHLIGHTED_SELECTOR",
 
   // Updates the rules state with the new list of CSS rules for the selected element.
   "UPDATE_RULES",
 
 ], module.exports);
--- a/devtools/client/inspector/rules/actions/moz.build
+++ b/devtools/client/inspector/rules/actions/moz.build
@@ -1,9 +1,10 @@
 # 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/.
 
 DevToolsModules(
+    'class-list.js',
     'index.js',
     'pseudo-classes.js',
     'rules.js',
 )
--- a/devtools/client/inspector/rules/components/ClassListPanel.js
+++ b/devtools/client/inspector/rules/components/ClassListPanel.js
@@ -1,36 +1,108 @@
 /* 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 strict";
 
-const { PureComponent } = require("devtools/client/shared/vendor/react");
+const { createRef, PureComponent } = require("devtools/client/shared/vendor/react");
 const dom = require("devtools/client/shared/vendor/react-dom-factories");
+const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
+const { connect } = require("devtools/client/shared/vendor/react-redux");
+const { KeyCodes } = require("devtools/client/shared/keycodes");
 
 const { getStr } = require("../utils/l10n");
+const Types = require("../types");
 
 class ClassListPanel extends PureComponent {
   static get propTypes() {
-    return {};
+    return {
+      classes: PropTypes.arrayOf(PropTypes.shape(Types.class)).isRequired,
+      onAddClass: PropTypes.func.isRequired,
+      onSetClassState: PropTypes.func.isRequired,
+    };
+  }
+
+  constructor(props) {
+    super(props);
+
+    this.state = {
+      // Class list panel input value.
+      value: "",
+    };
+
+    this.inputRef = createRef();
+
+    this.onInputChange = this.onInputChange.bind(this);
+    this.onInputKeyUp = this.onInputKeyUp.bind(this);
+    this.onToggleChange = this.onToggleChange.bind(this);
+  }
+
+  componentDidMount() {
+    this.inputRef.current.focus();
+  }
+
+  onInputChange({ target }) {
+    this.setState({ value: target.value });
+  }
+
+  onInputKeyUp({ target, keyCode }) {
+    // On Enter, submit the input.
+    if (keyCode === KeyCodes.DOM_VK_RETURN) {
+      this.props.onAddClass(target.value);
+      this.setState({ value: "" });
+    }
+  }
+
+  onToggleChange({ target }) {
+    this.props.onSetClassState(target.value, target.checked);
   }
 
   render() {
     return (
       dom.div(
         {
           id: "ruleview-class-panel",
           className: "ruleview-reveal-panel",
         },
         dom.input({
           className: "devtools-textinput add-class",
           placeholder: getStr("rule.classPanel.newClass.placeholder"),
+          onChange: this.onInputChange,
+          onKeyUp: this.onInputKeyUp,
+          ref: this.inputRef,
+          value: this.state.value,
         }),
         dom.div({ className: "classes" },
-          dom.p({ className: "no-classes" }, getStr("rule.classPanel.noClasses"))
+          this.props.classes.length ?
+            this.props.classes.map(({ name, isApplied }) => {
+              return (
+                dom.label(
+                  {
+                    key: name,
+                    title: name,
+                  },
+                  dom.input({
+                    checked: isApplied,
+                    onChange: this.onToggleChange,
+                    type: "checkbox",
+                    value: name,
+                  }),
+                  dom.span({}, name)
+                )
+              );
+            })
+            :
+            dom.p({ className: "no-classes" }, getStr("rule.classPanel.noClasses"))
         )
       )
     );
   }
 }
 
-module.exports = ClassListPanel;
+const mapStateToProps = state => {
+  return {
+    classes: state.classList.classes,
+  };
+};
+
+module.exports = connect(mapStateToProps)(ClassListPanel);
--- a/devtools/client/inspector/rules/components/Rule.js
+++ b/devtools/client/inspector/rules/components/Rule.js
@@ -16,27 +16,30 @@ const SourceLink = createFactory(require
 const Types = require("../types");
 
 class Rule extends PureComponent {
   static get propTypes() {
     return {
       onToggleDeclaration: PropTypes.func.isRequired,
       onToggleSelectorHighlighter: PropTypes.func.isRequired,
       rule: PropTypes.shape(Types.rule).isRequired,
+      showSelectorEditor: PropTypes.func.isRequired,
     };
   }
 
   render() {
     const {
       onToggleDeclaration,
       onToggleSelectorHighlighter,
       rule,
+      showSelectorEditor,
     } = this.props;
     const {
       declarations,
+      id,
       isUnmatched,
       isUserAgentStyle,
       selector,
       sourceLink,
       type,
     } = rule;
 
     return (
@@ -45,17 +48,20 @@ class Rule extends PureComponent {
           className: "ruleview-rule devtools-monospace" +
                      (isUnmatched ? " unmatched" : "") +
                      (isUserAgentStyle ? " uneditable" : ""),
         },
         SourceLink({ sourceLink }),
         dom.div({ className: "ruleview-code" },
           dom.div({},
             Selector({
+              id,
+              isUserAgentStyle,
               selector,
+              showSelectorEditor,
               type,
             }),
             type !== CSSRule.KEYFRAME_RULE ?
               SelectorHighlighter({
                 onToggleSelectorHighlighter,
                 selector,
               })
               :
--- a/devtools/client/inspector/rules/components/Rules.js
+++ b/devtools/client/inspector/rules/components/Rules.js
@@ -12,30 +12,33 @@ const Rule = createFactory(require("./Ru
 const Types = require("../types");
 
 class Rules extends PureComponent {
   static get propTypes() {
     return {
       onToggleDeclaration: PropTypes.func.isRequired,
       onToggleSelectorHighlighter: PropTypes.func.isRequired,
       rules: PropTypes.arrayOf(PropTypes.shape(Types.rule)).isRequired,
+      showSelectorEditor: PropTypes.func.isRequired,
     };
   }
 
   render() {
     const {
       onToggleDeclaration,
       onToggleSelectorHighlighter,
       rules,
+      showSelectorEditor,
     } = this.props;
 
     return rules.map(rule => {
       return Rule({
         key: rule.id,
         onToggleDeclaration,
         onToggleSelectorHighlighter,
         rule,
+        showSelectorEditor,
       });
     });
   }
 }
 
 module.exports = Rules;
--- a/devtools/client/inspector/rules/components/RulesApp.js
+++ b/devtools/client/inspector/rules/components/RulesApp.js
@@ -23,20 +23,32 @@ const Toolbar = createFactory(require(".
 const { getStr } = require("../utils/l10n");
 const Types = require("../types");
 
 const SHOW_PSEUDO_ELEMENTS_PREF = "devtools.inspector.show_pseudo_elements";
 
 class RulesApp extends PureComponent {
   static get propTypes() {
     return {
+      onAddClass: PropTypes.func.isRequired,
+      onSetClassState: PropTypes.func.isRequired,
+      onToggleClassPanelExpanded: PropTypes.func.isRequired,
       onToggleDeclaration: PropTypes.func.isRequired,
       onTogglePseudoClass: PropTypes.func.isRequired,
       onToggleSelectorHighlighter: PropTypes.func.isRequired,
       rules: PropTypes.arrayOf(PropTypes.shape(Types.rule)).isRequired,
+      showSelectorEditor: PropTypes.func.isRequired,
+    };
+  }
+
+  getRuleProps() {
+    return {
+      onToggleDeclaration: this.props.onToggleDeclaration,
+      onToggleSelectorHighlighter: this.props.onToggleSelectorHighlighter,
+      showSelectorEditor: this.props.showSelectorEditor,
     };
   }
 
   renderInheritedRules(rules) {
     if (!rules.length) {
       return null;
     }
 
@@ -48,18 +60,17 @@ class RulesApp extends PureComponent {
         lastInherited = rule.inheritance.inherited;
 
         output.push(
           dom.div({ className: "ruleview-header" }, rule.inheritance.inheritedSource)
         );
       }
 
       output.push(Rule({
-        onToggleDeclaration: this.props.onToggleDeclaration,
-        onToggleSelectorHighlighter: this.props.onToggleSelectorHighlighter,
+        ...this.getRuleProps(),
         rule,
       }));
     }
 
     return output;
   }
 
   renderKeyframesRules(rules) {
@@ -76,18 +87,17 @@ class RulesApp extends PureComponent {
       }
 
       lastKeyframes = rule.keyframesRule.id;
 
       const items = [
         {
           component: Rules,
           componentProps: {
-            onToggleDeclaration: this.props.onToggleDeclaration,
-            onToggleSelectorHighlighter: this.props.onToggleSelectorHighlighter,
+            ...this.getRuleProps(),
             rules: rules.filter(r => r.keyframesRule.id === lastKeyframes),
           },
           header: rule.keyframesRule.keyframesName,
           opened: true,
         },
       ];
 
       output.push(Accordion({ items }));
@@ -97,33 +107,31 @@ class RulesApp extends PureComponent {
   }
 
   renderStyleRules(rules) {
     if (!rules.length) {
       return null;
     }
 
     return Rules({
-      onToggleDeclaration: this.props.onToggleDeclaration,
-      onToggleSelectorHighlighter: this.props.onToggleSelectorHighlighter,
+      ...this.getRuleProps(),
       rules,
     });
   }
 
   renderPseudoElementRules(rules) {
     if (!rules.length) {
       return null;
     }
 
     const items = [
       {
         component: Rules,
         componentProps: {
-          onToggleDeclaration: this.props.onToggleDeclaration,
-          onToggleSelectorHighlighter: this.props.onToggleSelectorHighlighter,
+          ...this.getRuleProps(),
           rules,
         },
         header: getStr("rule.pseudoElement"),
         opened: Services.prefs.getBoolPref(SHOW_PSEUDO_ELEMENTS_PREF),
         onToggled: () => {
           const opened = Services.prefs.getBoolPref(SHOW_PSEUDO_ELEMENTS_PREF);
           Services.prefs.setBoolPref(SHOW_PSEUDO_ELEMENTS_PREF, !opened);
         },
@@ -157,16 +165,19 @@ class RulesApp extends PureComponent {
 
     return (
       dom.div(
         {
           id: "sidebar-panel-ruleview",
           className: "theme-sidebar inspector-tabpanel",
         },
         Toolbar({
+          onAddClass: this.props.onAddClass,
+          onSetClassState: this.props.onSetClassState,
+          onToggleClassPanelExpanded: this.props.onToggleClassPanelExpanded,
           onTogglePseudoClass: this.props.onTogglePseudoClass,
         }),
         dom.div(
           {
             id: "ruleview-container",
             className: "ruleview",
           },
           dom.div(
--- a/devtools/client/inspector/rules/components/Selector.js
+++ b/devtools/client/inspector/rules/components/Selector.js
@@ -1,39 +1,62 @@
 /* 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 strict";
 
-const { PureComponent } = require("devtools/client/shared/vendor/react");
+const { createRef, PureComponent } = require("devtools/client/shared/vendor/react");
 const dom = require("devtools/client/shared/vendor/react-dom-factories");
 const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
-
+const { editableItem } = require("devtools/client/shared/inplace-editor");
 const {
   parsePseudoClassesAndAttributes,
   SELECTOR_ATTRIBUTE,
   SELECTOR_ELEMENT,
   SELECTOR_PSEUDO_CLASS,
 } = require("devtools/shared/css/parsing-utils");
 const {
   ELEMENT_STYLE,
   PSEUDO_CLASSES,
 } = require("devtools/client/inspector/rules/constants");
 
 const Types = require("../types");
 
 class Selector extends PureComponent {
   static get propTypes() {
     return {
+      id: PropTypes.string.isRequired,
+      isUserAgentStyle: PropTypes.bool.isRequired,
       selector: PropTypes.shape(Types.selector).isRequired,
+      showSelectorEditor: PropTypes.func.isRequired,
       type: PropTypes.number.isRequired,
     };
   }
 
+  constructor(props) {
+    super(props);
+    this.selectorRef = createRef();
+  }
+
+  componentDidMount() {
+    if (this.props.isUserAgentStyle ||
+        this.props.type === ELEMENT_STYLE ||
+        this.props.type === CSSRule.KEYFRAME_RULE) {
+      // Selector is not editable.
+      return;
+    }
+
+    editableItem({
+      element: this.selectorRef.current,
+    }, element => {
+      this.props.showSelectorEditor(element, this.props.id);
+    });
+  }
+
   renderSelector() {
     // Show the text directly for custom selector text (such as the inline "element"
     // style and Keyframes rules).
     if (this.props.type === ELEMENT_STYLE || this.props.type === CSSRule.KEYFRAME_RULE) {
       return this.props.selector.selectorText;
     }
 
     const { matchedSelectors, selectors } = this.props.selector;
@@ -82,16 +105,17 @@ class Selector extends PureComponent {
     return output;
   }
 
   render() {
     return (
       dom.span(
         {
           className: "ruleview-selectorcontainer",
+          ref: this.selectorRef,
           tabIndex: 0,
         },
         this.renderSelector()
       )
     );
   }
 }
 
--- a/devtools/client/inspector/rules/components/Toolbar.js
+++ b/devtools/client/inspector/rules/components/Toolbar.js
@@ -2,84 +2,81 @@
  * 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 strict";
 
 const { createFactory, PureComponent } = require("devtools/client/shared/vendor/react");
 const dom = require("devtools/client/shared/vendor/react-dom-factories");
 const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
+const { connect } = require("devtools/client/shared/vendor/react-redux");
 
 const SearchBox = createFactory(require("./SearchBox"));
 
 loader.lazyGetter(this, "ClassListPanel", function() {
   return createFactory(require("./ClassListPanel"));
 });
 loader.lazyGetter(this, "PseudoClassPanel", function() {
   return createFactory(require("./PseudoClassPanel"));
 });
 
 const { getStr } = require("../utils/l10n");
 
 class Toolbar extends PureComponent {
   static get propTypes() {
     return {
+      isClassPanelExpanded: PropTypes.bool.isRequired,
+      onAddClass: PropTypes.func.isRequired,
+      onSetClassState: PropTypes.func.isRequired,
+      onToggleClassPanelExpanded: PropTypes.func.isRequired,
       onTogglePseudoClass: PropTypes.func.isRequired,
     };
   }
 
   constructor(props) {
     super(props);
 
     this.state = {
-      // Whether or not the class panel is expanded.
-      isClassPanelExpanded: false,
       // Whether or not the pseudo class panel is expanded.
       isPseudoClassPanelExpanded: false,
     };
 
     this.onClassPanelToggle = this.onClassPanelToggle.bind(this);
     this.onPseudoClassPanelToggle = this.onPseudoClassPanelToggle.bind(this);
   }
 
   onClassPanelToggle(event) {
     event.stopPropagation();
 
+    const isClassPanelExpanded = !this.props.isClassPanelExpanded;
+    this.props.onToggleClassPanelExpanded(isClassPanelExpanded);
     this.setState(prevState => {
-      const isClassPanelExpanded = !prevState.isClassPanelExpanded;
-      const isPseudoClassPanelExpanded = isClassPanelExpanded ?
-        false : prevState.isPseudoClassPanelExpanded;
-
       return {
-        isClassPanelExpanded,
-        isPseudoClassPanelExpanded,
+        isPseudoClassPanelExpanded: isClassPanelExpanded ?
+                                    false :
+                                    prevState.isPseudoClassPanelExpanded,
       };
     });
   }
 
   onPseudoClassPanelToggle(event) {
     event.stopPropagation();
 
-    this.setState(prevState => {
-      const isPseudoClassPanelExpanded = !prevState.isPseudoClassPanelExpanded;
-      const isClassPanelExpanded = isPseudoClassPanelExpanded ?
-        false : prevState.isClassPanelExpanded;
+    const isPseudoClassPanelExpanded = !this.state.isPseudoClassPanelExpanded;
 
-      return {
-        isClassPanelExpanded,
-        isPseudoClassPanelExpanded,
-      };
-    });
+    if (isPseudoClassPanelExpanded) {
+      this.props.onToggleClassPanelExpanded(false);
+    }
+
+    this.setState({ isPseudoClassPanelExpanded });
   }
 
   render() {
-    const {
-      isClassPanelExpanded,
-      isPseudoClassPanelExpanded,
-    } = this.state;
+    const { isClassPanelExpanded } = this.props;
+    const { isPseudoClassPanelExpanded } = this.state;
 
     return (
       dom.div(
         {
           id: "ruleview-toolbar-container",
           className: "devtools-toolbar",
         },
         dom.div({ id: "ruleview-toolbar" },
@@ -102,23 +99,32 @@ class Toolbar extends PureComponent {
               className: "devtools-button" +
                           (isClassPanelExpanded ? " checked" : ""),
               onClick: this.onClassPanelToggle,
               title: getStr("rule.classPanel.toggleClass.tooltip"),
             })
           )
         ),
         isClassPanelExpanded ?
-          ClassListPanel({})
+          ClassListPanel({
+            onAddClass: this.props.onAddClass,
+            onSetClassState: this.props.onSetClassState,
+          })
           :
           null,
         isPseudoClassPanelExpanded ?
           PseudoClassPanel({
             onTogglePseudoClass: this.props.onTogglePseudoClass,
           })
           :
           null
       )
     );
   }
 }
 
-module.exports = Toolbar;
+const mapStateToProps = state => {
+  return {
+    isClassPanelExpanded: state.classList.isClassPanelExpanded,
+  };
+};
+
+module.exports = connect(mapStateToProps)(Toolbar);
copy from devtools/client/inspector/rules/views/class-list-previewer.js
copy to devtools/client/inspector/rules/models/class-list.js
--- a/devtools/client/inspector/rules/views/class-list-previewer.js
+++ b/devtools/client/inspector/rules/models/class-list.js
@@ -1,18 +1,15 @@
 /* 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 strict";
 
 const EventEmitter = require("devtools/shared/event-emitter");
-const {LocalizationHelper} = require("devtools/shared/l10n");
-
-const L10N = new LocalizationHelper("devtools/client/locales/inspector.properties");
 
 // This serves as a local cache for the classes applied to each of the node we care about
 // here.
 // The map is indexed by NodeFront. Any time a new node is selected in the inspector, an
 // entry is added here, indexed by the corresponding NodeFront.
 // The value for each entry is an array of each of the class this node has. Items of this
 // array are objects like: { name, isApplied } where the name is the class itself, and
 // isApplied is a Boolean indicating if the class is applied on the node or not.
@@ -26,28 +23,28 @@ const CLASSES = new WeakMap();
  * disabled.
  * It also reacts to DOM mutations so the list of classes is up to date with what is in
  * the DOM.
  * It can also be used to enable/disable a given class, or add classes.
  *
  * @param {Inspector} inspector
  *        The current inspector instance.
  */
-function ClassListPreviewerModel(inspector) {
+function ClassList(inspector) {
   EventEmitter.decorate(this);
 
   this.inspector = inspector;
 
   this.onMutations = this.onMutations.bind(this);
   this.inspector.on("markupmutation", this.onMutations);
 
   this.classListProxyNode = this.inspector.panelDoc.createElement("div");
 }
 
-ClassListPreviewerModel.prototype = {
+ClassList.prototype = {
   destroy() {
     this.inspector.off("markupmutation", this.onMutations);
     this.inspector = null;
     this.classListProxyNode = null;
   },
 
   /**
    * The current node selection (which only returns if the node is an ELEMENT_NODE type
@@ -186,174 +183,9 @@ ClassListPreviewerModel.prototype = {
         if (target === this.currentNode) {
           this.emit("current-node-class-changed");
         }
       }
     }
   },
 };
 
-/**
- * This UI widget shows a textfield and a series of checkboxes in the rule-view. It is
- * used to toggle classes on the current node selection, and add new classes.
- *
- * @param {Inspector} inspector
- *        The current inspector instance.
- * @param {DomNode} containerEl
- *        The element in the rule-view where the widget should go.
- */
-function ClassListPreviewer(inspector, containerEl) {
-  this.inspector = inspector;
-  this.containerEl = containerEl;
-  this.model = new ClassListPreviewerModel(inspector);
-
-  this.onNewSelection = this.onNewSelection.bind(this);
-  this.onCheckBoxChanged = this.onCheckBoxChanged.bind(this);
-  this.onKeyPress = this.onKeyPress.bind(this);
-  this.onCurrentNodeClassChanged = this.onCurrentNodeClassChanged.bind(this);
-
-  // Create the add class text field.
-  this.addEl = this.doc.createElement("input");
-  this.addEl.classList.add("devtools-textinput");
-  this.addEl.classList.add("add-class");
-  this.addEl.setAttribute("placeholder",
-    L10N.getStr("inspector.classPanel.newClass.placeholder"));
-  this.addEl.addEventListener("keypress", this.onKeyPress);
-  this.containerEl.appendChild(this.addEl);
-
-  // Create the class checkboxes container.
-  this.classesEl = this.doc.createElement("div");
-  this.classesEl.classList.add("classes");
-  this.containerEl.appendChild(this.classesEl);
-
-  // Start listening for interesting events.
-  this.inspector.selection.on("new-node-front", this.onNewSelection);
-  this.containerEl.addEventListener("input", this.onCheckBoxChanged);
-  this.model.on("current-node-class-changed", this.onCurrentNodeClassChanged);
-
-  this.onNewSelection();
-}
-
-ClassListPreviewer.prototype = {
-  destroy() {
-    this.inspector.selection.off("new-node-front", this.onNewSelection);
-    this.addEl.removeEventListener("keypress", this.onKeyPress);
-    this.containerEl.removeEventListener("input", this.onCheckBoxChanged);
-
-    this.containerEl.innerHTML = "";
-
-    this.model.destroy();
-    this.containerEl = null;
-    this.inspector = null;
-    this.addEl = null;
-    this.classesEl = null;
-  },
-
-  get doc() {
-    return this.containerEl.ownerDocument;
-  },
-
-  /**
-   * Render the content of the panel. You typically don't need to call this as the panel
-   * renders itself on inspector selection changes.
-   */
-  render() {
-    this.classesEl.innerHTML = "";
-
-    for (const { name, isApplied } of this.model.currentClasses) {
-      const checkBox = this.renderCheckBox(name, isApplied);
-      this.classesEl.appendChild(checkBox);
-    }
-
-    if (!this.model.currentClasses.length) {
-      this.classesEl.appendChild(this.renderNoClassesMessage());
-    }
-  },
-
-  /**
-   * Render a single checkbox for a given classname.
-   *
-   * @param {String} name
-   *        The name of this class.
-   * @param {Boolean} isApplied
-   *        Is this class currently applied on the DOM node.
-   * @return {DOMNode} The DOM element for this checkbox.
-   */
-  renderCheckBox(name, isApplied) {
-    const box = this.doc.createElement("input");
-    box.setAttribute("type", "checkbox");
-    if (isApplied) {
-      box.setAttribute("checked", "checked");
-    }
-    box.dataset.name = name;
-
-    const labelWrapper = this.doc.createElement("label");
-    labelWrapper.setAttribute("title", name);
-    labelWrapper.appendChild(box);
-
-    // A child element is required to do the ellipsis.
-    const label = this.doc.createElement("span");
-    label.textContent = name;
-    labelWrapper.appendChild(label);
-
-    return labelWrapper;
-  },
-
-  /**
-   * Render the message displayed in the panel when the current element has no classes.
-   *
-   * @return {DOMNode} The DOM element for the message.
-   */
-  renderNoClassesMessage() {
-    const msg = this.doc.createElement("p");
-    msg.classList.add("no-classes");
-    msg.textContent = L10N.getStr("inspector.classPanel.noClasses");
-    return msg;
-  },
-
-  /**
-   * Focus the add-class text field.
-   */
-  focusAddClassField() {
-    if (this.addEl) {
-      this.addEl.focus();
-    }
-  },
-
-  onCheckBoxChanged({ target }) {
-    if (!target.dataset.name) {
-      return;
-    }
-
-    this.model.setClassState(target.dataset.name, target.checked).catch(e => {
-      // Only log the error if the panel wasn't destroyed in the meantime.
-      if (this.containerEl) {
-        console.error(e);
-      }
-    });
-  },
-
-  onKeyPress(event) {
-    if (event.key !== "Enter" || this.addEl.value === "") {
-      return;
-    }
-
-    this.model.addClassName(this.addEl.value).then(() => {
-      this.render();
-      this.addEl.value = "";
-    }).catch(e => {
-      // Only log the error if the panel wasn't destroyed in the meantime.
-      if (this.containerEl) {
-        console.error(e);
-      }
-    });
-  },
-
-  onNewSelection() {
-    this.render();
-  },
-
-  onCurrentNodeClassChanged() {
-    this.render();
-  },
-};
-
-module.exports = ClassListPreviewer;
+module.exports = ClassList;
--- a/devtools/client/inspector/rules/models/element-style.js
+++ b/devtools/client/inspector/rules/models/element-style.js
@@ -328,16 +328,83 @@ ElementStyle.prototype = {
       // overridden state has changed for the text property.
       if (this._updatePropertyOverridden(textProp)) {
         textProp.updateEditor();
       }
     }
   },
 
   /**
+   * Modifies the existing rule's selector to the new given value.
+   *
+   * @param {String} ruleId
+   *        The id of the Rule to be modified.
+   * @param {String} selector
+   *        The new selector value.
+   */
+  modifySelector: async function(ruleId, selector) {
+    try {
+      const rule = this.getRule(ruleId);
+      if (!rule) {
+        return;
+      }
+
+      const response = await rule.domRule.modifySelector(this.element, selector);
+      const { ruleProps, isMatching } = response;
+
+      if (!ruleProps) {
+        // Notify for changes, even when nothing changes, just to allow tests
+        // being able to track end of this request.
+        this.ruleView.emit("ruleview-invalid-selector");
+        return;
+      }
+
+      const newRule = new Rule(this, {
+        ...ruleProps,
+        isUnmatched: !isMatching,
+      });
+
+      // Recompute the list of applied styles because editing a
+      // selector might cause this rule's position to change.
+      const appliedStyles = await this.pageStyle.getApplied(this.element, {
+        inherited: true,
+        matchedSelectors: true,
+        filter: this.showUserAgentStyles ? "ua" : undefined,
+      });
+      const newIndex = appliedStyles.findIndex(r => r.rule == ruleProps.rule);
+      const oldIndex = this.rules.indexOf(rule);
+
+      // Remove the old rule and insert the new rule according to where it appears
+      // in the list of applied styles.
+      this.rules.splice(oldIndex, 1);
+      // If the selector no longer matches, then we leave the rule in
+      // the same relative position.
+      this.rules.splice(newIndex === -1 ? oldIndex : newIndex, 0, newRule);
+
+      // Mark any properties that are overridden according to the new list of rules.
+      this.markOverriddenAll();
+
+      // In order to keep the new rule in place of the old in the rules view, we need
+      // to remove the rule again if the rule was inserted to its new index according
+      // to the list of applied styles.
+      // Note: you might think we would replicate the list-modification logic above,
+      // but that is complicated due to the way the UI installs pseudo-element rules
+      // and the like.
+      if (newIndex !== -1) {
+        this.rules.splice(newIndex, 1);
+        this.rules.splice(oldIndex, 0, newRule);
+      }
+
+      this._changed();
+    } catch (e) {
+      console.error(e);
+    }
+  },
+
+  /**
    * Toggles the enabled state of the given CSS declaration.
    *
    * @param {String} ruleId
    *        The Rule id of the given CSS declaration.
    * @param {String} declarationId
    *        The TextProperty id for the CSS declaration.
    */
   toggleDeclaration: function(ruleId, declarationId) {
--- a/devtools/client/inspector/rules/models/moz.build
+++ b/devtools/client/inspector/rules/models/moz.build
@@ -1,12 +1,13 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
 DevToolsModules(
+    'class-list.js',
     'element-style.js',
     'rule.js',
     'text-property.js',
     'user-properties.js',
 )
--- a/devtools/client/inspector/rules/new-rules.js
+++ b/devtools/client/inspector/rules/new-rules.js
@@ -6,50 +6,62 @@
 
 const Services = require("Services");
 const ElementStyle = require("devtools/client/inspector/rules/models/element-style");
 const { createFactory, createElement } = require("devtools/client/shared/vendor/react");
 const { Provider } = require("devtools/client/shared/vendor/react-redux");
 const EventEmitter = require("devtools/shared/event-emitter");
 
 const {
+  updateClasses,
+  updateClassPanelExpanded,
+} = require("./actions/class-list");
+const {
   disableAllPseudoClasses,
   setPseudoClassLocks,
   togglePseudoClass,
 } = require("./actions/pseudo-classes");
 const {
   updateHighlightedSelector,
   updateRules,
 } = require("./actions/rules");
 
 const RulesApp = createFactory(require("./components/RulesApp"));
 
 const { LocalizationHelper } = require("devtools/shared/l10n");
 const INSPECTOR_L10N =
   new LocalizationHelper("devtools/client/locales/inspector.properties");
 
+loader.lazyRequireGetter(this, "ClassList", "devtools/client/inspector/rules/models/class-list");
+loader.lazyRequireGetter(this, "InplaceEditor", "devtools/client/shared/inplace-editor", true);
+
 const PREF_UA_STYLES = "devtools.inspector.showUserAgentStyles";
 
 class RulesView {
   constructor(inspector, window) {
     this.cssProperties = inspector.cssProperties;
     this.doc = window.document;
     this.inspector = inspector;
     this.pageStyle = inspector.pageStyle;
     this.selection = inspector.selection;
     this.store = inspector.store;
     this.telemetry = inspector.telemetry;
     this.toolbox = inspector.toolbox;
 
     this.showUserAgentStyles = Services.prefs.getBoolPref(PREF_UA_STYLES);
 
+    this.onAddClass = this.onAddClass.bind(this);
     this.onSelection = this.onSelection.bind(this);
+    this.onSetClassState = this.onSetClassState.bind(this);
+    this.onToggleClassPanelExpanded = this.onToggleClassPanelExpanded.bind(this);
     this.onToggleDeclaration = this.onToggleDeclaration.bind(this);
     this.onTogglePseudoClass = this.onTogglePseudoClass.bind(this);
     this.onToggleSelectorHighlighter = this.onToggleSelectorHighlighter.bind(this);
+    this.showSelectorEditor = this.showSelectorEditor.bind(this);
+    this.updateClassList = this.updateClassList.bind(this);
     this.updateRules = this.updateRules.bind(this);
 
     this.inspector.sidebar.on("select", this.onSelection);
     this.selection.on("detached-front", this.onSelection);
     this.selection.on("new-node-front", this.onSelection);
 
     this.init();
 
@@ -57,19 +69,23 @@ class RulesView {
   }
 
   init() {
     if (!this.inspector) {
       return;
     }
 
     const rulesApp = RulesApp({
+      onAddClass: this.onAddClass,
+      onSetClassState: this.onSetClassState,
+      onToggleClassPanelExpanded: this.onToggleClassPanelExpanded,
       onToggleDeclaration: this.onToggleDeclaration,
       onTogglePseudoClass: this.onTogglePseudoClass,
       onToggleSelectorHighlighter: this.onToggleSelectorHighlighter,
+      showSelectorEditor: this.showSelectorEditor,
     });
 
     const provider = createElement(Provider, {
       id: "ruleview",
       key: "ruleview",
       store: this.store,
       title: INSPECTOR_L10N.getStr("inspector.sidebar.ruleViewTitle"),
     }, rulesApp);
@@ -78,16 +94,22 @@ class RulesView {
     this.provider = provider;
   }
 
   destroy() {
     this.inspector.sidebar.off("select", this.onSelection);
     this.selection.off("detached-front", this.onSelection);
     this.selection.off("new-node-front", this.onSelection);
 
+    if (this._classList) {
+      this._classList.off("current-node-class-changed", this.refreshClassList);
+      this._classList.destroy();
+      this._classList = null;
+    }
+
     if (this._selectHighlighter) {
       this._selectorHighlighter.finalize();
       this._selectorHighlighter = null;
     }
 
     if (this.elementStyle) {
       this.elementStyle.destroy();
     }
@@ -101,16 +123,29 @@ class RulesView {
     this.selection = null;
     this.showUserAgentStyles = null;
     this.store = null;
     this.telemetry = null;
     this.toolbox = null;
   }
 
   /**
+   * Get an instance of the ClassList model used to manage the list of CSS classes
+   * applied to the element.
+   *
+   * @return {ClassList} used to manage the list of CSS classes applied to the element.
+   */
+  get classList() {
+    if (!this._classList) {
+      this._classList = new ClassList(this.inspector);
+    }
+
+    return this._classList;
+  }
+  /**
    * Creates a dummy element in the document that helps get the computed style in
    * TextProperty.
    *
    * @return {Element} used to get the computed style for text properties.
    */
   get dummyElement() {
     // To figure out how shorthand properties are interpreted by the
     // engine, we will set properties on a dummy element and observe
@@ -162,16 +197,27 @@ class RulesView {
    */
   isPanelVisible() {
     return this.inspector && this.inspector.toolbox && this.inspector.sidebar &&
            this.inspector.toolbox.currentToolId === "inspector" &&
            this.inspector.sidebar.getCurrentTabID() === "newruleview";
   }
 
   /**
+   * Handler for adding the given CSS class value to the current element's class list.
+   *
+   * @param  {String} value
+   *         The string that contains all classes.
+   */
+  async onAddClass(value) {
+    await this.classList.addClassName(value);
+    this.updateClassList();
+  }
+
+  /**
    * Handler for selection events "detached-front" and "new-node-front" and inspector
    * sidbar "select" event. Updates the rules view with the selected node if the panel
    * is visible.
    */
   onSelection() {
     if (!this.isPanelVisible()) {
       return;
     }
@@ -181,16 +227,46 @@ class RulesView {
       this.update();
       return;
     }
 
     this.update(this.selection.nodeFront);
   }
 
   /**
+   * Handler for toggling a CSS class from the current element's class list. Sets the
+   * state of given CSS class name to the given checked value.
+   *
+   * @param  {String} name
+   *         The CSS class name.
+   * @param  {Boolean} checked
+   *         Whether or not the given CSS class is checked.
+   */
+  async onSetClassState(name, checked) {
+    await this.classList.setClassState(name, checked);
+    this.updateClassList();
+  }
+
+  /**
+   * Handler for toggling the expanded property of the class list panel.
+   *
+   * @param  {Boolean} isClassPanelExpanded
+   *         Whether or not the class list panel is expanded.
+   */
+  onToggleClassPanelExpanded(isClassPanelExpanded) {
+    if (isClassPanelExpanded) {
+      this.classList.on("current-node-class-changed", this.updateClassList);
+    } else {
+      this.classList.off("current-node-class-changed", this.updateClassList);
+    }
+
+    this.store.dispatch(updateClassPanelExpanded(isClassPanelExpanded));
+  }
+
+  /**
    * Handler for toggling the enabled property for a given CSS declaration.
    *
    * @param  {String} ruleId
    *         The Rule id of the given CSS declaration.
    * @param  {String} declarationId
    *         The TextProperty id for the CSS declaration.
    */
   onToggleDeclaration(ruleId, declarationId) {
@@ -247,40 +323,78 @@ class RulesView {
       this.highlighters.selectorHighlighterShown = null;
       this.store.dispatch(updateHighlightedSelector(""));
       // This event is emitted for testing purposes.
       this.emit("ruleview-selectorhighlighter-toggled", false);
     }
   }
 
   /**
+   * Shows the inplace editor for the a selector.
+   *
+   * @param  {DOMNode} element
+   *         The selector's span element to show the inplace editor.
+   * @param  {String} ruleId
+   *         The id of the Rule to be modified.
+   */
+  showSelectorEditor(element, ruleId) {
+    new InplaceEditor({
+      element,
+      done: async (value, commit) => {
+        if (!value || !commit) {
+          return;
+        }
+
+        // Hide the selector highlighter if it matches the selector being edited.
+        if (this.highlighters.selectorHighlighterShown) {
+          const selector = await this.elementStyle.getRule(ruleId).getUniqueSelector();
+          if (this.highlighters.selectorHighlighterShown === selector) {
+            this.onToggleSelectorHighlighter(this.highlighters.selectorHighlighterShown);
+          }
+        }
+
+        await this.elementStyle.modifySelector(ruleId, value);
+      },
+    });
+  }
+
+  /**
    * Updates the rules view by dispatching the new rules data of the newly selected
    * element. This is called when the rules view becomes visible or upon new node
    * selection.
    *
    * @param  {NodeFront|null} element
    *         The NodeFront of the current selected element.
    */
   async update(element) {
     if (!element) {
       this.store.dispatch(disableAllPseudoClasses());
+      this.store.dispatch(updateClasses([]));
       this.store.dispatch(updateRules([]));
       return;
     }
 
     this.elementStyle = new ElementStyle(element, this, {}, this.pageStyle,
       this.showUserAgentStyles);
     this.elementStyle.onChanged = this.updateRules;
     await this.elementStyle.populate();
 
     this.store.dispatch(setPseudoClassLocks(this.elementStyle.element.pseudoClassLocks));
+    this.updateClassList();
     this.updateRules();
   }
 
   /**
+   * Updates the class list panel with the current list of CSS classes.
+   */
+  updateClassList() {
+    this.store.dispatch(updateClasses(this.classList.currentClasses));
+  }
+
+  /**
    * Updates the rules view by dispatching the current rules state. This is called from
    * the update() function, and from the ElementStyle's onChange() handler.
    */
   updateRules() {
     this.store.dispatch(updateRules(this.elementStyle.rules));
   }
 }
 
new file mode 100644
--- /dev/null
+++ b/devtools/client/inspector/rules/reducers/class-list.js
@@ -0,0 +1,44 @@
+/* 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 strict";
+
+const {
+  UPDATE_CLASSES,
+  UPDATE_CLASS_PANEL_EXPANDED,
+} = require("../actions/index");
+
+const INITIAL_CLASS_LIST = {
+  // An array of objects containing the CSS class state that is applied to the current
+  // element.
+  classes: [],
+  // Whether or not the class list panel is expanded.
+  isClassPanelExpanded: false,
+};
+
+const reducers = {
+
+  [UPDATE_CLASSES](classList, { classes }) {
+    return {
+      ...classList,
+      classes: [...classes],
+    };
+  },
+
+  [UPDATE_CLASS_PANEL_EXPANDED](classList, { isClassPanelExpanded }) {
+    return {
+      ...classList,
+      isClassPanelExpanded,
+    };
+  },
+
+};
+
+module.exports = function(classList = INITIAL_CLASS_LIST, action) {
+  const reducer = reducers[action.type];
+  if (!reducer) {
+    return classList;
+  }
+  return reducer(classList, action);
+};
--- a/devtools/client/inspector/rules/reducers/moz.build
+++ b/devtools/client/inspector/rules/reducers/moz.build
@@ -1,8 +1,9 @@
 # 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/.
 
 DevToolsModules(
+    'class-list.js',
     'pseudo-classes.js',
     'rules.js',
 )
--- a/devtools/client/inspector/rules/types.js
+++ b/devtools/client/inspector/rules/types.js
@@ -2,16 +2,27 @@
  * 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 strict";
 
 const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
 
 /**
+ * A CSS class.
+ */
+exports.classes = {
+  // The CSS class name.
+  name: PropTypes.string,
+
+  // Whether or not the CSS class is applied.
+  isApplied: PropTypes.bool,
+};
+
+/**
  * A CSS declaration.
  */
 const declaration = exports.declaration = {
   // Array of the computed properties for a CSS declaration.
   computedProperties: PropTypes.arrayOf(PropTypes.shape({
     // Whether or not the computed property is overridden.
     isOverridden: PropTypes.bool,
     // The computed property name.
--- a/devtools/client/inspector/rules/views/class-list-previewer.js
+++ b/devtools/client/inspector/rules/views/class-list-previewer.js
@@ -1,214 +1,32 @@
 /* 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 strict";
 
-const EventEmitter = require("devtools/shared/event-emitter");
+const ClassList = require("devtools/client/inspector/rules/models/class-list");
 const {LocalizationHelper} = require("devtools/shared/l10n");
 
 const L10N = new LocalizationHelper("devtools/client/locales/inspector.properties");
 
-// This serves as a local cache for the classes applied to each of the node we care about
-// here.
-// The map is indexed by NodeFront. Any time a new node is selected in the inspector, an
-// entry is added here, indexed by the corresponding NodeFront.
-// The value for each entry is an array of each of the class this node has. Items of this
-// array are objects like: { name, isApplied } where the name is the class itself, and
-// isApplied is a Boolean indicating if the class is applied on the node or not.
-const CLASSES = new WeakMap();
-
-/**
- * Manages the list classes per DOM elements we care about.
- * The actual list is stored in the CLASSES const, indexed by NodeFront objects.
- * The responsibility of this class is to be the source of truth for anyone who wants to
- * know which classes a given NodeFront has, and which of these are enabled and which are
- * disabled.
- * It also reacts to DOM mutations so the list of classes is up to date with what is in
- * the DOM.
- * It can also be used to enable/disable a given class, or add classes.
- *
- * @param {Inspector} inspector
- *        The current inspector instance.
- */
-function ClassListPreviewerModel(inspector) {
-  EventEmitter.decorate(this);
-
-  this.inspector = inspector;
-
-  this.onMutations = this.onMutations.bind(this);
-  this.inspector.on("markupmutation", this.onMutations);
-
-  this.classListProxyNode = this.inspector.panelDoc.createElement("div");
-}
-
-ClassListPreviewerModel.prototype = {
-  destroy() {
-    this.inspector.off("markupmutation", this.onMutations);
-    this.inspector = null;
-    this.classListProxyNode = null;
-  },
-
-  /**
-   * The current node selection (which only returns if the node is an ELEMENT_NODE type
-   * since that's the only type this model can work with.)
-   */
-  get currentNode() {
-    if (this.inspector.selection.isElementNode() &&
-        !this.inspector.selection.isPseudoElementNode()) {
-      return this.inspector.selection.nodeFront;
-    }
-    return null;
-  },
-
-  /**
-   * The class states for the current node selection. See the documentation of the CLASSES
-   * constant.
-   */
-  get currentClasses() {
-    if (!this.currentNode) {
-      return [];
-    }
-
-    if (!CLASSES.has(this.currentNode)) {
-      // Use the proxy node to get a clean list of classes.
-      this.classListProxyNode.className = this.currentNode.className;
-      const nodeClasses = [...new Set([...this.classListProxyNode.classList])]
-        .map(name => {
-          return { name, isApplied: true };
-        });
-
-      CLASSES.set(this.currentNode, nodeClasses);
-    }
-
-    return CLASSES.get(this.currentNode);
-  },
-
-  /**
-   * Same as currentClasses, but returns it in the form of a className string, where only
-   * enabled classes are added.
-   */
-  get currentClassesPreview() {
-    return this.currentClasses.filter(({ isApplied }) => isApplied)
-                              .map(({ name }) => name)
-                              .join(" ");
-  },
-
-  /**
-   * Set the state for a given class on the current node.
-   *
-   * @param {String} name
-   *        The class which state should be changed.
-   * @param {Boolean} isApplied
-   *        True if the class should be enabled, false otherwise.
-   * @return {Promise} Resolves when the change has been made in the DOM.
-   */
-  setClassState(name, isApplied) {
-    // Do the change in our local model.
-    const nodeClasses = this.currentClasses;
-    nodeClasses.find(({ name: cName }) => cName === name).isApplied = isApplied;
-
-    return this.applyClassState();
-  },
-
-  /**
-   * Add several classes to the current node at once.
-   *
-   * @param {String} classNameString
-   *        The string that contains all classes.
-   * @return {Promise} Resolves when the change has been made in the DOM.
-   */
-  addClassName(classNameString) {
-    this.classListProxyNode.className = classNameString;
-    return Promise.all([...new Set([...this.classListProxyNode.classList])].map(name => {
-      return this.addClass(name);
-    }));
-  },
-
-  /**
-   * Add a class to the current node at once.
-   *
-   * @param {String} name
-   *        The class to be added.
-   * @return {Promise} Resolves when the change has been made in the DOM.
-   */
-  addClass(name) {
-    // Avoid adding the same class again.
-    if (this.currentClasses.some(({ name: cName }) => cName === name)) {
-      return Promise.resolve();
-    }
-
-    // Change the local model, so we retain the state of the existing classes.
-    this.currentClasses.push({ name, isApplied: true });
-
-    return this.applyClassState();
-  },
-
-  /**
-   * Used internally by other functions like addClass or setClassState. Actually applies
-   * the class change to the DOM.
-   *
-   * @return {Promise} Resolves when the change has been made in the DOM.
-   */
-  applyClassState() {
-    // If there is no valid inspector selection, bail out silently. No need to report an
-    // error here.
-    if (!this.currentNode) {
-      return Promise.resolve();
-    }
-
-    // Remember which node we changed and the className we applied, so we can filter out
-    // dom mutations that are caused by us in onMutations.
-    this.lastStateChange = {
-      node: this.currentNode,
-      className: this.currentClassesPreview,
-    };
-
-    // Apply the change to the node.
-    const mod = this.currentNode.startModifyingAttributes();
-    mod.setAttribute("class", this.currentClassesPreview);
-    return mod.apply();
-  },
-
-  onMutations(mutations) {
-    for (const {type, target, attributeName} of mutations) {
-      // Only care if this mutation is for the class attribute.
-      if (type !== "attributes" || attributeName !== "class") {
-        continue;
-      }
-
-      const isMutationForOurChange = this.lastStateChange &&
-                                   target === this.lastStateChange.node &&
-                                   target.className === this.lastStateChange.className;
-
-      if (!isMutationForOurChange) {
-        CLASSES.delete(target);
-        if (target === this.currentNode) {
-          this.emit("current-node-class-changed");
-        }
-      }
-    }
-  },
-};
-
 /**
  * This UI widget shows a textfield and a series of checkboxes in the rule-view. It is
  * used to toggle classes on the current node selection, and add new classes.
  *
  * @param {Inspector} inspector
  *        The current inspector instance.
  * @param {DomNode} containerEl
  *        The element in the rule-view where the widget should go.
  */
 function ClassListPreviewer(inspector, containerEl) {
   this.inspector = inspector;
   this.containerEl = containerEl;
-  this.model = new ClassListPreviewerModel(inspector);
+  this.model = new ClassList(inspector);
 
   this.onNewSelection = this.onNewSelection.bind(this);
   this.onCheckBoxChanged = this.onCheckBoxChanged.bind(this);
   this.onKeyPress = this.onKeyPress.bind(this);
   this.onCurrentNodeClassChanged = this.onCurrentNodeClassChanged.bind(this);
 
   // Create the add class text field.
   this.addEl = this.doc.createElement("input");
--- a/devtools/server/startup/content-process.jsm
+++ b/devtools/server/startup/content-process.jsm
@@ -40,51 +40,40 @@ function setupServer(mm) {
   // actors, but don't need all the "browser actors" that are only useful when
   // debugging the parent process via the browser toolbox.
   DebuggerServer.registerActors({ root: true, target: true });
 
   // Clean up things when the client disconnects
   mm.addMessageListener("debug:content-process-destroy", function onDestroy() {
     mm.removeMessageListener("debug:content-process-destroy", onDestroy);
 
-    Cu.unblockThreadedExecution();
-
     DebuggerServer.destroy();
     gLoader.destroy();
     gLoader = null;
   });
 
   return gLoader;
 }
 
 function init(msg) {
   const mm = msg.target;
   const prefix = msg.data.prefix;
 
-  // Using the JS debugger causes problems when we're trying to
-  // schedule those zone groups across different threads. Calling
-  // blockThreadedExecution causes Gecko to switch to a simpler
-  // single-threaded model until unblockThreadedExecution is called
-  // later. We cannot start the debugger until the callback passed to
-  // blockThreadedExecution has run, signaling that we're running
-  // single-threaded.
-  Cu.blockThreadedExecution(() => {
-    // Setup a server if none started yet
-    const loader = setupServer(mm);
+  // Setup a server if none started yet
+  const loader = setupServer(mm);
+
+  // Connect both parent/child processes debugger servers RDP via message
+  // managers
+  const { DebuggerServer } = loader.require("devtools/server/main");
+  const conn = DebuggerServer.connectToParent(prefix, mm);
+  conn.parentMessageManager = mm;
 
-    // Connect both parent/child processes debugger servers RDP via message
-    // managers
-    const { DebuggerServer } = loader.require("devtools/server/main");
-    const conn = DebuggerServer.connectToParent(prefix, mm);
-    conn.parentMessageManager = mm;
+  const { ContentProcessTargetActor } =
+      loader.require("devtools/server/actors/targets/content-process");
+  const { ActorPool } = loader.require("devtools/server/actors/common");
+  const actor = new ContentProcessTargetActor(conn);
+  const actorPool = new ActorPool(conn);
+  actorPool.addActor(actor);
+  conn.addActorPool(actorPool);
 
-    const { ContentProcessTargetActor } =
-        loader.require("devtools/server/actors/targets/content-process");
-    const { ActorPool } = loader.require("devtools/server/actors/common");
-    const actor = new ContentProcessTargetActor(conn);
-    const actorPool = new ActorPool(conn);
-    actorPool.addActor(actor);
-    conn.addActorPool(actorPool);
-
-    const response = { actor: actor.form() };
-    mm.sendAsyncMessage("debug:content-process-actor", response);
-  });
+  const response = { actor: actor.form() };
+  mm.sendAsyncMessage("debug:content-process-actor", response);
 }
--- a/devtools/server/startup/frame.js
+++ b/devtools/server/startup/frame.js
@@ -34,44 +34,35 @@ try {
 
     const onConnect = DevToolsUtils.makeInfallible(function(msg) {
       removeMessageListener("debug:connect", onConnect);
 
       const mm = msg.target;
       const prefix = msg.data.prefix;
       const addonId = msg.data.addonId;
 
-      // Using the JS debugger causes problems when we're trying to
-      // schedule those zone groups across different threads. Calling
-      // blockThreadedExecution causes Gecko to switch to a simpler
-      // single-threaded model until unblockThreadedExecution is
-      // called later. We cannot start the debugger until the callback
-      // passed to blockThreadedExecution has run, signaling that
-      // we're running single-threaded.
-      Cu.blockThreadedExecution(() => {
-        const conn = DebuggerServer.connectToParent(prefix, mm);
-        conn.parentMessageManager = mm;
-        connections.set(prefix, conn);
+      const conn = DebuggerServer.connectToParent(prefix, mm);
+      conn.parentMessageManager = mm;
+      connections.set(prefix, conn);
 
-        let actor;
+      let actor;
 
-        if (addonId) {
-          const { WebExtensionTargetActor } = require("devtools/server/actors/targets/webextension");
-          actor = new WebExtensionTargetActor(conn, chromeGlobal, prefix, addonId);
-        } else {
-          const { FrameTargetActor } = require("devtools/server/actors/targets/frame");
-          actor = new FrameTargetActor(conn, chromeGlobal);
-        }
+      if (addonId) {
+        const { WebExtensionTargetActor } = require("devtools/server/actors/targets/webextension");
+        actor = new WebExtensionTargetActor(conn, chromeGlobal, prefix, addonId);
+      } else {
+        const { FrameTargetActor } = require("devtools/server/actors/targets/frame");
+        actor = new FrameTargetActor(conn, chromeGlobal);
+      }
 
-        const actorPool = new ActorPool(conn);
-        actorPool.addActor(actor);
-        conn.addActorPool(actorPool);
+      const actorPool = new ActorPool(conn);
+      actorPool.addActor(actor);
+      conn.addActorPool(actorPool);
 
-        sendAsyncMessage("debug:actor", {actor: actor.form(), prefix: prefix});
-      });
+      sendAsyncMessage("debug:actor", {actor: actor.form(), prefix: prefix});
     });
 
     addMessageListener("debug:connect", onConnect);
 
     // Allows executing module setup helper from the parent process.
     // See also: DebuggerServer.setupInChild()
     const onSetupInChild = DevToolsUtils.makeInfallible(msg => {
       const { module, setupChild, args } = msg.data;
@@ -108,18 +99,16 @@ try {
       const conn = connections.get(prefix);
       if (!conn) {
         // Several copies of this frame script can be running for a single frame since it
         // is loaded once for each DevTools connection to the frame.  If this disconnect
         // request doesn't match a connection known here, ignore it.
         return;
       }
 
-      Cu.unblockThreadedExecution();
-
       removeMessageListener("debug:disconnect", onDisconnect);
       // Call DebuggerServerConnection.close to destroy all child actors. It should end up
       // calling DebuggerServerConnection.onClosed that would actually cleanup all actor
       // pools.
       conn.close();
       connections.delete(prefix);
     });
     addMessageListener("debug:disconnect", onDisconnect);
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -94,17 +94,16 @@
 #include "mozilla/net/CookieServiceParent.h"
 #include "mozilla/net/PCookieServiceParent.h"
 #include "mozilla/plugins/PluginBridge.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/ProcessHangMonitor.h"
 #include "mozilla/ProcessHangMonitorIPC.h"
 #include "mozilla/RDDProcessManager.h"
 #include "mozilla/recordreplay/ParentIPC.h"
-#include "mozilla/Scheduler.h"
 #include "mozilla/ScopeExit.h"
 #include "mozilla/ScriptPreloader.h"
 #include "mozilla/Services.h"
 #include "mozilla/StaticPtr.h"
 #include "mozilla/StaticPrefs.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/TelemetryIPC.h"
 #include "mozilla/WebBrowserPersistDocumentParent.h"
@@ -2182,22 +2181,16 @@ void ContentParent::LaunchSubprocessInte
 #endif
 
   // Pass the lengths via command line flags.
   extraArgs.push_back("-prefsLen");
   extraArgs.push_back(formatPtrArg(prefSerializer.GetPrefLength()).get());
   extraArgs.push_back("-prefMapSize");
   extraArgs.push_back(formatPtrArg(prefSerializer.GetPrefMapSize()).get());
 
-  // Scheduler prefs need to be handled differently because the scheduler needs
-  // to start up in the content process before the normal preferences service.
-  nsPrintfCString schedulerPrefs = Scheduler::GetPrefs();
-  extraArgs.push_back("-schedulerPrefs");
-  extraArgs.push_back(schedulerPrefs.get());
-
   if (gSafeMode) {
     extraArgs.push_back("-safeMode");
   }
 
 #if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX)
   // If we're launching a middleman process for a
   // recording or replay, start the sandbox later.
   if (sEarlySandboxInit && IsContentSandboxEnabled() &&
--- a/dom/ipc/ContentProcess.cpp
+++ b/dom/ipc/ContentProcess.cpp
@@ -4,17 +4,16 @@
  * 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/. */
 
 #include "mozilla/ipc/IOThreadChild.h"
 
 #include "ContentProcess.h"
 #include "base/shared_memory.h"
 #include "mozilla/Preferences.h"
-#include "mozilla/Scheduler.h"
 #include "mozilla/recordreplay/ParentIPC.h"
 
 #if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX)
 #  include <stdlib.h>
 #  include "mozilla/Sandbox.h"
 #endif
 
 #if (defined(XP_WIN) || defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX)
@@ -76,17 +75,16 @@ static void SetUpSandboxEnvironment() {
 
   SetTmpEnvironmentVariable(sandboxedContentTemp);
 }
 #endif
 
 bool ContentProcess::Init(int aArgc, char* aArgv[]) {
   Maybe<uint64_t> childID;
   Maybe<bool> isForBrowser;
-  Maybe<const char*> schedulerPrefs;
   Maybe<const char*> parentBuildID;
   char* prefsHandle = nullptr;
   char* prefMapHandle = nullptr;
   char* prefsLen = nullptr;
   char* prefMapSize = nullptr;
 #if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX)
   nsCOMPtr<nsIFile> profileDir;
 #endif
@@ -137,22 +135,16 @@ bool ContentProcess::Init(int aArgc, cha
         return false;
       }
       prefsLen = aArgv[i];
     } else if (strcmp(aArgv[i], "-prefMapSize") == 0) {
       if (++i == aArgc) {
         return false;
       }
       prefMapSize = aArgv[i];
-    } else if (strcmp(aArgv[i], "-schedulerPrefs") == 0) {
-      if (++i == aArgc) {
-        return false;
-      }
-      schedulerPrefs = Some(aArgv[i]);
-
     } else if (strcmp(aArgv[i], "-safeMode") == 0) {
       gSafeMode = true;
 
     } else if (strcmp(aArgv[i], "-parentBuildID") == 0) {
       if (++i == aArgc) {
         return false;
       }
       parentBuildID = Some(aArgv[i]);
@@ -169,28 +161,26 @@ bool ContentProcess::Init(int aArgc, cha
         profileDir = nullptr;
       }
 #endif /* XP_MACOSX && MOZ_CONTENT_SANDBOX */
     }
   }
 
   // Did we find all the mandatory flags?
   if (childID.isNothing() || isForBrowser.isNothing() ||
-      schedulerPrefs.isNothing() || parentBuildID.isNothing()) {
+      parentBuildID.isNothing()) {
     return false;
   }
 
   SharedPreferenceDeserializer deserializer;
   if (!deserializer.DeserializeFromSharedMemory(prefsHandle, prefMapHandle,
                                                 prefsLen, prefMapSize)) {
     return false;
   }
 
-  Scheduler::SetPrefs(*schedulerPrefs);
-
   if (recordreplay::IsMiddleman()) {
     recordreplay::parent::InitializeMiddleman(aArgc, aArgv, ParentPid(),
                                               deserializer.GetPrefsHandle(),
                                               deserializer.GetPrefMapHandle());
   }
 
   mContent.Init(IOThreadChild::message_loop(), ParentPid(), *parentBuildID,
                 IOThreadChild::channel(), *childID, *isForBrowser);
--- a/dom/media/webspeech/synth/cocoa/OSXSpeechSynthesizerService.mm
+++ b/dom/media/webspeech/synth/cocoa/OSXSpeechSynthesizerService.mm
@@ -22,249 +22,213 @@
 // We can escape the default delimiters ("[[" and "]]") by temporarily
 // changing the delimiters just before they appear, and changing them back
 // just after.
 #define DLIM_ESCAPE_START "[[dlim (( ))]]"
 #define DLIM_ESCAPE_END "((dlim [[ ]]))"
 
 using namespace mozilla;
 
-class SpeechTaskCallback final : public nsISpeechTaskCallback
-{
-public:
-  SpeechTaskCallback(nsISpeechTask* aTask,
-                     NSSpeechSynthesizer* aSynth,
+class SpeechTaskCallback final : public nsISpeechTaskCallback {
+ public:
+  SpeechTaskCallback(nsISpeechTask* aTask, NSSpeechSynthesizer* aSynth,
                      const nsTArray<size_t>& aOffsets);
 
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(SpeechTaskCallback, nsISpeechTaskCallback)
 
   NS_DECL_NSISPEECHTASKCALLBACK
 
   void OnWillSpeakWord(uint32_t aIndex, uint32_t aLength);
   void OnError(uint32_t aIndex);
   void OnDidFinishSpeaking();
 
-private:
+ private:
   virtual ~SpeechTaskCallback();
 
   float GetTimeDurationFromStart();
 
   nsCOMPtr<nsISpeechTask> mTask;
   NSSpeechSynthesizer* mSpeechSynthesizer;
   SpeechDelegate* mDelegate;
   TimeStamp mStartingTime;
   uint32_t mCurrentIndex;
   nsTArray<size_t> mOffsets;
 };
 
-@interface SpeechDelegate : NSObject<NSSpeechSynthesizerDelegate>
-{
-@private
+@interface SpeechDelegate : NSObject <NSSpeechSynthesizerDelegate> {
+ @private
   SpeechTaskCallback* mCallback;
 }
 
-  - (id)initWithCallback:(SpeechTaskCallback*)aCallback;
+- (id)initWithCallback:(SpeechTaskCallback*)aCallback;
 @end
 
 @implementation SpeechDelegate
-- (id)initWithCallback:(SpeechTaskCallback*)aCallback
-{
+- (id)initWithCallback:(SpeechTaskCallback*)aCallback {
   [super init];
   mCallback = aCallback;
   return self;
 }
 
-- (void)speechSynthesizer:(NSSpeechSynthesizer *)aSender
-            willSpeakWord:(NSRange)aRange ofString:(NSString*)aString
-{
+- (void)speechSynthesizer:(NSSpeechSynthesizer*)aSender
+            willSpeakWord:(NSRange)aRange
+                 ofString:(NSString*)aString {
   mCallback->OnWillSpeakWord(aRange.location, aRange.length);
 }
 
-- (void)speechSynthesizer:(NSSpeechSynthesizer *)aSender
-        didFinishSpeaking:(BOOL)aFinishedSpeaking
-{
+- (void)speechSynthesizer:(NSSpeechSynthesizer*)aSender didFinishSpeaking:(BOOL)aFinishedSpeaking {
   mCallback->OnDidFinishSpeaking();
 }
 
 - (void)speechSynthesizer:(NSSpeechSynthesizer*)aSender
- didEncounterErrorAtIndex:(NSUInteger)aCharacterIndex
-                 ofString:(NSString*)aString
-                  message:(NSString*)aMessage
-{
+    didEncounterErrorAtIndex:(NSUInteger)aCharacterIndex
+                    ofString:(NSString*)aString
+                     message:(NSString*)aMessage {
   mCallback->OnError(aCharacterIndex);
 }
 @end
 
 NS_IMPL_CYCLE_COLLECTION(SpeechTaskCallback, mTask);
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(SpeechTaskCallback)
   NS_INTERFACE_MAP_ENTRY(nsISpeechTaskCallback)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISpeechTaskCallback)
 NS_INTERFACE_MAP_END
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(SpeechTaskCallback)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(SpeechTaskCallback)
 
-SpeechTaskCallback::SpeechTaskCallback(nsISpeechTask* aTask,
-                                       NSSpeechSynthesizer* aSynth,
+SpeechTaskCallback::SpeechTaskCallback(nsISpeechTask* aTask, NSSpeechSynthesizer* aSynth,
                                        const nsTArray<size_t>& aOffsets)
-  : mTask(aTask)
-  , mSpeechSynthesizer(aSynth)
-  , mCurrentIndex(0)
-  , mOffsets(aOffsets)
-{
+    : mTask(aTask), mSpeechSynthesizer(aSynth), mCurrentIndex(0), mOffsets(aOffsets) {
   mDelegate = [[SpeechDelegate alloc] initWithCallback:this];
   [mSpeechSynthesizer setDelegate:mDelegate];
   mStartingTime = TimeStamp::Now();
 }
 
-SpeechTaskCallback::~SpeechTaskCallback()
-{
+SpeechTaskCallback::~SpeechTaskCallback() {
   [mSpeechSynthesizer setDelegate:nil];
   [mDelegate release];
   [mSpeechSynthesizer release];
 }
 
 NS_IMETHODIMP
-SpeechTaskCallback::OnCancel()
-{
+SpeechTaskCallback::OnCancel() {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
   [mSpeechSynthesizer stopSpeaking];
   return NS_OK;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
 NS_IMETHODIMP
-SpeechTaskCallback::OnPause()
-{
+SpeechTaskCallback::OnPause() {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
   [mSpeechSynthesizer pauseSpeakingAtBoundary:NSSpeechImmediateBoundary];
   if (!mTask) {
     // When calling pause() on child porcess, it may not receive end event
     // from chrome process yet.
     return NS_ERROR_FAILURE;
   }
   mTask->DispatchPause(GetTimeDurationFromStart(), mCurrentIndex);
   return NS_OK;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
 NS_IMETHODIMP
-SpeechTaskCallback::OnResume()
-{
+SpeechTaskCallback::OnResume() {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
   [mSpeechSynthesizer continueSpeaking];
   if (!mTask) {
     // When calling resume() on child porcess, it may not receive end event
     // from chrome process yet.
     return NS_ERROR_FAILURE;
   }
   mTask->DispatchResume(GetTimeDurationFromStart(), mCurrentIndex);
   return NS_OK;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
 NS_IMETHODIMP
-SpeechTaskCallback::OnVolumeChanged(float aVolume)
-{
+SpeechTaskCallback::OnVolumeChanged(float aVolume) {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
   [mSpeechSynthesizer setObject:[NSNumber numberWithFloat:aVolume]
-                    forProperty:NSSpeechVolumeProperty error:nil];
+                    forProperty:NSSpeechVolumeProperty
+                          error:nil];
   return NS_OK;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
-float
-SpeechTaskCallback::GetTimeDurationFromStart()
-{
+float SpeechTaskCallback::GetTimeDurationFromStart() {
   TimeDuration duration = TimeStamp::Now() - mStartingTime;
   return duration.ToMilliseconds();
 }
 
-void
-SpeechTaskCallback::OnWillSpeakWord(uint32_t aIndex, uint32_t aLength)
-{
+void SpeechTaskCallback::OnWillSpeakWord(uint32_t aIndex, uint32_t aLength) {
   mCurrentIndex = aIndex < mOffsets.Length() ? mOffsets[aIndex] : mCurrentIndex;
   if (!mTask) {
     return;
   }
-  mTask->DispatchBoundary(NS_LITERAL_STRING("word"),
-                          GetTimeDurationFromStart(),
-                          mCurrentIndex, aLength, 1);
+  mTask->DispatchBoundary(NS_LITERAL_STRING("word"), GetTimeDurationFromStart(), mCurrentIndex,
+                          aLength, 1);
 }
 
-void
-SpeechTaskCallback::OnError(uint32_t aIndex)
-{
+void SpeechTaskCallback::OnError(uint32_t aIndex) {
   if (!mTask) {
     return;
   }
   mTask->DispatchError(GetTimeDurationFromStart(), aIndex);
 }
 
-void
-SpeechTaskCallback::OnDidFinishSpeaking()
-{
+void SpeechTaskCallback::OnDidFinishSpeaking() {
   mTask->DispatchEnd(GetTimeDurationFromStart(), mCurrentIndex);
   // no longer needed
   [mSpeechSynthesizer setDelegate:nil];
   mTask = nullptr;
 }
 
 namespace mozilla {
 namespace dom {
 
-struct OSXVoice
-{
-  OSXVoice() : mIsDefault(false)
-  {
-  }
+struct OSXVoice {
+  OSXVoice() : mIsDefault(false) {}
 
   nsString mUri;
   nsString mName;
   nsString mLocale;
   bool mIsDefault;
 };
 
-class RegisterVoicesRunnable final : public Runnable
-{
-public:
-  RegisterVoicesRunnable(OSXSpeechSynthesizerService* aSpeechService,
-                         nsTArray<OSXVoice>& aList)
-    : Runnable("RegisterVoicesRunnable")
-    , mSpeechService(aSpeechService)
-    , mVoices(aList)
-  {
-  }
+class RegisterVoicesRunnable final : public Runnable {
+ public:
+  RegisterVoicesRunnable(OSXSpeechSynthesizerService* aSpeechService, nsTArray<OSXVoice>& aList)
+      : Runnable("RegisterVoicesRunnable"), mSpeechService(aSpeechService), mVoices(aList) {}
 
   NS_IMETHOD Run() override;
 
-private:
+ private:
   ~RegisterVoicesRunnable() override = default;
 
   // This runnable always use sync mode.  It is unnecesarry to reference object
   OSXSpeechSynthesizerService* mSpeechService;
   nsTArray<OSXVoice>& mVoices;
 };
 
 NS_IMETHODIMP
-RegisterVoicesRunnable::Run()
-{
+RegisterVoicesRunnable::Run() {
   nsresult rv;
-  nsCOMPtr<nsISynthVoiceRegistry> registry =
-    do_GetService(NS_SYNTHVOICEREGISTRY_CONTRACTID, &rv);
+  nsCOMPtr<nsISynthVoiceRegistry> registry = do_GetService(NS_SYNTHVOICEREGISTRY_CONTRACTID, &rv);
   if (!registry) {
     return rv;
   }
 
   for (OSXVoice voice : mVoices) {
     rv = registry->AddVoice(mSpeechService, voice.mUri, voice.mName, voice.mLocale, true, false);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       continue;
@@ -275,56 +239,49 @@ RegisterVoicesRunnable::Run()
     }
   }
 
   registry->NotifyVoicesChanged();
 
   return NS_OK;
 }
 
-class EnumVoicesRunnable final : public Runnable
-{
-public:
+class EnumVoicesRunnable final : public Runnable {
+ public:
   explicit EnumVoicesRunnable(OSXSpeechSynthesizerService* aSpeechService)
-    : Runnable("EnumVoicesRunnable")
-    , mSpeechService(aSpeechService)
-  {
-  }
+      : Runnable("EnumVoicesRunnable"), mSpeechService(aSpeechService) {}
 
   NS_IMETHOD Run() override;
 
-private:
+ private:
   ~EnumVoicesRunnable() override = default;
 
   RefPtr<OSXSpeechSynthesizerService> mSpeechService;
 };
 
 NS_IMETHODIMP
-EnumVoicesRunnable::Run()
-{
+EnumVoicesRunnable::Run() {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
   AutoTArray<OSXVoice, 64> list;
 
   NSArray* voices = [NSSpeechSynthesizer availableVoices];
   NSString* defaultVoice = [NSSpeechSynthesizer defaultVoice];
 
   for (NSString* voice in voices) {
     OSXVoice item;
 
     NSDictionary* attr = [NSSpeechSynthesizer attributesForVoice:voice];
 
     nsAutoString identifier;
-    nsCocoaUtils::GetStringForNSString([attr objectForKey:NSVoiceIdentifier],
-                                       identifier);
+    nsCocoaUtils::GetStringForNSString([attr objectForKey:NSVoiceIdentifier], identifier);
 
     nsCocoaUtils::GetStringForNSString([attr objectForKey:NSVoiceName], item.mName);
 
-    nsCocoaUtils::GetStringForNSString(
-      [attr objectForKey:NSVoiceLocaleIdentifier], item.mLocale);
+    nsCocoaUtils::GetStringForNSString([attr objectForKey:NSVoiceLocaleIdentifier], item.mLocale);
     item.mLocale.ReplaceChar('_', '-');
 
     item.mUri.AssignLiteral("urn:moz-tts:osx:");
     item.mUri.Append(identifier);
 
     if ([voice isEqualToString:defaultVoice]) {
       item.mIsDefault = true;
     }
@@ -346,90 +303,76 @@ NS_INTERFACE_MAP_BEGIN(OSXSpeechSynthesi
   NS_INTERFACE_MAP_ENTRY(nsISpeechService)
   NS_INTERFACE_MAP_ENTRY(nsIObserver)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISpeechService)
 NS_INTERFACE_MAP_END
 
 NS_IMPL_ADDREF(OSXSpeechSynthesizerService)
 NS_IMPL_RELEASE(OSXSpeechSynthesizerService)
 
-OSXSpeechSynthesizerService::OSXSpeechSynthesizerService()
-  : mInitialized(false)
-{
-}
+OSXSpeechSynthesizerService::OSXSpeechSynthesizerService() : mInitialized(false) {}
 
-
-bool
-OSXSpeechSynthesizerService::Init()
-{
+bool OSXSpeechSynthesizerService::Init() {
   if (Preferences::GetBool("media.webspeech.synth.test") ||
       !Preferences::GetBool("media.webspeech.synth.enabled")) {
     // When test is enabled, we shouldn't add OS backend (Bug 1160844)
     return false;
   }
 
   nsCOMPtr<nsIThread> thread;
   if (NS_FAILED(NS_NewNamedThread("SpeechWorker", getter_AddRefs(thread)))) {
-  	return false;
+    return false;
   }
 
   // Get all the voices and register in the SynthVoiceRegistry
   nsCOMPtr<nsIRunnable> runnable = new EnumVoicesRunnable(this);
   thread->Dispatch(runnable, NS_DISPATCH_NORMAL);
 
   mInitialized = true;
   return true;
 }
 
 NS_IMETHODIMP
-OSXSpeechSynthesizerService::Speak(const nsAString& aText,
-                                   const nsAString& aUri,
-                                   float aVolume,
-                                   float aRate,
-                                   float aPitch,
-                                   nsISpeechTask* aTask)
-{
+OSXSpeechSynthesizerService::Speak(const nsAString& aText, const nsAString& aUri, float aVolume,
+                                   float aRate, float aPitch, nsISpeechTask* aTask) {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
   MOZ_ASSERT(StringBeginsWith(aUri, NS_LITERAL_STRING("urn:moz-tts:osx:")),
              "OSXSpeechSynthesizerService doesn't allow this voice URI");
 
   NSSpeechSynthesizer* synth = [[NSSpeechSynthesizer alloc] init];
   // strlen("urn:moz-tts:osx:") == 16
   NSString* identifier = nsCocoaUtils::ToNSString(Substring(aUri, 16));
   [synth setVoice:identifier];
 
   // default rate is 180-220
-  [synth setObject:[NSNumber numberWithInt:aRate * 200]
-         forProperty:NSSpeechRateProperty error:nil];
+  [synth setObject:[NSNumber numberWithInt:aRate * 200] forProperty:NSSpeechRateProperty error:nil];
   // volume allows 0.0-1.0
-  [synth setObject:[NSNumber numberWithFloat:aVolume]
-         forProperty:NSSpeechVolumeProperty error:nil];
+  [synth setObject:[NSNumber numberWithFloat:aVolume] forProperty:NSSpeechVolumeProperty error:nil];
   // Use default pitch value to calculate this
-  NSNumber* defaultPitch =
-    [synth objectForProperty:NSSpeechPitchBaseProperty error:nil];
+  NSNumber* defaultPitch = [synth objectForProperty:NSSpeechPitchBaseProperty error:nil];
   if (defaultPitch) {
     int newPitch = [defaultPitch intValue] * (aPitch / 2 + 0.5);
     [synth setObject:[NSNumber numberWithInt:newPitch]
-           forProperty:NSSpeechPitchBaseProperty error:nil];
+         forProperty:NSSpeechPitchBaseProperty
+               error:nil];
   }
 
   nsAutoString escapedText;
   // We need to map the the offsets from the given text to the escaped text.
   // The index of the offsets array is the position in the escaped text,
   // the element value is the position in the user-supplied text.
   nsTArray<size_t> offsets;
   offsets.SetCapacity(aText.Length());
 
   // This loop looks for occurances of "[[" or "]]", escapes them, and
   // populates the offsets array to supply a map to the original offsets.
   for (size_t i = 0; i < aText.Length(); i++) {
     if (aText.Length() > i + 1 &&
-        ((aText[i] == ']' && aText[i+1] == ']') ||
-         (aText[i] == '[' && aText[i+1] == '['))) {
+        ((aText[i] == ']' && aText[i + 1] == ']') || (aText[i] == '[' && aText[i + 1] == '['))) {
       escapedText.AppendLiteral(DLIM_ESCAPE_START);
       offsets.AppendElements(strlen(DLIM_ESCAPE_START));
       escapedText.Append(aText[i]);
       offsets.AppendElement(i);
       escapedText.Append(aText[++i]);
       offsets.AppendElement(i);
       escapedText.AppendLiteral(DLIM_ESCAPE_END);
       offsets.AppendElements(strlen(DLIM_ESCAPE_END));
@@ -450,49 +393,41 @@ OSXSpeechSynthesizerService::Speak(const
   aTask->DispatchStart();
   return NS_OK;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
 NS_IMETHODIMP
 OSXSpeechSynthesizerService::Observe(nsISupports* aSubject, const char* aTopic,
-                                     const char16_t* aData)
-{
+                                     const char16_t* aData) {
   return NS_OK;
 }
 
-OSXSpeechSynthesizerService*
-OSXSpeechSynthesizerService::GetInstance()
-{
+OSXSpeechSynthesizerService* OSXSpeechSynthesizerService::GetInstance() {
   MOZ_ASSERT(NS_IsMainThread());
   if (XRE_GetProcessType() != GeckoProcessType_Default) {
     return nullptr;
   }
 
   if (!sSingleton) {
-    RefPtr<OSXSpeechSynthesizerService> speechService =
-      new OSXSpeechSynthesizerService();
+    RefPtr<OSXSpeechSynthesizerService> speechService = new OSXSpeechSynthesizerService();
     if (speechService->Init()) {
       sSingleton = speechService;
     }
   }
   return sSingleton;
 }
 
-already_AddRefed<OSXSpeechSynthesizerService>
-OSXSpeechSynthesizerService::GetInstanceForService()
-{
+already_AddRefed<OSXSpeechSynthesizerService> OSXSpeechSynthesizerService::GetInstanceForService() {
   RefPtr<OSXSpeechSynthesizerService> speechService = GetInstance();
   return speechService.forget();
 }
 
-void
-OSXSpeechSynthesizerService::Shutdown()
-{
+void OSXSpeechSynthesizerService::Shutdown() {
   if (!sSingleton) {
     return;
   }
   sSingleton = nullptr;
 }
 
-} // namespace dom
-} // namespace mozilla
+}  // namespace dom
+}  // namespace mozilla
--- a/dom/plugins/ipc/PluginInterposeOSX.mm
+++ b/dom/plugins/ipc/PluginInterposeOSX.mm
@@ -42,29 +42,23 @@ using namespace mozilla::plugins;
 
 namespace mac_plugin_interposing {
 
 int32_t NSCursorInfo::mNativeCursorsSupported = -1;
 
 // This constructor may be called from the browser process or the plugin
 // process.
 NSCursorInfo::NSCursorInfo()
-  : mType(TypeArrow)
-  , mHotSpot(nsPoint(0, 0))
-  , mCustomImageData(NULL)
-  , mCustomImageDataLength(0)
-{
-}
+    : mType(TypeArrow),
+      mHotSpot(nsPoint(0, 0)),
+      mCustomImageData(NULL),
+      mCustomImageDataLength(0) {}
 
 NSCursorInfo::NSCursorInfo(NSCursor* aCursor)
-  : mType(TypeArrow)
-  , mHotSpot(nsPoint(0, 0))
-  , mCustomImageData(NULL)
-  , mCustomImageDataLength(0)
-{
+    : mType(TypeArrow), mHotSpot(nsPoint(0, 0)), mCustomImageData(NULL), mCustomImageDataLength(0) {
   // This constructor is only ever called from the plugin process, so the
   // following is safe.
   if (!GetNativeCursorsSupported()) {
     return;
   }
 
   NSPoint hotSpotCocoa = [aCursor hotSpot];
   mHotSpot = nsPoint(hotSpotCocoa.x, hotSpotCocoa.y);
@@ -91,28 +85,29 @@ NSCursorInfo::NSCursorInfo(NSCursor* aCu
   } else if ([aCursor isEqual:[NSCursor resizeLeftRightCursor]]) {
     mType = TypeResizeLeftRight;
   } else if ([aCursor isEqual:[NSCursor resizeRightCursor]]) {
     mType = TypeResizeRight;
   } else if ([aCursor isEqual:[NSCursor resizeUpCursor]]) {
     mType = TypeResizeUp;
   } else if ([aCursor isEqual:[NSCursor resizeUpDownCursor]]) {
     mType = TypeResizeUpDown;
-  // The following cursor types are only supported on OS X 10.6 and up.
+    // The following cursor types are only supported on OS X 10.6 and up.
   } else if ([nsCursorClass respondsToSelector:@selector(contextualMenuCursor)] &&
              [aCursor isEqual:[nsCursorClass performSelector:@selector(contextualMenuCursor)]]) {
     mType = TypeContextualMenu;
   } else if ([nsCursorClass respondsToSelector:@selector(dragCopyCursor)] &&
              [aCursor isEqual:[nsCursorClass performSelector:@selector(dragCopyCursor)]]) {
     mType = TypeDragCopy;
   } else if ([nsCursorClass respondsToSelector:@selector(dragLinkCursor)] &&
              [aCursor isEqual:[nsCursorClass performSelector:@selector(dragLinkCursor)]]) {
     mType = TypeDragLink;
   } else if ([nsCursorClass respondsToSelector:@selector(operationNotAllowedCursor)] &&
-             [aCursor isEqual:[nsCursorClass performSelector:@selector(operationNotAllowedCursor)]]) {
+             [aCursor
+                 isEqual:[nsCursorClass performSelector:@selector(operationNotAllowedCursor)]]) {
     mType = TypeNotAllowed;
   } else {
     NSImage* image = [aCursor image];
     NSArray* reps = image ? [image representations] : nil;
     NSUInteger repsCount = reps ? [reps count] : 0;
     if (!repsCount) {
       // If we have a custom cursor with no image representations, assume we
       // need a transparent cursor.
@@ -127,25 +122,23 @@ NSCursorInfo::NSCursorInfo(NSCursor* aCu
         if ([rep isKindOfClass:[NSBitmapImageRep class]]) {
           cgImage = [(NSBitmapImageRep*)rep CGImage];
           break;
         }
       }
       if (cgImage) {
         CFMutableDataRef data = ::CFDataCreateMutable(kCFAllocatorDefault, 0);
         if (data) {
-          CGImageDestinationRef dest = ::CGImageDestinationCreateWithData(data,
-                                                                          kUTTypePNG,
-                                                                          1,
-                                                                          NULL);
+          CGImageDestinationRef dest =
+              ::CGImageDestinationCreateWithData(data, kUTTypePNG, 1, NULL);
           if (dest) {
             ::CGImageDestinationAddImage(dest, cgImage, NULL);
             if (::CGImageDestinationFinalize(dest)) {
-              uint32_t dataLength = (uint32_t) ::CFDataGetLength(data);
-              mCustomImageData = (uint8_t*) moz_xmalloc(dataLength);
+              uint32_t dataLength = (uint32_t)::CFDataGetLength(data);
+              mCustomImageData = (uint8_t*)moz_xmalloc(dataLength);
               ::CFDataGetBytes(data, ::CFRangeMake(0, dataLength), mCustomImageData);
               mCustomImageDataLength = dataLength;
               mType = TypeCustom;
             }
             ::CFRelease(dest);
           }
           ::CFRelease(data);
         }
@@ -153,58 +146,54 @@ NSCursorInfo::NSCursorInfo(NSCursor* aCu
       if (!mCustomImageData) {
         mType = TypeArrow;
       }
     }
   }
 }
 
 NSCursorInfo::NSCursorInfo(const Cursor* aCursor)
-  : mType(TypeArrow)
-  , mHotSpot(nsPoint(0, 0))
-  , mCustomImageData(NULL)
-  , mCustomImageDataLength(0)
-{
+    : mType(TypeArrow), mHotSpot(nsPoint(0, 0)), mCustomImageData(NULL), mCustomImageDataLength(0) {
   // This constructor is only ever called from the plugin process, so the
   // following is safe.
   if (!GetNativeCursorsSupported()) {
     return;
   }
 
   mHotSpot = nsPoint(aCursor->hotSpot.h, aCursor->hotSpot.v);
 
   int width = 16, height = 16;
   int bytesPerPixel = 4;
   int rowBytes = width * bytesPerPixel;
   int bitmapSize = height * rowBytes;
 
   bool isTransparent = true;
 
-  uint8_t* bitmap = (uint8_t*) moz_xmalloc(bitmapSize);
+  uint8_t* bitmap = (uint8_t*)moz_xmalloc(bitmapSize);
   // The way we create 'bitmap' is largely "borrowed" from Chrome's
   // WebCursor::InitFromCursor().
   for (int y = 0; y < height; ++y) {
     unsigned short data = aCursor->data[y];
     unsigned short mask = aCursor->mask[y];
     // Change 'data' and 'mask' from big-endian to little-endian, but output
     // big-endian data below.
     data = ((data << 8) & 0xFF00) | ((data >> 8) & 0x00FF);
     mask = ((mask << 8) & 0xFF00) | ((mask >> 8) & 0x00FF);
     // It'd be nice to use a gray-scale bitmap.  But
     // CGBitmapContextCreateImage() (used below) won't work with one that also
     // has alpha values.
     for (int x = 0; x < width; ++x) {
       int offset = (y * rowBytes) + (x * bytesPerPixel);
       // Color value
       if (data & 0x8000) {
-        bitmap[offset]     = 0x0;
+        bitmap[offset] = 0x0;
         bitmap[offset + 1] = 0x0;
         bitmap[offset + 2] = 0x0;
       } else {
-        bitmap[offset]     = 0xFF;
+        bitmap[offset] = 0xFF;
         bitmap[offset + 1] = 0xFF;
         bitmap[offset + 2] = 0xFF;
       }
       // Mask value
       if (mask & 0x8000) {
         bitmap[offset + 3] = 0xFF;
         isTransparent = false;
       } else {
@@ -218,42 +207,31 @@ NSCursorInfo::NSCursorInfo(const Cursor*
   if (isTransparent) {
     // If aCursor is transparent, we don't need to serialize custom cursor
     // data over IPC.
     mType = TypeTransparent;
   } else {
     CGColorSpaceRef color = ::CGColorSpaceCreateDeviceRGB();
     if (color) {
       CGContextRef context =
-        ::CGBitmapContextCreate(bitmap,
-                                width,
-                                height,
-                                8,
-                                rowBytes,
-                                color,
-                                kCGImageAlphaPremultipliedLast |
-                                  kCGBitmapByteOrder32Big);
+          ::CGBitmapContextCreate(bitmap, width, height, 8, rowBytes, color,
+                                  kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big);
       if (context) {
         CGImageRef image = ::CGBitmapContextCreateImage(context);
         if (image) {
           ::CFMutableDataRef data = ::CFDataCreateMutable(kCFAllocatorDefault, 0);
           if (data) {
             CGImageDestinationRef dest =
-              ::CGImageDestinationCreateWithData(data,
-                                                 kUTTypePNG,
-                                                 1,
-                                                 NULL);
+                ::CGImageDestinationCreateWithData(data, kUTTypePNG, 1, NULL);
             if (dest) {
               ::CGImageDestinationAddImage(dest, image, NULL);
               if (::CGImageDestinationFinalize(dest)) {
-                uint32_t dataLength = (uint32_t) ::CFDataGetLength(data);
-                mCustomImageData = (uint8_t*) moz_xmalloc(dataLength);
-                ::CFDataGetBytes(data,
-                                 ::CFRangeMake(0, dataLength),
-                                 mCustomImageData);
+                uint32_t dataLength = (uint32_t)::CFDataGetLength(data);
+                mCustomImageData = (uint8_t*)moz_xmalloc(dataLength);
+                ::CFDataGetBytes(data, ::CFRangeMake(0, dataLength), mCustomImageData);
                 mCustomImageDataLength = dataLength;
                 mType = TypeCustom;
               }
               ::CFRelease(dest);
             }
             ::CFRelease(data);
           }
           ::CGImageRelease(image);
@@ -262,29 +240,27 @@ NSCursorInfo::NSCursorInfo(const Cursor*
       }
       ::CGColorSpaceRelease(color);
     }
   }
 
   free(bitmap);
 }
 
-NSCursorInfo::~NSCursorInfo()
-{
+NSCursorInfo::~NSCursorInfo() {
   if (mCustomImageData) {
     free(mCustomImageData);
   }
 }
 
-NSCursor* NSCursorInfo::GetNSCursor() const
-{
+NSCursor* NSCursorInfo::GetNSCursor() const {
   NSCursor* retval = nil;
 
   Class nsCursorClass = [NSCursor class];
-  switch(mType) {
+  switch (mType) {
     case TypeArrow:
       retval = [NSCursor arrowCursor];
       break;
     case TypeClosedHand:
       retval = [NSCursor closedHandCursor];
       break;
     case TypeCrosshair:
       retval = [NSCursor crosshairCursor];
@@ -347,34 +323,30 @@ NSCursor* NSCursorInfo::GetNSCursor() co
     case TypeTransparent:
       retval = GetTransparentCursor();
       break;
     default:
       break;
   }
 
   if (!retval && mCustomImageData && mCustomImageDataLength) {
-    CGDataProviderRef provider = ::CGDataProviderCreateWithData(NULL,
-                                                                (const void*)mCustomImageData,
-                                                                mCustomImageDataLength,
-                                                                NULL);
+    CGDataProviderRef provider = ::CGDataProviderCreateWithData(NULL, (const void*)mCustomImageData,
+                                                                mCustomImageDataLength, NULL);
     if (provider) {
-      CGImageRef cgImage = ::CGImageCreateWithPNGDataProvider(provider,
-                                                              NULL,
-                                                              false,
-                                                              kCGRenderingIntentDefault);
+      CGImageRef cgImage =
+          ::CGImageCreateWithPNGDataProvider(provider, NULL, false, kCGRenderingIntentDefault);
       if (cgImage) {
         NSBitmapImageRep* rep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage];
         if (rep) {
           NSImage* image = [[NSImage alloc] init];
           if (image) {
             [image addRepresentation:rep];
-            retval = [[[NSCursor alloc] initWithImage:image 
-                                              hotSpot:NSMakePoint(mHotSpot.x, mHotSpot.y)]
-                      autorelease];
+            retval =
+                [[[NSCursor alloc] initWithImage:image
+                                         hotSpot:NSMakePoint(mHotSpot.x, mHotSpot.y)] autorelease];
             [image release];
           }
           [rep release];
         }
         ::CGImageRelease(cgImage);
       }
       ::CFRelease(provider);
     }
@@ -385,81 +357,71 @@ NSCursor* NSCursorInfo::GetNSCursor() co
     retval = [NSCursor arrowCursor];
   }
 
   return retval;
 }
 
 // Get a transparent cursor with the appropriate hot spot.  We need one if
 // (for example) we have a custom cursor with no image data.
-NSCursor* NSCursorInfo::GetTransparentCursor() const
-{
+NSCursor* NSCursorInfo::GetTransparentCursor() const {
   NSCursor* retval = nil;
 
   int width = 16, height = 16;
   int bytesPerPixel = 2;
   int rowBytes = width * bytesPerPixel;
   int dataSize = height * rowBytes;
 
-  uint8_t* data = (uint8_t*) moz_xmalloc(dataSize);
+  uint8_t* data = (uint8_t*)moz_xmalloc(dataSize);
   for (int y = 0; y < height; ++y) {
     for (int x = 0; x < width; ++x) {
       int offset = (y * rowBytes) + (x * bytesPerPixel);
-      data[offset] = 0x7E;  // Arbitrary gray-scale value
-      data[offset + 1] = 0; // Alpha value to make us transparent
+      data[offset] = 0x7E;   // Arbitrary gray-scale value
+      data[offset + 1] = 0;  // Alpha value to make us transparent
     }
   }
 
   NSBitmapImageRep* imageRep =
-    [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:nil
-                                             pixelsWide:width
-                                             pixelsHigh:height
-                                          bitsPerSample:8
-                                        samplesPerPixel:2
-                                               hasAlpha:YES
-                                               isPlanar:NO
-                                         colorSpaceName:NSCalibratedWhiteColorSpace
-                                            bytesPerRow:rowBytes
-                                           bitsPerPixel:16]
-     autorelease];
+      [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:nil
+                                               pixelsWide:width
+                                               pixelsHigh:height
+                                            bitsPerSample:8
+                                          samplesPerPixel:2
+                                                 hasAlpha:YES
+                                                 isPlanar:NO
+                                           colorSpaceName:NSCalibratedWhiteColorSpace
+                                              bytesPerRow:rowBytes
+                                             bitsPerPixel:16] autorelease];
   if (imageRep) {
     uint8_t* repDataPtr = [imageRep bitmapData];
     if (repDataPtr) {
       memcpy(repDataPtr, data, dataSize);
-      NSImage *image =
-        [[[NSImage alloc] initWithSize:NSMakeSize(width, height)]
-         autorelease];
+      NSImage* image = [[[NSImage alloc] initWithSize:NSMakeSize(width, height)] autorelease];
       if (image) {
         [image addRepresentation:imageRep];
-        retval =
-          [[[NSCursor alloc] initWithImage:image
-                                   hotSpot:NSMakePoint(mHotSpot.x, mHotSpot.y)]
-           autorelease];
+        retval = [[[NSCursor alloc] initWithImage:image
+                                          hotSpot:NSMakePoint(mHotSpot.x, mHotSpot.y)] autorelease];
       }
     }
   }
 
   free(data);
 
   // Fall back to an arrow cursor if (for some reason) the above code failed.
   if (!retval) {
     retval = [NSCursor arrowCursor];
   }
 
   return retval;
 }
 
-NSCursorInfo::Type NSCursorInfo::GetType() const
-{
-  return mType;
-}
+NSCursorInfo::Type NSCursorInfo::GetType() const { return mType; }
 
-const char* NSCursorInfo::GetTypeName() const
-{
-  switch(mType) {
+const char* NSCursorInfo::GetTypeName() const {
+  switch (mType) {
     case TypeCustom:
       return "TypeCustom";
     case TypeArrow:
       return "TypeArrow";
     case TypeClosedHand:
       return "TypeClosedHand";
     case TypeContextualMenu:
       return "TypeContextualMenu";
@@ -494,99 +456,78 @@ const char* NSCursorInfo::GetTypeName() 
     case TypeTransparent:
       return "TypeTransparent";
     default:
       break;
   }
   return "TypeUnknown";
 }
 
-nsPoint NSCursorInfo::GetHotSpot() const
-{
-  return mHotSpot;
-}
+nsPoint NSCursorInfo::GetHotSpot() const { return mHotSpot; }
 
-uint8_t* NSCursorInfo::GetCustomImageData() const
-{
-  return mCustomImageData;
-}
+uint8_t* NSCursorInfo::GetCustomImageData() const { return mCustomImageData; }
+
+uint32_t NSCursorInfo::GetCustomImageDataLength() const { return mCustomImageDataLength; }
 
-uint32_t NSCursorInfo::GetCustomImageDataLength() const
-{
-  return mCustomImageDataLength;
-}
+void NSCursorInfo::SetType(Type aType) { mType = aType; }
 
-void NSCursorInfo::SetType(Type aType)
-{
-  mType = aType;
-}
+void NSCursorInfo::SetHotSpot(nsPoint aHotSpot) { mHotSpot = aHotSpot; }
 
-void NSCursorInfo::SetHotSpot(nsPoint aHotSpot)
-{
-  mHotSpot = aHotSpot;
-}
-
-void NSCursorInfo::SetCustomImageData(uint8_t* aData, uint32_t aDataLength)
-{
+void NSCursorInfo::SetCustomImageData(uint8_t* aData, uint32_t aDataLength) {
   if (mCustomImageData) {
     free(mCustomImageData);
   }
   if (aDataLength) {
-    mCustomImageData = (uint8_t*) moz_xmalloc(aDataLength);
+    mCustomImageData = (uint8_t*)moz_xmalloc(aDataLength);
     memcpy(mCustomImageData, aData, aDataLength);
   } else {
     mCustomImageData = NULL;
   }
   mCustomImageDataLength = aDataLength;
 }
 
 // This should never be called from the browser process -- only from the
 // plugin process.
-bool NSCursorInfo::GetNativeCursorsSupported()
-{
+bool NSCursorInfo::GetNativeCursorsSupported() {
   if (mNativeCursorsSupported == -1) {
     ENSURE_PLUGIN_THREAD(false);
-    PluginModuleChild *pmc = PluginModuleChild::GetChrome();
+    PluginModuleChild* pmc = PluginModuleChild::GetChrome();
     if (pmc) {
       bool result = pmc->GetNativeCursorsSupported();
       if (result) {
         mNativeCursorsSupported = 1;
       } else {
         mNativeCursorsSupported = 0;
       }
     }
   }
   return (mNativeCursorsSupported == 1);
 }
 
-} // namespace mac_plugin_interposing
+}  // namespace mac_plugin_interposing
 
 namespace mac_plugin_interposing {
 namespace parent {
 
 // Tracks plugin windows currently visible.
 std::set<uint32_t> plugin_visible_windows_set_;
 // Tracks full screen windows currently visible.
 std::set<uint32_t> plugin_fullscreen_windows_set_;
 // Tracks modal windows currently visible.
 std::set<uint32_t> plugin_modal_windows_set_;
 
-void OnPluginShowWindow(uint32_t window_id,
-                        CGRect window_bounds,
-                        bool modal) {
+void OnPluginShowWindow(uint32_t window_id, CGRect window_bounds, bool modal) {
   plugin_visible_windows_set_.insert(window_id);
 
-  if (modal)
-    plugin_modal_windows_set_.insert(window_id);
+  if (modal) plugin_modal_windows_set_.insert(window_id);
 
   CGRect main_display_bounds = ::CGDisplayBounds(CGMainDisplayID());
 
   if (CGRectEqualToRect(window_bounds, main_display_bounds) &&
-      (plugin_fullscreen_windows_set_.find(window_id) ==
-       plugin_fullscreen_windows_set_.end())) {
+      (plugin_fullscreen_windows_set_.find(window_id) == plugin_fullscreen_windows_set_.end())) {
     plugin_fullscreen_windows_set_.insert(window_id);
 
     nsCocoaUtils::HideOSChromeOnScreen(true);
   }
 }
 
 static void ActivateProcess(pid_t pid) {
   ProcessSerialNumber process;
@@ -612,220 +553,196 @@ static void ReleasePluginFullScreen(pid_
   if (plugin_pid != -1) {
     ActivateProcess(plugin_pid);
   }
 }
 
 void OnPluginHideWindow(uint32_t window_id, pid_t aPluginPid) {
   bool had_windows = !plugin_visible_windows_set_.empty();
   plugin_visible_windows_set_.erase(window_id);
-  bool browser_needs_activation = had_windows &&
-      plugin_visible_windows_set_.empty();
+  bool browser_needs_activation = had_windows && plugin_visible_windows_set_.empty();
 
   plugin_modal_windows_set_.erase(window_id);
-  if (plugin_fullscreen_windows_set_.find(window_id) !=
-      plugin_fullscreen_windows_set_.end()) {
+  if (plugin_fullscreen_windows_set_.find(window_id) != plugin_fullscreen_windows_set_.end()) {
     plugin_fullscreen_windows_set_.erase(window_id);
     pid_t plugin_pid = browser_needs_activation ? -1 : aPluginPid;
     browser_needs_activation = false;
     ReleasePluginFullScreen(plugin_pid);
   }
 
   if (browser_needs_activation) {
     ActivateProcess(getpid());
   }
 }
 
-void OnSetCursor(const NSCursorInfo& cursorInfo)
-{
+void OnSetCursor(const NSCursorInfo& cursorInfo) {
   NSCursor* aCursor = cursorInfo.GetNSCursor();
   if (aCursor) {
     [aCursor set];
   }
 }
 
-void OnShowCursor(bool show)
-{
+void OnShowCursor(bool show) {
   if (show) {
     [NSCursor unhide];
   } else {
     [NSCursor hide];
   }
 }
 
-void OnPushCursor(const NSCursorInfo& cursorInfo)
-{
+void OnPushCursor(const NSCursorInfo& cursorInfo) {
   NSCursor* aCursor = cursorInfo.GetNSCursor();
   if (aCursor) {
     [aCursor push];
   }
 }
 
-void OnPopCursor()
-{
-  [NSCursor pop];
-}
+void OnPopCursor() { [NSCursor pop]; }
 
-} // namespace parent
-} // namespace mac_plugin_interposing
+}  // namespace parent
+}  // namespace mac_plugin_interposing
 
 namespace mac_plugin_interposing {
 namespace child {
 
 // TODO(stuartmorgan): Make this an IPC to order the plugin process above the
 // browser process only if the browser is current frontmost.
 void FocusPluginProcess() {
   ProcessSerialNumber this_process, front_process;
-  if ((GetCurrentProcess(&this_process) != noErr) ||
-      (GetFrontProcess(&front_process) != noErr)) {
+  if ((GetCurrentProcess(&this_process) != noErr) || (GetFrontProcess(&front_process) != noErr)) {
     return;
   }
 
   Boolean matched = false;
-  if ((SameProcess(&this_process, &front_process, &matched) == noErr) &&
-      !matched) {
+  if ((SameProcess(&this_process, &front_process, &matched) == noErr) && !matched) {
     SetFrontProcess(&this_process);
   }
 }
 
-void NotifyBrowserOfPluginShowWindow(uint32_t window_id, CGRect bounds,
-                                     bool modal) {
+void NotifyBrowserOfPluginShowWindow(uint32_t window_id, CGRect bounds, bool modal) {
   ENSURE_PLUGIN_THREAD_VOID();
 
-  PluginModuleChild *pmc = PluginModuleChild::GetChrome();
-  if (pmc)
-    pmc->PluginShowWindow(window_id, modal, bounds);
+  PluginModuleChild* pmc = PluginModuleChild::GetChrome();
+  if (pmc) pmc->PluginShowWindow(window_id, modal, bounds);
 }
 
 void NotifyBrowserOfPluginHideWindow(uint32_t window_id, CGRect bounds) {
   ENSURE_PLUGIN_THREAD_VOID();
 
-  PluginModuleChild *pmc = PluginModuleChild::GetChrome();
-  if (pmc)
-    pmc->PluginHideWindow(window_id);
+  PluginModuleChild* pmc = PluginModuleChild::GetChrome();
+  if (pmc) pmc->PluginHideWindow(window_id);
 }
 
-void NotifyBrowserOfSetCursor(NSCursorInfo& aCursorInfo)
-{
+void NotifyBrowserOfSetCursor(NSCursorInfo& aCursorInfo) {
   ENSURE_PLUGIN_THREAD_VOID();
-  PluginModuleChild *pmc = PluginModuleChild::GetChrome();
+  PluginModuleChild* pmc = PluginModuleChild::GetChrome();
   if (pmc) {
     pmc->SetCursor(aCursorInfo);
   }
 }
 
-void NotifyBrowserOfShowCursor(bool show)
-{
+void NotifyBrowserOfShowCursor(bool show) {
   ENSURE_PLUGIN_THREAD_VOID();
-  PluginModuleChild *pmc = PluginModuleChild::GetChrome();
+  PluginModuleChild* pmc = PluginModuleChild::GetChrome();
   if (pmc) {
     pmc->ShowCursor(show);
   }
 }
 
-void NotifyBrowserOfPushCursor(NSCursorInfo& aCursorInfo)
-{
+void NotifyBrowserOfPushCursor(NSCursorInfo& aCursorInfo) {
   ENSURE_PLUGIN_THREAD_VOID();
-  PluginModuleChild *pmc = PluginModuleChild::GetChrome();
+  PluginModuleChild* pmc = PluginModuleChild::GetChrome();
   if (pmc) {
     pmc->PushCursor(aCursorInfo);
   }
 }
 
-void NotifyBrowserOfPopCursor()
-{
+void NotifyBrowserOfPopCursor() {
   ENSURE_PLUGIN_THREAD_VOID();
-  PluginModuleChild *pmc = PluginModuleChild::GetChrome();
+  PluginModuleChild* pmc = PluginModuleChild::GetChrome();
   if (pmc) {
     pmc->PopCursor();
   }
 }
 
 struct WindowInfo {
   uint32_t window_id;
   CGRect bounds;
   explicit WindowInfo(NSWindow* aWindow) {
     NSInteger window_num = [aWindow windowNumber];
     window_id = window_num > 0 ? window_num : 0;
     bounds = NSRectToCGRect([aWindow frame]);
   }
 };
 
 static void OnPluginWindowClosed(const WindowInfo& window_info) {
-  if (window_info.window_id == 0)
-    return;
+  if (window_info.window_id == 0) return;
   mac_plugin_interposing::child::NotifyBrowserOfPluginHideWindow(window_info.window_id,
                                                                  window_info.bounds);
 }
 
 static void OnPluginWindowShown(const WindowInfo& window_info, BOOL is_modal) {
   // The window id is 0 if it has never been shown (including while it is the
   // process of being shown for the first time); when that happens, we'll catch
   // it in _setWindowNumber instead.
   static BOOL s_pending_display_is_modal = NO;
   if (window_info.window_id == 0) {
-    if (is_modal)
-      s_pending_display_is_modal = YES;
+    if (is_modal) s_pending_display_is_modal = YES;
     return;
   }
   if (s_pending_display_is_modal) {
     is_modal = YES;
     s_pending_display_is_modal = NO;
   }
-  mac_plugin_interposing::child::NotifyBrowserOfPluginShowWindow(
-    window_info.window_id, window_info.bounds, is_modal);
+  mac_plugin_interposing::child::NotifyBrowserOfPluginShowWindow(window_info.window_id,
+                                                                 window_info.bounds, is_modal);
 }
 
-static BOOL OnSetCursor(NSCursorInfo &aInfo)
-{
+static BOOL OnSetCursor(NSCursorInfo& aInfo) {
   if (NSCursorInfo::GetNativeCursorsSupported()) {
     NotifyBrowserOfSetCursor(aInfo);
     return YES;
   }
   return NO;
 }
 
-static BOOL OnHideCursor()
-{
+static BOOL OnHideCursor() {
   if (NSCursorInfo::GetNativeCursorsSupported()) {
     NotifyBrowserOfShowCursor(NO);
     return YES;
   }
   return NO;
 }
 
-static BOOL OnUnhideCursor()
-{
+static BOOL OnUnhideCursor() {
   if (NSCursorInfo::GetNativeCursorsSupported()) {
     NotifyBrowserOfShowCursor(YES);
     return YES;
   }
   return NO;
 }
 
-static BOOL OnPushCursor(NSCursorInfo &aInfo)
-{
+static BOOL OnPushCursor(NSCursorInfo& aInfo) {
   if (NSCursorInfo::GetNativeCursorsSupported()) {
     NotifyBrowserOfPushCursor(aInfo);
     return YES;
   }
   return NO;
 }
 
-static BOOL OnPopCursor()
-{
+static BOOL OnPopCursor() {
   if (NSCursorInfo::GetNativeCursorsSupported()) {
     NotifyBrowserOfPopCursor();
     return YES;
   }
   return NO;
 }
 
-} // namespace child
-} // namespace mac_plugin_interposing
+}  // namespace child
+}  // namespace mac_plugin_interposing
 
 using namespace mac_plugin_interposing::child;
 
 @interface NSWindow (PluginInterposing)
 - (void)pluginInterpose_orderOut:(id)sender;
 - (void)pluginInterpose_orderFront:(id)sender;
 - (void)pluginInterpose_makeKeyAndOrderFront:(id)sender;
 - (void)pluginInterpose_setWindowNumber:(NSInteger)num;
@@ -847,21 +764,19 @@ using namespace mac_plugin_interposing::
 
 - (void)pluginInterpose_makeKeyAndOrderFront:(id)sender {
   mac_plugin_interposing::child::FocusPluginProcess();
   [self pluginInterpose_makeKeyAndOrderFront:sender];
   OnPluginWindowShown(WindowInfo(self), NO);
 }
 
 - (void)pluginInterpose_setWindowNumber:(NSInteger)num {
-  if (num > 0)
-    mac_plugin_interposing::child::FocusPluginProcess();
+  if (num > 0) mac_plugin_interposing::child::FocusPluginProcess();
   [self pluginInterpose_setWindowNumber:num];
-  if (num > 0)
-    OnPluginWindowShown(WindowInfo(self), NO);
+  if (num > 0) OnPluginWindowShown(WindowInfo(self), NO);
 }
 
 @end
 
 @interface NSApplication (PluginInterposing)
 - (NSInteger)pluginInterpose_runModalForWindow:(NSWindow*)window;
 @end
 
@@ -890,198 +805,169 @@ using namespace mac_plugin_interposing::
 + (void)pluginInterpose_unhide;
 + (void)pluginInterpose_pop;
 @end
 
 // Cache the results of [NSCursor set], [NSCursor push] and [NSCursor pop].
 // The last element is always the current cursor.
 static NSMutableArray* gCursorStack = nil;
 
-static BOOL initCursorStack()
-{
+static BOOL initCursorStack() {
   if (!gCursorStack) {
     gCursorStack = [[NSMutableArray arrayWithCapacity:5] retain];
   }
   return (gCursorStack != NULL);
 }
 
-static NSCursor* currentCursorFromCache()
-{
-  if (!initCursorStack())
-    return nil;
-  return (NSCursor*) [gCursorStack lastObject];
+static NSCursor* currentCursorFromCache() {
+  if (!initCursorStack()) return nil;
+  return (NSCursor*)[gCursorStack lastObject];
 }
 
-static void setCursorInCache(NSCursor* aCursor)
-{
-  if (!initCursorStack() || !aCursor)
-    return;
+static void setCursorInCache(NSCursor* aCursor) {
+  if (!initCursorStack() || !aCursor) return;
   NSUInteger count = [gCursorStack count];
   if (count) {
     [gCursorStack replaceObjectAtIndex:count - 1 withObject:aCursor];
   } else {
     [gCursorStack addObject:aCursor];
   }
 }
 
-static void pushCursorInCache(NSCursor* aCursor)
-{
-  if (!initCursorStack() || !aCursor)
-    return;
+static void pushCursorInCache(NSCursor* aCursor) {
+  if (!initCursorStack() || !aCursor) return;
   [gCursorStack addObject:aCursor];
 }
 
-static void popCursorInCache()
-{
-  if (!initCursorStack())
-    return;
+static void popCursorInCache() {
+  if (!initCursorStack()) return;
   // Apple's doc on the +[NSCursor pop] method says:  "If the current cursor
   // is the only cursor on the stack, this method does nothing."
   if ([gCursorStack count] > 1) {
     [gCursorStack removeLastObject];
   }
 }
 
 @implementation NSCursor (PluginInterposing)
 
-- (void)pluginInterpose_set
-{
+- (void)pluginInterpose_set {
   NSCursorInfo info(self);
   OnSetCursor(info);
   setCursorInCache(self);
   [self pluginInterpose_set];
 }
 
-- (void)pluginInterpose_push
-{
+- (void)pluginInterpose_push {
   NSCursorInfo info(self);
   OnPushCursor(info);
   pushCursorInCache(self);
   [self pluginInterpose_push];
 }
 
-- (void)pluginInterpose_pop
-{
+- (void)pluginInterpose_pop {
   OnPopCursor();
   popCursorInCache();
   [self pluginInterpose_pop];
 }
 
 // The currentCursor method always returns nil when running in a background
 // process.  But this may confuse plugins (notably Flash, see bug 621117).  So
 // if we get a nil return from the "call to super", we return a cursor that's
 // been cached by previous calls to set or push.  According to Apple's docs,
 // currentCursor "only returns the cursor set by your application using
 // NSCursor methods".  So we don't need to worry about changes to the cursor
 // made by other methods like SetThemeCursor().
-+ (NSCursor*)pluginInterpose_currentCursor
-{
++ (NSCursor*)pluginInterpose_currentCursor {
   NSCursor* retval = [self pluginInterpose_currentCursor];
   if (!retval) {
     retval = currentCursorFromCache();
   }
   return retval;
 }
 
-+ (void)pluginInterpose_hide
-{
++ (void)pluginInterpose_hide {
   OnHideCursor();
   [self pluginInterpose_hide];
 }
 
-+ (void)pluginInterpose_unhide
-{
++ (void)pluginInterpose_unhide {
   OnUnhideCursor();
   [self pluginInterpose_unhide];
 }
 
-+ (void)pluginInterpose_pop
-{
++ (void)pluginInterpose_pop {
   OnPopCursor();
   popCursorInCache();
   [self pluginInterpose_pop];
 }
 
 @end
 
-static void ExchangeMethods(Class target_class,
-                            BOOL class_method,
-                            SEL original,
-                            SEL replacement) {
+static void ExchangeMethods(Class target_class, BOOL class_method, SEL original, SEL replacement) {
   Method m1;
   Method m2;
   if (class_method) {
     m1 = class_getClassMethod(target_class, original);
     m2 = class_getClassMethod(target_class, replacement);
   } else {
     m1 = class_getInstanceMethod(target_class, original);
     m2 = class_getInstanceMethod(target_class, replacement);
   }
 
-  if (m1 == m2)
-    return;
+  if (m1 == m2) return;
 
   if (m1 && m2)
     method_exchangeImplementations(m1, m2);
   else
     MOZ_ASSERT_UNREACHABLE("Cocoa swizzling failed");
 }
 
 namespace mac_plugin_interposing {
 namespace child {
 
 void SetUpCocoaInterposing() {
   Class nswindow_class = [NSWindow class];
-  ExchangeMethods(nswindow_class, NO, @selector(orderOut:),
-                  @selector(pluginInterpose_orderOut:));
+  ExchangeMethods(nswindow_class, NO, @selector(orderOut:), @selector(pluginInterpose_orderOut:));
   ExchangeMethods(nswindow_class, NO, @selector(orderFront:),
                   @selector(pluginInterpose_orderFront:));
   ExchangeMethods(nswindow_class, NO, @selector(makeKeyAndOrderFront:),
                   @selector(pluginInterpose_makeKeyAndOrderFront:));
   ExchangeMethods(nswindow_class, NO, @selector(_setWindowNumber:),
                   @selector(pluginInterpose_setWindowNumber:));
 
   ExchangeMethods([NSApplication class], NO, @selector(runModalForWindow:),
                   @selector(pluginInterpose_runModalForWindow:));
 
   Class nscursor_class = [NSCursor class];
-  ExchangeMethods(nscursor_class, NO, @selector(set),
-                  @selector(pluginInterpose_set));
-  ExchangeMethods(nscursor_class, NO, @selector(push),
-                  @selector(pluginInterpose_push));
-  ExchangeMethods(nscursor_class, NO, @selector(pop),
-                  @selector(pluginInterpose_pop));
+  ExchangeMethods(nscursor_class, NO, @selector(set), @selector(pluginInterpose_set));
+  ExchangeMethods(nscursor_class, NO, @selector(push), @selector(pluginInterpose_push));
+  ExchangeMethods(nscursor_class, NO, @selector(pop), @selector(pluginInterpose_pop));
   ExchangeMethods(nscursor_class, YES, @selector(currentCursor),
                   @selector(pluginInterpose_currentCursor));
-  ExchangeMethods(nscursor_class, YES, @selector(hide),
-                  @selector(pluginInterpose_hide));
-  ExchangeMethods(nscursor_class, YES, @selector(unhide),
-                  @selector(pluginInterpose_unhide));
-  ExchangeMethods(nscursor_class, YES, @selector(pop),
-                  @selector(pluginInterpose_pop));
+  ExchangeMethods(nscursor_class, YES, @selector(hide), @selector(pluginInterpose_hide));
+  ExchangeMethods(nscursor_class, YES, @selector(unhide), @selector(pluginInterpose_unhide));
+  ExchangeMethods(nscursor_class, YES, @selector(pop), @selector(pluginInterpose_pop));
 }
 
 }  // namespace child
 }  // namespace mac_plugin_interposing
 
 // Called from plugin_child_interpose.mm, which hooks calls to
 // SetCursor() (the QuickDraw call) from the plugin child process.
 extern "C" NS_VISIBILITY_DEFAULT BOOL
-mac_plugin_interposing_child_OnSetCursor(const Cursor* cursor)
-{
+mac_plugin_interposing_child_OnSetCursor(const Cursor* cursor) {
   NSCursorInfo info(cursor);
   return OnSetCursor(info);
 }
 
 // Called from plugin_child_interpose.mm, which hooks calls to
 // SetThemeCursor() (the Appearance Manager call) from the plugin child
 // process.
 extern "C" NS_VISIBILITY_DEFAULT BOOL
-mac_plugin_interposing_child_OnSetThemeCursor(ThemeCursor cursor)
-{
+mac_plugin_interposing_child_OnSetThemeCursor(ThemeCursor cursor) {
   NSCursorInfo info;
   switch (cursor) {
     case kThemeArrowCursor:
       info.SetType(NSCursorInfo::TypeArrow);
       break;
     case kThemeCopyArrowCursor:
       info.SetType(NSCursorInfo::TypeDragCopy);
       break;
@@ -1140,19 +1026,15 @@ mac_plugin_interposing_child_OnSetThemeC
       break;
     default:
       info.SetType(NSCursorInfo::TypeArrow);
       break;
   }
   return OnSetCursor(info);
 }
 
-extern "C" NS_VISIBILITY_DEFAULT BOOL
-mac_plugin_interposing_child_OnHideCursor()
-{
+extern "C" NS_VISIBILITY_DEFAULT BOOL mac_plugin_interposing_child_OnHideCursor() {
   return OnHideCursor();
 }
 
-extern "C" NS_VISIBILITY_DEFAULT BOOL
-mac_plugin_interposing_child_OnShowCursor()
-{
+extern "C" NS_VISIBILITY_DEFAULT BOOL mac_plugin_interposing_child_OnShowCursor() {
   return OnUnhideCursor();
 }
--- a/dom/plugins/ipc/PluginUtilsOSX.mm
+++ b/dom/plugins/ipc/PluginUtilsOSX.mm
@@ -21,291 +21,264 @@
 - (double)contentsScale;
 - (void)setContentsScale:(double)scale;
 @end
 
 using namespace mozilla::plugins::PluginUtilsOSX;
 
 @interface CGBridgeLayer : CALayer {
   DrawPluginFunc mDrawFunc;
-  void* mPluginInstance;
+  void *mPluginInstance;
   nsIntRect mUpdateRect;
 }
-- (void)setDrawFunc:(DrawPluginFunc)aFunc
-     pluginInstance:(void*)aPluginInstance;
+- (void)setDrawFunc:(DrawPluginFunc)aFunc pluginInstance:(void *)aPluginInstance;
 - (void)updateRect:(nsIntRect)aRect;
 
 @end
 
 // CGBitmapContextSetData() is an undocumented function present (with
 // the same signature) since at least OS X 10.5.  As the name suggests,
 // it's used to replace the "data" in a bitmap context that was
 // originally specified in a call to CGBitmapContextCreate() or
 // CGBitmapContextCreateWithData().
-typedef void (*CGBitmapContextSetDataFunc) (CGContextRef c,
-                                            size_t x,
-                                            size_t y,
-                                            size_t width,
-                                            size_t height,
-                                            void* data,
-                                            size_t bitsPerComponent,
-                                            size_t bitsPerPixel,
-                                            size_t bytesPerRow);
+typedef void (*CGBitmapContextSetDataFunc)(CGContextRef c, size_t x, size_t y, size_t width,
+                                           size_t height, void *data, size_t bitsPerComponent,
+                                           size_t bitsPerPixel, size_t bytesPerRow);
 CGBitmapContextSetDataFunc CGBitmapContextSetDataPtr = NULL;
 
 @implementation CGBridgeLayer
-- (void) updateRect:(nsIntRect)aRect
-{
-   mUpdateRect.UnionRect(mUpdateRect, aRect);
+- (void)updateRect:(nsIntRect)aRect {
+  mUpdateRect.UnionRect(mUpdateRect, aRect);
 }
 
-- (void) setDrawFunc:(DrawPluginFunc)aFunc
-      pluginInstance:(void*)aPluginInstance
-{
+- (void)setDrawFunc:(DrawPluginFunc)aFunc pluginInstance:(void *)aPluginInstance {
   mDrawFunc = aFunc;
   mPluginInstance = aPluginInstance;
 }
 
-- (void)drawInContext:(CGContextRef)aCGContext
-{
-  ::CGContextSaveGState(aCGContext); 
+- (void)drawInContext:(CGContextRef)aCGContext {
+  ::CGContextSaveGState(aCGContext);
   ::CGContextTranslateCTM(aCGContext, 0, self.bounds.size.height);
-  ::CGContextScaleCTM(aCGContext, (CGFloat) 1, (CGFloat) -1);
+  ::CGContextScaleCTM(aCGContext, (CGFloat)1, (CGFloat)-1);
 
   mUpdateRect = nsIntRect::Truncate(0, 0, self.bounds.size.width, self.bounds.size.height);
 
   mDrawFunc(aCGContext, mPluginInstance, mUpdateRect);
 
   ::CGContextRestoreGState(aCGContext);
 
   mUpdateRect.SetEmpty();
 }
 
 @end
 
-void* mozilla::plugins::PluginUtilsOSX::GetCGLayer(DrawPluginFunc aFunc, 
-                                                   void* aPluginInstance, 
+void *mozilla::plugins::PluginUtilsOSX::GetCGLayer(DrawPluginFunc aFunc, void *aPluginInstance,
                                                    double aContentsScaleFactor) {
   CGBridgeLayer *bridgeLayer = [[CGBridgeLayer alloc] init];
 
   // We need to make bridgeLayer behave properly when its superlayer changes
   // size (in nsCARenderer::SetBounds()).
   bridgeLayer.autoresizingMask = kCALayerWidthSizable | kCALayerHeightSizable;
   bridgeLayer.needsDisplayOnBoundsChange = YES;
   NSNull *nullValue = [NSNull null];
-  NSDictionary *actions = [NSDictionary dictionaryWithObjectsAndKeys:
-                             nullValue, @"bounds",
-                             nullValue, @"contents",
-                             nullValue, @"contentsRect",
-                             nullValue, @"position",
-                             nil];
+  NSDictionary *actions = [NSDictionary
+      dictionaryWithObjectsAndKeys:nullValue, @"bounds", nullValue, @"contents", nullValue,
+                                   @"contentsRect", nullValue, @"position", nil];
   [bridgeLayer setStyle:[NSDictionary dictionaryWithObject:actions forKey:@"actions"]];
 
   // For reasons that aren't clear (perhaps one or more OS bugs), we can only
   // use full HiDPI resolution here if the tree is built with the 10.7 SDK or
   // up.  If we build with the 10.6 SDK, changing the contentsScale property
   // of bridgeLayer (even to the same value) causes it to stop working (go
   // blank).  This doesn't happen with objects that are members of the CALayer
   // class (as opposed to one of its subclasses).
-#if defined(MAC_OS_X_VERSION_10_7) && \
-    MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+#if defined(MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
   if ([bridgeLayer respondsToSelector:@selector(setContentsScale:)]) {
     bridgeLayer.contentsScale = aContentsScaleFactor;
   }
 #endif
 
-  [bridgeLayer setDrawFunc:aFunc
-            pluginInstance:aPluginInstance];
+  [bridgeLayer setDrawFunc:aFunc pluginInstance:aPluginInstance];
   return bridgeLayer;
 }
 
 void mozilla::plugins::PluginUtilsOSX::ReleaseCGLayer(void *cgLayer) {
-  CGBridgeLayer *bridgeLayer = (CGBridgeLayer*)cgLayer;
+  CGBridgeLayer *bridgeLayer = (CGBridgeLayer *)cgLayer;
   [bridgeLayer release];
 }
 
 void mozilla::plugins::PluginUtilsOSX::Repaint(void *caLayer, nsIntRect aRect) {
-  CGBridgeLayer *bridgeLayer = (CGBridgeLayer*)caLayer;
+  CGBridgeLayer *bridgeLayer = (CGBridgeLayer *)caLayer;
   [CATransaction begin];
   [bridgeLayer updateRect:aRect];
   [bridgeLayer setNeedsDisplay];
   [bridgeLayer displayIfNeeded];
   [CATransaction commit];
 }
 
 @interface EventProcessor : NSObject {
-  RemoteProcessEvents   aRemoteEvents;
-  void                 *aPluginModule;
+  RemoteProcessEvents aRemoteEvents;
+  void *aPluginModule;
 }
-- (void)setRemoteEvents:(RemoteProcessEvents) remoteEvents pluginModule:(void*) pluginModule;
+- (void)setRemoteEvents:(RemoteProcessEvents)remoteEvents pluginModule:(void *)pluginModule;
 - (void)onTick;
 @end
 
 @implementation EventProcessor
-- (void) onTick
-{
-    aRemoteEvents(aPluginModule);
+- (void)onTick {
+  aRemoteEvents(aPluginModule);
 }
 
-- (void)setRemoteEvents:(RemoteProcessEvents) remoteEvents pluginModule:(void*) pluginModule
-{
-    aRemoteEvents = remoteEvents;
-    aPluginModule = pluginModule;
+- (void)setRemoteEvents:(RemoteProcessEvents)remoteEvents pluginModule:(void *)pluginModule {
+  aRemoteEvents = remoteEvents;
+  aPluginModule = pluginModule;
 }
 @end
 
-#define EVENT_PROCESS_DELAY 0.05 // 50 ms
+#define EVENT_PROCESS_DELAY 0.05  // 50 ms
 
-NPError mozilla::plugins::PluginUtilsOSX::ShowCocoaContextMenu(void* aMenu, int aX, int aY, void* pluginModule, RemoteProcessEvents remoteEvent) 
-{
+NPError mozilla::plugins::PluginUtilsOSX::ShowCocoaContextMenu(void *aMenu, int aX, int aY,
+                                                               void *pluginModule,
+                                                               RemoteProcessEvents remoteEvent) {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   // Set the native cursor to the OS default (an arrow) before displaying the
   // context menu.  Otherwise (if the plugin has changed the cursor) it may
   // stay as the plugin has set it -- which means it may be invisible.  We
   // need to do this because we display the context menu without making the
   // plugin process the foreground process.  If we did, the cursor would
   // change to an arrow cursor automatically -- as it does in Chrome.
   [[NSCursor arrowCursor] set];
 
-  EventProcessor* eventProcessor = nullptr;
+  EventProcessor *eventProcessor = nullptr;
   NSTimer *eventTimer = nullptr;
   if (pluginModule) {
     // Create a timer to process browser events while waiting
     // on the menu. This prevents the browser from hanging
     // during the lifetime of the menu.
     eventProcessor = [[EventProcessor alloc] init];
     [eventProcessor setRemoteEvents:remoteEvent pluginModule:pluginModule];
     eventTimer = [NSTimer timerWithTimeInterval:EVENT_PROCESS_DELAY
-                                   target:eventProcessor selector:@selector(onTick)
-                                   userInfo:nil repeats:TRUE];
+                                         target:eventProcessor
+                                       selector:@selector(onTick)
+                                       userInfo:nil
+                                        repeats:TRUE];
     // Use NSEventTrackingRunLoopMode otherwise the timer will
     // not fire during the right click menu.
-    [[NSRunLoop currentRunLoop] addTimer:eventTimer
-                                 forMode:NSEventTrackingRunLoopMode];
+    [[NSRunLoop currentRunLoop] addTimer:eventTimer forMode:NSEventTrackingRunLoopMode];
   }
 
-  NSMenu* nsmenu = reinterpret_cast<NSMenu*>(aMenu);
+  NSMenu *nsmenu = reinterpret_cast<NSMenu *>(aMenu);
   NSPoint screen_point = ::NSMakePoint(aX, aY);
 
   [nsmenu popUpMenuPositioningItem:nil atLocation:screen_point inView:nil];
 
   if (pluginModule) {
     [eventTimer invalidate];
     [eventProcessor release];
   }
 
   return NPERR_NO_ERROR;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(NPERR_GENERIC_ERROR);
 }
 
-void mozilla::plugins::PluginUtilsOSX::InvokeNativeEventLoop()
-{
+void mozilla::plugins::PluginUtilsOSX::InvokeNativeEventLoop() {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
   ::CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.0, true);
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
-
 #define UNDOCUMENTED_SESSION_CONSTANT ((int)-2)
 namespace mozilla {
 namespace plugins {
 namespace PluginUtilsOSX {
-  static void *sApplicationASN = NULL;
-  static void *sApplicationInfoItem = NULL;
-} // namespace PluginUtilsOSX
-} // namespace plugins
-} // namespace mozilla
+static void *sApplicationASN = NULL;
+static void *sApplicationInfoItem = NULL;
+}  // namespace PluginUtilsOSX
+}  // namespace plugins
+}  // namespace mozilla
 
-bool mozilla::plugins::PluginUtilsOSX::SetProcessName(const char* aProcessName) {
+bool mozilla::plugins::PluginUtilsOSX::SetProcessName(const char *aProcessName) {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
   nsAutoreleasePool localPool;
 
   if (!aProcessName || strcmp(aProcessName, "") == 0) {
     return false;
   }
 
-  NSString *currentName = [[[NSBundle mainBundle] localizedInfoDictionary]
-                              objectForKey:(NSString *)kCFBundleNameKey];
+  NSString *currentName =
+      [[[NSBundle mainBundle] localizedInfoDictionary] objectForKey:(NSString *)kCFBundleNameKey];
 
   char formattedName[1024];
   SprintfLiteral(formattedName, "%s %s", [currentName UTF8String], aProcessName);
 
   aProcessName = formattedName;
 
   // This function is based on Chrome/Webkit's and relies on potentially dangerous SPI.
   typedef CFTypeRef (*LSGetASNType)();
-  typedef OSStatus (*LSSetInformationItemType)(int, CFTypeRef,
-                                               CFStringRef, 
-                                               CFStringRef,
-                                               CFDictionaryRef*);
+  typedef OSStatus (*LSSetInformationItemType)(int, CFTypeRef, CFStringRef, CFStringRef,
+                                               CFDictionaryRef *);
 
-  CFBundleRef launchServices = ::CFBundleGetBundleWithIdentifier(
-                                          CFSTR("com.apple.LaunchServices"));
+  CFBundleRef launchServices = ::CFBundleGetBundleWithIdentifier(CFSTR("com.apple.LaunchServices"));
   if (!launchServices) {
     NS_WARNING("Failed to set process name: Could not open LaunchServices bundle");
     return false;
   }
 
   if (!sApplicationASN) {
-    sApplicationASN = ::CFBundleGetFunctionPointerForName(launchServices, 
-                                            CFSTR("_LSGetCurrentApplicationASN"));
+    sApplicationASN =
+        ::CFBundleGetFunctionPointerForName(launchServices, CFSTR("_LSGetCurrentApplicationASN"));
     if (!sApplicationASN) {
       NS_WARNING("Failed to set process name: Could not get function pointer "
                  "for LaunchServices");
       return false;
     }
   }
 
-  LSGetASNType getASNFunc = reinterpret_cast<LSGetASNType>
-                                          (sApplicationASN);
+  LSGetASNType getASNFunc = reinterpret_cast<LSGetASNType>(sApplicationASN);
 
   if (!sApplicationInfoItem) {
-    sApplicationInfoItem = ::CFBundleGetFunctionPointerForName(launchServices, 
-                                            CFSTR("_LSSetApplicationInformationItem"));
+    sApplicationInfoItem = ::CFBundleGetFunctionPointerForName(
+        launchServices, CFSTR("_LSSetApplicationInformationItem"));
   }
 
-  LSSetInformationItemType setInformationItemFunc 
-                                          = reinterpret_cast<LSSetInformationItemType>
-                                          (sApplicationInfoItem);
+  LSSetInformationItemType setInformationItemFunc =
+      reinterpret_cast<LSSetInformationItemType>(sApplicationInfoItem);
 
-  void * displayNameKeyAddr = ::CFBundleGetDataPointerForName(launchServices,
-                                          CFSTR("_kLSDisplayNameKey"));
+  void *displayNameKeyAddr =
+      ::CFBundleGetDataPointerForName(launchServices, CFSTR("_kLSDisplayNameKey"));
 
   CFStringRef displayNameKey = nil;
   if (displayNameKeyAddr) {
-    displayNameKey = reinterpret_cast<CFStringRef>(*(CFStringRef*)displayNameKeyAddr);
+    displayNameKey = reinterpret_cast<CFStringRef>(*(CFStringRef *)displayNameKeyAddr);
   }
 
   // Rename will fail without this
   ProcessSerialNumber psn;
   if (::GetCurrentProcess(&psn) != noErr) {
     return false;
   }
 
   CFTypeRef currentAsn = getASNFunc ? getASNFunc() : nullptr;
 
-  if (!getASNFunc || !setInformationItemFunc || 
-      !displayNameKey || !currentAsn) {
+  if (!getASNFunc || !setInformationItemFunc || !displayNameKey || !currentAsn) {
     NS_WARNING("Failed to set process name: Accessing launchServices failed");
     return false;
   }
 
-  CFStringRef processName = ::CFStringCreateWithCString(nil, 
-                                                        aProcessName, 
-                                                        kCFStringEncodingASCII);
+  CFStringRef processName = ::CFStringCreateWithCString(nil, aProcessName, kCFStringEncodingASCII);
   if (!processName) {
     NS_WARNING("Failed to set process name: Could not create CFStringRef");
     return false;
   }
 
-  OSErr err = setInformationItemFunc(UNDOCUMENTED_SESSION_CONSTANT, currentAsn,
-                                     displayNameKey, processName,
-                                     nil); // Optional out param
+  OSErr err =
+      setInformationItemFunc(UNDOCUMENTED_SESSION_CONSTANT, currentAsn, displayNameKey, processName,
+                             nil);  // Optional out param
   ::CFRelease(processName);
   if (err != noErr) {
     NS_WARNING("Failed to set process name: LSSetInformationItemType err");
     return false;
   }
 
   return true;
   NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(false);
@@ -366,31 +339,23 @@ double nsDoubleBufferCARenderer::GetBack
 IOSurfaceID nsDoubleBufferCARenderer::GetFrontSurfaceID() {
   if (!HasFrontSurface()) {
     return 0;
   }
 
   return mFrontSurface->GetIOSurfaceID();
 }
 
-bool nsDoubleBufferCARenderer::HasBackSurface() {
-  return !!mBackSurface;
-}
+bool nsDoubleBufferCARenderer::HasBackSurface() { return !!mBackSurface; }
 
-bool nsDoubleBufferCARenderer::HasFrontSurface() {
-  return !!mFrontSurface;
-}
+bool nsDoubleBufferCARenderer::HasFrontSurface() { return !!mFrontSurface; }
 
-bool nsDoubleBufferCARenderer::HasCALayer() {
-  return !!mCALayer;
-}
+bool nsDoubleBufferCARenderer::HasCALayer() { return !!mCALayer; }
 
-void nsDoubleBufferCARenderer::SetCALayer(void *aCALayer) {
-  mCALayer = aCALayer;
-}
+void nsDoubleBufferCARenderer::SetCALayer(void *aCALayer) { mCALayer = aCALayer; }
 
 bool nsDoubleBufferCARenderer::InitFrontSurface(size_t aWidth, size_t aHeight,
                                                 double aContentsScaleFactor,
                                                 AllowOfflineRendererEnum aAllowOfflineRenderer) {
   if (!mCALayer) {
     return false;
   }
 
@@ -405,21 +370,19 @@ bool nsDoubleBufferCARenderer::InitFront
     mCARenderer = new nsCARenderer();
     if (!mCARenderer) {
       mFrontSurface = nullptr;
       return false;
     }
 
     mCARenderer->AttachIOSurface(mFrontSurface);
 
-    nsresult result = mCARenderer->SetupRenderer(mCALayer,
-                        mFrontSurface->GetWidth(),
-                        mFrontSurface->GetHeight(),
-                        mContentsScaleFactor,
-                        aAllowOfflineRenderer);
+    nsresult result =
+        mCARenderer->SetupRenderer(mCALayer, mFrontSurface->GetWidth(), mFrontSurface->GetHeight(),
+                                   mContentsScaleFactor, aAllowOfflineRenderer);
 
     if (result != NS_OK) {
       mCARenderer = nullptr;
       mFrontSurface = nullptr;
       return false;
     }
   } else {
     mCARenderer->AttachIOSurface(mFrontSurface);
@@ -428,18 +391,18 @@ bool nsDoubleBufferCARenderer::InitFront
   return true;
 }
 
 void nsDoubleBufferCARenderer::Render() {
   if (!HasFrontSurface() || !mCARenderer) {
     return;
   }
 
-  mCARenderer->Render(GetFrontSurfaceWidth(), GetFrontSurfaceHeight(),
-                      mContentsScaleFactor, nullptr);
+  mCARenderer->Render(GetFrontSurfaceWidth(), GetFrontSurfaceHeight(), mContentsScaleFactor,
+                      nullptr);
 }
 
 void nsDoubleBufferCARenderer::SwapSurfaces() {
   RefPtr<MacIOSurface> prevFrontSurface = mFrontSurface;
   mFrontSurface = mBackSurface;
   mBackSurface = prevFrontSurface;
 
   if (mFrontSurface) {
@@ -456,12 +419,11 @@ void nsDoubleBufferCARenderer::ClearFron
 
 void nsDoubleBufferCARenderer::ClearBackSurface() {
   mBackSurface = nullptr;
   if (!mFrontSurface && !mBackSurface) {
     mCARenderer = nullptr;
   }
 }
 
-} // namespace PluginUtilsOSX
-} // namespace plugins
-} // namespace mozilla
-
+}  // namespace PluginUtilsOSX
+}  // namespace plugins
+}  // namespace mozilla
--- a/dom/plugins/ipc/interpose/plugin_child_interpose.mm
+++ b/dom/plugins/ipc/interpose/plugin_child_interpose.mm
@@ -22,113 +22,108 @@
 // which will get loaded by the OS before any other modules when the plugin
 // child process is launched (from GeckoChildProcessHost::
 // PerformAsyncLaunch()).  For this reason it shouldn't link in other
 // browser modules when loaded.  Instead it should use dlsym() to load
 // pointers to the methods it wants to call in other modules.
 
 #if !defined(__LP64__)
 
-#include <dlfcn.h>
-#import <Carbon/Carbon.h>
+#  include <dlfcn.h>
+#  import <Carbon/Carbon.h>
 
 // The header file QuickdrawAPI.h is missing on OS X 10.7 and up (though the
 // QuickDraw APIs defined in it are still present) -- so we need to supply the
 // relevant parts of its contents here.  It's likely that Apple will eventually
 // remove the APIs themselves (probably in OS X 10.8), so we need to make them
 // weak imports, and test for their presence before using them.
-#if !defined(__QUICKDRAWAPI__)
+#  if !defined(__QUICKDRAWAPI__)
 
 struct Cursor;
-extern "C" void SetCursor(const Cursor * crsr) __attribute__((weak_import));
+extern "C" void SetCursor(const Cursor* crsr) __attribute__((weak_import));
 
-#endif /* __QUICKDRAWAPI__ */
+#  endif /* __QUICKDRAWAPI__ */
 
-BOOL (*OnSetThemeCursorPtr) (ThemeCursor) = NULL;
-BOOL (*OnSetCursorPtr) (const Cursor*) = NULL;
-BOOL (*OnHideCursorPtr) () = NULL;
-BOOL (*OnShowCursorPtr) () = NULL;
+BOOL (*OnSetThemeCursorPtr)(ThemeCursor) = NULL;
+BOOL (*OnSetCursorPtr)(const Cursor*) = NULL;
+BOOL (*OnHideCursorPtr)() = NULL;
+BOOL (*OnShowCursorPtr)() = NULL;
 
-static BOOL loadXULPtrs()
-{
+static BOOL loadXULPtrs() {
   if (!OnSetThemeCursorPtr) {
     // mac_plugin_interposing_child_OnSetThemeCursor(ThemeCursor cursor) is in
     // PluginInterposeOSX.mm
-    OnSetThemeCursorPtr = (BOOL(*)(ThemeCursor))
-      dlsym(RTLD_DEFAULT, "mac_plugin_interposing_child_OnSetThemeCursor");
+    OnSetThemeCursorPtr =
+        (BOOL(*)(ThemeCursor))dlsym(RTLD_DEFAULT, "mac_plugin_interposing_child_OnSetThemeCursor");
   }
   if (!OnSetCursorPtr) {
     // mac_plugin_interposing_child_OnSetCursor(const Cursor* cursor) is in
     // PluginInterposeOSX.mm
-    OnSetCursorPtr = (BOOL(*)(const Cursor*))
-      dlsym(RTLD_DEFAULT, "mac_plugin_interposing_child_OnSetCursor");
+    OnSetCursorPtr =
+        (BOOL(*)(const Cursor*))dlsym(RTLD_DEFAULT, "mac_plugin_interposing_child_OnSetCursor");
   }
   if (!OnHideCursorPtr) {
     // mac_plugin_interposing_child_OnHideCursor() is in PluginInterposeOSX.mm
-    OnHideCursorPtr = (BOOL(*)())
-      dlsym(RTLD_DEFAULT, "mac_plugin_interposing_child_OnHideCursor");
+    OnHideCursorPtr = (BOOL(*)())dlsym(RTLD_DEFAULT, "mac_plugin_interposing_child_OnHideCursor");
   }
   if (!OnShowCursorPtr) {
     // mac_plugin_interposing_child_OnShowCursor() is in PluginInterposeOSX.mm
-    OnShowCursorPtr = (BOOL(*)())
-      dlsym(RTLD_DEFAULT, "mac_plugin_interposing_child_OnShowCursor");
+    OnShowCursorPtr = (BOOL(*)())dlsym(RTLD_DEFAULT, "mac_plugin_interposing_child_OnShowCursor");
   }
   return (OnSetCursorPtr && OnSetThemeCursorPtr && OnHideCursorPtr && OnShowCursorPtr);
 }
 
-static OSStatus MacPluginChildSetThemeCursor(ThemeCursor cursor)
-{
+static OSStatus MacPluginChildSetThemeCursor(ThemeCursor cursor) {
   if (loadXULPtrs()) {
     OnSetThemeCursorPtr(cursor);
   }
   return ::SetThemeCursor(cursor);
 }
 
-static void MacPluginChildSetCursor(const Cursor* cursor)
-{
+static void MacPluginChildSetCursor(const Cursor* cursor) {
   if (::SetCursor) {
     if (loadXULPtrs()) {
       OnSetCursorPtr(cursor);
     }
     ::SetCursor(cursor);
   }
 }
 
-static CGError MacPluginChildCGDisplayHideCursor(CGDirectDisplayID display)
-{
+static CGError MacPluginChildCGDisplayHideCursor(CGDirectDisplayID display) {
   if (loadXULPtrs()) {
     OnHideCursorPtr();
   }
   return ::CGDisplayHideCursor(display);
 }
 
-static CGError MacPluginChildCGDisplayShowCursor(CGDirectDisplayID display)
-{
+static CGError MacPluginChildCGDisplayShowCursor(CGDirectDisplayID display) {
   if (loadXULPtrs()) {
     OnShowCursorPtr();
   }
   return ::CGDisplayShowCursor(display);
 }
 
-#pragma mark -
+#  pragma mark -
 
 struct interpose_substitution {
   const void* replacement;
   const void* original;
 };
 
-#define INTERPOSE_FUNCTION(function) \
-    { reinterpret_cast<const void*>(MacPluginChild##function), \
-      reinterpret_cast<const void*>(function) }
+#  define INTERPOSE_FUNCTION(function)                         \
+    {                                                          \
+      reinterpret_cast<const void*>(MacPluginChild##function), \
+          reinterpret_cast<const void*>(function)              \
+    }
 
 __attribute__((used)) static const interpose_substitution substitutions[]
     __attribute__((section("__DATA, __interpose"))) = {
-  INTERPOSE_FUNCTION(SetThemeCursor),
-  INTERPOSE_FUNCTION(CGDisplayHideCursor),
-  INTERPOSE_FUNCTION(CGDisplayShowCursor),
-  // SetCursor() and other QuickDraw APIs will probably be removed in OS X
-  // 10.8.  But this will make 'SetCursor' NULL, which will just stop the OS
-  // from interposing it (tested using an INTERPOSE_FUNCTION_BROKEN macro
-  // that just sets the second address of each tuple to NULL).
-  INTERPOSE_FUNCTION(SetCursor),
+        INTERPOSE_FUNCTION(SetThemeCursor),
+        INTERPOSE_FUNCTION(CGDisplayHideCursor),
+        INTERPOSE_FUNCTION(CGDisplayShowCursor),
+        // SetCursor() and other QuickDraw APIs will probably be removed in OS X
+        // 10.8.  But this will make 'SetCursor' NULL, which will just stop the OS
+        // from interposing it (tested using an INTERPOSE_FUNCTION_BROKEN macro
+        // that just sets the second address of each tuple to NULL).
+        INTERPOSE_FUNCTION(SetCursor),
 };
 
 #endif  // !__LP64__
--- a/dom/plugins/test/testplugin/nptest_macosx.mm
+++ b/dom/plugins/test/testplugin/nptest_macosx.mm
@@ -1,63 +1,53 @@
 /* ***** BEGIN LICENSE BLOCK *****
- * 
+ *
  * Copyright (c) 2008, Mozilla Corporation
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
- * 
+ *
  * * Redistributions of source code must retain the above copyright notice, this
  *   list of conditions and the following disclaimer.
  * * Redistributions in binary form must reproduce the above copyright notice,
  *   this list of conditions and the following disclaimer in the documentation
  *   and/or other materials provided with the distribution.
  * * Neither the name of the Mozilla Corporation nor the names of its
  *   contributors may be used to endorse or promote products derived from this
  *   software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * 
+ *
  * Contributor(s):
  *   Josh Aas <josh@mozilla.com>
- * 
+ *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nptest_platform.h"
 #include "nsAlgorithm.h"
 #include <CoreServices/CoreServices.h>
 #include <algorithm>
 
 using namespace std;
 
-bool
-pluginSupportsWindowMode()
-{
-  return false;
-}
+bool pluginSupportsWindowMode() { return false; }
 
-bool
-pluginSupportsWindowlessMode()
-{
-  return true;
-}
+bool pluginSupportsWindowlessMode() { return true; }
 
-NPError
-pluginInstanceInit(InstanceData* instanceData)
-{
+NPError pluginInstanceInit(InstanceData* instanceData) {
   NPP npp = instanceData->npp;
 
   NPBool supportsCoreGraphics = false;
   if ((NPN_GetValue(npp, NPNVsupportsCoreGraphicsBool, &supportsCoreGraphics) == NPERR_NO_ERROR) &&
       supportsCoreGraphics) {
     NPN_SetValue(npp, NPPVpluginDrawingModel, (void*)NPDrawingModelCoreGraphics);
   } else {
     printf("CoreGraphics drawing model not supported, can't create a plugin instance.\n");
@@ -72,241 +62,216 @@ pluginInstanceInit(InstanceData* instanc
   } else {
     printf("Cocoa event model not supported, can't create a plugin instance.\n");
     return NPERR_INCOMPATIBLE_VERSION_ERROR;
   }
 
   return NPERR_NO_ERROR;
 }
 
-void
-pluginInstanceShutdown(InstanceData* instanceData)
-{
+void pluginInstanceShutdown(InstanceData* instanceData) {}
+
+static bool RectEquals(const NPRect& r1, const NPRect& r2) {
+  return r1.left == r2.left && r1.top == r2.top && r1.right == r2.right && r1.bottom == r2.bottom;
 }
 
-static bool
-RectEquals(const NPRect& r1, const NPRect& r2)
-{
-  return r1.left == r2.left && r1.top == r2.top &&
-         r1.right == r2.right && r1.bottom == r2.bottom;
-}
-
-void
-pluginDoSetWindow(InstanceData* instanceData, NPWindow* newWindow)
-{
+void pluginDoSetWindow(InstanceData* instanceData, NPWindow* newWindow) {
   // Ugh. Due to a terrible Gecko bug, we have to ignore position changes
   // when the clip rect doesn't change; the position can be wrong
   // when set by a path other than nsPluginFrame::FixUpPluginWindow.
   int32_t oldX = instanceData->window.x;
   int32_t oldY = instanceData->window.y;
-  bool clipChanged =
-    !RectEquals(instanceData->window.clipRect, newWindow->clipRect);
+  bool clipChanged = !RectEquals(instanceData->window.clipRect, newWindow->clipRect);
   instanceData->window = *newWindow;
   if (!clipChanged) {
     instanceData->window.x = oldX;
     instanceData->window.y = oldY;
   }
 }
 
-void
-pluginWidgetInit(InstanceData* instanceData, void* oldWindow)
-{
+void pluginWidgetInit(InstanceData* instanceData, void* oldWindow) {
   // Should never be called since we don't support window mode
 }
 
-static void 
-GetColorsFromRGBA(uint32_t rgba, float* r, float* g, float* b, float* a)
-{
+static void GetColorsFromRGBA(uint32_t rgba, float* r, float* g, float* b, float* a) {
   *b = (rgba & 0xFF) / 255.0;
   *g = ((rgba & 0xFF00) >> 8) / 255.0;
   *r = ((rgba & 0xFF0000) >> 16) / 255.0;
   *a = ((rgba & 0xFF000000) >> 24) / 255.0;
 }
 
-static void
-pluginDraw(InstanceData* instanceData, NPCocoaEvent* event)
-{
-  if (!instanceData)
-    return;
+static void pluginDraw(InstanceData* instanceData, NPCocoaEvent* event) {
+  if (!instanceData) return;
 
   notifyDidPaint(instanceData);
 
   NPP npp = instanceData->npp;
-  if (!npp)
-    return;
-  
+  if (!npp) return;
+
   const char* uaString = NPN_UserAgent(npp);
-  if (!uaString)
-    return;
+  if (!uaString) return;
 
   NPWindow window = instanceData->window;
 
   CGContextRef cgContext = event->data.draw.context;
 
   float windowWidth = window.width;
   float windowHeight = window.height;
 
-  switch(instanceData->scriptableObject->drawMode) {
-  case DM_DEFAULT: {
-    CFStringRef uaCFString = CFStringCreateWithCString(kCFAllocatorDefault, uaString, kCFStringEncodingASCII);
-    // save the cgcontext gstate
-    CGContextSaveGState(cgContext);
+  switch (instanceData->scriptableObject->drawMode) {
+    case DM_DEFAULT: {
+      CFStringRef uaCFString =
+          CFStringCreateWithCString(kCFAllocatorDefault, uaString, kCFStringEncodingASCII);
+      // save the cgcontext gstate
+      CGContextSaveGState(cgContext);
 
-    // we get a flipped context
-    CGContextTranslateCTM(cgContext, 0.0, windowHeight);
-    CGContextScaleCTM(cgContext, 1.0, -1.0);
+      // we get a flipped context
+      CGContextTranslateCTM(cgContext, 0.0, windowHeight);
+      CGContextScaleCTM(cgContext, 1.0, -1.0);
 
-    // draw a gray background for the plugin
-    CGContextAddRect(cgContext, CGRectMake(0, 0, windowWidth, windowHeight));
-    CGContextSetGrayFillColor(cgContext, 0.5, 1.0);
-    CGContextDrawPath(cgContext, kCGPathFill);
+      // draw a gray background for the plugin
+      CGContextAddRect(cgContext, CGRectMake(0, 0, windowWidth, windowHeight));
+      CGContextSetGrayFillColor(cgContext, 0.5, 1.0);
+      CGContextDrawPath(cgContext, kCGPathFill);
 
-    // draw a black frame around the plugin
-    CGContextAddRect(cgContext, CGRectMake(0, 0, windowWidth, windowHeight));
-    CGContextSetGrayStrokeColor(cgContext, 0.0, 1.0);
-    CGContextSetLineWidth(cgContext, 6.0);
-    CGContextStrokePath(cgContext);
+      // draw a black frame around the plugin
+      CGContextAddRect(cgContext, CGRectMake(0, 0, windowWidth, windowHeight));
+      CGContextSetGrayStrokeColor(cgContext, 0.0, 1.0);
+      CGContextSetLineWidth(cgContext, 6.0);
+      CGContextStrokePath(cgContext);
 
-    // draw the UA string using Core Text
-    CGContextSetTextMatrix(cgContext, CGAffineTransformIdentity);
+      // draw the UA string using Core Text
+      CGContextSetTextMatrix(cgContext, CGAffineTransformIdentity);
 
-    // Initialize a rectangular path.
-    CGMutablePathRef path = CGPathCreateMutable();
-    CGRect bounds = CGRectMake(10.0, 10.0, std::max(0.0, windowWidth - 20.0),
-                               std::max(0.0, windowHeight - 20.0));
-    CGPathAddRect(path, NULL, bounds);
+      // Initialize a rectangular path.
+      CGMutablePathRef path = CGPathCreateMutable();
+      CGRect bounds = CGRectMake(10.0, 10.0, std::max(0.0, windowWidth - 20.0),
+                                 std::max(0.0, windowHeight - 20.0));
+      CGPathAddRect(path, NULL, bounds);
 
-    // Initialize an attributed string.
-    CFMutableAttributedStringRef attrString = CFAttributedStringCreateMutable(kCFAllocatorDefault, 0);
-    CFAttributedStringReplaceString(attrString, CFRangeMake(0, 0), uaCFString);
+      // Initialize an attributed string.
+      CFMutableAttributedStringRef attrString =
+          CFAttributedStringCreateMutable(kCFAllocatorDefault, 0);
+      CFAttributedStringReplaceString(attrString, CFRangeMake(0, 0), uaCFString);
 
-    // Create a color and add it as an attribute to the string.
-    CGColorSpaceRef rgbColorSpace = CGColorSpaceCreateDeviceRGB();
-    CGFloat components[] = { 0.0, 0.0, 0.0, 1.0 };
-    CGColorRef red = CGColorCreate(rgbColorSpace, components);    
-    CGColorSpaceRelease(rgbColorSpace);
-    CFAttributedStringSetAttribute(attrString, CFRangeMake(0, 50), kCTForegroundColorAttributeName, red);
+      // Create a color and add it as an attribute to the string.
+      CGColorSpaceRef rgbColorSpace = CGColorSpaceCreateDeviceRGB();
+      CGFloat components[] = {0.0, 0.0, 0.0, 1.0};
+      CGColorRef red = CGColorCreate(rgbColorSpace, components);
+      CGColorSpaceRelease(rgbColorSpace);
+      CFAttributedStringSetAttribute(attrString, CFRangeMake(0, 50),
+                                     kCTForegroundColorAttributeName, red);
 
-    // Create the framesetter with the attributed string.
-    CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString(attrString);
-    CFRelease(attrString);
+      // Create the framesetter with the attributed string.
+      CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString(attrString);
+      CFRelease(attrString);
 
-    // Create the frame and draw it into the graphics context
-    CTFrameRef frame = CTFramesetterCreateFrame(framesetter, CFRangeMake(0, 0), path, NULL);
-    CFRelease(framesetter);
-    if (frame) {
-      CTFrameDraw(frame, cgContext);
-      CFRelease(frame);
-    }
+      // Create the frame and draw it into the graphics context
+      CTFrameRef frame = CTFramesetterCreateFrame(framesetter, CFRangeMake(0, 0), path, NULL);
+      CFRelease(framesetter);
+      if (frame) {
+        CTFrameDraw(frame, cgContext);
+        CFRelease(frame);
+      }
 
-    // restore the cgcontext gstate
-    CGContextRestoreGState(cgContext);
-    break;
-  }
-  case DM_SOLID_COLOR: {
-    // save the cgcontext gstate
-    CGContextSaveGState(cgContext);
+      // restore the cgcontext gstate
+      CGContextRestoreGState(cgContext);
+      break;
+    }
+    case DM_SOLID_COLOR: {
+      // save the cgcontext gstate
+      CGContextSaveGState(cgContext);
 
-    // we get a flipped context
-    CGContextTranslateCTM(cgContext, 0.0, windowHeight);
-    CGContextScaleCTM(cgContext, 1.0, -1.0);
+      // we get a flipped context
+      CGContextTranslateCTM(cgContext, 0.0, windowHeight);
+      CGContextScaleCTM(cgContext, 1.0, -1.0);
 
-    // draw a solid background for the plugin
-    CGContextAddRect(cgContext, CGRectMake(0, 0, windowWidth, windowHeight));
+      // draw a solid background for the plugin
+      CGContextAddRect(cgContext, CGRectMake(0, 0, windowWidth, windowHeight));
 
-    float r,g,b,a;
-    GetColorsFromRGBA(instanceData->scriptableObject->drawColor, &r, &g, &b, &a);
-    CGContextSetRGBFillColor(cgContext, r, g, b, a);
-    CGContextDrawPath(cgContext, kCGPathFill);
+      float r, g, b, a;
+      GetColorsFromRGBA(instanceData->scriptableObject->drawColor, &r, &g, &b, &a);
+      CGContextSetRGBFillColor(cgContext, r, g, b, a);
+      CGContextDrawPath(cgContext, kCGPathFill);
 
-    // restore the cgcontext gstate
-    CGContextRestoreGState(cgContext);
-    break;
-  }
+      // restore the cgcontext gstate
+      CGContextRestoreGState(cgContext);
+      break;
+    }
   }
 }
 
-int16_t
-pluginHandleEvent(InstanceData* instanceData, void* event)
-{
+int16_t pluginHandleEvent(InstanceData* instanceData, void* event) {
   NPCocoaEvent* cocoaEvent = (NPCocoaEvent*)event;
-  if (!cocoaEvent)
-    return kNPEventNotHandled;
+  if (!cocoaEvent) return kNPEventNotHandled;
 
   switch (cocoaEvent->type) {
     case NPCocoaEventDrawRect:
       pluginDraw(instanceData, cocoaEvent);
       break;
     case NPCocoaEventMouseDown:
     case NPCocoaEventMouseUp:
     case NPCocoaEventMouseMoved:
     case NPCocoaEventMouseDragged:
       instanceData->lastMouseX = (int32_t)cocoaEvent->data.mouse.pluginX;
       instanceData->lastMouseY = (int32_t)cocoaEvent->data.mouse.pluginY;
       if (cocoaEvent->type == NPCocoaEventMouseUp) {
         instanceData->mouseUpEventCount++;
       }
       break;
     case NPCocoaEventWindowFocusChanged:
-      instanceData->topLevelWindowActivationState = cocoaEvent->data.focus.hasFocus ?
-        ACTIVATION_STATE_ACTIVATED : ACTIVATION_STATE_DEACTIVATED;
-      instanceData->topLevelWindowActivationEventCount = instanceData->topLevelWindowActivationEventCount + 1;
+      instanceData->topLevelWindowActivationState = cocoaEvent->data.focus.hasFocus
+                                                        ? ACTIVATION_STATE_ACTIVATED
+                                                        : ACTIVATION_STATE_DEACTIVATED;
+      instanceData->topLevelWindowActivationEventCount =
+          instanceData->topLevelWindowActivationEventCount + 1;
       break;
     case NPCocoaEventFocusChanged:
-      instanceData->focusState = cocoaEvent->data.focus.hasFocus ?
-      ACTIVATION_STATE_ACTIVATED : ACTIVATION_STATE_DEACTIVATED;
+      instanceData->focusState = cocoaEvent->data.focus.hasFocus ? ACTIVATION_STATE_ACTIVATED
+                                                                 : ACTIVATION_STATE_DEACTIVATED;
       instanceData->focusEventCount = instanceData->focusEventCount + 1;
       break;
     default:
       return kNPEventNotHandled;
   }
 
   return kNPEventHandled;
 }
 
-int32_t pluginGetEdge(InstanceData* instanceData, RectEdge edge)
-{
+int32_t pluginGetEdge(InstanceData* instanceData, RectEdge edge) {
   NPWindow* w = &instanceData->window;
   switch (edge) {
-  case EDGE_LEFT:
-    return w->x;
-  case EDGE_TOP:
-    return w->y;
-  case EDGE_RIGHT:
-    return w->x + w->width;
-  case EDGE_BOTTOM:
-    return w->y + w->height;
+    case EDGE_LEFT:
+      return w->x;
+    case EDGE_TOP:
+      return w->y;
+    case EDGE_RIGHT:
+      return w->x + w->width;
+    case EDGE_BOTTOM:
+      return w->y + w->height;
   }
   MOZ_CRASH("Unexpected RectEdge?!");
 }
 
-int32_t pluginGetClipRegionRectCount(InstanceData* instanceData)
-{
-  return 1;
-}
+int32_t pluginGetClipRegionRectCount(InstanceData* instanceData) { return 1; }
 
-int32_t pluginGetClipRegionRectEdge(InstanceData* instanceData, 
-    int32_t rectIndex, RectEdge edge)
-{
-  if (rectIndex != 0)
-    return NPTEST_INT32_ERROR;
+int32_t pluginGetClipRegionRectEdge(InstanceData* instanceData, int32_t rectIndex, RectEdge edge) {
+  if (rectIndex != 0) return NPTEST_INT32_ERROR;
 
   // We have to add the Cocoa titlebar height here since the clip rect
   // is being returned relative to that
   static const int COCOA_TITLEBAR_HEIGHT = 22;
 
   NPWindow* w = &instanceData->window;
   switch (edge) {
-  case EDGE_LEFT:
-    return w->clipRect.left;
-  case EDGE_TOP:
-    return w->clipRect.top + COCOA_TITLEBAR_HEIGHT;
-  case EDGE_RIGHT:
-    return w->clipRect.right;
-  case EDGE_BOTTOM:
-    return w->clipRect.bottom + COCOA_TITLEBAR_HEIGHT;
+    case EDGE_LEFT:
+      return w->clipRect.left;
+    case EDGE_TOP:
+      return w->clipRect.top + COCOA_TITLEBAR_HEIGHT;
+    case EDGE_RIGHT:
+      return w->clipRect.right;
+    case EDGE_BOTTOM:
+      return w->clipRect.bottom + COCOA_TITLEBAR_HEIGHT;
   }
   MOZ_CRASH("Unexpected RectEdge?!");
 }
 
-void pluginDoInternalConsistencyCheck(InstanceData* instanceData, string& error)
-{
-}
+void pluginDoInternalConsistencyCheck(InstanceData* instanceData, string& error) {}
--- a/dom/system/mac/CoreLocationLocationProvider.mm
+++ b/dom/system/mac/CoreLocationLocationProvider.mm
@@ -27,64 +27,57 @@
 
 #include "nsObjCExceptions.h"
 
 using namespace mozilla;
 
 static const CLLocationAccuracy kHIGH_ACCURACY = kCLLocationAccuracyBest;
 static const CLLocationAccuracy kDEFAULT_ACCURACY = kCLLocationAccuracyNearestTenMeters;
 
-@interface LocationDelegate : NSObject <CLLocationManagerDelegate>
-{
+@interface LocationDelegate : NSObject <CLLocationManagerDelegate> {
   CoreLocationLocationProvider* mProvider;
 }
 
 - (id)init:(CoreLocationLocationProvider*)aProvider;
-- (void)locationManager:(CLLocationManager*)aManager
-  didFailWithError:(NSError *)aError;
+- (void)locationManager:(CLLocationManager*)aManager didFailWithError:(NSError*)aError;
 - (void)locationManager:(CLLocationManager*)aManager didUpdateLocations:(NSArray*)locations;
 
 @end
 
 @implementation LocationDelegate
-- (id) init:(CoreLocationLocationProvider*) aProvider
-{
+- (id)init:(CoreLocationLocationProvider*)aProvider {
   if ((self = [super init])) {
     mProvider = aProvider;
   }
 
   return self;
 }
 
-- (void)locationManager:(CLLocationManager*)aManager
-  didFailWithError:(NSError *)aError
-{
-  nsCOMPtr<nsIConsoleService> console =
-    do_GetService(NS_CONSOLESERVICE_CONTRACTID);
+- (void)locationManager:(CLLocationManager*)aManager didFailWithError:(NSError*)aError {
+  nsCOMPtr<nsIConsoleService> console = do_GetService(NS_CONSOLESERVICE_CONTRACTID);
 
   NS_ENSURE_TRUE_VOID(console);
 
   NSString* message =
-    [@"Failed to acquire position: " stringByAppendingString: [aError localizedDescription]];
+      [@"Failed to acquire position: " stringByAppendingString:[aError localizedDescription]];
 
   console->LogStringMessage(NS_ConvertUTF8toUTF16([message UTF8String]).get());
 
   if ([aError code] == kCLErrorDenied) {
     mProvider->NotifyError(dom::PositionError_Binding::PERMISSION_DENIED);
     return;
   }
 
   // The CL provider does not fallback to GeoIP, so use NetworkGeolocationProvider for this.
   // The concept here is: on error, hand off geolocation to MLS, which will then report
   // back a location or error.
   mProvider->CreateMLSFallbackProvider();
 }
 
-- (void)locationManager:(CLLocationManager*)aManager didUpdateLocations:(NSArray*)aLocations
-{
+- (void)locationManager:(CLLocationManager*)aManager didUpdateLocations:(NSArray*)aLocations {
   if (aLocations.count < 1) {
     return;
   }
 
   mProvider->CancelMLSFallbackProvider();
 
   CLLocation* location = [aLocations objectAtIndex:0];
 
@@ -95,70 +88,56 @@ static const CLLocationAccuracy kDEFAULT
   if (location.verticalAccuracy >= 0) {
     altitude = location.altitude;
     altitudeAccuracy = location.verticalAccuracy;
   } else {
     altitude = UnspecifiedNaN<double>();
     altitudeAccuracy = UnspecifiedNaN<double>();
   }
 
-  double speed = location.speed >= 0
-               ? location.speed
-               : UnspecifiedNaN<double>();
+  double speed = location.speed >= 0 ? location.speed : UnspecifiedNaN<double>();
 
-  double heading = location.course >= 0
-                 ? location.course
-                 : UnspecifiedNaN<double>();
+  double heading = location.course >= 0 ? location.course : UnspecifiedNaN<double>();
 
   // nsGeoPositionCoords will convert NaNs to null for optional properties of
   // the JavaScript Coordinates object.
-  nsCOMPtr<nsIDOMGeoPosition> geoPosition =
-    new nsGeoPosition(location.coordinate.latitude,
-                      location.coordinate.longitude,
-                      altitude,
-                      location.horizontalAccuracy,
-                      altitudeAccuracy,
-                      heading,
-                      speed,
-                      PR_Now() / PR_USEC_PER_MSEC);
+  nsCOMPtr<nsIDOMGeoPosition> geoPosition = new nsGeoPosition(
+      location.coordinate.latitude, location.coordinate.longitude, altitude,
+      location.horizontalAccuracy, altitudeAccuracy, heading, speed, PR_Now() / PR_USEC_PER_MSEC);
 
   mProvider->Update(geoPosition);
   Telemetry::Accumulate(Telemetry::GEOLOCATION_OSX_SOURCE_IS_MLS, false);
 }
 @end
 
 NS_IMPL_ISUPPORTS(CoreLocationLocationProvider::MLSUpdate, nsIGeolocationUpdate);
 
 CoreLocationLocationProvider::MLSUpdate::MLSUpdate(CoreLocationLocationProvider& parentProvider)
-  : mParentLocationProvider(parentProvider)
-{
-}
+    : mParentLocationProvider(parentProvider) {}
 
 NS_IMETHODIMP
-CoreLocationLocationProvider::MLSUpdate::Update(nsIDOMGeoPosition *position)
-{
+CoreLocationLocationProvider::MLSUpdate::Update(nsIDOMGeoPosition* position) {
   nsCOMPtr<nsIDOMGeoPositionCoords> coords;
   position->GetCoords(getter_AddRefs(coords));
   if (!coords) {
     return NS_ERROR_FAILURE;
   }
   mParentLocationProvider.Update(position);
   Telemetry::Accumulate(Telemetry::GEOLOCATION_OSX_SOURCE_IS_MLS, true);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-CoreLocationLocationProvider::MLSUpdate::NotifyError(uint16_t error)
-{
+CoreLocationLocationProvider::MLSUpdate::NotifyError(uint16_t error) {
   mParentLocationProvider.NotifyError(error);
   return NS_OK;
 }
 
 class CoreLocationObjects {
-public:
+ public:
   nsresult Init(CoreLocationLocationProvider* aProvider) {
     mLocationManager = [[CLLocationManager alloc] init];
     NS_ENSURE_TRUE(mLocationManager, NS_ERROR_NOT_AVAILABLE);
 
     mLocationDelegate = [[LocationDelegate alloc] init:aProvider];
     NS_ENSURE_TRUE(mLocationDelegate, NS_ERROR_NOT_AVAILABLE);
 
     mLocationManager.desiredAccuracy = kDEFAULT_ACCURACY;
@@ -179,103 +158,88 @@ public:
 
   LocationDelegate* mLocationDelegate;
   CLLocationManager* mLocationManager;
 };
 
 NS_IMPL_ISUPPORTS(CoreLocationLocationProvider, nsIGeolocationProvider)
 
 CoreLocationLocationProvider::CoreLocationLocationProvider()
-  : mCLObjects(nullptr), mMLSFallbackProvider(nullptr)
-{
-}
+    : mCLObjects(nullptr), mMLSFallbackProvider(nullptr) {}
 
 NS_IMETHODIMP
-CoreLocationLocationProvider::Startup()
-{
+CoreLocationLocationProvider::Startup() {
   if (!mCLObjects) {
     nsAutoPtr<CoreLocationObjects> clObjs(new CoreLocationObjects());
 
     nsresult rv = clObjs->Init(this);
     NS_ENSURE_SUCCESS(rv, rv);
 
     mCLObjects = clObjs.forget();
   }
 
   // Must be stopped before starting or response (success or failure) is not guaranteed
   [mCLObjects->mLocationManager stopUpdatingLocation];
   [mCLObjects->mLocationManager startUpdatingLocation];
   return NS_OK;
 }
 
 NS_IMETHODIMP
-CoreLocationLocationProvider::Watch(nsIGeolocationUpdate* aCallback)
-{
+CoreLocationLocationProvider::Watch(nsIGeolocationUpdate* aCallback) {
   if (mCallback) {
     return NS_OK;
   }
 
   mCallback = aCallback;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-CoreLocationLocationProvider::Shutdown()
-{
+CoreLocationLocationProvider::Shutdown() {
   NS_ENSURE_STATE(mCLObjects);
 
   [mCLObjects->mLocationManager stopUpdatingLocation];
 
   delete mCLObjects;
   mCLObjects = nullptr;
 
   if (mMLSFallbackProvider) {
     mMLSFallbackProvider->Shutdown();
     mMLSFallbackProvider = nullptr;
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-CoreLocationLocationProvider::SetHighAccuracy(bool aEnable)
-{
+CoreLocationLocationProvider::SetHighAccuracy(bool aEnable) {
   NS_ENSURE_STATE(mCLObjects);
 
-  mCLObjects->mLocationManager.desiredAccuracy =
-    (aEnable ? kHIGH_ACCURACY : kDEFAULT_ACCURACY);
+  mCLObjects->mLocationManager.desiredAccuracy = (aEnable ? kHIGH_ACCURACY : kDEFAULT_ACCURACY);
 
   return NS_OK;
 }
 
-void
-CoreLocationLocationProvider::Update(nsIDOMGeoPosition* aSomewhere)
-{
+void CoreLocationLocationProvider::Update(nsIDOMGeoPosition* aSomewhere) {
   if (aSomewhere && mCallback) {
     mCallback->Update(aSomewhere);
   }
 }
-void
-CoreLocationLocationProvider::NotifyError(uint16_t aErrorCode)
-{
+void CoreLocationLocationProvider::NotifyError(uint16_t aErrorCode) {
   mCallback->NotifyError(aErrorCode);
 }
-void
-CoreLocationLocationProvider::CreateMLSFallbackProvider()
-{
+void CoreLocationLocationProvider::CreateMLSFallbackProvider() {
   if (mMLSFallbackProvider) {
     return;
   }
 
   mMLSFallbackProvider = new MLSFallback(0);
   mMLSFallbackProvider->Startup(new MLSUpdate(*this));
 }
 
-void
-CoreLocationLocationProvider::CancelMLSFallbackProvider()
-{
+void CoreLocationLocationProvider::CancelMLSFallbackProvider() {
   if (!mMLSFallbackProvider) {
     return;
   }
 
   mMLSFallbackProvider->Shutdown();
   mMLSFallbackProvider = nullptr;
 }
--- a/dom/system/mac/nsOSPermissionRequest.mm
+++ b/dom/system/mac/nsOSPermissionRequest.mm
@@ -10,62 +10,56 @@
 #include "nsCocoaFeatures.h"
 #include "nsCocoaUtils.h"
 
 using namespace mozilla;
 
 using mozilla::dom::Promise;
 
 NS_IMETHODIMP
-nsOSPermissionRequest::GetAudioCapturePermissionState(uint16_t* aAudio)
-{
+nsOSPermissionRequest::GetAudioCapturePermissionState(uint16_t* aAudio) {
   MOZ_ASSERT(aAudio);
 
   if (!nsCocoaFeatures::OnMojaveOrLater()) {
     return nsOSPermissionRequestBase::GetAudioCapturePermissionState(aAudio);
   }
 
   return nsCocoaUtils::GetAudioCapturePermissionState(*aAudio);
 }
 
 NS_IMETHODIMP
-nsOSPermissionRequest::GetVideoCapturePermissionState(uint16_t* aVideo)
-{
+nsOSPermissionRequest::GetVideoCapturePermissionState(uint16_t* aVideo) {
   MOZ_ASSERT(aVideo);
 
   if (!nsCocoaFeatures::OnMojaveOrLater()) {
     return nsOSPermissionRequestBase::GetVideoCapturePermissionState(aVideo);
   }
 
   return nsCocoaUtils::GetVideoCapturePermissionState(*aVideo);
 }
 
 NS_IMETHODIMP
-nsOSPermissionRequest::RequestVideoCapturePermission(JSContext* aCx,
-                                                     Promise** aPromiseOut)
-{
+nsOSPermissionRequest::RequestVideoCapturePermission(JSContext* aCx, Promise** aPromiseOut) {
   if (!nsCocoaFeatures::OnMojaveOrLater()) {
     return nsOSPermissionRequestBase::RequestVideoCapturePermission(aCx, aPromiseOut);
   }
 
   RefPtr<Promise> promiseHandle;
   nsresult rv = GetPromise(aCx, promiseHandle);
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   rv = nsCocoaUtils::RequestVideoCapturePermission(promiseHandle);
   promiseHandle.forget(aPromiseOut);
   return rv;
 }
 
 NS_IMETHODIMP
-nsOSPermissionRequest::RequestAudioCapturePermission(JSContext* aCx,
-                                                     Promise** aPromiseOut)
-{
+nsOSPermissionRequest::RequestAudioCapturePermission(JSContext* aCx, Promise** aPromiseOut) {
   if (!nsCocoaFeatures::OnMojaveOrLater()) {
     return nsOSPermissionRequestBase::RequestAudioCapturePermission(aCx, aPromiseOut);
   }
 
   RefPtr<Promise> promiseHandle;
   nsresult rv = GetPromise(aCx, promiseHandle);
   if (NS_FAILED(rv)) {
     return rv;
--- a/embedding/ios/GeckoEmbed/GeckoEmbed/main.mm
+++ b/embedding/ios/GeckoEmbed/GeckoEmbed/main.mm
@@ -14,52 +14,49 @@
 #include "nsXPCOMGlue.h"
 #include "nsXREAppData.h"
 #include "mozilla/AppData.h"
 #include "nsCOMPtr.h"
 #include "nsIFile.h"
 #include "nsIPrefService.h"
 #include "nsServiceManagerUtils.h"
 
-static const nsXREAppData sAppData = {
-  sizeof(nsXREAppData),
-  nullptr, // directory
-  "Mozilla",
-  "Browser",
-  nullptr,
-  "38.0a1",
-  "201502090123",
-  "browser@mozilla.org",
-  nullptr, // copyright
-  0,
-  nullptr, // xreDirectory
-  "38.0a1",
-  "*",
-  "https://crash-reports.mozilla.com/submit",
-  nullptr,
-  "Firefox"
-};
+static const nsXREAppData sAppData = {sizeof(nsXREAppData),
+                                      nullptr,  // directory
+                                      "Mozilla",
+                                      "Browser",
+                                      nullptr,
+                                      "38.0a1",
+                                      "201502090123",
+                                      "browser@mozilla.org",
+                                      nullptr,  // copyright
+                                      0,
+                                      nullptr,  // xreDirectory
+                                      "38.0a1",
+                                      "*",
+                                      "https://crash-reports.mozilla.com/submit",
+                                      nullptr,
+                                      "Firefox"};
 
 XRE_GetFileFromPathType XRE_GetFileFromPath;
 XRE_CreateAppDataType XRE_CreateAppData;
 XRE_FreeAppDataType XRE_FreeAppData;
 XRE_mainType XRE_main;
 
 static const nsDynamicFunctionLoad kXULFuncs[] = {
-    { "XRE_GetFileFromPath", (NSFuncPtr*) &XRE_GetFileFromPath },
-    { "XRE_CreateAppData", (NSFuncPtr*) &XRE_CreateAppData },
-    { "XRE_FreeAppData", (NSFuncPtr*) &XRE_FreeAppData },
-    { "XRE_main", (NSFuncPtr*) &XRE_main },
-    { nullptr, nullptr }
-};
+    {"XRE_GetFileFromPath", (NSFuncPtr*)&XRE_GetFileFromPath},
+    {"XRE_CreateAppData", (NSFuncPtr*)&XRE_CreateAppData},
+    {"XRE_FreeAppData", (NSFuncPtr*)&XRE_FreeAppData},
+    {"XRE_main", (NSFuncPtr*)&XRE_main},
+    {nullptr, nullptr}};
 
 const int MAXPATHLEN = 1024;
 const char* XPCOM_DLL = "XUL";
 
-int main(int argc, char * argv[]) {
+int main(int argc, char* argv[]) {
   char exeDir[MAXPATHLEN];
   NSString* bundlePath = [[NSBundle mainBundle] bundlePath];
   strncpy(exeDir, [bundlePath UTF8String], MAXPATHLEN);
   strcat(exeDir, "/Frameworks/");
   strncat(exeDir, XPCOM_DLL, MAXPATHLEN - strlen(exeDir));
 
   nsresult rv = XPCOMGlueStartup(exeDir);
   if (NS_FAILED(rv)) {
@@ -77,17 +74,17 @@ int main(int argc, char * argv[]) {
 
   nsCOMPtr<nsIFile> greDir;
   rv = NS_NewNativeLocalFile(nsDependentCString([bundlePath UTF8String]), true,
                              getter_AddRefs(greDir));
   if (NS_FAILED(rv)) {
     printf("Couldn't find the application directory.\n");
     return 255;
   }
-    
+
   nsCOMPtr<nsIFile> appSubdir;
   greDir->Clone(getter_AddRefs(appSubdir));
   greDir->Append(NS_LITERAL_STRING("Frameworks"));
   appSubdir->Append(NS_LITERAL_STRING("browser"));
 
   mozilla::SetStrongPtr(appData.directory, static_cast<nsIFile*>(appSubdir.get()));
   greDir.forget(&appData.xreDirectory);
 
--- a/gfx/2d/QuartzSupport.mm
+++ b/gfx/2d/QuartzSupport.mm
@@ -9,42 +9,38 @@
 #include "MacIOSurface.h"
 #include "mozilla/Sprintf.h"
 
 #import <QuartzCore/QuartzCore.h>
 #import <AppKit/NSOpenGL.h>
 #include <dlfcn.h>
 #include "GLDefs.h"
 
-#define IOSURFACE_FRAMEWORK_PATH \
-  "/System/Library/Frameworks/IOSurface.framework/IOSurface"
-#define OPENGL_FRAMEWORK_PATH \
-  "/System/Library/Frameworks/OpenGL.framework/OpenGL"
-#define COREGRAPHICS_FRAMEWORK_PATH \
-  "/System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreGraphics.framework/CoreGraphics"
+#define IOSURFACE_FRAMEWORK_PATH "/System/Library/Frameworks/IOSurface.framework/IOSurface"
+#define OPENGL_FRAMEWORK_PATH "/System/Library/Frameworks/OpenGL.framework/OpenGL"
+#define COREGRAPHICS_FRAMEWORK_PATH                                                             \
+  "/System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreGraphics.framework/" \
+  "CoreGraphics"
 
 @interface CALayer (ContentsScale)
 - (double)contentsScale;
 - (void)setContentsScale:(double)scale;
 @end
 
-
 CGColorSpaceRef CreateSystemColorSpace() {
   CGColorSpaceRef cspace = ::CGDisplayCopyColorSpace(::CGMainDisplayID());
   if (!cspace) {
     cspace = ::CGColorSpaceCreateDeviceRGB();
   }
   return cspace;
 }
 
-nsCARenderer::~nsCARenderer() {
-  Destroy();
-}
+nsCARenderer::~nsCARenderer() { Destroy(); }
 
-void cgdata_release_callback(void *aCGData, const void *data, size_t size) {
+void cgdata_release_callback(void* aCGData, const void* data, size_t size) {
   if (aCGData) {
     free(aCGData);
   }
 }
 
 void nsCARenderer::Destroy() {
   if (mCARenderer) {
     CARenderer* caRenderer = (CARenderer*)mCARenderer;
@@ -70,18 +66,17 @@ void nsCARenderer::Destroy() {
       if (mIOTexture) {
         ::glDeleteTextures(1, &mIOTexture);
       }
       if (mFBO) {
         ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
         ::glDeleteFramebuffersEXT(1, &mFBO);
       }
 
-      if (oldContext)
-        ::CGLSetCurrentContext(oldContext);
+      if (oldContext) ::CGLSetCurrentContext(oldContext);
     }
     ::CGLDestroyContext((CGLContextObj)mOpenGLContext);
   }
   if (mCGImage) {
     ::CGImageRelease(mCGImage);
   }
   // mCGData is deallocated by cgdata_release_callback
 
@@ -90,35 +85,30 @@ void nsCARenderer::Destroy() {
   mFBOTexture = 0;
   mOpenGLContext = nullptr;
   mCGImage = nullptr;
   mIOSurface = nullptr;
   mFBO = 0;
   mIOTexture = 0;
 }
 
-nsresult nsCARenderer::SetupRenderer(void *aCALayer, int aWidth, int aHeight,
+nsresult nsCARenderer::SetupRenderer(void* aCALayer, int aWidth, int aHeight,
                                      double aContentsScaleFactor,
                                      AllowOfflineRendererEnum aAllowOfflineRenderer) {
   mAllowOfflineRenderer = aAllowOfflineRenderer;
 
-  if (aWidth == 0 || aHeight == 0 || aContentsScaleFactor <= 0)
-    return NS_ERROR_FAILURE;
+  if (aWidth == 0 || aHeight == 0 || aContentsScaleFactor <= 0) return NS_ERROR_FAILURE;
 
-  if (aWidth == mUnsupportedWidth &&
-      aHeight == mUnsupportedHeight) {
+  if (aWidth == mUnsupportedWidth && aHeight == mUnsupportedHeight) {
     return NS_ERROR_FAILURE;
   }
 
-  CGLPixelFormatAttribute attributes[] = {
-    kCGLPFAAccelerated,
-    kCGLPFADepthSize, (CGLPixelFormatAttribute)24,
-    kCGLPFAAllowOfflineRenderers,
-    (CGLPixelFormatAttribute)0
-  };
+  CGLPixelFormatAttribute attributes[] = {kCGLPFAAccelerated, kCGLPFADepthSize,
+                                          (CGLPixelFormatAttribute)24, kCGLPFAAllowOfflineRenderers,
+                                          (CGLPixelFormatAttribute)0};
 
   if (mAllowOfflineRenderer == DISALLOW_OFFLINE_RENDERER) {
     attributes[3] = (CGLPixelFormatAttribute)0;
   }
 
   GLint screen;
   CGLPixelFormatObj format;
   if (::CGLChoosePixelFormat(attributes, &format, &screen) != kCGLNoError) {
@@ -131,18 +121,17 @@ nsresult nsCARenderer::SetupRenderer(voi
   if (::CGLCreateContext(format, nullptr, &mOpenGLContext) != kCGLNoError) {
     mUnsupportedWidth = aWidth;
     mUnsupportedHeight = aHeight;
     Destroy();
     return NS_ERROR_FAILURE;
   }
   ::CGLDestroyPixelFormat(format);
 
-  CARenderer* caRenderer = [[CARenderer rendererWithCGLContext:mOpenGLContext 
-                                                       options:nil] retain];
+  CARenderer* caRenderer = [[CARenderer rendererWithCGLContext:mOpenGLContext options:nil] retain];
   if (caRenderer == nil) {
     mUnsupportedWidth = aWidth;
     mUnsupportedHeight = aHeight;
     Destroy();
     return NS_ERROR_FAILURE;
   }
   CALayer* wrapperCALayer = [[CALayer layer] retain];
   if (wrapperCALayer == nil) {
@@ -158,44 +147,44 @@ nsresult nsCARenderer::SetupRenderer(voi
   caRenderer.layer = wrapperCALayer;
   [wrapperCALayer addSublayer:(CALayer*)aCALayer];
   mContentsScaleFactor = aContentsScaleFactor;
   size_t intScaleFactor = ceil(mContentsScaleFactor);
   SetBounds(aWidth, aHeight);
 
   // We target rendering to a CGImage if no shared IOSurface are given.
   if (!mIOSurface) {
-    mCGData = malloc(aWidth*intScaleFactor*aHeight*4*intScaleFactor);
+    mCGData = malloc(aWidth * intScaleFactor * aHeight * 4 * intScaleFactor);
     if (!mCGData) {
       mUnsupportedWidth = aWidth;
       mUnsupportedHeight = aHeight;
       Destroy();
       return NS_ERROR_FAILURE;
     }
-    memset(mCGData, 0, aWidth*intScaleFactor*aHeight*4*intScaleFactor);
+    memset(mCGData, 0, aWidth * intScaleFactor * aHeight * 4 * intScaleFactor);
 
     CGDataProviderRef dataProvider = nullptr;
-    dataProvider = ::CGDataProviderCreateWithData(mCGData,
-                                        mCGData, aHeight*intScaleFactor*aWidth*4*intScaleFactor,
-                                        cgdata_release_callback);
+    dataProvider = ::CGDataProviderCreateWithData(
+        mCGData, mCGData, aHeight * intScaleFactor * aWidth * 4 * intScaleFactor,
+        cgdata_release_callback);
     if (!dataProvider) {
       cgdata_release_callback(mCGData, mCGData,
-                              aHeight*intScaleFactor*aWidth*4*intScaleFactor);
+                              aHeight * intScaleFactor * aWidth * 4 * intScaleFactor);
       mUnsupportedWidth = aWidth;
       mUnsupportedHeight = aHeight;
       Destroy();
       return NS_ERROR_FAILURE;
     }
 
     CGColorSpaceRef colorSpace = CreateSystemColorSpace();
 
-    mCGImage = ::CGImageCreate(aWidth * intScaleFactor, aHeight * intScaleFactor,
-                8, 32, aWidth * intScaleFactor * 4, colorSpace,
-                kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host,
-                dataProvider, nullptr, true, kCGRenderingIntentDefault);
+    mCGImage = ::CGImageCreate(aWidth * intScaleFactor, aHeight * intScaleFactor, 8, 32,
+                               aWidth * intScaleFactor * 4, colorSpace,
+                               kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host,
+                               dataProvider, nullptr, true, kCGRenderingIntentDefault);
 
     ::CGDataProviderRelease(dataProvider);
     ::CGColorSpaceRelease(colorSpace);
     if (!mCGImage) {
       mUnsupportedWidth = aWidth;
       mUnsupportedHeight = aHeight;
       Destroy();
       return NS_ERROR_FAILURE;
@@ -206,116 +195,106 @@ nsresult nsCARenderer::SetupRenderer(voi
   ::CGLSetCurrentContext(mOpenGLContext);
 
   if (mIOSurface) {
     // Create the IOSurface mapped texture.
     ::glGenTextures(1, &mIOTexture);
     ::glBindTexture(GL_TEXTURE_RECTANGLE_ARB, mIOTexture);
     ::glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
     ::glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-    MacIOSurfaceLib::CGLTexImageIOSurface2D(mOpenGLContext, GL_TEXTURE_RECTANGLE_ARB,
-                                           GL_RGBA, aWidth * intScaleFactor,
-                                           aHeight * intScaleFactor,
-                                           GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
-                                           mIOSurface->mIOSurfacePtr, 0);
+    MacIOSurfaceLib::CGLTexImageIOSurface2D(mOpenGLContext, GL_TEXTURE_RECTANGLE_ARB, GL_RGBA,
+                                            aWidth * intScaleFactor, aHeight * intScaleFactor,
+                                            GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
+                                            mIOSurface->mIOSurfacePtr, 0);
     ::glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
   } else {
     ::glGenTextures(1, &mFBOTexture);
     ::glBindTexture(GL_TEXTURE_RECTANGLE_ARB, mFBOTexture);
     ::glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
     ::glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
     ::glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
   }
 
   // Create the fbo
   ::glGenFramebuffersEXT(1, &mFBO);
   ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mFBO);
   if (mIOSurface) {
-   ::glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
+    ::glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
                                 GL_TEXTURE_RECTANGLE_ARB, mIOTexture, 0);
   } else {
     ::glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
                                 GL_TEXTURE_RECTANGLE_ARB, mFBOTexture, 0);
   }
 
-
   // Make sure that the Framebuffer configuration is supported on the client machine
   GLenum fboStatus;
   fboStatus = ::glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
   if (fboStatus != GL_FRAMEBUFFER_COMPLETE_EXT) {
     NS_ERROR("FBO not supported");
-    if (oldContext)
-      ::CGLSetCurrentContext(oldContext);
+    if (oldContext) ::CGLSetCurrentContext(oldContext);
     mUnsupportedWidth = aWidth;
     mUnsupportedHeight = aHeight;
     Destroy();
     return NS_ERROR_FAILURE;
   }
 
   SetViewport(aWidth, aHeight);
 
   GLenum result = ::glGetError();
   if (result != GL_NO_ERROR) {
     NS_ERROR("Unexpected OpenGL Error");
     mUnsupportedWidth = aWidth;
     mUnsupportedHeight = aHeight;
     Destroy();
-    if (oldContext)
-      ::CGLSetCurrentContext(oldContext);
+    if (oldContext) ::CGLSetCurrentContext(oldContext);
     return NS_ERROR_FAILURE;
   }
 
-  if (oldContext)
-    ::CGLSetCurrentContext(oldContext);
+  if (oldContext) ::CGLSetCurrentContext(oldContext);
 
   return NS_OK;
 }
 
 void nsCARenderer::SetBounds(int aWidth, int aHeight) {
   CARenderer* caRenderer = (CARenderer*)mCARenderer;
   CALayer* wrapperLayer = (CALayer*)mWrapperCALayer;
   NSArray* sublayers = [wrapperLayer sublayers];
-  CALayer* pluginLayer = (CALayer*) [sublayers objectAtIndex:0];
+  CALayer* pluginLayer = (CALayer*)[sublayers objectAtIndex:0];
 
   // Create a transaction and disable animations
   // to make the position update instant.
   [CATransaction begin];
-  NSMutableDictionary *newActions =
-    [[NSMutableDictionary alloc] initWithObjectsAndKeys:
-      [NSNull null], @"onOrderIn",
-      [NSNull null], @"onOrderOut",
-      [NSNull null], @"sublayers",
-      [NSNull null], @"contents",
-      [NSNull null], @"position",
-      [NSNull null], @"bounds",
-      nil];
+  NSMutableDictionary* newActions = [[NSMutableDictionary alloc]
+      initWithObjectsAndKeys:[NSNull null], @"onOrderIn", [NSNull null], @"onOrderOut",
+                             [NSNull null], @"sublayers", [NSNull null], @"contents", [NSNull null],
+                             @"position", [NSNull null], @"bounds", nil];
   wrapperLayer.actions = newActions;
   [newActions release];
 
   // If we're in HiDPI mode, mContentsScaleFactor will (presumably) be 2.0.
   // For some reason, to make things work properly in HiDPI mode we need to
   // make caRenderer's 'bounds' and 'layer' different sizes -- to set 'bounds'
   // to the size of 'layer's backing store.  And to avoid this possibly
   // confusing the plugin, we need to hide it's effects from the plugin by
   // making pluginLayer (usually the CALayer* provided by the plugin) a
   // sublayer of our own wrapperLayer (see bug 829284).
   size_t intScaleFactor = ceil(mContentsScaleFactor);
-  [CATransaction setValue: [NSNumber numberWithFloat:0.0f] forKey: kCATransactionAnimationDuration];
-  [CATransaction setValue: (id) kCFBooleanTrue forKey: kCATransactionDisableActions];
+  [CATransaction setValue:[NSNumber numberWithFloat:0.0f] forKey:kCATransactionAnimationDuration];
+  [CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions];
   [wrapperLayer setBounds:CGRectMake(0, 0, aWidth, aHeight)];
-  [wrapperLayer setPosition:CGPointMake(aWidth/2.0, aHeight/2.0)];
+  [wrapperLayer setPosition:CGPointMake(aWidth / 2.0, aHeight / 2.0)];
   [pluginLayer setBounds:CGRectMake(0, 0, aWidth, aHeight)];
   [pluginLayer setFrame:CGRectMake(0, 0, aWidth, aHeight)];
   caRenderer.bounds = CGRectMake(0, 0, aWidth * intScaleFactor, aHeight * intScaleFactor);
   if (mContentsScaleFactor != 1.0) {
     CGAffineTransform affineTransform = [wrapperLayer affineTransform];
     affineTransform.a = mContentsScaleFactor;
     affineTransform.d = mContentsScaleFactor;
-    affineTransform.tx = ((double)aWidth)/mContentsScaleFactor;
-    affineTransform.ty = ((double)aHeight)/mContentsScaleFactor;
+    affineTransform.tx = ((double)aWidth) / mContentsScaleFactor;
+    affineTransform.ty = ((double)aHeight) / mContentsScaleFactor;
     [wrapperLayer setAffineTransform:affineTransform];
   } else {
     // These settings are the default values.  But they might have been
     // changed as above if we were previously running in a HiDPI mode
     // (i.e. if we just switched from that to a non-HiDPI mode).
     [wrapperLayer setAffineTransform:CGAffineTransformIdentity];
   }
   [CATransaction commit];
@@ -324,46 +303,44 @@ void nsCARenderer::SetBounds(int aWidth,
 void nsCARenderer::SetViewport(int aWidth, int aHeight) {
   size_t intScaleFactor = ceil(mContentsScaleFactor);
   aWidth *= intScaleFactor;
   aHeight *= intScaleFactor;
 
   ::glViewport(0.0, 0.0, aWidth, aHeight);
   ::glMatrixMode(GL_PROJECTION);
   ::glLoadIdentity();
-  ::glOrtho (0.0, aWidth, 0.0, aHeight, -1, 1);
+  ::glOrtho(0.0, aWidth, 0.0, aHeight, -1, 1);
 
   // Render upside down to speed up CGContextDrawImage
   ::glTranslatef(0.0f, aHeight, 0.0);
   ::glScalef(1.0, -1.0, 1.0);
 }
 
-void nsCARenderer::AttachIOSurface(MacIOSurface *aSurface) {
-  if (mIOSurface &&
-      aSurface->GetIOSurfaceID() == mIOSurface->GetIOSurfaceID()) {
+void nsCARenderer::AttachIOSurface(MacIOSurface* aSurface) {
+  if (mIOSurface && aSurface->GetIOSurfaceID() == mIOSurface->GetIOSurfaceID()) {
     return;
   }
 
   mIOSurface = aSurface;
 
   // Update the framebuffer and viewport
   if (mCARenderer) {
     CARenderer* caRenderer = (CARenderer*)mCARenderer;
     size_t intScaleFactor = ceil(mContentsScaleFactor);
     int width = caRenderer.bounds.size.width / intScaleFactor;
     int height = caRenderer.bounds.size.height / intScaleFactor;
 
     CGLContextObj oldContext = ::CGLGetCurrentContext();
     ::CGLSetCurrentContext(mOpenGLContext);
     ::glBindTexture(GL_TEXTURE_RECTANGLE_ARB, mIOTexture);
-    MacIOSurfaceLib::CGLTexImageIOSurface2D(mOpenGLContext, GL_TEXTURE_RECTANGLE_ARB,
-                                           GL_RGBA, mIOSurface->GetDevicePixelWidth(),
-                                           mIOSurface->GetDevicePixelHeight(),
-                                           GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
-                                           mIOSurface->mIOSurfacePtr, 0);
+    MacIOSurfaceLib::CGLTexImageIOSurface2D(
+        mOpenGLContext, GL_TEXTURE_RECTANGLE_ARB, GL_RGBA, mIOSurface->GetDevicePixelWidth(),
+        mIOSurface->GetDevicePixelHeight(), GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
+        mIOSurface->mIOSurfacePtr, 0);
     ::glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
 
     // Rebind the FBO to make it live
     ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mFBO);
 
     if (static_cast<int>(mIOSurface->GetWidth()) != width ||
         static_cast<int>(mIOSurface->GetHeight()) != height) {
       width = mIOSurface->GetWidth();
@@ -381,29 +358,27 @@ void nsCARenderer::AttachIOSurface(MacIO
 IOSurfaceID nsCARenderer::GetIOSurfaceID() {
   if (!mIOSurface) {
     return 0;
   }
 
   return mIOSurface->GetIOSurfaceID();
 }
 
-nsresult nsCARenderer::Render(int aWidth, int aHeight, 
-                              double aContentsScaleFactor,
-                              CGImageRef *aOutCGImage) {
+nsresult nsCARenderer::Render(int aWidth, int aHeight, double aContentsScaleFactor,
+                              CGImageRef* aOutCGImage) {
   if (!aOutCGImage && !mIOSurface) {
     NS_ERROR("No target destination for rendering");
   } else if (aOutCGImage) {
     // We are expected to return a CGImageRef, we will set
     // it to nullptr in case we fail before the image is ready.
     *aOutCGImage = nullptr;
   }
 
-  if (aWidth == 0 || aHeight == 0 || aContentsScaleFactor <= 0)
-    return NS_OK;
+  if (aWidth == 0 || aHeight == 0 || aContentsScaleFactor <= 0) return NS_OK;
 
   if (!mCARenderer || !mWrapperCALayer) {
     return NS_ERROR_FAILURE;
   }
 
   CARenderer* caRenderer = (CARenderer*)mCARenderer;
   CALayer* wrapperLayer = (CALayer*)mWrapperCALayer;
   size_t intScaleFactor = ceil(aContentsScaleFactor);
@@ -412,25 +387,25 @@ nsresult nsCARenderer::Render(int aWidth
 
   if (renderer_width != aWidth || renderer_height != aHeight ||
       mContentsScaleFactor != aContentsScaleFactor) {
     // XXX: This should be optimized to not rescale the buffer
     //      if we are resizing down.
     // caLayer may be the CALayer* provided by the plugin, so we need to
     // preserve it across the call to Destroy().
     NSArray* sublayers = [wrapperLayer sublayers];
-    CALayer* caLayer = (CALayer*) [sublayers objectAtIndex:0];
+    CALayer* caLayer = (CALayer*)[sublayers objectAtIndex:0];
     // mIOSurface is set by AttachIOSurface(), not by SetupRenderer().  So
     // since it may have been set by a prior call to AttachIOSurface(), we
     // need to preserve it across the call to Destroy().
     RefPtr<MacIOSurface> ioSurface = mIOSurface;
     Destroy();
     mIOSurface = ioSurface;
-    if (SetupRenderer(caLayer, aWidth, aHeight, aContentsScaleFactor,
-                      mAllowOfflineRenderer) != NS_OK) {
+    if (SetupRenderer(caLayer, aWidth, aHeight, aContentsScaleFactor, mAllowOfflineRenderer) !=
+        NS_OK) {
       return NS_ERROR_FAILURE;
     }
 
     caRenderer = (CARenderer*)mCARenderer;
   }
 
   CGLContextObj oldContext = ::CGLGetCurrentContext();
   ::CGLSetCurrentContext(mOpenGLContext);
@@ -439,174 +414,163 @@ nsresult nsCARenderer::Render(int aWidth
     // texture for readback.
     ::glGenTextures(1, &mFBOTexture);
   }
 
   GLenum result = ::glGetError();
   if (result != GL_NO_ERROR) {
     NS_ERROR("Unexpected OpenGL Error");
     Destroy();
-    if (oldContext)
-      ::CGLSetCurrentContext(oldContext);
+    if (oldContext) ::CGLSetCurrentContext(oldContext);
     return NS_ERROR_FAILURE;
   }
 
   ::glClearColor(0.0, 0.0, 0.0, 0.0);
   ::glClear(GL_COLOR_BUFFER_BIT);
 
   [CATransaction commit];
   double caTime = ::CACurrentMediaTime();
   [caRenderer beginFrameAtTime:caTime timeStamp:nullptr];
-  [caRenderer addUpdateRect:CGRectMake(0,0, aWidth * intScaleFactor,
-                                       aHeight * intScaleFactor)];
+  [caRenderer addUpdateRect:CGRectMake(0, 0, aWidth * intScaleFactor, aHeight * intScaleFactor)];
   [caRenderer render];
   [caRenderer endFrame];
 
   // Read the data back either to the IOSurface or mCGImage.
   if (mIOSurface) {
     ::glFlush();
   } else {
     ::glPixelStorei(GL_PACK_ALIGNMENT, 4);
     ::glPixelStorei(GL_PACK_ROW_LENGTH, 0);
     ::glPixelStorei(GL_PACK_SKIP_ROWS, 0);
     ::glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
 
-    ::glReadPixels(0.0f, 0.0f, aWidth * intScaleFactor,
-                        aHeight * intScaleFactor,
-                        GL_BGRA, GL_UNSIGNED_BYTE,
-                        mCGData);
+    ::glReadPixels(0.0f, 0.0f, aWidth * intScaleFactor, aHeight * intScaleFactor, GL_BGRA,
+                   GL_UNSIGNED_BYTE, mCGData);
 
     *aOutCGImage = mCGImage;
   }
 
   if (oldContext) {
     ::CGLSetCurrentContext(oldContext);
   }
 
   return NS_OK;
 }
 
-nsresult nsCARenderer::DrawSurfaceToCGContext(CGContextRef aContext, 
-                                              MacIOSurface *surf, 
-                                              CGColorSpaceRef aColorSpace,
-                                              int aX, int aY,
+nsresult nsCARenderer::DrawSurfaceToCGContext(CGContextRef aContext, MacIOSurface* surf,
+                                              CGColorSpaceRef aColorSpace, int aX, int aY,
                                               size_t aWidth, size_t aHeight) {
   surf->Lock();
   size_t bytesPerRow = surf->GetBytesPerRow();
   size_t ioWidth = surf->GetWidth();
   size_t ioHeight = surf->GetHeight();
 
   // We get rendering glitches if we use a width/height that falls
   // outside of the IOSurface.
-  if (aWidth + aX > ioWidth) 
-    aWidth = ioWidth - aX;
-  if (aHeight + aY > ioHeight) 
-    aHeight = ioHeight - aY;
+  if (aWidth + aX > ioWidth) aWidth = ioWidth - aX;
+  if (aHeight + aY > ioHeight) aHeight = ioHeight - aY;
 
-  if (aX < 0 || static_cast<size_t>(aX) >= ioWidth ||
-      aY < 0 || static_cast<size_t>(aY) >= ioHeight) {
+  if (aX < 0 || static_cast<size_t>(aX) >= ioWidth || aY < 0 ||
+      static_cast<size_t>(aY) >= ioHeight) {
     surf->Unlock();
     return NS_ERROR_FAILURE;
   }
 
   void* ioData = surf->GetBaseAddress();
   double scaleFactor = surf->GetContentsScaleFactor();
   size_t intScaleFactor = ceil(surf->GetContentsScaleFactor());
-  CGDataProviderRef dataProvider = ::CGDataProviderCreateWithData(ioData,
-                                      ioData, ioHeight*intScaleFactor*(bytesPerRow)*4, 
-                                      nullptr); //No release callback 
+  CGDataProviderRef dataProvider =
+      ::CGDataProviderCreateWithData(ioData, ioData, ioHeight * intScaleFactor * (bytesPerRow)*4,
+                                     nullptr);  // No release callback
   if (!dataProvider) {
     surf->Unlock();
     return NS_ERROR_FAILURE;
   }
 
-  CGImageRef cgImage = ::CGImageCreate(ioWidth * intScaleFactor,
-              ioHeight * intScaleFactor, 8, 32, bytesPerRow, aColorSpace,
-              kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host,
-              dataProvider, nullptr, true, kCGRenderingIntentDefault);
+  CGImageRef cgImage =
+      ::CGImageCreate(ioWidth * intScaleFactor, ioHeight * intScaleFactor, 8, 32, bytesPerRow,
+                      aColorSpace, kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host,
+                      dataProvider, nullptr, true, kCGRenderingIntentDefault);
   ::CGDataProviderRelease(dataProvider);
   if (!cgImage) {
     surf->Unlock();
     return NS_ERROR_FAILURE;
   }
-  CGImageRef subImage = ::CGImageCreateWithImageInRect(cgImage,
-                                       ::CGRectMake(aX * scaleFactor,
-                                                    aY * scaleFactor,
-                                                    aWidth * scaleFactor,
-                                                    aHeight * scaleFactor));
+  CGImageRef subImage = ::CGImageCreateWithImageInRect(
+      cgImage, ::CGRectMake(aX * scaleFactor, aY * scaleFactor, aWidth * scaleFactor,
+                            aHeight * scaleFactor));
   if (!subImage) {
     ::CGImageRelease(cgImage);
     surf->Unlock();
     return NS_ERROR_FAILURE;
   }
 
   ::CGContextScaleCTM(aContext, 1.0f, -1.0f);
-  ::CGContextDrawImage(aContext, 
-                       CGRectMake(aX * scaleFactor,
-                                  (-(CGFloat)aY - (CGFloat)aHeight) * scaleFactor, 
-                                  aWidth * scaleFactor,
-                                  aHeight * scaleFactor), 
+  ::CGContextDrawImage(aContext,
+                       CGRectMake(aX * scaleFactor, (-(CGFloat)aY - (CGFloat)aHeight) * scaleFactor,
+                                  aWidth * scaleFactor, aHeight * scaleFactor),
                        subImage);
 
   ::CGImageRelease(subImage);
   ::CGImageRelease(cgImage);
   surf->Unlock();
   return NS_OK;
 }
 
 void nsCARenderer::DetachCALayer() {
   CALayer* wrapperLayer = (CALayer*)mWrapperCALayer;
   NSArray* sublayers = [wrapperLayer sublayers];
-  CALayer* oldLayer = (CALayer*) [sublayers objectAtIndex:0];
+  CALayer* oldLayer = (CALayer*)[sublayers objectAtIndex:0];
   [oldLayer removeFromSuperlayer];
 }
 
-void nsCARenderer::AttachCALayer(void *aCALayer) {
+void nsCARenderer::AttachCALayer(void* aCALayer) {
   CALayer* wrapperLayer = (CALayer*)mWrapperCALayer;
   NSArray* sublayers = [wrapperLayer sublayers];
-  CALayer* oldLayer = (CALayer*) [sublayers objectAtIndex:0];
+  CALayer* oldLayer = (CALayer*)[sublayers objectAtIndex:0];
   [oldLayer removeFromSuperlayer];
   [wrapperLayer addSublayer:(CALayer*)aCALayer];
 }
 
 #ifdef DEBUG
 
 int sSaveToDiskSequence = 0;
-void nsCARenderer::SaveToDisk(MacIOSurface *surf) {
+void nsCARenderer::SaveToDisk(MacIOSurface* surf) {
   surf->Lock();
   size_t bytesPerRow = surf->GetBytesPerRow();
   size_t ioWidth = surf->GetWidth();
   size_t ioHeight = surf->GetHeight();
   void* ioData = surf->GetBaseAddress();
-  CGDataProviderRef dataProvider = ::CGDataProviderCreateWithData(ioData,
-                                      ioData, ioHeight*(bytesPerRow)*4, 
-                                      nullptr); //No release callback 
+  CGDataProviderRef dataProvider =
+      ::CGDataProviderCreateWithData(ioData, ioData, ioHeight * (bytesPerRow)*4,
+                                     nullptr);  // No release callback
   if (!dataProvider) {
     surf->Unlock();
     return;
   }
 
   CGColorSpaceRef colorSpace = CreateSystemColorSpace();
-  CGImageRef cgImage = ::CGImageCreate(ioWidth, ioHeight, 8, 32, bytesPerRow,
-              colorSpace, kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host,
-              dataProvider, nullptr, true, kCGRenderingIntentDefault);
+  CGImageRef cgImage = ::CGImageCreate(ioWidth, ioHeight, 8, 32, bytesPerRow, colorSpace,
+                                       kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host,
+                                       dataProvider, nullptr, true, kCGRenderingIntentDefault);
   ::CGDataProviderRelease(dataProvider);
   ::CGColorSpaceRelease(colorSpace);
   if (!cgImage) {
     surf->Unlock();
     return;
   }
 
   char cstr[1000];
   SprintfLiteral(cstr, "file:///Users/benoitgirard/debug/iosurface_%i.png", ++sSaveToDiskSequence);
 
-  CFStringRef cfStr = ::CFStringCreateWithCString(kCFAllocatorDefault, cstr, kCFStringEncodingMacRoman);
+  CFStringRef cfStr =
+      ::CFStringCreateWithCString(kCFAllocatorDefault, cstr, kCFStringEncodingMacRoman);
 
   printf("Exporting: %s\n", cstr);
-  CFURLRef url = ::CFURLCreateWithString( nullptr, cfStr, nullptr);
+  CFURLRef url = ::CFURLCreateWithString(nullptr, cfStr, nullptr);
   ::CFRelease(cfStr);
 
   CFStringRef type = kUTTypePNG;
   size_t count = 1;
   CFDictionaryRef options = nullptr;
   CGImageDestinationRef dest = ::CGImageDestinationCreateWithURL(url, type, count, options);
   ::CFRelease(url);
 
@@ -614,12 +578,11 @@ void nsCARenderer::SaveToDisk(MacIOSurfa
 
   ::CGImageDestinationFinalize(dest);
   ::CFRelease(dest);
   ::CGImageRelease(cgImage);
 
   surf->Unlock();
 
   return;
-
 }
 
 #endif
--- a/gfx/gl/GLContextProviderCGL.mm
+++ b/gfx/gl/GLContextProviderCGL.mm
@@ -23,372 +23,301 @@
 // #define EMULATE_VM
 
 namespace mozilla {
 namespace gl {
 
 using namespace mozilla::gfx;
 using namespace mozilla::widget;
 
-class CGLLibrary
-{
-public:
-    bool EnsureInitialized()
-    {
-        if (mInitialized) {
-            return true;
-        }
-        if (!mOGLLibrary) {
-            mOGLLibrary = PR_LoadLibrary("/System/Library/Frameworks/OpenGL.framework/OpenGL");
-            if (!mOGLLibrary) {
-                NS_WARNING("Couldn't load OpenGL Framework.");
-                return false;
-            }
-        }
-
-        const char* db = PR_GetEnv("MOZ_CGL_DB");
-        if (db) {
-            mUseDoubleBufferedWindows = *db != '0';
-        }
-
-        mInitialized = true;
-        return true;
+class CGLLibrary {
+ public:
+  bool EnsureInitialized() {
+    if (mInitialized) {
+      return true;
+    }
+    if (!mOGLLibrary) {
+      mOGLLibrary = PR_LoadLibrary("/System/Library/Frameworks/OpenGL.framework/OpenGL");
+      if (!mOGLLibrary) {
+        NS_WARNING("Couldn't load OpenGL Framework.");
+        return false;
+      }
     }
 
-    bool UseDoubleBufferedWindows() const {
-        MOZ_ASSERT(mInitialized);
-        return mUseDoubleBufferedWindows;
+    const char* db = PR_GetEnv("MOZ_CGL_DB");
+    if (db) {
+      mUseDoubleBufferedWindows = *db != '0';
     }
 
-private:
-    bool mInitialized = false;
-    bool mUseDoubleBufferedWindows = true;
-    PRLibrary* mOGLLibrary = nullptr;
+    mInitialized = true;
+    return true;
+  }
+
+  bool UseDoubleBufferedWindows() const {
+    MOZ_ASSERT(mInitialized);
+    return mUseDoubleBufferedWindows;
+  }
+
+ private:
+  bool mInitialized = false;
+  bool mUseDoubleBufferedWindows = true;
+  PRLibrary* mOGLLibrary = nullptr;
 };
 
 CGLLibrary sCGLLibrary;
 
 GLContextCGL::GLContextCGL(CreateContextFlags flags, const SurfaceCaps& caps,
                            NSOpenGLContext* context, bool isOffscreen)
-    : GLContext(flags, caps, nullptr, isOffscreen)
-    , mContext(context)
-{
+    : GLContext(flags, caps, nullptr, isOffscreen), mContext(context) {}
+
+GLContextCGL::~GLContextCGL() {
+  MarkDestroyed();
+
+  if (mContext) {
+    if ([NSOpenGLContext currentContext] == mContext) {
+      // Clear the current context before releasing. If we don't do
+      // this, the next time we call [NSOpenGLContext currentContext],
+      // "invalid context" will be printed to the console.
+      [NSOpenGLContext clearCurrentContext];
+    }
+    [mContext release];
+  }
 }
 
-GLContextCGL::~GLContextCGL()
-{
-    MarkDestroyed();
+bool GLContextCGL::Init() {
+  if (!InitWithPrefix("gl", true)) return false;
 
-    if (mContext) {
-        if ([NSOpenGLContext currentContext] == mContext) {
-            // Clear the current context before releasing. If we don't do
-            // this, the next time we call [NSOpenGLContext currentContext],
-            // "invalid context" will be printed to the console.
-            [NSOpenGLContext clearCurrentContext];
-        }
-        [mContext release];
-    }
+  return true;
 }
 
-bool
-GLContextCGL::Init()
-{
-    if (!InitWithPrefix("gl", true))
-        return false;
-
-    return true;
-}
-
-CGLContextObj
-GLContextCGL::GetCGLContext() const
-{
-    return static_cast<CGLContextObj>([mContext CGLContextObj]);
+CGLContextObj GLContextCGL::GetCGLContext() const {
+  return static_cast<CGLContextObj>([mContext CGLContextObj]);
 }
 
-bool
-GLContextCGL::MakeCurrentImpl() const
-{
-    if (mContext) {
-        [mContext makeCurrentContext];
-        MOZ_ASSERT(IsCurrentImpl());
-        // Use non-blocking swap in "ASAP mode".
-        // ASAP mode means that rendering is iterated as fast as possible.
-        // ASAP mode is entered when layout.frame_rate=0 (requires restart).
-        // If swapInt is 1, then glSwapBuffers will block and wait for a vblank signal.
-        // When we're iterating as fast as possible, however, we want a non-blocking
-        // glSwapBuffers, which will happen when swapInt==0.
-        GLint swapInt = gfxPrefs::LayoutFrameRate() == 0 ? 0 : 1;
-        [mContext setValues:&swapInt forParameter:NSOpenGLCPSwapInterval];
-    }
-    return true;
+bool GLContextCGL::MakeCurrentImpl() const {
+  if (mContext) {
+    [mContext makeCurrentContext];
+    MOZ_ASSERT(IsCurrentImpl());
+    // Use non-blocking swap in "ASAP mode".
+    // ASAP mode means that rendering is iterated as fast as possible.
+    // ASAP mode is entered when layout.frame_rate=0 (requires restart).
+    // If swapInt is 1, then glSwapBuffers will block and wait for a vblank signal.
+    // When we're iterating as fast as possible, however, we want a non-blocking
+    // glSwapBuffers, which will happen when swapInt==0.
+    GLint swapInt = gfxPrefs::LayoutFrameRate() == 0 ? 0 : 1;
+    [mContext setValues:&swapInt forParameter:NSOpenGLCPSwapInterval];
+  }
+  return true;
 }
 
-bool
-GLContextCGL::IsCurrentImpl() const
-{
-    return [NSOpenGLContext currentContext] == mContext;
-}
+bool GLContextCGL::IsCurrentImpl() const { return [NSOpenGLContext currentContext] == mContext; }
 
-GLenum
-GLContextCGL::GetPreferredARGB32Format() const
-{
-    return LOCAL_GL_BGRA;
-}
+GLenum GLContextCGL::GetPreferredARGB32Format() const { return LOCAL_GL_BGRA; }
 
-bool
-GLContextCGL::SetupLookupFunction()
-{
-    return false;
-}
+bool GLContextCGL::SetupLookupFunction() { return false; }
 
-bool
-GLContextCGL::IsDoubleBuffered() const
-{
-  return sCGLLibrary.UseDoubleBufferedWindows();
-}
+bool GLContextCGL::IsDoubleBuffered() const { return sCGLLibrary.UseDoubleBufferedWindows(); }
 
-bool
-GLContextCGL::SwapBuffers()
-{
+bool GLContextCGL::SwapBuffers() {
   AUTO_PROFILER_LABEL("GLContextCGL::SwapBuffers", GRAPHICS);
 
   [mContext flushBuffer];
   return true;
 }
 
-void
-GLContextCGL::GetWSIInfo(nsCString* const out) const
-{
-    out->AppendLiteral("CGL");
-}
+void GLContextCGL::GetWSIInfo(nsCString* const out) const { out->AppendLiteral("CGL"); }
 
-already_AddRefed<GLContext>
-GLContextProviderCGL::CreateWrappingExisting(void*, void*)
-{
-    return nullptr;
+already_AddRefed<GLContext> GLContextProviderCGL::CreateWrappingExisting(void*, void*) {
+  return nullptr;
 }
 
 static const NSOpenGLPixelFormatAttribute kAttribs_singleBuffered[] = {
-    NSOpenGLPFAAllowOfflineRenderers,
-    0
-};
+    NSOpenGLPFAAllowOfflineRenderers, 0};
 
 static const NSOpenGLPixelFormatAttribute kAttribs_singleBuffered_accel[] = {
-    NSOpenGLPFAAccelerated,
-    NSOpenGLPFAAllowOfflineRenderers,
-    0
-};
+    NSOpenGLPFAAccelerated, NSOpenGLPFAAllowOfflineRenderers, 0};
 
 static const NSOpenGLPixelFormatAttribute kAttribs_doubleBuffered[] = {
-    NSOpenGLPFAAllowOfflineRenderers,
-    NSOpenGLPFADoubleBuffer,
-    0
-};
+    NSOpenGLPFAAllowOfflineRenderers, NSOpenGLPFADoubleBuffer, 0};
 
 static const NSOpenGLPixelFormatAttribute kAttribs_doubleBuffered_accel[] = {
-    NSOpenGLPFAAccelerated,
-    NSOpenGLPFAAllowOfflineRenderers,
-    NSOpenGLPFADoubleBuffer,
-    0
-};
+    NSOpenGLPFAAccelerated, NSOpenGLPFAAllowOfflineRenderers, NSOpenGLPFADoubleBuffer, 0};
 
 static const NSOpenGLPixelFormatAttribute kAttribs_doubleBuffered_accel_webrender[] = {
     NSOpenGLPFAAccelerated,
     NSOpenGLPFAAllowOfflineRenderers,
     NSOpenGLPFADoubleBuffer,
     NSOpenGLPFAOpenGLProfile,
     NSOpenGLProfileVersion3_2Core,
-    NSOpenGLPFADepthSize, 24,
-    0
-};
+    NSOpenGLPFADepthSize,
+    24,
+    0};
 
-static NSOpenGLContext*
-CreateWithFormat(const NSOpenGLPixelFormatAttribute* attribs)
-{
-    NSOpenGLPixelFormat* format = [[NSOpenGLPixelFormat alloc]
-                                   initWithAttributes:attribs];
-    if (!format) {
-        NS_WARNING("Failed to create NSOpenGLPixelFormat.");
-        return nullptr;
-    }
+static NSOpenGLContext* CreateWithFormat(const NSOpenGLPixelFormatAttribute* attribs) {
+  NSOpenGLPixelFormat* format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attribs];
+  if (!format) {
+    NS_WARNING("Failed to create NSOpenGLPixelFormat.");
+    return nullptr;
+  }
 
-    NSOpenGLContext* context = [[NSOpenGLContext alloc] initWithFormat:format
-                                shareContext:nullptr];
+  NSOpenGLContext* context = [[NSOpenGLContext alloc] initWithFormat:format shareContext:nullptr];
 
-    [format release];
+  [format release];
 
-    return context;
+  return context;
 }
 
-already_AddRefed<GLContext>
-GLContextProviderCGL::CreateForCompositorWidget(CompositorWidget* aCompositorWidget, bool aForceAccelerated)
-{
-    return CreateForWindow(aCompositorWidget->RealWidget(),
-                           aCompositorWidget->GetCompositorOptions().UseWebRender(),
-                           aForceAccelerated);
+already_AddRefed<GLContext> GLContextProviderCGL::CreateForCompositorWidget(
+    CompositorWidget* aCompositorWidget, bool aForceAccelerated) {
+  return CreateForWindow(aCompositorWidget->RealWidget(),
+                         aCompositorWidget->GetCompositorOptions().UseWebRender(),
+                         aForceAccelerated);
 }
 
-already_AddRefed<GLContext>
-GLContextProviderCGL::CreateForWindow(nsIWidget* aWidget,
-                                      bool aWebRender,
-                                      bool aForceAccelerated)
-{
-    if (!sCGLLibrary.EnsureInitialized()) {
-        return nullptr;
-    }
+already_AddRefed<GLContext> GLContextProviderCGL::CreateForWindow(nsIWidget* aWidget,
+                                                                  bool aWebRender,
+                                                                  bool aForceAccelerated) {
+  if (!sCGLLibrary.EnsureInitialized()) {
+    return nullptr;
+  }
 
 #ifdef EMULATE_VM
-    if (aForceAccelerated) {
-        return nullptr;
-    }
+  if (aForceAccelerated) {
+    return nullptr;
+  }
 #endif
 
-    const NSOpenGLPixelFormatAttribute* attribs;
-    if (sCGLLibrary.UseDoubleBufferedWindows()) {
-        if (aWebRender) {
-            attribs = aForceAccelerated ? kAttribs_doubleBuffered_accel_webrender : kAttribs_doubleBuffered;
-        } else {
-            attribs = aForceAccelerated ? kAttribs_doubleBuffered_accel : kAttribs_doubleBuffered;
-        }
+  const NSOpenGLPixelFormatAttribute* attribs;
+  if (sCGLLibrary.UseDoubleBufferedWindows()) {
+    if (aWebRender) {
+      attribs =
+          aForceAccelerated ? kAttribs_doubleBuffered_accel_webrender : kAttribs_doubleBuffered;
     } else {
-        attribs = aForceAccelerated ? kAttribs_singleBuffered_accel : kAttribs_singleBuffered;
+      attribs = aForceAccelerated ? kAttribs_doubleBuffered_accel : kAttribs_doubleBuffered;
     }
-    NSOpenGLContext* context = CreateWithFormat(attribs);
-    if (!context) {
-        return nullptr;
-    }
+  } else {
+    attribs = aForceAccelerated ? kAttribs_singleBuffered_accel : kAttribs_singleBuffered;
+  }
+  NSOpenGLContext* context = CreateWithFormat(attribs);
+  if (!context) {
+    return nullptr;
+  }
 
-    GLint opaque = gfxPrefs::CompositorGLContextOpaque();
-    [context setValues:&opaque forParameter:NSOpenGLCPSurfaceOpacity];
+  GLint opaque = gfxPrefs::CompositorGLContextOpaque();
+  [context setValues:&opaque forParameter:NSOpenGLCPSurfaceOpacity];
 
-    RefPtr<GLContextCGL> glContext = new GLContextCGL(CreateContextFlags::NONE,
-                                                      SurfaceCaps::ForRGBA(), context,
-                                                      false);
+  RefPtr<GLContextCGL> glContext =
+      new GLContextCGL(CreateContextFlags::NONE, SurfaceCaps::ForRGBA(), context, false);
 
-    if (!glContext->Init()) {
-        glContext = nullptr;
-        [context release];
-        return nullptr;
-    }
+  if (!glContext->Init()) {
+    glContext = nullptr;
+    [context release];
+    return nullptr;
+  }
 
-    return glContext.forget();
+  return glContext.forget();
 }
 
-static already_AddRefed<GLContextCGL>
-CreateOffscreenFBOContext(CreateContextFlags flags)
-{
-    if (!sCGLLibrary.EnsureInitialized()) {
-        return nullptr;
-    }
+static already_AddRefed<GLContextCGL> CreateOffscreenFBOContext(CreateContextFlags flags) {
+  if (!sCGLLibrary.EnsureInitialized()) {
+    return nullptr;
+  }
 
-    NSOpenGLContext* context = nullptr;
+  NSOpenGLContext* context = nullptr;
 
-    std::vector<NSOpenGLPixelFormatAttribute> attribs;
+  std::vector<NSOpenGLPixelFormatAttribute> attribs;
 
-    if (flags & CreateContextFlags::ALLOW_OFFLINE_RENDERER ||
-        !(flags & CreateContextFlags::HIGH_POWER))
-    {
-        // This is really poorly named on Apple's part, but "AllowOfflineRenderers" means
-        // that we want to allow running on the iGPU instead of requiring the dGPU.
-        attribs.push_back(NSOpenGLPFAAllowOfflineRenderers);
-    }
+  if (flags & CreateContextFlags::ALLOW_OFFLINE_RENDERER ||
+      !(flags & CreateContextFlags::HIGH_POWER)) {
+    // This is really poorly named on Apple's part, but "AllowOfflineRenderers" means
+    // that we want to allow running on the iGPU instead of requiring the dGPU.
+    attribs.push_back(NSOpenGLPFAAllowOfflineRenderers);
+  }
 
-    if (gfxPrefs::RequireHardwareGL()) {
-        attribs.push_back(NSOpenGLPFAAccelerated);
-    }
+  if (gfxPrefs::RequireHardwareGL()) {
+    attribs.push_back(NSOpenGLPFAAccelerated);
+  }
 
-    if (!(flags & CreateContextFlags::REQUIRE_COMPAT_PROFILE)) {
-        auto coreAttribs = attribs;
-        coreAttribs.push_back(NSOpenGLPFAOpenGLProfile);
-        coreAttribs.push_back(NSOpenGLProfileVersion3_2Core);
-        coreAttribs.push_back(0);
-        context = CreateWithFormat(coreAttribs.data());
-    }
-
-    if (!context) {
-        attribs.push_back(0);
-        context = CreateWithFormat(attribs.data());
-    }
+  if (!(flags & CreateContextFlags::REQUIRE_COMPAT_PROFILE)) {
+    auto coreAttribs = attribs;
+    coreAttribs.push_back(NSOpenGLPFAOpenGLProfile);
+    coreAttribs.push_back(NSOpenGLProfileVersion3_2Core);
+    coreAttribs.push_back(0);
+    context = CreateWithFormat(coreAttribs.data());
+  }
 
-    if (!context) {
-        NS_WARNING("Failed to create NSOpenGLContext.");
-        return nullptr;
-    }
+  if (!context) {
+    attribs.push_back(0);
+    context = CreateWithFormat(attribs.data());
+  }
 
-    RefPtr<GLContextCGL> glContext = new GLContextCGL(flags, SurfaceCaps::Any(), context,
-                                                      true);
+  if (!context) {
+    NS_WARNING("Failed to create NSOpenGLContext.");
+    return nullptr;
+  }
 
-    if (gfxPrefs::GLMultithreaded()) {
-        CGLEnable(glContext->GetCGLContext(), kCGLCEMPEngine);
-    }
-    return glContext.forget();
+  RefPtr<GLContextCGL> glContext = new GLContextCGL(flags, SurfaceCaps::Any(), context, true);
+
+  if (gfxPrefs::GLMultithreaded()) {
+    CGLEnable(glContext->GetCGLContext(), kCGLCEMPEngine);
+  }
+  return glContext.forget();
 }
 
-already_AddRefed<GLContext>
-GLContextProviderCGL::CreateHeadless(CreateContextFlags flags,
-                                     nsACString* const out_failureId)
-{
-    RefPtr<GLContextCGL> gl;
-    gl = CreateOffscreenFBOContext(flags);
-    if (!gl) {
-        *out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_CGL_FBO");
-        return nullptr;
-    }
+already_AddRefed<GLContext> GLContextProviderCGL::CreateHeadless(CreateContextFlags flags,
+                                                                 nsACString* const out_failureId) {
+  RefPtr<GLContextCGL> gl;
+  gl = CreateOffscreenFBOContext(flags);
+  if (!gl) {
+    *out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_CGL_FBO");
+    return nullptr;
+  }
 
-    if (!gl->Init()) {
-        *out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_CGL_INIT");
-        NS_WARNING("Failed during Init.");
-        return nullptr;
-    }
+  if (!gl->Init()) {
+    *out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_CGL_INIT");
+    NS_WARNING("Failed during Init.");
+    return nullptr;
+  }
 
-    return gl.forget();
+  return gl.forget();
 }
 
-already_AddRefed<GLContext>
-GLContextProviderCGL::CreateOffscreen(const IntSize& size,
-                                      const SurfaceCaps& minCaps,
-                                      CreateContextFlags flags,
-                                      nsACString* const out_failureId)
-{
-    RefPtr<GLContext> gl = CreateHeadless(flags, out_failureId);
-    if (!gl) {
-        return nullptr;
-    }
+already_AddRefed<GLContext> GLContextProviderCGL::CreateOffscreen(const IntSize& size,
+                                                                  const SurfaceCaps& minCaps,
+                                                                  CreateContextFlags flags,
+                                                                  nsACString* const out_failureId) {
+  RefPtr<GLContext> gl = CreateHeadless(flags, out_failureId);
+  if (!gl) {
+    return nullptr;
+  }
 
-    if (!gl->InitOffscreen(size, minCaps)) {
-        *out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_CGL_INIT");
-        return nullptr;
-    }
+  if (!gl->InitOffscreen(size, minCaps)) {
+    *out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_CGL_INIT");
+    return nullptr;
+  }
 
-    return gl.forget();
+  return gl.forget();
 }
 
 static RefPtr<GLContext> gGlobalContext;
 
-GLContext*
-GLContextProviderCGL::GetGlobalContext()
-{
-    static bool triedToCreateContext = false;
-    if (!triedToCreateContext) {
-        triedToCreateContext = true;
+GLContext* GLContextProviderCGL::GetGlobalContext() {
+  static bool triedToCreateContext = false;
+  if (!triedToCreateContext) {
+    triedToCreateContext = true;
 
-        MOZ_RELEASE_ASSERT(!gGlobalContext);
-        nsCString discardFailureId;
-        RefPtr<GLContext> temp = CreateHeadless(CreateContextFlags::NONE,
-                                                &discardFailureId);
-        gGlobalContext = temp;
+    MOZ_RELEASE_ASSERT(!gGlobalContext);
+    nsCString discardFailureId;
+    RefPtr<GLContext> temp = CreateHeadless(CreateContextFlags::NONE, &discardFailureId);
+    gGlobalContext = temp;
 
-        if (!gGlobalContext) {
-            NS_WARNING("Couldn't init gGlobalContext.");
-        }
+    if (!gGlobalContext) {
+      NS_WARNING("Couldn't init gGlobalContext.");
     }
+  }
 
-    return gGlobalContext;
+  return gGlobalContext;
 }
 
-void
-GLContextProviderCGL::Shutdown()
-{
-    gGlobalContext = nullptr;
-}
+void GLContextProviderCGL::Shutdown() { gGlobalContext = nullptr; }
 
 } /* namespace gl */
 } /* namespace mozilla */
--- a/gfx/gl/GLContextProviderEAGL.mm
+++ b/gfx/gl/GLContextProviderEAGL.mm
@@ -18,261 +18,207 @@
 #import <UIKit/UIKit.h>
 
 namespace mozilla {
 namespace gl {
 
 using namespace mozilla::widget;
 
 GLContextEAGL::GLContextEAGL(CreateContextFlags flags, const SurfaceCaps& caps,
-                             EAGLContext* context, GLContext* sharedContext,
-                             bool isOffscreen)
-    : GLContext(flags, caps, sharedContext, isOffscreen)
-    , mContext(context)
-{
+                             EAGLContext* context, GLContext* sharedContext, bool isOffscreen)
+    : GLContext(flags, caps, sharedContext, isOffscreen), mContext(context) {}
+
+GLContextEAGL::~GLContextEAGL() {
+  MakeCurrent();
+
+  if (mBackbufferFB) {
+    fDeleteFramebuffers(1, &mBackbufferFB);
+  }
+
+  if (mBackbufferRB) {
+    fDeleteRenderbuffers(1, &mBackbufferRB);
+  }
+
+  MarkDestroyed();
+
+  if (mLayer) {
+    mLayer = nil;
+  }
+
+  if (mContext) {
+    [EAGLContext setCurrentContext:nil];
+    [mContext release];
+  }
 }
 
-GLContextEAGL::~GLContextEAGL()
-{
-    MakeCurrent();
-
-    if (mBackbufferFB) {
-        fDeleteFramebuffers(1, &mBackbufferFB);
-    }
-
-    if (mBackbufferRB) {
-        fDeleteRenderbuffers(1, &mBackbufferRB);
-    }
-
-    MarkDestroyed();
-
-    if (mLayer) {
-      mLayer = nil;
-    }
-
-    if (mContext) {
-      [EAGLContext setCurrentContext:nil];
-      [mContext release];
-    }
-}
+bool GLContextEAGL::Init() {
+  if (!InitWithPrefix("gl", true)) return false;
 
-bool
-GLContextEAGL::Init()
-{
-    if (!InitWithPrefix("gl", true))
-        return false;
-
-    return true;
-}
-
-bool
-GLContextEAGL::AttachToWindow(nsIWidget* aWidget)
-{
-    // This should only be called once
-    MOZ_ASSERT(!mBackbufferFB && !mBackbufferRB);
-
-    UIView* view =
-        reinterpret_cast<UIView*>(aWidget->GetNativeData(NS_NATIVE_WIDGET));
-
-    if (!view) {
-      MOZ_CRASH("no view!");
-    }
-
-    mLayer = [view layer];
-
-    fGenFramebuffers(1, &mBackbufferFB);
-    return RecreateRB();
+  return true;
 }
 
-bool
-GLContextEAGL::RecreateRB()
-{
-    MakeCurrent();
+bool GLContextEAGL::AttachToWindow(nsIWidget* aWidget) {
+  // This should only be called once
+  MOZ_ASSERT(!mBackbufferFB && !mBackbufferRB);
 
-    CAEAGLLayer* layer = (CAEAGLLayer*)mLayer;
+  UIView* view = reinterpret_cast<UIView*>(aWidget->GetNativeData(NS_NATIVE_WIDGET));
 
-    if (mBackbufferRB) {
-        // It doesn't seem to be enough to just call renderbufferStorage: below,
-        // we apparently have to recreate the RB.
-        fDeleteRenderbuffers(1, &mBackbufferRB);
-        mBackbufferRB = 0;
-    }
+  if (!view) {
+    MOZ_CRASH("no view!");
+  }
 
-    fGenRenderbuffers(1, &mBackbufferRB);
-    fBindRenderbuffer(LOCAL_GL_RENDERBUFFER, mBackbufferRB);
-
-    [mContext renderbufferStorage:LOCAL_GL_RENDERBUFFER
-              fromDrawable:layer];
+  mLayer = [view layer];
 
-    fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, mBackbufferFB);
-    fFramebufferRenderbuffer(LOCAL_GL_FRAMEBUFFER, LOCAL_GL_COLOR_ATTACHMENT0,
-                             LOCAL_GL_RENDERBUFFER, mBackbufferRB);
-
-    return LOCAL_GL_FRAMEBUFFER_COMPLETE == fCheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER);
+  fGenFramebuffers(1, &mBackbufferFB);
+  return RecreateRB();
 }
 
-bool
-GLContextEAGL::MakeCurrentImpl() const
-{
-    if (mContext) {
-        if(![EAGLContext setCurrentContext:mContext]) {
-            return false;
-        }
-    }
-    return true;
+bool GLContextEAGL::RecreateRB() {
+  MakeCurrent();
+
+  CAEAGLLayer* layer = (CAEAGLLayer*)mLayer;
+
+  if (mBackbufferRB) {
+    // It doesn't seem to be enough to just call renderbufferStorage: below,
+    // we apparently have to recreate the RB.
+    fDeleteRenderbuffers(1, &mBackbufferRB);
+    mBackbufferRB = 0;
+  }
+
+  fGenRenderbuffers(1, &mBackbufferRB);
+  fBindRenderbuffer(LOCAL_GL_RENDERBUFFER, mBackbufferRB);
+
+  [mContext renderbufferStorage:LOCAL_GL_RENDERBUFFER fromDrawable:layer];
+
+  fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, mBackbufferFB);
+  fFramebufferRenderbuffer(LOCAL_GL_FRAMEBUFFER, LOCAL_GL_COLOR_ATTACHMENT0, LOCAL_GL_RENDERBUFFER,
+                           mBackbufferRB);
+
+  return LOCAL_GL_FRAMEBUFFER_COMPLETE == fCheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER);
 }
 
-bool
-GLContextEAGL::IsCurrentImpl() const
-{
-    return [EAGLContext currentContext] == mContext;
+bool GLContextEAGL::MakeCurrentImpl() const {
+  if (mContext) {
+    if (![EAGLContext setCurrentContext:mContext]) {
+      return false;
+    }
+  }
+  return true;
 }
 
-bool
-GLContextEAGL::SetupLookupFunction()
-{
-    return false;
-}
+bool GLContextEAGL::IsCurrentImpl() const { return [EAGLContext currentContext] == mContext; }
+
+bool GLContextEAGL::SetupLookupFunction() { return false; }
 
-bool
-GLContextEAGL::IsDoubleBuffered() const
-{
-    return true;
-}
+bool GLContextEAGL::IsDoubleBuffered() const { return true; }
 
-bool
-GLContextEAGL::SwapBuffers()
-{
+bool GLContextEAGL::SwapBuffers() {
   AUTO_PROFILER_LABEL("GLContextEAGL::SwapBuffers", GRAPHICS);
 
   [mContext presentRenderbuffer:LOCAL_GL_RENDERBUFFER];
   return true;
 }
 
-void
-GLContextEAGL::GetWSIInfo(nsCString* const out) const
-{
-    out->AppendLiteral("EAGL");
+void GLContextEAGL::GetWSIInfo(nsCString* const out) const { out->AppendLiteral("EAGL"); }
+
+already_AddRefed<GLContext> GLContextProviderEAGL::CreateWrappingExisting(void*, void*) {
+  return nullptr;
 }
 
-already_AddRefed<GLContext>
-GLContextProviderEAGL::CreateWrappingExisting(void*, void*)
-{
-    return nullptr;
-}
-
-static GLContextEAGL*
-GetGlobalContextEAGL()
-{
-    return static_cast<GLContextEAGL*>(GLContextProviderEAGL::GetGlobalContext());
+static GLContextEAGL* GetGlobalContextEAGL() {
+  return static_cast<GLContextEAGL*>(GLContextProviderEAGL::GetGlobalContext());
 }
 
-static already_AddRefed<GLContext>
-CreateEAGLContext(CreateContextFlags flags, bool aOffscreen, GLContextEAGL* sharedContext)
-{
-    EAGLRenderingAPI apis[] = { kEAGLRenderingAPIOpenGLES3, kEAGLRenderingAPIOpenGLES2 };
+static already_AddRefed<GLContext> CreateEAGLContext(CreateContextFlags flags, bool aOffscreen,
+                                                     GLContextEAGL* sharedContext) {
+  EAGLRenderingAPI apis[] = {kEAGLRenderingAPIOpenGLES3, kEAGLRenderingAPIOpenGLES2};
 
-    // Try to create a GLES3 context if we can, otherwise fall back to GLES2
-    EAGLContext* context = nullptr;
-    for (EAGLRenderingAPI api : apis) {
-        if (sharedContext) {
-            context = [[EAGLContext alloc] initWithAPI:api
-                       sharegroup:sharedContext->GetEAGLContext().sharegroup];
-        } else {
-            context = [[EAGLContext alloc] initWithAPI:api];
-        }
-
-        if (context) {
-            break;
-        }
-    }
-
-    if (!context) {
-        return nullptr;
+  // Try to create a GLES3 context if we can, otherwise fall back to GLES2
+  EAGLContext* context = nullptr;
+  for (EAGLRenderingAPI api : apis) {
+    if (sharedContext) {
+      context = [[EAGLContext alloc] initWithAPI:api
+                                      sharegroup:sharedContext->GetEAGLContext().sharegroup];
+    } else {
+      context = [[EAGLContext alloc] initWithAPI:api];
     }
 
-    RefPtr<GLContextEAGL> glContext = new GLContextEAGL(flags, SurfaceCaps::ForRGBA(),
-                                                        context, sharedContext,
-                                                        aOffscreen);
-    if (!glContext->Init()) {
-        glContext = nullptr;
-        return nullptr;
+    if (context) {
+      break;
     }
+  }
 
-    return glContext.forget();
+  if (!context) {
+    return nullptr;
+  }
+
+  RefPtr<GLContextEAGL> glContext =
+      new GLContextEAGL(flags, SurfaceCaps::ForRGBA(), context, sharedContext, aOffscreen);
+  if (!glContext->Init()) {
+    glContext = nullptr;
+    return nullptr;
+  }
+
+  return glContext.forget();
 }
 
-already_AddRefed<GLContext>
-GLContextProviderEAGL::CreateForCompositorWidget(CompositorWidget* aCompositorWidget, bool aForceAccelerated)
-{
-    return CreateForWindow(aCompositorWidget->RealWidget(),
-                           aCompositorWidget->GetCompositorOptions().UseWebRender(),
-                           aForceAccelerated);
+already_AddRefed<GLContext> GLContextProviderEAGL::CreateForCompositorWidget(
+    CompositorWidget* aCompositorWidget, bool aForceAccelerated) {
+  return CreateForWindow(aCompositorWidget->RealWidget(),
+                         aCompositorWidget->GetCompositorOptions().UseWebRender(),
+                         aForceAccelerated);
 }
 
-already_AddRefed<GLContext>
-GLContextProviderEAGL::CreateForWindow(nsIWidget* aWidget,
-                                       bool aWebRender,
-                                       bool aForceAccelerated)
-{
-    RefPtr<GLContext> glContext = CreateEAGLContext(CreateContextFlags::NONE, false,
-                                                    GetGlobalContextEAGL());
-    if (!glContext) {
-        return nullptr;
-    }
+already_AddRefed<GLContext> GLContextProviderEAGL::CreateForWindow(nsIWidget* aWidget,
+                                                                   bool aWebRender,
+                                                                   bool aForceAccelerated) {
+  RefPtr<GLContext> glContext =
+      CreateEAGLContext(CreateContextFlags::NONE, false, GetGlobalContextEAGL());
+  if (!glContext) {
+    return nullptr;
+  }
 
-    if (!GLContextEAGL::Cast(glContext)->AttachToWindow(aWidget)) {
-        return nullptr;
-    }
+  if (!GLContextEAGL::Cast(glContext)->AttachToWindow(aWidget)) {
+    return nullptr;
+  }
 
-    return glContext.forget();
+  return glContext.forget();
 }
 
-already_AddRefed<GLContext>
-GLContextProviderEAGL::CreateHeadless(CreateContextFlags flags,
-                                      nsACString* const out_failureId)
-{
-    return CreateEAGLContext(flags, true, GetGlobalContextEAGL());
+already_AddRefed<GLContext> GLContextProviderEAGL::CreateHeadless(CreateContextFlags flags,
+                                                                  nsACString* const out_failureId) {
+  return CreateEAGLContext(flags, true, GetGlobalContextEAGL());
 }
 
-already_AddRefed<GLContext>
-GLContextProviderEAGL::CreateOffscreen(const mozilla::gfx::IntSize& size,
-                                       const SurfaceCaps& caps,
-                                       CreateContextFlags flags,
-                                       nsACString* const out_failureId)
-{
-    RefPtr<GLContext> glContext = CreateHeadless(flags, out_failureId);
-    if (!glContext->InitOffscreen(size, caps)) {
-        return nullptr;
-    }
+already_AddRefed<GLContext> GLContextProviderEAGL::CreateOffscreen(
+    const mozilla::gfx::IntSize& size, const SurfaceCaps& caps, CreateContextFlags flags,
+    nsACString* const out_failureId) {
+  RefPtr<GLContext> glContext = CreateHeadless(flags, out_failureId);
+  if (!glContext->InitOffscreen(size, caps)) {
+    return nullptr;
+  }
 
-    return glContext.forget();
+  return glContext.forget();
 }
 
 static RefPtr<GLContext> gGlobalContext;
 
-GLContext*
-GLContextProviderEAGL::GetGlobalContext()
-{
-    static bool triedToCreateContext = false;
-    if (!triedToCreateContext) {
-        triedToCreateContext = true;
+GLContext* GLContextProviderEAGL::GetGlobalContext() {
+  static bool triedToCreateContext = false;
+  if (!triedToCreateContext) {
+    triedToCreateContext = true;
 
-        MOZ_RELEASE_ASSERT(!gGlobalContext, "GFX: Global GL context already initialized.");
-        RefPtr<GLContext> temp = CreateHeadless(CreateContextFlags::NONE);
-        gGlobalContext = temp;
+    MOZ_RELEASE_ASSERT(!gGlobalContext, "GFX: Global GL context already initialized.");
+    RefPtr<GLContext> temp = CreateHeadless(CreateContextFlags::NONE);
+    gGlobalContext = temp;
 
-        if (!gGlobalContext) {
-            MOZ_CRASH("Failed to create global context");
-        }
+    if (!gGlobalContext) {
+      MOZ_CRASH("Failed to create global context");
     }
+  }
 
-    return gGlobalContext;
+  return gGlobalContext;
 }
 
-void
-GLContextProviderEAGL::Shutdown()
-{
-    gGlobalContext = nullptr;
-}
+void GLContextProviderEAGL::Shutdown() { gGlobalContext = nullptr; }
 
 } /* namespace gl */
 } /* namespace mozilla */
--- a/gfx/thebes/PrintTargetCG.mm
+++ b/gfx/thebes/PrintTargetCG.mm
@@ -8,147 +8,121 @@
 #include "cairo.h"
 #include "cairo-quartz.h"
 #include "mozilla/gfx/HelpersCairo.h"
 #include "nsObjCExceptions.h"
 
 namespace mozilla {
 namespace gfx {
 
-PrintTargetCG::PrintTargetCG(PMPrintSession aPrintSession,
-                             PMPageFormat aPageFormat,
-                             PMPrintSettings aPrintSettings,
-                             const IntSize& aSize)
-  : PrintTarget(/* aCairoSurface */ nullptr, aSize)
-  , mPrintSession(aPrintSession)
-  , mPageFormat(aPageFormat)
-  , mPrintSettings(aPrintSettings)
-{
+PrintTargetCG::PrintTargetCG(PMPrintSession aPrintSession, PMPageFormat aPageFormat,
+                             PMPrintSettings aPrintSettings, const IntSize& aSize)
+    : PrintTarget(/* aCairoSurface */ nullptr, aSize),
+      mPrintSession(aPrintSession),
+      mPageFormat(aPageFormat),
+      mPrintSettings(aPrintSettings) {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   ::PMRetain(mPrintSession);
 
   // TODO: Add memory reporting like gfxQuartzSurface.
-  //RecordMemoryUsed(mSize.height * 4 + sizeof(gfxQuartzSurface));
+  // RecordMemoryUsed(mSize.height * 4 + sizeof(gfxQuartzSurface));
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
-PrintTargetCG::~PrintTargetCG()
-{
+PrintTargetCG::~PrintTargetCG() {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
-  if (mPrintSession)
-    ::PMRelease(mPrintSession);
+  if (mPrintSession) ::PMRelease(mPrintSession);
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
-/* static */ already_AddRefed<PrintTargetCG>
-PrintTargetCG::CreateOrNull(PMPrintSession aPrintSession,
-                            PMPageFormat aPageFormat,
-                            PMPrintSettings aPrintSettings,
-                            const IntSize& aSize)
-{
+/* static */ already_AddRefed<PrintTargetCG> PrintTargetCG::CreateOrNull(
+    PMPrintSession aPrintSession, PMPageFormat aPageFormat, PMPrintSettings aPrintSettings,
+    const IntSize& aSize) {
   if (!Factory::CheckSurfaceSize(aSize)) {
     return nullptr;
   }
 
-  RefPtr<PrintTargetCG> target = new PrintTargetCG(aPrintSession, aPageFormat,
-                                                   aPrintSettings, aSize);
+  RefPtr<PrintTargetCG> target =
+      new PrintTargetCG(aPrintSession, aPageFormat, aPrintSettings, aSize);
 
   return target.forget();
 }
 
-static size_t
-PutBytesNull(void* info, const void* buffer, size_t count)
-{
-  return count;
-}
+static size_t PutBytesNull(void* info, const void* buffer, size_t count) { return count; }
 
-already_AddRefed<DrawTarget>
-PrintTargetCG::GetReferenceDrawTarget()
-{
+already_AddRefed<DrawTarget> PrintTargetCG::GetReferenceDrawTarget() {
   if (!mRefDT) {
     const IntSize size(1, 1);
 
     CGDataConsumerCallbacks callbacks = {PutBytesNull, nullptr};
     CGDataConsumerRef consumer = CGDataConsumerCreate(nullptr, &callbacks);
     CGContextRef pdfContext = CGPDFContextCreate(consumer, nullptr, nullptr);
     CGDataConsumerRelease(consumer);
 
     cairo_surface_t* similar =
-      cairo_quartz_surface_create_for_cg_context(
-        pdfContext, size.width, size.height);
+        cairo_quartz_surface_create_for_cg_context(pdfContext, size.width, size.height);
 
     CGContextRelease(pdfContext);
 
     if (cairo_surface_status(similar)) {
       return nullptr;
     }
 
-    RefPtr<DrawTarget> dt =
-      Factory::CreateDrawTargetForCairoSurface(similar, size);
+    RefPtr<DrawTarget> dt = Factory::CreateDrawTargetForCairoSurface(similar, size);
 
     // The DT addrefs the surface, so we need drop our own reference to it:
     cairo_surface_destroy(similar);
 
     if (!dt || !dt->IsValid()) {
       return nullptr;
     }
     mRefDT = dt.forget();
   }
 
   return do_AddRef(mRefDT);
 }
 
-nsresult
-PrintTargetCG::BeginPrinting(const nsAString& aTitle,
-                             const nsAString& aPrintToFileName,
-                             int32_t aStartPage,
-                             int32_t aEndPage)
-{
+nsresult PrintTargetCG::BeginPrinting(const nsAString& aTitle, const nsAString& aPrintToFileName,
+                                      int32_t aStartPage, int32_t aEndPage) {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
   OSStatus status;
   status = ::PMSetFirstPage(mPrintSettings, aStartPage, false);
   NS_ASSERTION(status == noErr, "PMSetFirstPage failed");
   status = ::PMSetLastPage(mPrintSettings, aEndPage, false);
   NS_ASSERTION(status == noErr, "PMSetLastPage failed");
 
   status = ::PMSessionBeginCGDocumentNoDialog(mPrintSession, mPrintSettings, mPageFormat);
 
   return status == noErr ? NS_OK : NS_ERROR_ABORT;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
-nsresult
-PrintTargetCG::EndPrinting()
-{
+nsresult PrintTargetCG::EndPrinting() {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
   ::PMSessionEndDocumentNoDialog(mPrintSession);
   return NS_OK;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
-nsresult
-PrintTargetCG::AbortPrinting()
-{
+nsresult PrintTargetCG::AbortPrinting() {
 #ifdef DEBUG
   mHasActivePage = false;
 #endif
   return EndPrinting();
 }
 
-nsresult
-PrintTargetCG::BeginPage()
-{
+nsresult PrintTargetCG::BeginPage() {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
   PMSessionError(mPrintSession);
   OSStatus status = ::PMSessionBeginPageNoDialog(mPrintSession, mPageFormat, NULL);
   if (status != noErr) {
     return NS_ERROR_ABORT;
   }
 
@@ -164,42 +138,39 @@ PrintTargetCG::BeginPage()
   unsigned int width = static_cast<unsigned int>(mSize.width);
   unsigned int height = static_cast<unsigned int>(mSize.height);
 
   // Initially, origin is at bottom-left corner of the paper.
   // Here, we translate it to top-left corner of the paper.
   CGContextTranslateCTM(context, 0, height);
   CGContextScaleCTM(context, 1.0, -1.0);
 
-  cairo_surface_t* surface =
-    cairo_quartz_surface_create_for_cg_context(context, width, height);
+  cairo_surface_t* surface = cairo_quartz_surface_create_for_cg_context(context, width, height);
 
   if (cairo_surface_status(surface)) {
     return NS_ERROR_FAILURE;
   }
 
   mCairoSurface = surface;
 
   return PrintTarget::BeginPage();
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
-nsresult
-PrintTargetCG::EndPage()
-{
+nsresult PrintTargetCG::EndPage() {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
 
   cairo_surface_finish(mCairoSurface);
   mCairoSurface = nullptr;
 
   OSStatus status = ::PMSessionEndPageNoDialog(mPrintSession);
   if (status != noErr) {
     return NS_ERROR_ABORT;
   }
 
   return PrintTarget::EndPage();
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
-} // namespace gfx
-} // namespace mozilla
+}  // namespace gfx
+}  // namespace mozilla
--- a/gfx/thebes/gfxMacPlatformFontList.mm
+++ b/gfx/thebes/gfxMacPlatformFontList.mm
@@ -89,1857 +89,1624 @@ using mozilla::dom::FontFamilyListEntry;
 #define INDEX_FONT_TRAITS 3
 
 static const int kAppleMaxWeight = 14;
 static const int kAppleExtraLightWeight = 3;
 static const int kAppleUltraLightWeight = 2;
 
 static const int gAppleWeightToCSSWeight[] = {
     0,
-    1, // 1.
-    1, // 2.  W1, ultralight
-    2, // 3.  W2, extralight
-    3, // 4.  W3, light
-    4, // 5.  W4, semilight
-    5, // 6.  W5, medium
-    6, // 7.
-    6, // 8.  W6, semibold
-    7, // 9.  W7, bold
-    8, // 10. W8, extrabold
-    8, // 11.
-    9, // 12. W9, ultrabold
-    9, // 13
-    9  // 14
+    1,  // 1.
+    1,  // 2.  W1, ultralight
+    2,  // 3.  W2, extralight
+    3,  // 4.  W3, light
+    4,  // 5.  W4, semilight
+    5,  // 6.  W5, medium
+    6,  // 7.
+    6,  // 8.  W6, semibold
+    7,  // 9.  W7, bold
+    8,  // 10. W8, extrabold
+    8,  // 11.
+    9,  // 12. W9, ultrabold
+    9,  // 13
+    9   // 14
 };
 
 // cache Cocoa's "shared font manager" for performance
-static NSFontManager *sFontManager;
+static NSFontManager* sFontManager;
 
-static void GetStringForNSString(const NSString *aSrc, nsAString& aDest)
-{
-    aDest.SetLength([aSrc length]);
-    [aSrc getCharacters:reinterpret_cast<unichar*>(aDest.BeginWriting())];
+static void GetStringForNSString(const NSString* aSrc, nsAString& aDest) {
+  aDest.SetLength([aSrc length]);
+  [aSrc getCharacters:reinterpret_cast<unichar*>(aDest.BeginWriting())];
 }
 
-static NSString* GetNSStringForString(const nsAString& aSrc)
-{
-    return [NSString stringWithCharacters:reinterpret_cast<const unichar*>(aSrc.BeginReading())
-                                   length:aSrc.Length()];
+static NSString* GetNSStringForString(const nsAString& aSrc) {
+  return [NSString stringWithCharacters:reinterpret_cast<const unichar*>(aSrc.BeginReading())
+                                 length:aSrc.Length()];
 }
 
-#define LOG_FONTLIST(args) MOZ_LOG(gfxPlatform::GetLog(eGfxLog_fontlist), \
-                               mozilla::LogLevel::Debug, args)
-#define LOG_FONTLIST_ENABLED() MOZ_LOG_TEST( \
-                                   gfxPlatform::GetLog(eGfxLog_fontlist), \
-                                   mozilla::LogLevel::Debug)
-#define LOG_CMAPDATA_ENABLED() MOZ_LOG_TEST( \
-                                   gfxPlatform::GetLog(eGfxLog_cmapdata), \
-                                   mozilla::LogLevel::Debug)
+#define LOG_FONTLIST(args) \
+  MOZ_LOG(gfxPlatform::GetLog(eGfxLog_fontlist), mozilla::LogLevel::Debug, args)
+#define LOG_FONTLIST_ENABLED() \
+  MOZ_LOG_TEST(gfxPlatform::GetLog(eGfxLog_fontlist), mozilla::LogLevel::Debug)
+#define LOG_CMAPDATA_ENABLED() \
+  MOZ_LOG_TEST(gfxPlatform::GetLog(eGfxLog_cmapdata), mozilla::LogLevel::Debug)
 
-#pragma mark-
+#pragma mark -
 
 // Complex scripts will not render correctly unless appropriate AAT or OT
 // layout tables are present.
 // For OpenType, we also check that the GSUB table supports the relevant
 // script tag, to avoid using things like Arial Unicode MS for Lao (it has
 // the characters, but lacks OpenType support).
 
 // TODO: consider whether we should move this to gfxFontEntry and do similar
 // cmap-masking on other platforms to avoid using fonts that won't shape
 // properly.
 
-nsresult
-MacOSFontEntry::ReadCMAP(FontInfoData *aFontInfoData)
-{
-    // attempt this once, if errors occur leave a blank cmap
-    if (mCharacterMap) {
-        return NS_OK;
+nsresult MacOSFontEntry::ReadCMAP(FontInfoData* aFontInfoData) {
+  // attempt this once, if errors occur leave a blank cmap
+  if (mCharacterMap) {
+    return NS_OK;
+  }
+
+  RefPtr<gfxCharacterMap> charmap;
+  nsresult rv;
+
+  if (aFontInfoData && (charmap = GetCMAPFromFontInfo(aFontInfoData, mUVSOffset))) {
+    rv = NS_OK;
+  } else {
+    uint32_t kCMAP = TRUETYPE_TAG('c', 'm', 'a', 'p');
+    charmap = new gfxCharacterMap();
+    AutoTable cmapTable(this, kCMAP);
+
+    if (cmapTable) {
+      uint32_t cmapLen;
+      const uint8_t* cmapData =
+          reinterpret_cast<const uint8_t*>(hb_blob_get_data(cmapTable, &cmapLen));
+      rv = gfxFontUtils::ReadCMAP(cmapData, cmapLen, *charmap, mUVSOffset);
+    } else {
+      rv = NS_ERROR_NOT_AVAILABLE;
+    }
+  }
+
+  if (NS_SUCCEEDED(rv) && !mIsDataUserFont && !HasGraphiteTables()) {
+    // For downloadable fonts, trust the author and don't
+    // try to munge the cmap based on script shaping support.
+
+    // We also assume a Graphite font knows what it's doing,
+    // and provides whatever shaping is needed for the
+    // characters it supports, so only check/clear the
+    // complex-script ranges for non-Graphite fonts
+
+    // for layout support, check for the presence of mort/morx/kerx and/or
+    // opentype layout tables
+    bool hasAATLayout = HasFontTable(TRUETYPE_TAG('m', 'o', 'r', 'x')) ||
+                        HasFontTable(TRUETYPE_TAG('m', 'o', 'r', 't'));
+    bool hasAppleKerning = HasFontTable(TRUETYPE_TAG('k', 'e', 'r', 'x'));
+    bool hasGSUB = HasFontTable(TRUETYPE_TAG('G', 'S', 'U', 'B'));
+    bool hasGPOS = HasFontTable(TRUETYPE_TAG('G', 'P', 'O', 'S'));
+    if ((hasAATLayout && !(hasGSUB || hasGPOS)) || hasAppleKerning) {
+      mRequiresAAT = true;  // prefer CoreText if font has no OTL tables,
+                            // or if it uses the Apple-specific 'kerx'
+                            // variant of kerning table
     }
 
-    RefPtr<gfxCharacterMap> charmap;
-    nsresult rv;
-
-    if (aFontInfoData && (charmap = GetCMAPFromFontInfo(aFontInfoData,
-                                                        mUVSOffset))) {
-        rv = NS_OK;
-    } else {
-        uint32_t kCMAP = TRUETYPE_TAG('c','m','a','p');
-        charmap = new gfxCharacterMap();
-        AutoTable cmapTable(this, kCMAP);
-
-        if (cmapTable) {
-            uint32_t cmapLen;
-            const uint8_t* cmapData =
-                reinterpret_cast<const uint8_t*>(hb_blob_get_data(cmapTable,
-                                                                  &cmapLen));
-            rv = gfxFontUtils::ReadCMAP(cmapData, cmapLen,
-                                        *charmap, mUVSOffset);
-        } else {
-            rv = NS_ERROR_NOT_AVAILABLE;
-        }
-    }
-
-    if (NS_SUCCEEDED(rv) && !mIsDataUserFont && !HasGraphiteTables()) {
-        // For downloadable fonts, trust the author and don't
-        // try to munge the cmap based on script shaping support.
-
-        // We also assume a Graphite font knows what it's doing,
-        // and provides whatever shaping is needed for the
-        // characters it supports, so only check/clear the
-        // complex-script ranges for non-Graphite fonts
-
-        // for layout support, check for the presence of mort/morx/kerx and/or
-        // opentype layout tables
-        bool hasAATLayout = HasFontTable(TRUETYPE_TAG('m','o','r','x')) ||
-                            HasFontTable(TRUETYPE_TAG('m','o','r','t'));
-        bool hasAppleKerning = HasFontTable(TRUETYPE_TAG('k','e','r','x'));
-        bool hasGSUB = HasFontTable(TRUETYPE_TAG('G','S','U','B'));
-        bool hasGPOS = HasFontTable(TRUETYPE_TAG('G','P','O','S'));
-        if ((hasAATLayout && !(hasGSUB || hasGPOS)) || hasAppleKerning) {
-            mRequiresAAT = true; // prefer CoreText if font has no OTL tables,
-                                 // or if it uses the Apple-specific 'kerx'
-                                 // variant of kerning table
+    for (const ScriptRange* sr = gfxPlatformFontList::sComplexScriptRanges; sr->rangeStart; sr++) {
+      // check to see if the cmap includes complex script codepoints
+      if (charmap->TestRange(sr->rangeStart, sr->rangeEnd)) {
+        if (hasAATLayout) {
+          // prefer CoreText for Apple's complex-script fonts,
+          // even if they also have some OpenType tables
+          // (e.g. Geeza Pro Bold on 10.6; see bug 614903)
+          mRequiresAAT = true;
+          // and don't mask off complex-script ranges, we assume
+          // the AAT tables will provide the necessary shaping
+          continue;
         }
 
-        for (const ScriptRange* sr = gfxPlatformFontList::sComplexScriptRanges;
-             sr->rangeStart; sr++) {
-            // check to see if the cmap includes complex script codepoints
-            if (charmap->TestRange(sr->rangeStart, sr->rangeEnd)) {
-                if (hasAATLayout) {
-                    // prefer CoreText for Apple's complex-script fonts,
-                    // even if they also have some OpenType tables
-                    // (e.g. Geeza Pro Bold on 10.6; see bug 614903)
-                    mRequiresAAT = true;
-                    // and don't mask off complex-script ranges, we assume
-                    // the AAT tables will provide the necessary shaping
-                    continue;
-                }
-
-                // We check for GSUB here, as GPOS alone would not be ok.
-                if (hasGSUB && SupportsScriptInGSUB(sr->tags, sr->numTags)) {
-                    continue;
-                }
-
-                charmap->ClearRange(sr->rangeStart, sr->rangeEnd);
-            }
+        // We check for GSUB here, as GPOS alone would not be ok.
+        if (hasGSUB && SupportsScriptInGSUB(sr->tags, sr->numTags)) {
+          continue;
         }
 
-        // Bug 1360309, 1393624: several of Apple's Chinese fonts have spurious
-        // blank glyphs for obscure Tibetan and Arabic-script codepoints.
-        // Blacklist these so that font fallback will not use them.
-        if (mRequiresAAT && (FamilyName().EqualsLiteral("Songti SC") ||
-                             FamilyName().EqualsLiteral("Songti TC") ||
-                             FamilyName().EqualsLiteral("STSong") ||
-        // Bug 1390980: on 10.11, the Kaiti fonts are also affected.
-                             FamilyName().EqualsLiteral("Kaiti SC") ||
-                             FamilyName().EqualsLiteral("Kaiti TC") ||
-                             FamilyName().EqualsLiteral("STKaiti"))) {
-            charmap->ClearRange(0x0f6b, 0x0f70);
-            charmap->ClearRange(0x0f8c, 0x0f8f);
-            charmap->clear(0x0f98);
-            charmap->clear(0x0fbd);
-            charmap->ClearRange(0x0fcd, 0x0fff);
-            charmap->clear(0x0620);
-            charmap->clear(0x065f);
-            charmap->ClearRange(0x06ee, 0x06ef);
-            charmap->clear(0x06ff);
-        }
-    }
-
-    mHasCmapTable = NS_SUCCEEDED(rv);
-    if (mHasCmapTable) {
-        gfxPlatformFontList *pfl = gfxPlatformFontList::PlatformFontList();
-        mCharacterMap = pfl->FindCharMap(charmap);
-    } else {
-        // if error occurred, initialize to null cmap
-        mCharacterMap = new gfxCharacterMap();
+        charmap->ClearRange(sr->rangeStart, sr->rangeEnd);
+      }
     }
 
-    LOG_FONTLIST(("(fontlist-cmap) name: %s, size: %zu hash: %8.8x%s\n",
-                  mName.get(),
-                  charmap->SizeOfIncludingThis(moz_malloc_size_of),
-                  charmap->mHash, mCharacterMap == charmap ? " new" : ""));
-    if (LOG_CMAPDATA_ENABLED()) {
-        char prefix[256];
-        SprintfLiteral(prefix, "(cmapdata) name: %.220s",
-                       mName.get());
-        charmap->Dump(prefix, eGfxLog_cmapdata);
+    // Bug 1360309, 1393624: several of Apple's Chinese fonts have spurious
+    // blank glyphs for obscure Tibetan and Arabic-script codepoints.
+    // Blacklist these so that font fallback will not use them.
+    if (mRequiresAAT &&
+        (FamilyName().EqualsLiteral("Songti SC") || FamilyName().EqualsLiteral("Songti TC") ||
+         FamilyName().EqualsLiteral("STSong") ||
+         // Bug 1390980: on 10.11, the Kaiti fonts are also affected.
+         FamilyName().EqualsLiteral("Kaiti SC") || FamilyName().EqualsLiteral("Kaiti TC") ||
+         FamilyName().EqualsLiteral("STKaiti"))) {
+      charmap->ClearRange(0x0f6b, 0x0f70);
+      charmap->ClearRange(0x0f8c, 0x0f8f);
+      charmap->clear(0x0f98);
+      charmap->clear(0x0fbd);
+      charmap->ClearRange(0x0fcd, 0x0fff);
+      charmap->clear(0x0620);
+      charmap->clear(0x065f);
+      charmap->ClearRange(0x06ee, 0x06ef);
+      charmap->clear(0x06ff);
     }
+  }
 
-    return rv;
+  mHasCmapTable = NS_SUCCEEDED(rv);
+  if (mHasCmapTable) {
+    gfxPlatformFontList* pfl = gfxPlatformFontList::PlatformFontList();
+    mCharacterMap = pfl->FindCharMap(charmap);
+  } else {
+    // if error occurred, initialize to null cmap
+    mCharacterMap = new gfxCharacterMap();
+  }
+
+  LOG_FONTLIST(("(fontlist-cmap) name: %s, size: %zu hash: %8.8x%s\n", mName.get(),
+                charmap->SizeOfIncludingThis(moz_malloc_size_of), charmap->mHash,
+                mCharacterMap == charmap ? " new" : ""));
+  if (LOG_CMAPDATA_ENABLED()) {
+    char prefix[256];
+    SprintfLiteral(prefix, "(cmapdata) name: %.220s", mName.get());
+    charmap->Dump(prefix, eGfxLog_cmapdata);
+  }
+
+  return rv;
 }
 
-gfxFont*
-MacOSFontEntry::CreateFontInstance(const gfxFontStyle *aFontStyle)
-{
-    RefPtr<UnscaledFontMac> unscaledFont(mUnscaledFont);
-    if (!unscaledFont) {
-        CGFontRef baseFont = GetFontRef();
-        if (!baseFont) {
-            return nullptr;
-        }
-        unscaledFont = new UnscaledFontMac(baseFont, mIsDataUserFont);
-        mUnscaledFont = unscaledFont;
+gfxFont* MacOSFontEntry::CreateFontInstance(const gfxFontStyle* aFontStyle) {
+  RefPtr<UnscaledFontMac> unscaledFont(mUnscaledFont);
+  if (!unscaledFont) {
+    CGFontRef baseFont = GetFontRef();
+    if (!baseFont) {
+      return nullptr;
     }
+    unscaledFont = new UnscaledFontMac(baseFont, mIsDataUserFont);
+    mUnscaledFont = unscaledFont;
+  }
 
-    return new gfxMacFont(unscaledFont, this, aFontStyle);
-}
-
-bool
-MacOSFontEntry::HasVariations()
-{
-    if (!mHasVariationsInitialized) {
-        mHasVariationsInitialized = true;
-        mHasVariations =
-            gfxPlatform::GetPlatform()->HasVariationFontSupport() &&
-            HasFontTable(TRUETYPE_TAG('f','v','a','r'));
-    }
-
-    return mHasVariations;
+  return new gfxMacFont(unscaledFont, this, aFontStyle);
 }
 
-void
-MacOSFontEntry::GetVariationAxes(nsTArray<gfxFontVariationAxis>& aVariationAxes)
-{
-    MOZ_ASSERT(aVariationAxes.IsEmpty());
-    CTFontRef ctFont =
-        CTFontCreateWithGraphicsFont(mFontRef, 0.0, nullptr, nullptr);
-    CFArrayRef axes = CTFontCopyVariationAxes(ctFont);
-    CFRelease(ctFont);
-    if (axes) {
-        for (CFIndex i = 0; i < CFArrayGetCount(axes); ++i) {
-            gfxFontVariationAxis axis;
-            auto val = (CFDictionaryRef)CFArrayGetValueAtIndex(axes, i);
-            auto num = (CFNumberRef)CFDictionaryGetValue(val,
-                           kCTFontVariationAxisIdentifierKey);
-            SInt32 tag = 0;
-            if (num) {
-                CFNumberGetValue(num, kCFNumberSInt32Type, &tag);
-            }
-            Float32 minValue = 0, maxValue = 0, defaultValue = 0;
-            num = (CFNumberRef)CFDictionaryGetValue(val,
-                      kCTFontVariationAxisMinimumValueKey);
-            if (num) {
-                CFNumberGetValue(num, kCFNumberFloat32Type, &minValue);
-            }
-            num = (CFNumberRef)CFDictionaryGetValue(val,
-                      kCTFontVariationAxisMaximumValueKey);
-            if (num) {
-                CFNumberGetValue(num, kCFNumberFloat32Type, &maxValue);
-            }
-            num = (CFNumberRef)CFDictionaryGetValue(val,
-                      kCTFontVariationAxisDefaultValueKey);
-            if (num) {
-                CFNumberGetValue(num, kCFNumberFloat32Type, &defaultValue);
-            }
-            auto name = (CFStringRef)CFDictionaryGetValue(val,
-                            kCTFontVariationAxisNameKey);
-            if (name) {
-                CFIndex len = CFStringGetLength(name);
-                nsAutoString nameStr;
-                nameStr.SetLength(len);
-                CFStringGetCharacters(name, CFRangeMake(0, len),
-                                      (UniChar*)nameStr.BeginWriting());
-                AppendUTF16toUTF8(nameStr, axis.mName);
-            }
-            axis.mTag = (uint32_t)tag;
-            axis.mMinValue = minValue;
-            axis.mMaxValue = maxValue;
-            axis.mDefaultValue = defaultValue;
-            aVariationAxes.AppendElement(axis);
-        }
-        CFRelease(axes);
-    }
+bool MacOSFontEntry::HasVariations() {
+  if (!mHasVariationsInitialized) {
+    mHasVariationsInitialized = true;
+    mHasVariations = gfxPlatform::GetPlatform()->HasVariationFontSupport() &&
+                     HasFontTable(TRUETYPE_TAG('f', 'v', 'a', 'r'));
+  }
+
+  return mHasVariations;
 }
 
-void
-MacOSFontEntry::GetVariationInstances(nsTArray<gfxFontVariationInstance>& aInstances)
-{
-    gfxFontUtils::GetVariationInstances(this, aInstances);
+void MacOSFontEntry::GetVariationAxes(nsTArray<gfxFontVariationAxis>& aVariationAxes) {
+  MOZ_ASSERT(aVariationAxes.IsEmpty());
+  CTFontRef ctFont = CTFontCreateWithGraphicsFont(mFontRef, 0.0, nullptr, nullptr);
+  CFArrayRef axes = CTFontCopyVariationAxes(ctFont);
+  CFRelease(ctFont);
+  if (axes) {
+    for (CFIndex i = 0; i < CFArrayGetCount(axes); ++i) {
+      gfxFontVariationAxis axis;
+      auto val = (CFDictionaryRef)CFArrayGetValueAtIndex(axes, i);
+      auto num = (CFNumberRef)CFDictionaryGetValue(val, kCTFontVariationAxisIdentifierKey);
+      SInt32 tag = 0;
+      if (num) {
+        CFNumberGetValue(num, kCFNumberSInt32Type, &tag);
+      }
+      Float32 minValue = 0, maxValue = 0, defaultValue = 0;
+      num = (CFNumberRef)CFDictionaryGetValue(val, kCTFontVariationAxisMinimumValueKey);
+      if (num) {
+        CFNumberGetValue(num, kCFNumberFloat32Type, &minValue);
+      }
+      num = (CFNumberRef)CFDictionaryGetValue(val, kCTFontVariationAxisMaximumValueKey);
+      if (num) {
+        CFNumberGetValue(num, kCFNumberFloat32Type, &maxValue);
+      }
+      num = (CFNumberRef)CFDictionaryGetValue(val, kCTFontVariationAxisDefaultValueKey);
+      if (num) {
+        CFNumberGetValue(num, kCFNumberFloat32Type, &defaultValue);
+      }
+      auto name = (CFStringRef)CFDictionaryGetValue(val, kCTFontVariationAxisNameKey);
+      if (name) {
+        CFIndex len = CFStringGetLength(name);
+        nsAutoString nameStr;
+        nameStr.SetLength(len);
+        CFStringGetCharacters(name, CFRangeMake(0, len), (UniChar*)nameStr.BeginWriting());
+        AppendUTF16toUTF8(nameStr, axis.mName);
+      }
+      axis.mTag = (uint32_t)tag;
+      axis.mMinValue = minValue;
+      axis.mMaxValue = maxValue;
+      axis.mDefaultValue = defaultValue;
+      aVariationAxes.AppendElement(axis);
+    }
+    CFRelease(axes);
+  }
 }
 
-bool
-MacOSFontEntry::IsCFF()
-{
-    if (!mIsCFFInitialized) {
-        mIsCFFInitialized = true;
-        mIsCFF = HasFontTable(TRUETYPE_TAG('C','F','F',' '));
-    }
-
-    return mIsCFF;
+void MacOSFontEntry::GetVariationInstances(nsTArray<gfxFontVariationInstance>& aInstances) {
+  gfxFontUtils::GetVariationInstances(this, aInstances);
 }
 
-MacOSFontEntry::MacOSFontEntry(const nsACString& aPostscriptName,
-                               WeightRange aWeight,