Bug 1521460 - Also reformat objective-c files r=mstange,ehsan,spohl
authorSylvestre Ledru <sledru@mozilla.com>
Mon, 21 Jan 2019 18:18:16 +0100
changeset 498660 0e3b5fe32d113a4a857bf7b948921f531cca8a8e
parent 498659 d11a86413d42d1957a8d0451af8f284956909974
child 498661 99f1a193599dd6b000345a72ee19243bb7062342
push idunknown
push userunknown
push dateunknown
reviewersmstange, ehsan, spohl
bugs1521460
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
Bug 1521460 - Also reformat objective-c files r=mstange,ehsan,spohl # ignore-this-changeset Differential Revision: https://phabricator.services.mozilla.com/D17139
accessible/mac/AccessibleWrap.mm
accessible/mac/DocAccessibleWrap.mm
accessible/mac/MacUtils.mm
accessible/mac/Platform.mm
accessible/mac/RootAccessibleWrap.mm
accessible/mac/mozAccessible.mm
accessible/mac/mozActionElements.mm
accessible/mac/mozDocAccessible.mm
accessible/mac/mozHTMLAccessible.mm
accessible/mac/mozTableAccessible.mm
accessible/mac/mozTextAccessible.mm
dom/media/webspeech/synth/cocoa/OSXSpeechSynthesizerService.mm
dom/plugins/ipc/PluginInterposeOSX.mm
dom/plugins/ipc/PluginUtilsOSX.mm
dom/plugins/ipc/interpose/plugin_child_interpose.mm
dom/plugins/test/testplugin/nptest_macosx.mm
dom/system/mac/CoreLocationLocationProvider.mm
dom/system/mac/nsOSPermissionRequest.mm
embedding/ios/GeckoEmbed/GeckoEmbed/main.mm
gfx/2d/QuartzSupport.mm
gfx/gl/GLContextProviderCGL.mm
gfx/gl/GLContextProviderEAGL.mm
gfx/thebes/PrintTargetCG.mm
gfx/thebes/gfxMacPlatformFontList.mm
hal/cocoa/CocoaSensor.mm
hal/cocoa/smslib.mm
image/decoders/icon/mac/nsIconChannelCocoa.mm
ipc/chromium/src/base/chrome_application_mac.mm
ipc/chromium/src/base/file_util_mac.mm
ipc/chromium/src/base/mac_util.mm
ipc/chromium/src/base/message_pump_mac.mm
ipc/chromium/src/base/platform_thread_mac.mm
ipc/chromium/src/base/process_util_mac.mm
ipc/chromium/src/base/scoped_nsautorelease_pool.mm
ipc/chromium/src/base/sys_string_conversions_mac.mm
ipc/chromium/src/chrome/common/mach_ipc_mac.mm
ipc/glue/ProcessUtils_mac.mm
ipc/glue/SharedMemoryBasic_mach.mm
js/xpconnect/shell/xpcshellMacUtils.mm
netwerk/system/mac/nsNetworkLinkService.mm
netwerk/wifi/osx_corewlan.mm
security/manager/ssl/OSReauthenticatorDarwin.mm
security/sandbox/mac/Sandbox.mm
toolkit/components/parentalcontrols/nsParentalControlsServiceCocoa.mm
toolkit/components/startup/nsUserInfoMac.mm
toolkit/crashreporter/client/crashreporter_osx.mm
toolkit/crashreporter/mac_utils.mm
toolkit/mozapps/update/updater/launchchild_osx.mm
toolkit/mozapps/update/updater/progressui_osx.mm
toolkit/system/osxproxy/ProxyUtils.mm
toolkit/system/osxproxy/nsOSXSystemProxySettings.mm
toolkit/xre/MacApplicationDelegate.mm
toolkit/xre/MacAutoreleasePool.mm
toolkit/xre/MacLaunchHelper.mm
toolkit/xre/UIKitDirProvider.mm
toolkit/xre/nsNativeAppSupportCocoa.mm
toolkit/xre/updaterfileutils_osx.mm
uriloader/exthandler/mac/nsLocalHandlerAppMac.mm
uriloader/exthandler/mac/nsMIMEInfoMac.mm
uriloader/exthandler/mac/nsOSHelperAppService.mm
uriloader/exthandler/uikit/nsLocalHandlerAppUIKit.mm
uriloader/exthandler/uikit/nsMIMEInfoUIKit.mm
uriloader/exthandler/uikit/nsOSHelperAppService.mm
widget/cocoa/ComplexTextInputPanel.mm
widget/cocoa/GfxInfo.mm
widget/cocoa/NativeKeyBindings.mm
widget/cocoa/OSXNotificationCenter.mm
widget/cocoa/RectTextureImage.mm
widget/cocoa/ScreenHelperCocoa.mm
widget/cocoa/SwipeTracker.mm
widget/cocoa/TextInputHandler.mm
widget/cocoa/VibrancyManager.mm
widget/cocoa/ViewRegion.mm
widget/cocoa/WidgetTraceEvent.mm
widget/cocoa/nsAppShell.mm
widget/cocoa/nsBidiKeyboard.mm
widget/cocoa/nsChildView.mm
widget/cocoa/nsClipboard.mm
widget/cocoa/nsCocoaDebugUtils.mm
widget/cocoa/nsCocoaFeatures.mm
widget/cocoa/nsCocoaUtils.mm
widget/cocoa/nsCocoaWindow.mm
widget/cocoa/nsColorPicker.mm
widget/cocoa/nsCursorManager.mm
widget/cocoa/nsDeviceContextSpecX.mm
widget/cocoa/nsDragService.mm
widget/cocoa/nsFilePicker.mm
widget/cocoa/nsIdleServiceX.mm
widget/cocoa/nsLookAndFeel.mm
widget/cocoa/nsMacCursor.mm
widget/cocoa/nsMacDockSupport.mm
widget/cocoa/nsMacSharingService.mm
widget/cocoa/nsMacWebAppUtils.mm
widget/cocoa/nsMenuBarX.mm
widget/cocoa/nsMenuGroupOwnerX.mm
widget/cocoa/nsMenuItemIconX.mm
widget/cocoa/nsMenuItemX.mm
widget/cocoa/nsMenuUtilsX.mm
widget/cocoa/nsMenuX.mm
widget/cocoa/nsNativeThemeCocoa.mm
widget/cocoa/nsPrintDialogX.mm
widget/cocoa/nsPrintSettingsServiceX.mm
widget/cocoa/nsPrintSettingsX.mm
widget/cocoa/nsSandboxViolationSink.mm
widget/cocoa/nsSound.mm
widget/cocoa/nsStandaloneNativeMenu.mm
widget/cocoa/nsSystemStatusBarCocoa.mm
widget/cocoa/nsToolkit.mm
widget/cocoa/nsWidgetFactory.mm
widget/cocoa/nsWindowMap.mm
widget/headless/HeadlessKeyBindingsCocoa.mm
widget/uikit/nsAppShell.mm
widget/uikit/nsLookAndFeel.mm
widget/uikit/nsScreenManager.mm
widget/uikit/nsWidgetFactory.mm
widget/uikit/nsWindow.mm
xpcom/base/MacHelpers.mm
xpcom/base/MacStringHelpers.mm
xpcom/base/nsMacPreferencesReader.mm
xpcom/io/CocoaFileUtils.mm
--- 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/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,1855 +89,1622 @@ 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,
-                               bool aIsStandardFace,
-                               double aSizeHint)
+bool MacOSFontEntry::IsCFF() {
+  if (!mIsCFFInitialized) {
+    mIsCFFInitialized = true;
+    mIsCFF = HasFontTable(TRUETYPE_TAG('C', 'F', 'F', ' '));
+  }
+
+  return mIsCFF;
+}
+
+MacOSFontEntry::MacOSFontEntry(const nsACString& aPostscriptName, WeightRange aWeight,
+                               bool aIsStandardFace, double aSizeHint)
     : gfxFontEntry(aPostscriptName, aIsStandardFace),
       mFontRef(NULL),
       mSizeHint(aSizeHint),
       mFontRefInitialized(false),
       mRequiresAAT(false),
       mIsCFF(false),
       mIsCFFInitialized(false),
       mHasVariations(false),
       mHasVariationsInitialized(false),
       mHasAATSmallCaps(false),
       mHasAATSmallCapsInitialized(false),
       mCheckedForTracking(false),
       mCheckedForOpszAxis(false),
       mTrakTable(nullptr),
       mTrakValues(nullptr),
       mTrakSizeTable(nullptr),
-      mNumTrakSizes(0)
-{
-    mWeightRange = aWeight;
+      mNumTrakSizes(0) {
+  mWeightRange = aWeight;
 }
 
-MacOSFontEntry::MacOSFontEntry(const nsACString& aPostscriptName,
-                               CGFontRef aFontRef,
-                               WeightRange aWeight,
-                               StretchRange aStretch,
-                               SlantStyleRange aStyle,
-                               bool aIsDataUserFont,
-                               bool aIsLocalUserFont)
+MacOSFontEntry::MacOSFontEntry(const nsACString& aPostscriptName, CGFontRef aFontRef,
+                               WeightRange aWeight, StretchRange aStretch, SlantStyleRange aStyle,
+                               bool aIsDataUserFont, bool aIsLocalUserFont)
     : gfxFontEntry(aPostscriptName, false),
       mFontRef(NULL),
       mSizeHint(0.0),
       mFontRefInitialized(false),
       mRequiresAAT(false),
       mIsCFF(false),
       mIsCFFInitialized(false),
       mHasVariations(false),
       mHasVariationsInitialized(false),
       mHasAATSmallCaps(false),
       mHasAATSmallCapsInitialized(false),
       mCheckedForTracking(false),
       mCheckedForOpszAxis(false),
       mTrakTable(nullptr),
       mTrakValues(nullptr),
       mTrakSizeTable(nullptr),
-      mNumTrakSizes(0)
-{
-    mFontRef = aFontRef;
-    mFontRefInitialized = true;
-    ::CFRetain(mFontRef);
+      mNumTrakSizes(0) {
+  mFontRef = aFontRef;
+  mFontRefInitialized = true;
+  ::CFRetain(mFontRef);
 
-    mWeightRange = aWeight;
-    mStretchRange = aStretch;
-    mFixedPitch = false; // xxx - do we need this for downloaded fonts?
-    mStyleRange = aStyle;
+  mWeightRange = aWeight;
+  mStretchRange = aStretch;
+  mFixedPitch = false;  // xxx - do we need this for downloaded fonts?
+  mStyleRange = aStyle;
 
-    NS_ASSERTION(!(aIsDataUserFont && aIsLocalUserFont),
-                 "userfont is either a data font or a local font");
-    mIsDataUserFont = aIsDataUserFont;
-    mIsLocalUserFont = aIsLocalUserFont;
+  NS_ASSERTION(!(aIsDataUserFont && aIsLocalUserFont),
+               "userfont is either a data font or a local font");
+  mIsDataUserFont = aIsDataUserFont;
+  mIsLocalUserFont = aIsLocalUserFont;
 }
 
-gfxFontEntry*
-MacOSFontEntry::Clone() const
-{
-    MOZ_ASSERT(!IsUserFont(), "we can only clone installed fonts!");
-    MacOSFontEntry* fe =
-        new MacOSFontEntry(Name(), Weight(), mStandardFace, mSizeHint);
-    fe->mStyleRange = mStyleRange;
-    fe->mStretchRange = mStretchRange;
-    fe->mFixedPitch = mFixedPitch;
-    return fe;
+gfxFontEntry* MacOSFontEntry::Clone() const {
+  MOZ_ASSERT(!IsUserFont(), "we can only clone installed fonts!");
+  MacOSFontEntry* fe = new MacOSFontEntry(Name(), Weight(), mStandardFace, mSizeHint);
+  fe->mStyleRange = mStyleRange;
+  fe->mStretchRange = mStretchRange;
+  fe->mFixedPitch = mFixedPitch;
+  return fe;
 }
 
-CGFontRef
-MacOSFontEntry::GetFontRef()
-{
-    if (!mFontRefInitialized) {
-        mFontRefInitialized = true;
-        NSString *psname = GetNSStringForString(NS_ConvertUTF8toUTF16(mName));
-        mFontRef = ::CGFontCreateWithFontName(CFStringRef(psname));
-        if (!mFontRef) {
-            // This happens on macOS 10.12 for font entry names that start with
-            // .AppleSystemUIFont. For those fonts, we need to go through NSFont
-            // to get the correct CGFontRef.
-            // Both the Text and the Display variant of the display font use
-            // .AppleSystemUIFontSomethingSomething as their member names.
-            // That's why we're carrying along mSizeHint to this place so that
-            // we get the variant that we want for this family.
-            NSFont* font = [NSFont fontWithName:psname size:mSizeHint];
-            if (font) {
-                mFontRef = CTFontCopyGraphicsFont((CTFontRef)font, nullptr);
-            }
-        }
+CGFontRef MacOSFontEntry::GetFontRef() {
+  if (!mFontRefInitialized) {
+    mFontRefInitialized = true;
+    NSString* psname = GetNSStringForString(NS_ConvertUTF8toUTF16(mName));
+    mFontRef = ::CGFontCreateWithFontName(CFStringRef(psname));
+    if (!mFontRef) {
+      // This happens on macOS 10.12 for font entry names that start with
+      // .AppleSystemUIFont. For those fonts, we need to go through NSFont
+      // to get the correct CGFontRef.
+      // Both the Text and the Display variant of the display font use
+      // .AppleSystemUIFontSomethingSomething as their member names.
+      // That's why we're carrying along mSizeHint to this place so that
+      // we get the variant that we want for this family.
+      NSFont* font = [NSFont fontWithName:psname size:mSizeHint];
+      if (font) {
+        mFontRef = CTFontCopyGraphicsFont((CTFontRef)font, nullptr);
+      }
     }
-    return mFontRef;
+  }
+  return mFontRef;
 }
 
 // For a logging build, we wrap the CFDataRef in a FontTableRec so that we can
 // use the MOZ_COUNT_[CD]TOR macros in it. A release build without logging
 // does not get this overhead.
 class FontTableRec {
-public:
-    explicit FontTableRec(CFDataRef aDataRef)
-        : mDataRef(aDataRef)
-    {
-        MOZ_COUNT_CTOR(FontTableRec);
-    }
+ public:
+  explicit FontTableRec(CFDataRef aDataRef) : mDataRef(aDataRef) { MOZ_COUNT_CTOR(FontTableRec); }
 
-    ~FontTableRec() {
-        MOZ_COUNT_DTOR(FontTableRec);
-        ::CFRelease(mDataRef);
-    }
+  ~FontTableRec() {
+    MOZ_COUNT_DTOR(FontTableRec);
+    ::CFRelease(mDataRef);
+  }
 
-private:
-    CFDataRef mDataRef;
+ private:
+  CFDataRef mDataRef;
 };
 
-/*static*/ void
-MacOSFontEntry::DestroyBlobFunc(void* aUserData)
-{
+/*static*/ void MacOSFontEntry::DestroyBlobFunc(void* aUserData) {
 #ifdef NS_BUILD_REFCNT_LOGGING
-    FontTableRec *ftr = static_cast<FontTableRec*>(aUserData);
-    delete ftr;
+  FontTableRec* ftr = static_cast<FontTableRec*>(aUserData);
+  delete ftr;
 #else
-    ::CFRelease((CFDataRef)aUserData);
+  ::CFRelease((CFDataRef)aUserData);
 #endif
 }
 
-hb_blob_t *
-MacOSFontEntry::GetFontTable(uint32_t aTag)
-{
-    CGFontRef fontRef = GetFontRef();
-    if (!fontRef) {
-        return nullptr;
-    }
+hb_blob_t* MacOSFontEntry::GetFontTable(uint32_t aTag) {
+  CGFontRef fontRef = GetFontRef();
+  if (!fontRef) {
+    return nullptr;
+  }
 
-    CFDataRef dataRef = ::CGFontCopyTableForTag(fontRef, aTag);
-    if (dataRef) {
-        return hb_blob_create((const char*)::CFDataGetBytePtr(dataRef),
-                              ::CFDataGetLength(dataRef),
-                              HB_MEMORY_MODE_READONLY,
+  CFDataRef dataRef = ::CGFontCopyTableForTag(fontRef, aTag);
+  if (dataRef) {
+    return hb_blob_create((const char*)::CFDataGetBytePtr(dataRef), ::CFDataGetLength(dataRef),
+                          HB_MEMORY_MODE_READONLY,
 #ifdef NS_BUILD_REFCNT_LOGGING
-                              new FontTableRec(dataRef),
+                          new FontTableRec(dataRef),
 #else
-                              (void*)dataRef,
+                          (void*)dataRef,
 #endif
-                              DestroyBlobFunc);
-    }
+                          DestroyBlobFunc);
+  }
 
-    return nullptr;
+  return nullptr;
 }
 
-bool
-MacOSFontEntry::HasFontTable(uint32_t aTableTag)
-{
-    if (mAvailableTables.Count() == 0) {
-        nsAutoreleasePool localPool;
+bool MacOSFontEntry::HasFontTable(uint32_t aTableTag) {
+  if (mAvailableTables.Count() == 0) {
+    nsAutoreleasePool localPool;
 
-        CGFontRef fontRef = GetFontRef();
-        if (!fontRef) {
-            return false;
-        }
-        CFArrayRef tags = ::CGFontCopyTableTags(fontRef);
-        if (!tags) {
-            return false;
-        }
-        int numTags = (int) ::CFArrayGetCount(tags);
-        for (int t = 0; t < numTags; t++) {
-            uint32_t tag = (uint32_t)(uintptr_t)::CFArrayGetValueAtIndex(tags, t);
-            mAvailableTables.PutEntry(tag);
-        }
-        ::CFRelease(tags);
+    CGFontRef fontRef = GetFontRef();
+    if (!fontRef) {
+      return false;
+    }
+    CFArrayRef tags = ::CGFontCopyTableTags(fontRef);
+    if (!tags) {
+      return false;
     }
+    int numTags = (int)::CFArrayGetCount(tags);
+    for (int t = 0; t < numTags; t++) {
+      uint32_t tag = (uint32_t)(uintptr_t)::CFArrayGetValueAtIndex(tags, t);
+      mAvailableTables.PutEntry(tag);
+    }
+    ::CFRelease(tags);
+  }
 
-    return mAvailableTables.GetEntry(aTableTag);
+  return mAvailableTables.GetEntry(aTableTag);
 }
 
 typedef struct {
-    AutoSwap_PRUint32 version;
-    AutoSwap_PRUint16 format;
-    AutoSwap_PRUint16 horizOffset;
-    AutoSwap_PRUint16 vertOffset;
-    AutoSwap_PRUint16 reserved;
-//  TrackData horizData;
-//  TrackData vertData;
+  AutoSwap_PRUint32 version;
+  AutoSwap_PRUint16 format;
+  AutoSwap_PRUint16 horizOffset;
+  AutoSwap_PRUint16 vertOffset;
+  AutoSwap_PRUint16 reserved;
+  //  TrackData horizData;
+  //  TrackData vertData;
 } TrakHeader;
 
 typedef struct {
-    AutoSwap_PRUint16 nTracks;
-    AutoSwap_PRUint16 nSizes;
-    AutoSwap_PRUint32 sizeTableOffset;
-//  trackTableEntry trackTable[];
-//  fixed32 sizeTable[];
+  AutoSwap_PRUint16 nTracks;
+  AutoSwap_PRUint16 nSizes;
+  AutoSwap_PRUint32 sizeTableOffset;
+  //  trackTableEntry trackTable[];
+  //  fixed32 sizeTable[];
 } TrackData;
 
 typedef struct {
-    AutoSwap_PRUint32 track;
-    AutoSwap_PRUint16 nameIndex;
-    AutoSwap_PRUint16 offset;
+  AutoSwap_PRUint32 track;
+  AutoSwap_PRUint16 nameIndex;
+  AutoSwap_PRUint16 offset;
 } TrackTableEntry;
 
-bool
-MacOSFontEntry::HasTrackingTable()
-{
-    if (!mCheckedForTracking) {
-        mCheckedForTracking = true;
-        mTrakTable = GetFontTable(TRUETYPE_TAG('t','r','a','k'));
-        if (mTrakTable) {
-            if (!ParseTrakTable()) {
-                hb_blob_destroy(mTrakTable);
-                mTrakTable = nullptr;
-            }
-        }
+bool MacOSFontEntry::HasTrackingTable() {
+  if (!mCheckedForTracking) {
+    mCheckedForTracking = true;
+    mTrakTable = GetFontTable(TRUETYPE_TAG('t', 'r', 'a', 'k'));
+    if (mTrakTable) {
+      if (!ParseTrakTable()) {
+        hb_blob_destroy(mTrakTable);
+        mTrakTable = nullptr;
+      }
     }
-    return mTrakTable != nullptr;
+  }
+  return mTrakTable != nullptr;
 }
 
-bool
-MacOSFontEntry::ParseTrakTable()
-{
-    // Check table validity and set up the subtable pointers we need;
-    // if 'trak' table is invalid, or doesn't contain a 'normal' track,
-    // return false to tell the caller not to try using it.
-    unsigned int len;
-    const char* data = hb_blob_get_data(mTrakTable, &len);
-    if (len < sizeof(TrakHeader)) {
-        return false;
-    }
-    auto trak = reinterpret_cast<const TrakHeader*>(data);
-    uint16_t horizOffset = trak->horizOffset;
-    if (trak->version != 0x00010000 ||
-        uint16_t(trak->format) != 0 ||
-        horizOffset == 0 ||
-        uint16_t(trak->reserved) != 0) {
-        return false;
-    }
-    // Find the horizontal trackData, and check it doesn't overrun the buffer.
-    if (horizOffset > len - sizeof(TrackData)) {
-        return false;
-    }
-    auto trackData = reinterpret_cast<const TrackData*>(data + horizOffset);
-    uint16_t nTracks = trackData->nTracks;
-    mNumTrakSizes = trackData->nSizes;
-    if (nTracks == 0 || mNumTrakSizes < 2) {
-        return false;
+bool MacOSFontEntry::ParseTrakTable() {
+  // Check table validity and set up the subtable pointers we need;
+  // if 'trak' table is invalid, or doesn't contain a 'normal' track,
+  // return false to tell the caller not to try using it.
+  unsigned int len;
+  const char* data = hb_blob_get_data(mTrakTable, &len);
+  if (len < sizeof(TrakHeader)) {
+    return false;
+  }
+  auto trak = reinterpret_cast<const TrakHeader*>(data);
+  uint16_t horizOffset = trak->horizOffset;
+  if (trak->version != 0x00010000 || uint16_t(trak->format) != 0 || horizOffset == 0 ||
+      uint16_t(trak->reserved) != 0) {
+    return false;
+  }
+  // Find the horizontal trackData, and check it doesn't overrun the buffer.
+  if (horizOffset > len - sizeof(TrackData)) {
+    return false;
+  }
+  auto trackData = reinterpret_cast<const TrackData*>(data + horizOffset);
+  uint16_t nTracks = trackData->nTracks;
+  mNumTrakSizes = trackData->nSizes;
+  if (nTracks == 0 || mNumTrakSizes < 2) {
+    return false;
+  }
+  uint32_t sizeTableOffset = trackData->sizeTableOffset;
+  // Find the trackTable, and check it doesn't overrun the buffer.
+  if (horizOffset > len - (sizeof(TrackData) + nTracks * sizeof(TrackTableEntry))) {
+    return false;
+  }
+  auto trackTable =
+      reinterpret_cast<const TrackTableEntry*>(data + horizOffset + sizeof(TrackData));
+  // Look for 'normal' tracking, bail out if no such track is present.
+  unsigned trackIndex;
+  for (trackIndex = 0; trackIndex < nTracks; ++trackIndex) {
+    if (trackTable[trackIndex].track == 0x00000000) {
+      break;
     }
-    uint32_t sizeTableOffset = trackData->sizeTableOffset;
-    // Find the trackTable, and check it doesn't overrun the buffer.
-    if (horizOffset >
-        len - (sizeof(TrackData) + nTracks * sizeof(TrackTableEntry))) {
-        return false;
-    }
-    auto trackTable = reinterpret_cast<const TrackTableEntry*>
-        (data + horizOffset + sizeof(TrackData));
-    // Look for 'normal' tracking, bail out if no such track is present.
-    unsigned trackIndex;
-    for (trackIndex = 0; trackIndex < nTracks; ++trackIndex) {
-        if (trackTable[trackIndex].track == 0x00000000) {
-            break;
-        }
-    }
-    if (trackIndex == nTracks) {
-        return false;
-    }
-    // Find list of tracking values, and check they won't overrun.
-    uint16_t offset = trackTable[trackIndex].offset;
-    if (offset > len - mNumTrakSizes * sizeof(uint16_t)) {
-        return false;
-    }
-    mTrakValues = reinterpret_cast<const AutoSwap_PRInt16*>(data + offset);
-    // Find the size subtable, and check it doesn't overrun the buffer.
-    mTrakSizeTable =
-        reinterpret_cast<const AutoSwap_PRInt32*>(data + sizeTableOffset);
-    if (mTrakSizeTable + mNumTrakSizes >
-        reinterpret_cast<const AutoSwap_PRInt32*>(data + len)) {
-        return false;
-    }
-    return true;
+  }
+  if (trackIndex == nTracks) {
+    return false;
+  }
+  // Find list of tracking values, and check they won't overrun.
+  uint16_t offset = trackTable[trackIndex].offset;
+  if (offset > len - mNumTrakSizes * sizeof(uint16_t)) {
+    return false;
+  }
+  mTrakValues = reinterpret_cast<const AutoSwap_PRInt16*>(data + offset);
+  // Find the size subtable, and check it doesn't overrun the buffer.
+  mTrakSizeTable = reinterpret_cast<const AutoSwap_PRInt32*>(data + sizeTableOffset);
+  if (mTrakSizeTable + mNumTrakSizes > reinterpret_cast<const AutoSwap_PRInt32*>(data + len)) {
+    return false;
+  }
+  return true;
 }
 
-float
-MacOSFontEntry::TrackingForCSSPx(float aSize) const
-{
-    MOZ_ASSERT(mTrakTable && mTrakValues && mTrakSizeTable);
+float MacOSFontEntry::TrackingForCSSPx(float aSize) const {
+  MOZ_ASSERT(mTrakTable && mTrakValues && mTrakSizeTable);
 
-    // Find index of first sizeTable entry that is >= the requested size.
-    Fixed fixedSize = X2Fix(aSize);
-    unsigned sizeIndex;
-    for (sizeIndex = 0; sizeIndex < mNumTrakSizes; ++sizeIndex) {
-        if (mTrakSizeTable[sizeIndex] >= fixedSize) {
-            break;
-        }
+  // Find index of first sizeTable entry that is >= the requested size.
+  Fixed fixedSize = X2Fix(aSize);
+  unsigned sizeIndex;
+  for (sizeIndex = 0; sizeIndex < mNumTrakSizes; ++sizeIndex) {
+    if (mTrakSizeTable[sizeIndex] >= fixedSize) {
+      break;
     }
-    // Return the tracking value for the requested size, or an interpolated
-    // value if the exact size isn't found.
-    if (sizeIndex == mNumTrakSizes) {
-        // Request is larger than last entry in the table, so just use that.
-        // (We don't attempt to extrapolate more extreme tracking values than
-        // the largest or smallest present in the table.)
-        return int16_t(mTrakValues[mNumTrakSizes - 1]);
-    }
-    if (sizeIndex == 0 || mTrakSizeTable[sizeIndex] == fixedSize) {
-        // Found an exact match, or size was smaller than the first entry.
-        return int16_t(mTrakValues[sizeIndex]);
-    }
-    // Requested size falls between two entries: interpolate value.
-    double s0 = Fix2X(mTrakSizeTable[sizeIndex - 1]);
-    double s1 = Fix2X(mTrakSizeTable[sizeIndex]);
-    double t = (aSize - s0) / (s1 - s0);
-    return (1.0 - t) * int16_t(mTrakValues[sizeIndex - 1]) +
-           t * int16_t(mTrakValues[sizeIndex]);
+  }
+  // Return the tracking value for the requested size, or an interpolated
+  // value if the exact size isn't found.
+  if (sizeIndex == mNumTrakSizes) {
+    // Request is larger than last entry in the table, so just use that.
+    // (We don't attempt to extrapolate more extreme tracking values than
+    // the largest or smallest present in the table.)
+    return int16_t(mTrakValues[mNumTrakSizes - 1]);
+  }
+  if (sizeIndex == 0 || mTrakSizeTable[sizeIndex] == fixedSize) {
+    // Found an exact match, or size was smaller than the first entry.
+    return int16_t(mTrakValues[sizeIndex]);
+  }
+  // Requested size falls between two entries: interpolate value.
+  double s0 = Fix2X(mTrakSizeTable[sizeIndex - 1]);
+  double s1 = Fix2X(mTrakSizeTable[sizeIndex]);
+  double t = (aSize - s0) / (s1 - s0);
+  return (1.0 - t) * int16_t(mTrakValues[sizeIndex - 1]) + t * int16_t(mTrakValues[sizeIndex]);
 }
 
-static bool
-CheckForAATSmallCaps(CFArrayRef aFeatures)
-{
-    // Walk the array of feature descriptors from the font, and see whether
-    // a small-caps feature setting is available.
-    // Just bail out (returning false) if at any point we fail to find the
-    // expected dictionary keys, etc; if the font has bad data, we don't even
-    // try to search the rest of it.
-    auto numFeatures = CFArrayGetCount(aFeatures);
-    for (auto f = 0; f < numFeatures; ++f) {
-        auto featureDict = (CFDictionaryRef)
-            CFArrayGetValueAtIndex(aFeatures, f);
-        if (!featureDict) {
-            return false;
-        }
-        auto featureNum = (CFNumberRef)
-            CFDictionaryGetValue(featureDict,
-                                 CFSTR("CTFeatureTypeIdentifier"));
-        if (!featureNum) {
-            return false;
-        }
-        int16_t featureType;
-        if (!CFNumberGetValue(featureNum, kCFNumberSInt16Type, &featureType)) {
-            return false;
+static bool CheckForAATSmallCaps(CFArrayRef aFeatures) {
+  // Walk the array of feature descriptors from the font, and see whether
+  // a small-caps feature setting is available.
+  // Just bail out (returning false) if at any point we fail to find the
+  // expected dictionary keys, etc; if the font has bad data, we don't even
+  // try to search the rest of it.
+  auto numFeatures = CFArrayGetCount(aFeatures);
+  for (auto f = 0; f < numFeatures; ++f) {
+    auto featureDict = (CFDictionaryRef)CFArrayGetValueAtIndex(aFeatures, f);
+    if (!featureDict) {
+      return false;
+    }
+    auto featureNum =
+        (CFNumberRef)CFDictionaryGetValue(featureDict, CFSTR("CTFeatureTypeIdentifier"));
+    if (!featureNum) {
+      return false;
+    }
+    int16_t featureType;
+    if (!CFNumberGetValue(featureNum, kCFNumberSInt16Type, &featureType)) {
+      return false;
+    }
+    if (featureType == kLetterCaseType || featureType == kLowerCaseType) {
+      // Which selector to look for, depending whether we've found the
+      // legacy LetterCase feature or the new LowerCase one.
+      const uint16_t smallCaps =
+          (featureType == kLetterCaseType) ? kSmallCapsSelector : kLowerCaseSmallCapsSelector;
+      auto selectors =
+          (CFArrayRef)CFDictionaryGetValue(featureDict, CFSTR("CTFeatureTypeSelectors"));
+      if (!selectors) {
+        return false;
+      }
+      auto numSelectors = CFArrayGetCount(selectors);
+      for (auto s = 0; s < numSelectors; s++) {
+        auto selectorDict = (CFDictionaryRef)CFArrayGetValueAtIndex(selectors, s);
+        if (!selectorDict) {
+          return false;
         }
-        if (featureType == kLetterCaseType || featureType == kLowerCaseType) {
-            // Which selector to look for, depending whether we've found the
-            // legacy LetterCase feature or the new LowerCase one.
-            const uint16_t smallCaps = (featureType == kLetterCaseType)
-                                       ? kSmallCapsSelector
-                                       : kLowerCaseSmallCapsSelector;
-            auto selectors = (CFArrayRef)
-                CFDictionaryGetValue(featureDict,
-                                     CFSTR("CTFeatureTypeSelectors"));
-            if (!selectors) {
-                return false;
-            }
-            auto numSelectors = CFArrayGetCount(selectors);
-            for (auto s = 0; s < numSelectors; s++) {
-                auto selectorDict =
-                    (CFDictionaryRef)CFArrayGetValueAtIndex(selectors, s);
-                if (!selectorDict) {
-                    return false;
-                }
-                auto selectorNum = (CFNumberRef)
-                    CFDictionaryGetValue(selectorDict,
-                                         CFSTR("CTFeatureSelectorIdentifier"));
-                if (!selectorNum) {
-                    return false;
-                }
-                int16_t selectorValue;
-                if (!CFNumberGetValue(selectorNum, kCFNumberSInt16Type,
-                                      &selectorValue)) {
-                    return false;
-                }
-                if (selectorValue == smallCaps) {
-                    return true;
-                }
-            }
+        auto selectorNum =
+            (CFNumberRef)CFDictionaryGetValue(selectorDict, CFSTR("CTFeatureSelectorIdentifier"));
+        if (!selectorNum) {
+          return false;
         }
+        int16_t selectorValue;
+        if (!CFNumberGetValue(selectorNum, kCFNumberSInt16Type, &selectorValue)) {
+          return false;
+        }
+        if (selectorValue == smallCaps) {
+          return true;
+        }
+      }
     }
-    return false;
+  }
+  return false;
 }
 
-bool
-MacOSFontEntry::SupportsOpenTypeFeature(Script aScript, uint32_t aFeatureTag)
-{
-    // If we're going to shape with Core Text, we don't support added
-    // OpenType features (aside from any CT applies by default), except
-    // for 'smcp' which we map to an AAT feature selector.
-    if (RequiresAATLayout()) {
-        if (aFeatureTag != HB_TAG('s','m','c','p')) {
-            return false;
-        }
-        if (mHasAATSmallCapsInitialized) {
-            return mHasAATSmallCaps;
-        }
-        mHasAATSmallCapsInitialized = true;
-        CTFontRef ctFont =
-            CTFontCreateWithGraphicsFont(mFontRef, 0.0, nullptr, nullptr);
-        if (ctFont) {
-            CFArrayRef features = CTFontCopyFeatures(ctFont);
-            CFRelease(ctFont);
-            if (features) {
-                mHasAATSmallCaps = CheckForAATSmallCaps(features);
-                CFRelease(features);
-            }
-        }
-        return mHasAATSmallCaps;
+bool MacOSFontEntry::SupportsOpenTypeFeature(Script aScript, uint32_t aFeatureTag) {
+  // If we're going to shape with Core Text, we don't support added
+  // OpenType features (aside from any CT applies by default), except
+  // for 'smcp' which we map to an AAT feature selector.
+  if (RequiresAATLayout()) {
+    if (aFeatureTag != HB_TAG('s', 'm', 'c', 'p')) {
+      return false;
+    }
+    if (mHasAATSmallCapsInitialized) {
+      return mHasAATSmallCaps;
     }
-    return gfxFontEntry::SupportsOpenTypeFeature(aScript, aFeatureTag);
+    mHasAATSmallCapsInitialized = true;
+    CTFontRef ctFont = CTFontCreateWithGraphicsFont(mFontRef, 0.0, nullptr, nullptr);
+    if (ctFont) {
+      CFArrayRef features = CTFontCopyFeatures(ctFont);
+      CFRelease(ctFont);
+      if (features) {
+        mHasAATSmallCaps = CheckForAATSmallCaps(features);
+        CFRelease(features);
+      }
+    }
+    return mHasAATSmallCaps;
+  }
+  return gfxFontEntry::SupportsOpenTypeFeature(aScript, aFeatureTag);
 }
 
-void
-MacOSFontEntry::AddSizeOfIncludingThis(MallocSizeOf aMallocSizeOf,
-                                       FontListSizes* aSizes) const
-{
-    aSizes->mFontListSize += aMallocSizeOf(this);
-    AddSizeOfExcludingThis(aMallocSizeOf, aSizes);
+void MacOSFontEntry::AddSizeOfIncludingThis(MallocSizeOf aMallocSizeOf,
+                                            FontListSizes* aSizes) const {
+  aSizes->mFontListSize += aMallocSizeOf(this);
+  AddSizeOfExcludingThis(aMallocSizeOf, aSizes);
 }
 
 /* gfxMacFontFamily */
-#pragma mark-
+#pragma mark -
 
-class gfxMacFontFamily : public gfxFontFamily
-{
-public:
-    explicit gfxMacFontFamily(const nsACString& aName, double aSizeHint) :
-        gfxFontFamily(aName),
-        mSizeHint(aSizeHint)
-    {}
+class gfxMacFontFamily : public gfxFontFamily {
+ public:
+  explicit gfxMacFontFamily(const nsACString& aName, double aSizeHint)
+      : gfxFontFamily(aName), mSizeHint(aSizeHint) {}
 
-    virtual ~gfxMacFontFamily() {}
+  virtual ~gfxMacFontFamily() {}
 
-    virtual void LocalizedName(nsACString& aLocalizedName);
+  virtual void LocalizedName(nsACString& aLocalizedName);
 
-    virtual void FindStyleVariations(FontInfoData *aFontInfoData = nullptr);
+  virtual void FindStyleVariations(FontInfoData* aFontInfoData = nullptr);
 
-    virtual bool IsSingleFaceFamily() const
-    {
-        return false;
-    }
+  virtual bool IsSingleFaceFamily() const { return false; }
 
-protected:
-    double mSizeHint;
+ protected:
+  double mSizeHint;
 };
 
-void
-gfxMacFontFamily::LocalizedName(nsACString& aLocalizedName)
-{
-    nsAutoreleasePool localPool;
+void gfxMacFontFamily::LocalizedName(nsACString& aLocalizedName) {
+  nsAutoreleasePool localPool;
 
-    // It's unsafe to call HasOtherFamilyNames off the main thread because
-    // it entrains FindStyleVariations, which calls GetWeightOverride, which
-    // retrieves prefs.  And the pref names can change (via user overrides),
-    // so we can't use gfxPrefs to access them.
-    if (NS_IsMainThread() && !HasOtherFamilyNames()) {
-        aLocalizedName = mName;
-        return;
-    }
+  // It's unsafe to call HasOtherFamilyNames off the main thread because
+  // it entrains FindStyleVariations, which calls GetWeightOverride, which
+  // retrieves prefs.  And the pref names can change (via user overrides),
+  // so we can't use gfxPrefs to access them.
+  if (NS_IsMainThread() && !HasOtherFamilyNames()) {
+    aLocalizedName = mName;
+    return;
+  }
 
-    NSString *family = GetNSStringForString(NS_ConvertUTF8toUTF16(mName));
-    NSString *localized = [sFontManager
-                           localizedNameForFamily:family
-                                             face:nil];
+  NSString* family = GetNSStringForString(NS_ConvertUTF8toUTF16(mName));
+  NSString* localized = [sFontManager localizedNameForFamily:family face:nil];
 
-    if (localized) {
-        nsAutoString locName;
-        GetStringForNSString(localized, locName);
-        CopyUTF16toUTF8(locName, aLocalizedName);
-        return;
-    }
+  if (localized) {
+    nsAutoString locName;
+    GetStringForNSString(localized, locName);
+    CopyUTF16toUTF8(locName, aLocalizedName);
+    return;
+  }
 
-    // failed to get localized name, just use the canonical one
-    aLocalizedName = mName;
+  // failed to get localized name, just use the canonical one
+  aLocalizedName = mName;
 }
 
 // Return the CSS weight value to use for the given face, overriding what
 // AppKit gives us (used to adjust families with bad weight values, see
 // bug 931426).
 // A return value of 0 indicates no override - use the existing weight.
-static inline int
-GetWeightOverride(const nsAString& aPSName)
-{
-    nsAutoCString prefName("font.weight-override.");
-    // The PostScript name is required to be ASCII; if it's not, the font is
-    // broken anyway, so we really don't care that this is lossy.
-    LossyAppendUTF16toASCII(aPSName, prefName);
-    return Preferences::GetInt(prefName.get(), 0);
+static inline int GetWeightOverride(const nsAString& aPSName) {
+  nsAutoCString prefName("font.weight-override.");
+  // The PostScript name is required to be ASCII; if it's not, the font is
+  // broken anyway, so we really don't care that this is lossy.
+  LossyAppendUTF16toASCII(aPSName, prefName);
+  return Preferences::GetInt(prefName.get(), 0);
 }
 
-void
-gfxMacFontFamily::FindStyleVariations(FontInfoData *aFontInfoData)
-{
-    if (mHasStyles)
-        return;
-
-    nsAutoreleasePool localPool;
+void gfxMacFontFamily::FindStyleVariations(FontInfoData* aFontInfoData) {
+  if (mHasStyles) return;
 
-    NSString *family = GetNSStringForString(NS_ConvertUTF8toUTF16(mName));
+  nsAutoreleasePool localPool;
 
-    // create a font entry for each face
-    NSArray *fontfaces = [sFontManager
-                          availableMembersOfFontFamily:family];  // returns an array of [psname, style name, weight, traits] elements, goofy api
-    int faceCount = [fontfaces count];
-    int faceIndex;
+  NSString* family = GetNSStringForString(NS_ConvertUTF8toUTF16(mName));
 
-    for (faceIndex = 0; faceIndex < faceCount; faceIndex++) {
-        NSArray *face = [fontfaces objectAtIndex:faceIndex];
-        NSString *psname = [face objectAtIndex:INDEX_FONT_POSTSCRIPT_NAME];
-        int32_t appKitWeight = [[face objectAtIndex:INDEX_FONT_WEIGHT] unsignedIntValue];
-        uint32_t macTraits = [[face objectAtIndex:INDEX_FONT_TRAITS] unsignedIntValue];
-        NSString *facename = [face objectAtIndex:INDEX_FONT_FACE_NAME];
-        bool isStandardFace = false;
+  // create a font entry for each face
+  NSArray* fontfaces = [sFontManager
+      availableMembersOfFontFamily:family];  // returns an array of [psname, style name, weight,
+                                             // traits] elements, goofy api
+  int faceCount = [fontfaces count];
+  int faceIndex;
 
-        if (appKitWeight == kAppleExtraLightWeight) {
-            // if the facename contains UltraLight, set the weight to the ultralight weight value
-            NSRange range = [facename rangeOfString:@"ultralight" options:NSCaseInsensitiveSearch];
-            if (range.location != NSNotFound) {
-                appKitWeight = kAppleUltraLightWeight;
-            }
-        }
-
-        // make a nsString
-        nsAutoString postscriptFontName;
-        GetStringForNSString(psname, postscriptFontName);
-
-        int32_t cssWeight = GetWeightOverride(postscriptFontName);
-        if (cssWeight) {
-            // scale down and clamp, to get a value from 1..9
-            cssWeight = ((cssWeight + 50) / 100);
-            cssWeight = std::max(1, std::min(cssWeight, 9));
-        } else {
-            cssWeight =
-                gfxMacPlatformFontList::AppleWeightToCSSWeight(appKitWeight);
-        }
-        cssWeight *= 100; // scale up to CSS values
+  for (faceIndex = 0; faceIndex < faceCount; faceIndex++) {
+    NSArray* face = [fontfaces objectAtIndex:faceIndex];
+    NSString* psname = [face objectAtIndex:INDEX_FONT_POSTSCRIPT_NAME];
+    int32_t appKitWeight = [[face objectAtIndex:INDEX_FONT_WEIGHT] unsignedIntValue];
+    uint32_t macTraits = [[face objectAtIndex:INDEX_FONT_TRAITS] unsignedIntValue];
+    NSString* facename = [face objectAtIndex:INDEX_FONT_FACE_NAME];
+    bool isStandardFace = false;
 
-        if ([facename isEqualToString:@"Regular"] ||
-            [facename isEqualToString:@"Bold"] ||
-            [facename isEqualToString:@"Italic"] ||
-            [facename isEqualToString:@"Oblique"] ||
-            [facename isEqualToString:@"Bold Italic"] ||
-            [facename isEqualToString:@"Bold Oblique"])
-        {
-            isStandardFace = true;
-        }
+    if (appKitWeight == kAppleExtraLightWeight) {
+      // if the facename contains UltraLight, set the weight to the ultralight weight value
+      NSRange range = [facename rangeOfString:@"ultralight" options:NSCaseInsensitiveSearch];
+      if (range.location != NSNotFound) {
+        appKitWeight = kAppleUltraLightWeight;
+      }
+    }
 
-        // create a font entry
-        MacOSFontEntry *fontEntry =
-            new MacOSFontEntry(NS_ConvertUTF16toUTF8(postscriptFontName),
-                               WeightRange(FontWeight(cssWeight)),
-                               isStandardFace, mSizeHint);
-        if (!fontEntry) {
-            break;
-        }
+    // make a nsString
+    nsAutoString postscriptFontName;
+    GetStringForNSString(psname, postscriptFontName);
 
-        // set additional properties based on the traits reported by Cocoa
-        if (macTraits & (NSCondensedFontMask | NSNarrowFontMask | NSCompressedFontMask)) {
-            fontEntry->mStretchRange = StretchRange(FontStretch::Condensed());
-        } else if (macTraits & NSExpandedFontMask) {
-            fontEntry->mStretchRange = StretchRange(FontStretch::Expanded());
-        }
-        // Cocoa fails to set the Italic traits bit for HelveticaLightItalic,
-        // at least (see bug 611855), so check for style name endings as well
-        if ((macTraits & NSItalicFontMask) ||
-            [facename hasSuffix:@"Italic"] ||
-            [facename hasSuffix:@"Oblique"])
-        {
-            fontEntry->mStyleRange = SlantStyleRange(FontSlantStyle::Italic());
-        }
-        if (macTraits & NSFixedPitchFontMask) {
-            fontEntry->mFixedPitch = true;
-        }
+    int32_t cssWeight = GetWeightOverride(postscriptFontName);
+    if (cssWeight) {