Merge the nullptr conversion from mozilla-central into mozilla-inbound
authorEhsan Akhgari <ehsan@mozilla.com>
Mon, 30 Jul 2012 10:28:15 -0400
changeset 106869 5de03a91ebe77332f004e6502d23f4347bc7b994
parent 106868 14ed511f2d6b6befdb1acd0ced547adc86062a04 (current diff)
parent 106838 b5c4b792f3f2a047e3517472d72842a76afb77cd (diff)
child 106870 eda4a70cc9462bba18f4dacae70b04ef16d72a75
push id214
push userakeybl@mozilla.com
push dateWed, 14 Nov 2012 20:38:59 +0000
treeherdermozilla-release@c8b08ec8e1aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone17.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge the nullptr conversion from mozilla-central into mozilla-inbound
content/base/src/nsGenericElement.h
content/base/src/nsXMLNameSpaceMap.cpp
content/canvas/src/CustomQS_Canvas2D.h
content/html/content/src/nsHTMLInputElement.cpp
content/media/ogg/nsOggReader.cpp
content/svg/content/src/nsSVGSVGElement.cpp
content/svg/content/src/nsSVGScriptElement.cpp
content/svg/content/src/nsSVGUseElement.cpp
content/xbl/src/nsXBLBinding.cpp
content/xbl/src/nsXBLDocumentInfo.cpp
content/xul/content/src/nsXULElement.cpp
content/xul/document/src/nsXULPrototypeCache.cpp
content/xul/document/src/nsXULPrototypeDocument.cpp
docshell/base/nsDocShell.cpp
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMClassInfo.h
dom/base/nsJSEnvironment.cpp
dom/plugins/base/nsJSNPRuntime.cpp
dom/src/json/nsJSON.cpp
dom/workers/ChromeWorkerScope.cpp
dom/workers/Worker.cpp
editor/libeditor/html/nsHTMLAnonymousUtils.cpp
editor/libeditor/html/nsHTMLEditRules.cpp
editor/libeditor/text/nsPlaintextEditor.cpp
embedding/components/find/src/nsFind.cpp
embedding/components/printingui/src/unixshared/nsPrintProgress.cpp
gfx/thebes/gfxASurface.h
image/decoders/nsJPEGDecoder.cpp
image/src/imgRequest.cpp
js/ipc/ObjectWrapperParent.cpp
js/xpconnect/shell/xpcshell.cpp
js/xpconnect/src/XPCComponents.cpp
js/xpconnect/src/XPCQuickStubs.cpp
js/xpconnect/src/XPCQuickStubs.h
js/xpconnect/src/XPCWrappedJSClass.cpp
js/xpconnect/src/XPCWrappedNativeJSOps.cpp
js/xpconnect/src/dombindings.cpp
js/xpconnect/src/qsgen.py
js/xpconnect/wrappers/XrayWrapper.cpp
layout/base/nsDocumentViewer.cpp
layout/base/nsLayoutUtils.cpp
layout/base/nsPresContext.cpp
layout/base/nsPresContext.h
layout/generic/nsSelection.cpp
layout/inspector/src/inCSSValueSearch.cpp
layout/inspector/src/inDOMUtils.cpp
layout/mathml/nsMathMLChar.cpp
layout/style/nsROCSSPrimitiveValue.cpp
netwerk/base/public/nsNetUtil.h
netwerk/base/src/nsSocketTransport2.cpp
netwerk/base/src/nsURIChecker.cpp
netwerk/cache/nsDiskCacheDeviceSQL.cpp
netwerk/protocol/ftp/nsFtpConnectionThread.cpp
netwerk/protocol/http/nsHttpDigestAuth.cpp
rdf/datasource/src/nsFileSystemDataSource.cpp
security/manager/ssl/src/TransportSecurityInfo.cpp
security/manager/ssl/src/nsCMS.cpp
security/manager/ssl/src/nsNSSCertificateDB.cpp
security/manager/ssl/src/nsNSSIOLayer.cpp
toolkit/xre/nsXREDirProvider.cpp
xpcom/ds/nsSupportsArray.h
--- a/accessible/build/nsAccessibilityFactory.cpp
+++ b/accessible/build/nsAccessibilityFactory.cpp
@@ -11,17 +11,17 @@
 #include "nsIAccessibilityService.h"
 #include "nsIAccessibleRetrieval.h"
 #include "nscore.h"
 
 static nsresult
 NS_ConstructAccessibilityService(nsISupports *aOuter, REFNSIID aIID, void **aResult)
 {
     nsresult rv;
-    NS_ASSERTION(aOuter == nsnull, "no aggregation");
+    NS_ASSERTION(aOuter == nullptr, "no aggregation");
     nsIAccessibilityService* accessibility;
     rv = NS_GetAccessibilityService(&accessibility);
     if (NS_FAILED(rv)) {
         NS_ERROR("Unable to construct accessibility service");
         return rv;
     }
     rv = accessibility->QueryInterface(aIID, aResult);
     NS_ASSERTION(NS_SUCCEEDED(rv), "unable to find correct interface");
--- a/accessible/src/atk/AccessibleWrap.cpp
+++ b/accessible/src/atk/AccessibleWrap.cpp
@@ -233,17 +233,17 @@ mai_atk_object_get_type(void)
 
 #ifdef MAI_LOGGING
 PRInt32 AccessibleWrap::mAccWrapCreated = 0;
 PRInt32 AccessibleWrap::mAccWrapDeleted = 0;
 #endif
 
 AccessibleWrap::
   AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) :
-  Accessible(aContent, aDoc), mAtkObject(nsnull)
+  Accessible(aContent, aDoc), mAtkObject(nullptr)
 {
 #ifdef MAI_LOGGING
   ++mAccWrapCreated;
 #endif
   MAI_LOG_DEBUG(("==AccessibleWrap creating: this=%p,total=%d left=%d\n",
                  (void*)this, mAccWrapCreated,
                  (mAccWrapCreated-mAccWrapDeleted)));
 }
@@ -260,21 +260,21 @@ AccessibleWrap::~AccessibleWrap()
                    (mAccWrapCreated-mAccWrapDeleted)));
 }
 
 void
 AccessibleWrap::ShutdownAtkObject()
 {
     if (mAtkObject) {
         if (IS_MAI_OBJECT(mAtkObject)) {
-            MAI_ATK_OBJECT(mAtkObject)->accWrap = nsnull;
+            MAI_ATK_OBJECT(mAtkObject)->accWrap = nullptr;
         }
-        SetMaiHyperlink(nsnull);
+        SetMaiHyperlink(nullptr);
         g_object_unref(mAtkObject);
-        mAtkObject = nsnull;
+        mAtkObject = nullptr;
     }
 }
 
 void
 AccessibleWrap::Shutdown()
 {
   ShutdownAtkObject();
   Accessible::Shutdown();
@@ -283,17 +283,17 @@ AccessibleWrap::Shutdown()
 MaiHyperlink*
 AccessibleWrap::GetMaiHyperlink(bool aCreate /* = true */)
 {
     // make sure mAtkObject is created
     GetAtkObject();
 
     NS_ASSERTION(quark_mai_hyperlink, "quark_mai_hyperlink not initialized");
     NS_ASSERTION(IS_MAI_OBJECT(mAtkObject), "Invalid AtkObject");
-    MaiHyperlink* maiHyperlink = nsnull;
+    MaiHyperlink* maiHyperlink = nullptr;
     if (quark_mai_hyperlink && IS_MAI_OBJECT(mAtkObject)) {
         maiHyperlink = (MaiHyperlink*)g_object_get_qdata(G_OBJECT(mAtkObject),
                                                          quark_mai_hyperlink);
         if (!maiHyperlink && aCreate) {
             maiHyperlink = new MaiHyperlink(this);
             SetMaiHyperlink(maiHyperlink);
         }
     }
@@ -314,17 +314,17 @@ AccessibleWrap::SetMaiHyperlink(MaiHyper
         g_object_set_qdata(G_OBJECT(mAtkObject), quark_mai_hyperlink,
                            aMaiHyperlink);
     }
 }
 
 NS_IMETHODIMP
 AccessibleWrap::GetNativeInterface(void** aOutAccessible)
 {
-    *aOutAccessible = nsnull;
+    *aOutAccessible = nullptr;
 
     if (!mAtkObject) {
         if (IsDefunct() || !nsAccUtils::IsEmbeddedObject(this)) {
             // We don't create ATK objects for node which has been shutdown, or
             // nsIAccessible plain text leaves
             return NS_ERROR_FAILURE;
         }
 
@@ -342,29 +342,29 @@ AccessibleWrap::GetNativeInterface(void*
 
     *aOutAccessible = mAtkObject;
     return NS_OK;
 }
 
 AtkObject *
 AccessibleWrap::GetAtkObject(void)
 {
-    void *atkObj = nsnull;
+    void *atkObj = nullptr;
     GetNativeInterface(&atkObj);
     return static_cast<AtkObject *>(atkObj);
 }
 
 // Get AtkObject from nsIAccessible interface
 /* static */
 AtkObject *
 AccessibleWrap::GetAtkObject(nsIAccessible* acc)
 {
-    void *atkObjPtr = nsnull;
+    void *atkObjPtr = nullptr;
     acc->GetNativeInterface(&atkObjPtr);
-    return atkObjPtr ? ATK_OBJECT(atkObjPtr) : nsnull;    
+    return atkObjPtr ? ATK_OBJECT(atkObjPtr) : nullptr;    
 }
 
 /* private */
 PRUint16
 AccessibleWrap::CreateMaiInterfaces(void)
 {
   PRUint16 interfacesBits = 0;
     
@@ -615,17 +615,17 @@ initializeCB(AtkObject *aAtkObj, gpointe
                    (sMaiAtkObjCreated-sMaiAtkObjDeleted)));
 }
 
 void
 finalizeCB(GObject *aObj)
 {
     if (!IS_MAI_OBJECT(aObj))
         return;
-    NS_ASSERTION(MAI_ATK_OBJECT(aObj)->accWrap == nsnull, "AccWrap NOT null");
+    NS_ASSERTION(MAI_ATK_OBJECT(aObj)->accWrap == nullptr, "AccWrap NOT null");
 
 #ifdef MAI_LOGGING
     ++sMaiAtkObjDeleted;
 #endif
     MAI_LOG_DEBUG(("MaiAtkObj Delete obj=%p, all=%d, left=%d\n",
                    (void*)aObj, sMaiAtkObjCreated,
                    (sMaiAtkObjCreated-sMaiAtkObjDeleted)));
 
@@ -635,34 +635,34 @@ finalizeCB(GObject *aObj)
         G_OBJECT_CLASS (parent_class)->finalize(aObj);
 }
 
 const gchar*
 getNameCB(AtkObject* aAtkObj)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
   if (!accWrap)
-    return nsnull;
+    return nullptr;
 
   nsAutoString uniName;
   accWrap->Name(uniName);
 
   NS_ConvertUTF8toUTF16 objName(aAtkObj->name);
   if (!uniName.Equals(objName))
     atk_object_set_name(aAtkObj, NS_ConvertUTF16toUTF8(uniName).get());
 
   return aAtkObj->name;
 }
 
 const gchar *
 getDescriptionCB(AtkObject *aAtkObj)
 {
     AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
     if (!accWrap || accWrap->IsDefunct())
-        return nsnull;
+        return nullptr;
 
     /* nsIAccessible is responsible for the non-NULL description */
     nsAutoString uniDesc;
     accWrap->Description(uniDesc);
 
     NS_ConvertUTF8toUTF16 objDesc(aAtkObj->description);
     if (!uniDesc.Equals(objDesc))
         atk_object_set_description(aAtkObj,
@@ -703,22 +703,22 @@ getRoleCB(AtkObject *aAtkObj)
 
   return aAtkObj->role;
 }
 
 AtkAttributeSet*
 ConvertToAtkAttributeSet(nsIPersistentProperties* aAttributes)
 {
     if (!aAttributes)
-        return nsnull;
+        return nullptr;
 
-    AtkAttributeSet *objAttributeSet = nsnull;
+    AtkAttributeSet *objAttributeSet = nullptr;
     nsCOMPtr<nsISimpleEnumerator> propEnum;
     nsresult rv = aAttributes->Enumerate(getter_AddRefs(propEnum));
-    NS_ENSURE_SUCCESS(rv, nsnull);
+    NS_ENSURE_SUCCESS(rv, nullptr);
 
     bool hasMore;
     while (NS_SUCCEEDED(propEnum->HasMoreElements(&hasMore)) && hasMore) {
         nsCOMPtr<nsISupports> sup;
         rv = propEnum->GetNext(getter_AddRefs(sup));
         NS_ENSURE_SUCCESS(rv, objAttributeSet);
 
         nsCOMPtr<nsIPropertyElement> propElem(do_QueryInterface(sup));
@@ -755,37 +755,37 @@ GetAttributeSet(Accessible* aAccessible)
           nsAutoString oldValueUnused;
           attributes->SetStringProperty(NS_LITERAL_CSTRING("haspopup"), NS_LITERAL_STRING("true"),
                                         oldValueUnused);
         }
 
         return ConvertToAtkAttributeSet(attributes);
     }
 
-    return nsnull;
+    return nullptr;
 }
 
 AtkAttributeSet *
 getAttributesCB(AtkObject *aAtkObj)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
-  return accWrap ? GetAttributeSet(accWrap) : nsnull;
+  return accWrap ? GetAttributeSet(accWrap) : nullptr;
 }
 
 AtkObject *
 getParentCB(AtkObject *aAtkObj)
 {
   if (!aAtkObj->accessible_parent) {
     AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
     if (!accWrap)
-      return nsnull;
+      return nullptr;
 
     Accessible* accParent = accWrap->Parent();
     if (!accParent)
-      return nsnull;
+      return nullptr;
 
     AtkObject* parent = AccessibleWrap::GetAtkObject(accParent);
     if (parent)
       atk_object_set_parent(aAtkObj, parent);
   }
   return aAtkObj->accessible_parent;
 }
 
@@ -800,33 +800,33 @@ getChildCountCB(AtkObject *aAtkObj)
     return static_cast<gint>(accWrap->EmbeddedChildCount());
 }
 
 AtkObject *
 refChildCB(AtkObject *aAtkObj, gint aChildIndex)
 {
     // aChildIndex should not be less than zero
     if (aChildIndex < 0) {
-      return nsnull;
+      return nullptr;
     }
 
     AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
     if (!accWrap || nsAccUtils::MustPrune(accWrap)) {
-        return nsnull;
+        return nullptr;
     }
 
     Accessible* accChild = accWrap->GetEmbeddedChildAt(aChildIndex);
     if (!accChild)
-        return nsnull;
+        return nullptr;
 
     AtkObject* childAtkObj = AccessibleWrap::GetAtkObject(accChild);
 
     NS_ASSERTION(childAtkObj, "Fail to get AtkObj");
     if (!childAtkObj)
-        return nsnull;
+        return nullptr;
     g_object_ref(childAtkObj);
 
   if (aAtkObj != childAtkObj->accessible_parent)
     atk_object_set_parent(childAtkObj, aAtkObj);
 
   return childAtkObj;
 }
 
@@ -867,17 +867,17 @@ TranslateStates(PRUint64 aState, AtkStat
     bitMask <<= 1;
     ++ stateIndex;
   }
 }
 
 AtkStateSet *
 refStateSetCB(AtkObject *aAtkObj)
 {
-    AtkStateSet *state_set = nsnull;
+    AtkStateSet *state_set = nullptr;
     state_set = ATK_OBJECT_CLASS(parent_class)->ref_state_set(aAtkObj);
 
     AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
     if (!accWrap) {
         TranslateStates(states::DEFUNCT, state_set);
         return state_set;
     }
 
@@ -914,17 +914,17 @@ refRelationSetCB(AtkObject *aAtkObj)
     AtkRelationType atkType = static_cast<AtkRelationType>(relationTypes[i]);
     AtkRelation* atkRelation =
       atk_relation_set_get_relation_by_type(relation_set, atkType);
     if (atkRelation)
       atk_relation_set_remove(relation_set, atkRelation);
 
     Relation rel(accWrap->RelationByType(relationTypes[i]));
     nsTArray<AtkObject*> targets;
-    Accessible* tempAcc = nsnull;
+    Accessible* tempAcc = nullptr;
     while ((tempAcc = rel.Next()))
       targets.AppendElement(AccessibleWrap::GetAtkObject(tempAcc));
 
     if (targets.Length()) {
       atkRelation = atk_relation_new(targets.Elements(), targets.Length(), atkType);
       atk_relation_set_add(relation_set, atkRelation);
       g_object_unref(atkRelation);
     }
@@ -933,28 +933,28 @@ refRelationSetCB(AtkObject *aAtkObj)
   return relation_set;
 }
 
 // Check if aAtkObj is a valid MaiAtkObject, and return the AccessibleWrap
 // for it.
 AccessibleWrap*
 GetAccessibleWrap(AtkObject* aAtkObj)
 {
-  NS_ENSURE_TRUE(IS_MAI_OBJECT(aAtkObj), nsnull);
+  NS_ENSURE_TRUE(IS_MAI_OBJECT(aAtkObj), nullptr);
   AccessibleWrap* accWrap = MAI_ATK_OBJECT(aAtkObj)->accWrap;
 
   // Check if the accessible was deconstructed.
   if (!accWrap)
-    return nsnull;
+    return nullptr;
 
-  NS_ENSURE_TRUE(accWrap->GetAtkObject() == aAtkObj, nsnull);
+  NS_ENSURE_TRUE(accWrap->GetAtkObject() == aAtkObj, nullptr);
 
   AccessibleWrap* appAccWrap = nsAccessNode::GetApplicationAccessible();
   if (appAccWrap != accWrap && !accWrap->IsValidObject())
-    return nsnull;
+    return nullptr;
 
   return accWrap;
 }
 
 nsresult
 AccessibleWrap::HandleAccEvent(AccEvent* aEvent)
 {
   nsresult rv = Accessible::HandleAccEvent(aEvent);
@@ -1303,17 +1303,17 @@ AccessibleWrap::FireAtkTextChangedEvent(
 
     AccTextChangeEvent* event = downcast_accEvent(aEvent);
     NS_ENSURE_TRUE(event, NS_ERROR_FAILURE);
 
     PRInt32 start = event->GetStartOffset();
     PRUint32 length = event->GetLength();
     bool isInserted = event->IsTextInserted();
     bool isFromUserInput = aEvent->IsFromUserInput();
-    char* signal_name = nsnull;
+    char* signal_name = nullptr;
 
   if (gAvailableAtkSignals == eUnknown)
     gAvailableAtkSignals =
       g_signal_lookup("text-insert", G_OBJECT_TYPE(aObject)) ?
         eHaveNewAtkTextSignals : eNoNewAtkSignals;
 
   if (gAvailableAtkSignals == eNoNewAtkSignals) {
     // XXX remove this code and the gHaveNewTextSignals check when we can
--- a/accessible/src/atk/ApplicationAccessibleWrap.cpp
+++ b/accessible/src/atk/ApplicationAccessibleWrap.cpp
@@ -23,17 +23,17 @@
 #endif
 
 using namespace mozilla;
 using namespace mozilla::a11y;
 
 typedef GType (* AtkGetTypeType) (void);
 GType g_atk_hyperlink_impl_type = G_TYPE_INVALID;
 static bool sATKChecked = false;
-static PRLibrary *sATKLib = nsnull;
+static PRLibrary *sATKLib = nullptr;
 static const char sATKLibName[] = "libatk-1.0.so.0";
 static const char sATKHyperlinkImplGetTypeSymbol[] =
   "atk_hyperlink_impl_get_type";
 
 /* gail function pointer */
 static guint (* gail_add_global_event_listener) (GSignalEmissionHook listener,
                                                  const gchar *event_type);
 static void (* gail_remove_global_event_listener) (guint remove_listener);
@@ -436,17 +436,17 @@ AtkObject*
 mai_util_get_root(void)
 {
   if (nsAccessibilityService::IsShutdown()) {
     // We've shutdown, try to use gail instead
     // (to avoid assert in spi_atk_tidy_windows())
     if (gail_get_root)
       return gail_get_root();
 
-    return nsnull;
+    return nullptr;
   }
 
   return nsAccessNode::GetApplicationAccessible()->GetAtkObject();
 }
 
 G_CONST_RETURN gchar *
 mai_util_get_toolkit_name(void)
 {
@@ -647,17 +647,17 @@ ApplicationAccessibleWrap::Unload()
         //   (*sGail.shutdown)();
         // PR_UnloadLibrary(sGail.lib);
         sGail.lib = NULL;
         sGail.init = NULL;
         sGail.shutdown = NULL;
     }
     // if (sATKLib) {
     //     PR_UnloadLibrary(sATKLib);
-    //     sATKLib = nsnull;
+    //     sATKLib = nullptr;
     // }
 }
 
 ENameValueFlag
 ApplicationAccessibleWrap::Name(nsString& aName)
 {
   // ATK doesn't provide a way to obtain an application name (for example,
   // Firefox or Thunderbird) like IA2 does. Thus let's return an application
@@ -665,17 +665,17 @@ ApplicationAccessibleWrap::Name(nsString
   // Minefield aka nightly Firefox or Daily aka nightly Thunderbird).
   GetAppName(aName);
   return eNameOK;
 }
 
 NS_IMETHODIMP
 ApplicationAccessibleWrap::GetNativeInterface(void** aOutAccessible)
 {
-    *aOutAccessible = nsnull;
+    *aOutAccessible = nullptr;
 
     if (!mAtkObject) {
         mAtkObject =
             reinterpret_cast<AtkObject *>
                             (g_object_new(MAI_TYPE_ATK_OBJECT, NULL));
         NS_ENSURE_TRUE(mAtkObject, NS_ERROR_OUT_OF_MEMORY);
 
         atk_object_initialize(mAtkObject, this);
@@ -836,17 +836,17 @@ LoadGtkModule(GnomeAccessibilityModule& 
     return NS_OK;
 }
 
 namespace mozilla {
 namespace a11y {
 
   static const char sAccEnv [] = "GNOME_ACCESSIBILITY";
 #ifdef MOZ_ENABLE_DBUS
-static DBusPendingCall *sPendingCall = nsnull;
+static DBusPendingCall *sPendingCall = nullptr;
 #endif
 
 void
 PreInit()
 {
 #ifdef MOZ_ENABLE_DBUS
   static bool sChecked = FALSE;
   if (sChecked)
@@ -856,17 +856,17 @@ PreInit()
 
   // dbus is only checked if GNOME_ACCESSIBILITY is unset
   // also make sure that a session bus address is available to prevent dbus from
   // starting a new one.  Dbus confuses the test harness when it creates a new
   // process (see bug 693343)
   if (PR_GetEnv(sAccEnv) || !PR_GetEnv("DBUS_SESSION_BUS_ADDRESS"))
     return;
 
-  DBusConnection* bus = dbus_bus_get(DBUS_BUS_SESSION, nsnull);
+  DBusConnection* bus = dbus_bus_get(DBUS_BUS_SESSION, nullptr);
   if (!bus)
     return;
 
   dbus_connection_set_exit_on_disconnect(bus, FALSE);
 
   static const char* iface = "org.a11y.Status";
   static const char* member = "IsEnabled";
   DBusMessage *message;
@@ -902,24 +902,24 @@ ShouldA11yBeEnabled()
   // check if accessibility enabled/disabled by environment variable
   const char* envValue = PR_GetEnv(sAccEnv);
   if (envValue)
     return sShouldEnable = !!atoi(envValue);
 
 #ifdef MOZ_ENABLE_DBUS
   PreInit();
   bool dbusSuccess = false;
-  DBusMessage *reply = nsnull;
+  DBusMessage *reply = nullptr;
   if (!sPendingCall)
     goto dbus_done;
 
   dbus_pending_call_block(sPendingCall);
   reply = dbus_pending_call_steal_reply(sPendingCall);
   dbus_pending_call_unref(sPendingCall);
-  sPendingCall = nsnull;
+  sPendingCall = nullptr;
   if (!reply ||
       dbus_message_get_type(reply) != DBUS_MESSAGE_TYPE_METHOD_RETURN ||
       strcmp(dbus_message_get_signature (reply), DBUS_TYPE_VARIANT_AS_STRING))
     goto dbus_done;
 
   DBusMessageIter iter, iter_variant, iter_struct;
   dbus_bool_t dResult;
   dbus_message_iter_init(reply, &iter);
--- a/accessible/src/atk/AtkSocketAccessible.cpp
+++ b/accessible/src/atk/AtkSocketAccessible.cpp
@@ -63,30 +63,30 @@ mai_atk_socket_init(MaiAtkSocket* aAcc)
 {
 }
 
 static AtkObject*
 mai_atk_socket_new(AccessibleWrap* aAccWrap)
 {
   NS_ENSURE_TRUE(aAccWrap, NULL);
 
-  MaiAtkSocket* acc = nsnull;
+  MaiAtkSocket* acc = nullptr;
   acc = static_cast<MaiAtkSocket*>(g_object_new(MAI_TYPE_ATK_SOCKET, NULL));
   NS_ENSURE_TRUE(acc, NULL);
 
   acc->accWrap = aAccWrap;
   return ATK_OBJECT(acc);
 }
 
 extern "C" {
 static AtkObject*
 RefAccessibleAtPoint(AtkComponent* aComponent, gint aX, gint aY,
                      AtkCoordType aCoordType)
 {
-  NS_ENSURE_TRUE(MAI_IS_ATK_SOCKET(aComponent), nsnull);
+  NS_ENSURE_TRUE(MAI_IS_ATK_SOCKET(aComponent), nullptr);
 
   return refAccessibleAtPointHelper(MAI_ATK_SOCKET(aComponent)->accWrap,
                                     aX, aY, aCoordType);
 }
 
 static void
 GetExtents(AtkComponent* aComponent, gint* aX, gint* aY, gint* aWidth,
            gint* aHeight, AtkCoordType aCoordType)
@@ -140,14 +140,14 @@ AtkSocketAccessible::GetNativeInterface(
   return NS_OK;
 }
 
 void
 AtkSocketAccessible::Shutdown()
 {
   if (mAtkObject) {
     if (MAI_IS_ATK_SOCKET(mAtkObject))
-      MAI_ATK_SOCKET(mAtkObject)->accWrap = nsnull;
+      MAI_ATK_SOCKET(mAtkObject)->accWrap = nullptr;
     g_object_unref(mAtkObject);
-    mAtkObject = nsnull;
+    mAtkObject = nullptr;
   }
   AccessibleWrap::Shutdown();
 }
--- a/accessible/src/atk/RootAccessibleWrap.cpp
+++ b/accessible/src/atk/RootAccessibleWrap.cpp
@@ -6,23 +6,23 @@
 
 #include "RootAccessibleWrap.h"
 
 #include "nsMai.h"
 
 using namespace mozilla::a11y;
 
 NativeRootAccessibleWrap::NativeRootAccessibleWrap(AtkObject* aAccessible):
-  RootAccessible(nsnull, nsnull, nsnull)
+  RootAccessible(nullptr, nullptr, nullptr)
 {
   // XXX: mark the object as defunct to ensure no single internal method is
   // running on it.
   mFlags |= eIsDefunct;
 
   g_object_ref(aAccessible);
   mAtkObject = aAccessible;
 }
 
 NativeRootAccessibleWrap::~NativeRootAccessibleWrap()
 {
   g_object_unref(mAtkObject);
-  mAtkObject = nsnull;
+  mAtkObject = nullptr;
 }
--- a/accessible/src/atk/nsMaiHyperlink.cpp
+++ b/accessible/src/atk/nsMaiHyperlink.cpp
@@ -85,44 +85,44 @@ mai_atk_hyperlink_get_type(void)
                                       "MaiAtkHyperlink",
                                       &tinfo, GTypeFlags(0));
     }
     return type;
 }
 
 MaiHyperlink::MaiHyperlink(Accessible* aHyperLink) :
     mHyperlink(aHyperLink),
-    mMaiAtkHyperlink(nsnull)
+    mMaiAtkHyperlink(nullptr)
 {
 }
 
 MaiHyperlink::~MaiHyperlink()
 {
     if (mMaiAtkHyperlink) {
-        MAI_ATK_HYPERLINK(mMaiAtkHyperlink)->maiHyperlink = nsnull;
+        MAI_ATK_HYPERLINK(mMaiAtkHyperlink)->maiHyperlink = nullptr;
         g_object_unref(mMaiAtkHyperlink);
     }
 }
 
 AtkHyperlink*
 MaiHyperlink::GetAtkHyperlink(void)
 {
-  NS_ENSURE_TRUE(mHyperlink, nsnull);
+  NS_ENSURE_TRUE(mHyperlink, nullptr);
 
   if (mMaiAtkHyperlink)
     return mMaiAtkHyperlink;
 
   if (!mHyperlink->IsLink())
-    return nsnull;
+    return nullptr;
 
     mMaiAtkHyperlink =
         reinterpret_cast<AtkHyperlink *>
                         (g_object_new(mai_atk_hyperlink_get_type(), NULL));
     NS_ASSERTION(mMaiAtkHyperlink, "OUT OF MEMORY");
-    NS_ENSURE_TRUE(mMaiAtkHyperlink, nsnull);
+    NS_ENSURE_TRUE(mMaiAtkHyperlink, nullptr);
 
     /* be sure to initialize it with "this" */
     MaiHyperlink::Initialize(mMaiAtkHyperlink, this);
 
     return mMaiAtkHyperlink;
 }
 
 /* static */
@@ -164,48 +164,48 @@ classInitCB(AtkHyperlinkClass *aClass)
 void
 finalizeCB(GObject *aObj)
 {
     NS_ASSERTION(MAI_IS_ATK_HYPERLINK(aObj), "Invalid MaiAtkHyperlink");
     if (!MAI_IS_ATK_HYPERLINK(aObj))
         return;
 
     MaiAtkHyperlink *maiAtkHyperlink = MAI_ATK_HYPERLINK(aObj);
-    maiAtkHyperlink->maiHyperlink = nsnull;
+    maiAtkHyperlink->maiHyperlink = nullptr;
 
     /* call parent finalize function */
     if (G_OBJECT_CLASS (parent_class)->finalize)
         G_OBJECT_CLASS (parent_class)->finalize(aObj);
 }
 
 gchar *
 getUriCB(AtkHyperlink *aLink, gint aLinkIndex)
 {
     Accessible* hyperlink = get_accessible_hyperlink(aLink);
-    NS_ENSURE_TRUE(hyperlink, nsnull);
+    NS_ENSURE_TRUE(hyperlink, nullptr);
 
     nsCOMPtr<nsIURI> uri = hyperlink->AnchorURIAt(aLinkIndex);
     if (!uri)
-        return nsnull;
+        return nullptr;
 
     nsCAutoString cautoStr;
     nsresult rv = uri->GetSpec(cautoStr);
-    NS_ENSURE_SUCCESS(rv, nsnull);
+    NS_ENSURE_SUCCESS(rv, nullptr);
 
     return g_strdup(cautoStr.get());
 }
 
 AtkObject *
 getObjectCB(AtkHyperlink *aLink, gint aLinkIndex)
 {
     Accessible* hyperlink = get_accessible_hyperlink(aLink);
-    NS_ENSURE_TRUE(hyperlink, nsnull);
+    NS_ENSURE_TRUE(hyperlink, nullptr);
 
     Accessible* anchor = hyperlink->AnchorAt(aLinkIndex);
-    NS_ENSURE_TRUE(anchor, nsnull);
+    NS_ENSURE_TRUE(anchor, nullptr);
 
     AtkObject* atkObj = AccessibleWrap::GetAtkObject(anchor);
     //no need to add ref it, because it is "get" not "ref"
     return atkObj;
 }
 
 gint
 getEndIndexCB(AtkHyperlink *aLink)
@@ -243,15 +243,15 @@ getAnchorCountCB(AtkHyperlink *aLink)
     return static_cast<gint>(hyperlink->AnchorCount());
 }
 
 // Check if aHyperlink is a valid MaiHyperlink, and return the
 // HyperLinkAccessible related.
 Accessible*
 get_accessible_hyperlink(AtkHyperlink *aHyperlink)
 {
-    NS_ENSURE_TRUE(MAI_IS_ATK_HYPERLINK(aHyperlink), nsnull);
+    NS_ENSURE_TRUE(MAI_IS_ATK_HYPERLINK(aHyperlink), nullptr);
     MaiHyperlink * maiHyperlink =
         MAI_ATK_HYPERLINK(aHyperlink)->maiHyperlink;
-    NS_ENSURE_TRUE(maiHyperlink != nsnull, nsnull);
-    NS_ENSURE_TRUE(maiHyperlink->GetAtkHyperlink() == aHyperlink, nsnull);
+    NS_ENSURE_TRUE(maiHyperlink != nullptr, nullptr);
+    NS_ENSURE_TRUE(maiHyperlink->GetAtkHyperlink() == aHyperlink, nullptr);
     return maiHyperlink->GetAccHyperlink();
 }
--- a/accessible/src/atk/nsMaiHyperlink.h
+++ b/accessible/src/atk/nsMaiHyperlink.h
@@ -21,17 +21,17 @@ class MaiHyperlink
 {
 public:
   MaiHyperlink(Accessible* aHyperLink);
   ~MaiHyperlink();
 
 public:
   AtkHyperlink *GetAtkHyperlink(void);
   Accessible* GetAccHyperlink()
-    { return mHyperlink && mHyperlink->IsLink() ? mHyperlink : nsnull; }
+    { return mHyperlink && mHyperlink->IsLink() ? mHyperlink : nullptr; }
 
 protected:
   Accessible* mHyperlink;
   AtkHyperlink* mMaiAtkHyperlink;
 public:
   static nsresult Initialize(AtkHyperlink *aObj, MaiHyperlink *aClass);
 };
 #endif /* __MAI_HYPERLINK_H__ */
--- a/accessible/src/atk/nsMaiInterfaceAction.cpp
+++ b/accessible/src/atk/nsMaiInterfaceAction.cpp
@@ -34,43 +34,43 @@ getActionCountCB(AtkAction *aAction)
   return accWrap ? accWrap->ActionCount() : 0;
 }
 
 static const gchar*
 getActionDescriptionCB(AtkAction *aAction, gint aActionIndex)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aAction));
   if (!accWrap)
-    return nsnull;
+    return nullptr;
 
   nsAutoString description;
   nsresult rv = accWrap->GetActionDescription(aActionIndex, description);
-  NS_ENSURE_SUCCESS(rv, nsnull);
+  NS_ENSURE_SUCCESS(rv, nullptr);
   return AccessibleWrap::ReturnString(description);
 }
 
 static const gchar*
 getActionNameCB(AtkAction *aAction, gint aActionIndex)
 {
     AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aAction));
     if (!accWrap)
-        return nsnull;
+        return nullptr;
 
     nsAutoString autoStr;
     nsresult rv = accWrap->GetActionName(aActionIndex, autoStr);
-    NS_ENSURE_SUCCESS(rv, nsnull);
+    NS_ENSURE_SUCCESS(rv, nullptr);
     return AccessibleWrap::ReturnString(autoStr);
 }
 
 static const gchar*
 getKeyBindingCB(AtkAction *aAction, gint aActionIndex)
 {
   AccessibleWrap* acc = GetAccessibleWrap(ATK_OBJECT(aAction));
   if (!acc)
-    return nsnull;
+    return nullptr;
 
   // Return all key bindings including access key and keyboard shortcut.
   nsAutoString keyBindingsStr;
 
   // Get access key.
   KeyBinding keyBinding = acc->AccessKey();
   if (!keyBinding.IsEmpty()) {
     keyBinding.AppendToString(keyBindingsStr, KeyBinding::eAtkFormat);
--- a/accessible/src/atk/nsMaiInterfaceComponent.cpp
+++ b/accessible/src/atk/nsMaiInterfaceComponent.cpp
@@ -41,30 +41,30 @@ grabFocusCB(AtkComponent* aComponent)
 }
 }
 
 AtkObject*
 refAccessibleAtPointHelper(AccessibleWrap* aAccWrap, gint aX, gint aY,
                            AtkCoordType aCoordType)
 {
   if (!aAccWrap || aAccWrap->IsDefunct() || nsAccUtils::MustPrune(aAccWrap))
-    return nsnull;
+    return nullptr;
 
   // Accessible::ChildAtPoint(x,y) is in screen pixels.
   if (aCoordType == ATK_XY_WINDOW) {
     nsIntPoint winCoords =
       nsCoreUtils::GetScreenCoordsForWindow(aAccWrap->GetNode());
     aX += winCoords.x;
     aY += winCoords.y;
   }
 
   Accessible* accAtPoint = aAccWrap->ChildAtPoint(aX, aY,
                                                   Accessible::eDirectChild);
   if (!accAtPoint)
-    return nsnull;
+    return nullptr;
 
   AtkObject* atkObj = AccessibleWrap::GetAtkObject(accAtPoint);
   if (atkObj)
     g_object_ref(atkObj);
   return atkObj;
 }
 
 void
--- a/accessible/src/atk/nsMaiInterfaceDocument.cpp
+++ b/accessible/src/atk/nsMaiInterfaceDocument.cpp
@@ -39,21 +39,21 @@ documentInterfaceInitCB(AtkDocumentIface
     aIface->get_document_locale = getDocumentLocaleCB;
 }
 
 const gchar *
 getDocumentLocaleCB(AtkDocument *aDocument)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aDocument));
   if (!accWrap)
-    return nsnull;
+    return nullptr;
 
   nsAutoString locale;
   accWrap->Language(locale);
-  return locale.IsEmpty() ? nsnull : AccessibleWrap::ReturnString(locale);
+  return locale.IsEmpty() ? nullptr : AccessibleWrap::ReturnString(locale);
 }
 
 static inline GSList *
 prependToList(GSList *aList, const char *const aName, const nsAutoString &aValue)
 {
   if (aValue.IsEmpty())
     return aList;
 
@@ -64,20 +64,20 @@ prependToList(GSList *aList, const char 
     return g_slist_prepend(aList, atkAttr);
 }
 
 AtkAttributeSet *
 getDocumentAttributesCB(AtkDocument *aDocument)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aDocument));
   if (!accWrap || !accWrap->IsDoc())
-    return nsnull;
+    return nullptr;
 
   // according to atkobject.h, AtkAttributeSet is a GSList
-  GSList* attributes = nsnull;
+  GSList* attributes = nullptr;
   DocAccessible* document = accWrap->AsDoc();
   nsAutoString aURL;
   nsresult rv = document->GetURL(aURL);
   if (NS_SUCCEEDED(rv))
     attributes = prependToList(attributes, kDocUrlName, aURL);
 
   nsAutoString aW3CDocType;
   rv = document->GetDocType(aW3CDocType);
@@ -93,26 +93,26 @@ getDocumentAttributesCB(AtkDocument *aDo
 }
 
 const gchar *
 getDocumentAttributeValueCB(AtkDocument *aDocument,
                             const gchar *aAttrName)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aDocument));
   if (!accWrap || !accWrap->IsDoc())
-    return nsnull;
+    return nullptr;
 
   DocAccessible* document = accWrap->AsDoc();
   nsresult rv;
   nsAutoString attrValue;
   if (!strcasecmp(aAttrName, kDocTypeName))
     rv = document->GetDocType(attrValue);
   else if (!strcasecmp(aAttrName, kDocUrlName))
     rv = document->GetURL(attrValue);
   else if (!strcasecmp(aAttrName, kMimeTypeName))
     rv = document->GetMimeType(attrValue);
   else
-    return nsnull;
+    return nullptr;
 
-  NS_ENSURE_SUCCESS(rv, nsnull);
-  return attrValue.IsEmpty() ? nsnull : AccessibleWrap::ReturnString(attrValue);
+  NS_ENSURE_SUCCESS(rv, nullptr);
+  return attrValue.IsEmpty() ? nullptr : AccessibleWrap::ReturnString(attrValue);
 }
 }
--- a/accessible/src/atk/nsMaiInterfaceHyperlinkImpl.cpp
+++ b/accessible/src/atk/nsMaiInterfaceHyperlinkImpl.cpp
@@ -9,22 +9,22 @@
 #include "nsMaiHyperlink.h"
 
 extern "C" {
 static AtkHyperlink*
 getHyperlinkCB(AtkHyperlinkImpl* aImpl)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aImpl));
   if (!accWrap)
-    return nsnull;
+    return nullptr;
 
-  NS_ENSURE_TRUE(accWrap->IsLink(), nsnull);
+  NS_ENSURE_TRUE(accWrap->IsLink(), nullptr);
 
   MaiHyperlink* maiHyperlink = accWrap->GetMaiHyperlink();
-  NS_ENSURE_TRUE(maiHyperlink, nsnull);
+  NS_ENSURE_TRUE(maiHyperlink, nullptr);
   return maiHyperlink->GetAtkHyperlink();
 }
 }
 
 void
 hyperlinkImplInterfaceInitCB(AtkHyperlinkImplIface *aIface)
 {
   NS_ASSERTION(aIface, "no interface!");
--- a/accessible/src/atk/nsMaiInterfaceHypertext.cpp
+++ b/accessible/src/atk/nsMaiInterfaceHypertext.cpp
@@ -12,31 +12,31 @@
 
 extern "C" {
 
 static AtkHyperlink*
 getLinkCB(AtkHypertext *aText, gint aLinkIndex)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
   if (!accWrap)
-    return nsnull;
+    return nullptr;
 
   HyperTextAccessible* hyperText = accWrap->AsHyperText();
-  NS_ENSURE_TRUE(hyperText, nsnull);
+  NS_ENSURE_TRUE(hyperText, nullptr);
 
   Accessible* hyperLink = hyperText->GetLinkAt(aLinkIndex);
   if (!hyperLink)
-    return nsnull;
+    return nullptr;
 
   AtkObject* hyperLinkAtkObj = AccessibleWrap::GetAtkObject(hyperLink);
   AccessibleWrap* accChild = GetAccessibleWrap(hyperLinkAtkObj);
-  NS_ENSURE_TRUE(accChild, nsnull);
+  NS_ENSURE_TRUE(accChild, nullptr);
 
   MaiHyperlink *maiHyperlink = accChild->GetMaiHyperlink();
-  NS_ENSURE_TRUE(maiHyperlink, nsnull);
+  NS_ENSURE_TRUE(maiHyperlink, nullptr);
   return maiHyperlink->GetAtkHyperlink();
 }
 
 static gint
 getLinkCountCB(AtkHypertext *aText)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
   if (!accWrap)
--- a/accessible/src/atk/nsMaiInterfaceSelection.cpp
+++ b/accessible/src/atk/nsMaiInterfaceSelection.cpp
@@ -33,21 +33,21 @@ clearSelectionCB(AtkSelection *aSelectio
   return accWrap->UnselectAll();
 }
 
 static AtkObject*
 refSelectionCB(AtkSelection *aSelection, gint i)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aSelection));
   if (!accWrap || !accWrap->IsSelect())
-    return nsnull;
+    return nullptr;
 
   Accessible* selectedItem = accWrap->GetSelectedItem(i);
   if (!selectedItem)
-    return nsnull;
+    return nullptr;
 
   AtkObject* atkObj = AccessibleWrap::GetAtkObject(selectedItem);
   if (atkObj)
     g_object_ref(atkObj);
 
   return atkObj;
 }
 
--- a/accessible/src/atk/nsMaiInterfaceTable.cpp
+++ b/accessible/src/atk/nsMaiInterfaceTable.cpp
@@ -17,27 +17,27 @@
 using namespace mozilla::a11y;
 
 extern "C" {
 static AtkObject*
 refAtCB(AtkTable *aTable, gint aRow, gint aColumn)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
   if (!accWrap)
-    return nsnull;
+    return nullptr;
 
     nsCOMPtr<nsIAccessibleTable> accTable;
     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
                             getter_AddRefs(accTable));
-    NS_ENSURE_TRUE(accTable, nsnull);
+    NS_ENSURE_TRUE(accTable, nullptr);
 
     nsCOMPtr<nsIAccessible> cell;
     nsresult rv = accTable->GetCellAt(aRow, aColumn,getter_AddRefs(cell));
     if (NS_FAILED(rv) || !cell)
-        return nsnull;
+        return nullptr;
 
     AtkObject* cellAtkObj = AccessibleWrap::GetAtkObject(cell);
     if (cellAtkObj) {
         g_object_ref(cellAtkObj);
     }
     return cellAtkObj;
 }
 
@@ -170,60 +170,60 @@ getRowExtentAtCB(AtkTable *aTable,
     return static_cast<gint>(extent);
 }
 
 static AtkObject*
 getCaptionCB(AtkTable* aTable)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
   if (!accWrap)
-    return nsnull;
+    return nullptr;
 
   TableAccessible* table = accWrap->AsTable();
-  NS_ENSURE_TRUE(table, nsnull);
+  NS_ENSURE_TRUE(table, nullptr);
 
   Accessible* caption = table->Caption();
-  return caption ? AccessibleWrap::GetAtkObject(caption) : nsnull;
+  return caption ? AccessibleWrap::GetAtkObject(caption) : nullptr;
 }
 
 static const gchar*
 getColumnDescriptionCB(AtkTable *aTable, gint aColumn)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
   if (!accWrap)
-    return nsnull;
+    return nullptr;
 
     nsCOMPtr<nsIAccessibleTable> accTable;
     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
                             getter_AddRefs(accTable));
-    NS_ENSURE_TRUE(accTable, nsnull);
+    NS_ENSURE_TRUE(accTable, nullptr);
 
     nsAutoString autoStr;
     nsresult rv = accTable->GetColumnDescription(aColumn, autoStr);
-    NS_ENSURE_SUCCESS(rv, nsnull);
+    NS_ENSURE_SUCCESS(rv, nullptr);
 
     return AccessibleWrap::ReturnString(autoStr);
 }
 
 static AtkObject*
 getColumnHeaderCB(AtkTable *aTable, gint aColumn)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
   if (!accWrap)
-    return nsnull;
+    return nullptr;
 
     nsCOMPtr<nsIAccessibleTable> accTable;
     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
                             getter_AddRefs(accTable));
-    NS_ENSURE_TRUE(accTable, nsnull);
+    NS_ENSURE_TRUE(accTable, nullptr);
 
     nsCOMPtr<nsIAccessible> accCell;
     accTable->GetCellAt(0, aColumn, getter_AddRefs(accCell));
     if (!accCell)
-        return nsnull;
+        return nullptr;
 
     // If the cell at the first row is column header then assume it is column
     // header for all rows,
     if (nsAccUtils::Role(accCell) == nsIAccessibleRole::ROLE_COLUMNHEADER)
         return AccessibleWrap::GetAtkObject(accCell);
 
     // otherwise get column header for the data cell at the first row.
     nsCOMPtr<nsIAccessibleTableCell> accTableCell =
@@ -231,60 +231,60 @@ getColumnHeaderCB(AtkTable *aTable, gint
 
     if (accTableCell) {
         nsCOMPtr<nsIArray> headerCells;
         accTableCell->GetColumnHeaderCells(getter_AddRefs(headerCells));
         if (headerCells) {
             nsresult rv;
             nsCOMPtr<nsIAccessible> accHeaderCell =
                 do_QueryElementAt(headerCells, 0, &rv);
-            NS_ENSURE_SUCCESS(rv, nsnull);
+            NS_ENSURE_SUCCESS(rv, nullptr);
 
             return AccessibleWrap::GetAtkObject(accHeaderCell);
         }
     }
 
-    return nsnull;
+    return nullptr;
 }
 
 static const gchar*
 getRowDescriptionCB(AtkTable *aTable, gint aRow)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
   if (!accWrap)
-    return nsnull;
+    return nullptr;
 
     nsCOMPtr<nsIAccessibleTable> accTable;
     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
                             getter_AddRefs(accTable));
-    NS_ENSURE_TRUE(accTable, nsnull);
+    NS_ENSURE_TRUE(accTable, nullptr);
 
     nsAutoString autoStr;
     nsresult rv = accTable->GetRowDescription(aRow, autoStr);
-    NS_ENSURE_SUCCESS(rv, nsnull);
+    NS_ENSURE_SUCCESS(rv, nullptr);
 
     return AccessibleWrap::ReturnString(autoStr);
 }
 
 static AtkObject*
 getRowHeaderCB(AtkTable *aTable, gint aRow)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
   if (!accWrap)
-    return nsnull;
+    return nullptr;
 
     nsCOMPtr<nsIAccessibleTable> accTable;
     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
                             getter_AddRefs(accTable));
-    NS_ENSURE_TRUE(accTable, nsnull);
+    NS_ENSURE_TRUE(accTable, nullptr);
 
     nsCOMPtr<nsIAccessible> accCell;
     accTable->GetCellAt(aRow, 0, getter_AddRefs(accCell));
     if (!accCell)
-      return nsnull;
+      return nullptr;
 
     // If the cell at the first column is row header then assume it is row
     // header for all columns,
     if (nsAccUtils::Role(accCell) == nsIAccessibleRole::ROLE_ROWHEADER)
         return AccessibleWrap::GetAtkObject(accCell);
 
     // otherwise get row header for the data cell at the first column.
     nsCOMPtr<nsIAccessibleTableCell> accTableCell =
@@ -292,33 +292,33 @@ getRowHeaderCB(AtkTable *aTable, gint aR
 
     if (accTableCell) {
       nsCOMPtr<nsIArray> headerCells;
       accTableCell->GetRowHeaderCells(getter_AddRefs(headerCells));
       if (headerCells) {
         nsresult rv;
         nsCOMPtr<nsIAccessible> accHeaderCell =
             do_QueryElementAt(headerCells, 0, &rv);
-        NS_ENSURE_SUCCESS(rv, nsnull);
+        NS_ENSURE_SUCCESS(rv, nullptr);
 
         return AccessibleWrap::GetAtkObject(accHeaderCell);
       }
     }
 
-    return nsnull;
+    return nullptr;
 }
 
 static AtkObject*
 getSummaryCB(AtkTable *aTable)
 {
   // Neither html:table nor xul:tree nor ARIA grid/tree have an ability to
   // link an accessible object to specify a summary. There is closes method
   // in nsIAccessibleTable::summary to get a summary as a string which is not
   // mapped directly to ATK.
-  return nsnull;
+  return nullptr;
 }
 
 static gint
 getSelectedColumnsCB(AtkTable *aTable, gint **aSelected)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
   if (!accWrap)
     return 0;
@@ -327,17 +327,17 @@ getSelectedColumnsCB(AtkTable *aTable, g
     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
                             getter_AddRefs(accTable));
     NS_ENSURE_TRUE(accTable, 0);
 
     PRUint32 size = 0;
     PRInt32 *columns = NULL;
     nsresult rv = accTable->GetSelectedColumnIndices(&size, &columns);
     if (NS_FAILED(rv) || (size == 0) || !columns) {
-        *aSelected = nsnull;
+        *aSelected = nullptr;
         return 0;
     }
 
     gint *atkColumns = g_new(gint, size);
     if (!atkColumns) {
         NS_WARNING("OUT OF MEMORY");
         return 0;
     }
@@ -362,17 +362,17 @@ getSelectedRowsCB(AtkTable *aTable, gint
     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
                             getter_AddRefs(accTable));
     NS_ENSURE_TRUE(accTable, 0);
 
     PRUint32 size = 0;
     PRInt32 *rows = NULL;
     nsresult rv = accTable->GetSelectedRowIndices(&size, &rows);
     if (NS_FAILED(rv) || (size == 0) || !rows) {
-        *aSelected = nsnull;
+        *aSelected = nullptr;
         return 0;
     }
 
     gint *atkRows = g_new(gint, size);
     if (!atkRows) {
         NS_WARNING("OUT OF MEMORY");
         return 0;
     }
--- a/accessible/src/atk/nsMaiInterfaceText.cpp
+++ b/accessible/src/atk/nsMaiInterfaceText.cpp
@@ -27,90 +27,90 @@ ConvertTexttoAsterisks(AccessibleWrap* a
 
 extern "C" {
 
 static gchar*
 getTextCB(AtkText *aText, gint aStartOffset, gint aEndOffset)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
   if (!accWrap)
-    return nsnull;
+    return nullptr;
 
     nsCOMPtr<nsIAccessibleText> accText;
     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
                             getter_AddRefs(accText));
-    NS_ENSURE_TRUE(accText, nsnull);
+    NS_ENSURE_TRUE(accText, nullptr);
 
     nsAutoString autoStr;
     nsresult rv = accText->GetText(aStartOffset, aEndOffset, autoStr);
-    NS_ENSURE_SUCCESS(rv, nsnull);
+    NS_ENSURE_SUCCESS(rv, nullptr);
 
     ConvertTexttoAsterisks(accWrap, autoStr);
     NS_ConvertUTF16toUTF8 cautoStr(autoStr);
 
     //copy and return, libspi will free it.
-    return (cautoStr.get()) ? g_strdup(cautoStr.get()) : nsnull;
+    return (cautoStr.get()) ? g_strdup(cautoStr.get()) : nullptr;
 }
 
 static gchar*
 getTextAfterOffsetCB(AtkText *aText, gint aOffset,
                      AtkTextBoundary aBoundaryType,
                      gint *aStartOffset, gint *aEndOffset)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
   if (!accWrap)
-    return nsnull;
+    return nullptr;
 
     nsCOMPtr<nsIAccessibleText> accText;
     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
                             getter_AddRefs(accText));
-    NS_ENSURE_TRUE(accText, nsnull);
+    NS_ENSURE_TRUE(accText, nullptr);
 
     nsAutoString autoStr;
     PRInt32 startOffset = 0, endOffset = 0;
     nsresult rv =
         accText->GetTextAfterOffset(aOffset, aBoundaryType,
                                     &startOffset, &endOffset, autoStr);
     *aStartOffset = startOffset;
     *aEndOffset = endOffset;
 
-    NS_ENSURE_SUCCESS(rv, nsnull);
+    NS_ENSURE_SUCCESS(rv, nullptr);
 
     ConvertTexttoAsterisks(accWrap, autoStr);
     NS_ConvertUTF16toUTF8 cautoStr(autoStr);
-    return (cautoStr.get()) ? g_strdup(cautoStr.get()) : nsnull;
+    return (cautoStr.get()) ? g_strdup(cautoStr.get()) : nullptr;
 }
 
 static gchar*
 getTextAtOffsetCB(AtkText *aText, gint aOffset,
                   AtkTextBoundary aBoundaryType,
                   gint *aStartOffset, gint *aEndOffset)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
   if (!accWrap)
-    return nsnull;
+    return nullptr;
 
     nsCOMPtr<nsIAccessibleText> accText;
     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
                             getter_AddRefs(accText));
-    NS_ENSURE_TRUE(accText, nsnull);
+    NS_ENSURE_TRUE(accText, nullptr);
 
     nsAutoString autoStr;
     PRInt32 startOffset = 0, endOffset = 0;
     nsresult rv =
         accText->GetTextAtOffset(aOffset, aBoundaryType,
                                  &startOffset, &endOffset, autoStr);
     *aStartOffset = startOffset;
     *aEndOffset = endOffset;
 
-    NS_ENSURE_SUCCESS(rv, nsnull);
+    NS_ENSURE_SUCCESS(rv, nullptr);
 
     ConvertTexttoAsterisks(accWrap, autoStr);
     NS_ConvertUTF16toUTF8 cautoStr(autoStr);
-    return (cautoStr.get()) ? g_strdup(cautoStr.get()) : nsnull;
+    return (cautoStr.get()) ? g_strdup(cautoStr.get()) : nullptr;
 }
 
 static gunichar
 getCharacterAtOffsetCB(AtkText* aText, gint aOffset)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
   if (!accWrap)
     return 0;
@@ -136,36 +136,36 @@ getCharacterAtOffsetCB(AtkText* aText, g
 
 static gchar*
 getTextBeforeOffsetCB(AtkText *aText, gint aOffset,
                       AtkTextBoundary aBoundaryType,
                       gint *aStartOffset, gint *aEndOffset)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
   if (!accWrap)
-    return nsnull;
+    return nullptr;
 
     nsCOMPtr<nsIAccessibleText> accText;
     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
                             getter_AddRefs(accText));
-    NS_ENSURE_TRUE(accText, nsnull);
+    NS_ENSURE_TRUE(accText, nullptr);
 
     nsAutoString autoStr;
     PRInt32 startOffset = 0, endOffset = 0;
     nsresult rv =
         accText->GetTextBeforeOffset(aOffset, aBoundaryType,
                                      &startOffset, &endOffset, autoStr);
     *aStartOffset = startOffset;
     *aEndOffset = endOffset;
 
-    NS_ENSURE_SUCCESS(rv, nsnull);
+    NS_ENSURE_SUCCESS(rv, nullptr);
 
     ConvertTexttoAsterisks(accWrap, autoStr);
     NS_ConvertUTF16toUTF8 cautoStr(autoStr);
-    return (cautoStr.get()) ? g_strdup(cautoStr.get()) : nsnull;
+    return (cautoStr.get()) ? g_strdup(cautoStr.get()) : nullptr;
 }
 
 static gint
 getCaretOffsetCB(AtkText *aText)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
   if (!accWrap)
     return 0;
@@ -185,52 +185,52 @@ getRunAttributesCB(AtkText *aText, gint 
                    gint *aStartOffset,
                    gint *aEndOffset)
 {
   *aStartOffset = -1;
   *aEndOffset = -1;
 
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
   if (!accWrap)
-    return nsnull;
+    return nullptr;
 
     nsCOMPtr<nsIAccessibleText> accText;
     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
                             getter_AddRefs(accText));
-    NS_ENSURE_TRUE(accText, nsnull);
+    NS_ENSURE_TRUE(accText, nullptr);
 
     nsCOMPtr<nsIPersistentProperties> attributes;
     PRInt32 startOffset = 0, endOffset = 0;
     nsresult rv = accText->GetTextAttributes(false, aOffset,
                                              &startOffset, &endOffset,
                                              getter_AddRefs(attributes));
-    NS_ENSURE_SUCCESS(rv, nsnull);
+    NS_ENSURE_SUCCESS(rv, nullptr);
 
     *aStartOffset = startOffset;
     *aEndOffset = endOffset;
 
     return ConvertToAtkAttributeSet(attributes);
 }
 
 static AtkAttributeSet*
 getDefaultAttributesCB(AtkText *aText)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
   if (!accWrap)
-    return nsnull;
+    return nullptr;
 
     nsCOMPtr<nsIAccessibleText> accText;
     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
                             getter_AddRefs(accText));
-    NS_ENSURE_TRUE(accText, nsnull);
+    NS_ENSURE_TRUE(accText, nullptr);
 
     nsCOMPtr<nsIPersistentProperties> attributes;
     nsresult rv = accText->GetDefaultTextAttributes(getter_AddRefs(attributes));
     if (NS_FAILED(rv))
-        return nsnull;
+        return nullptr;
 
     return ConvertToAtkAttributeSet(attributes);
 }
 
 static void
 getCharacterExtentsCB(AtkText *aText, gint aOffset,
                       gint *aX, gint *aY,
                       gint *aWidth, gint *aHeight,
@@ -363,31 +363,31 @@ getTextSelectionCountCB(AtkText *aText)
 }
 
 static gchar*
 getTextSelectionCB(AtkText *aText, gint aSelectionNum,
                    gint *aStartOffset, gint *aEndOffset)
 {
   AccessibleWrap* accWrap = GetAccessibleWrap(ATK_OBJECT(aText));
   if (!accWrap)
-    return nsnull;
+    return nullptr;
 
     nsCOMPtr<nsIAccessibleText> accText;
     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleText),
                             getter_AddRefs(accText));
-    NS_ENSURE_TRUE(accText, nsnull);
+    NS_ENSURE_TRUE(accText, nullptr);
 
     PRInt32 startOffset = 0, endOffset = 0;
     nsresult rv = accText->GetSelectionBounds(aSelectionNum,
                                               &startOffset, &endOffset);
 
     *aStartOffset = startOffset;
     *aEndOffset = endOffset;
 
-    NS_ENSURE_SUCCESS(rv, nsnull);
+    NS_ENSURE_SUCCESS(rv, nullptr);
 
     return getTextCB(aText, *aStartOffset, *aEndOffset);
 }
 
 // set methods
 static gboolean
 addTextSelectionCB(AtkText *aText,
                    gint aStartOffset,
--- a/accessible/src/base/ARIAStateMap.cpp
+++ b/accessible/src/base/ARIAStateMap.cpp
@@ -21,24 +21,24 @@ using namespace mozilla::a11y::aria;
 struct EnumTypeData
 {
   EnumTypeData(nsIAtom* aAttrName,
                nsIAtom** aValue1, PRUint64 aState1,
                nsIAtom** aValue2, PRUint64 aState2,
                nsIAtom** aValue3 = 0, PRUint64 aState3 = 0) :
     mState1(aState1), mState2(aState2), mState3(aState3), mDefaultState(0),
     mAttrName(aAttrName), mValue1(aValue1), mValue2(aValue2), mValue3(aValue3),
-    mNullValue(nsnull)
+    mNullValue(nullptr)
   { }
 
   EnumTypeData(nsIAtom* aAttrName, PRUint64 aDefaultState,
                nsIAtom** aValue1, PRUint64 aState1) :
     mState1(aState1), mState2(0), mState3(0), mDefaultState(aDefaultState),
-    mAttrName(aAttrName), mValue1(aValue1), mValue2(nsnull), mValue3(nsnull),
-    mNullValue(nsnull)
+    mAttrName(aAttrName), mValue1(aValue1), mValue2(nullptr), mValue3(nullptr),
+    mNullValue(nullptr)
   { }
 
   // States applied if corresponding enum values are matched.
   const PRUint64 mState1;
   const PRUint64 mState2;
   const PRUint64 mState3;
 
   // Default state if no one enum value is matched.
--- a/accessible/src/base/AccCollector.cpp
+++ b/accessible/src/base/AccCollector.cpp
@@ -18,24 +18,24 @@ AccCollector::
 
 AccCollector::~AccCollector()
 {
 }
 
 PRUint32
 AccCollector::Count()
 {
-  EnsureNGetIndex(nsnull);
+  EnsureNGetIndex(nullptr);
   return mObjects.Length();
 }
 
 Accessible*
 AccCollector::GetAccessibleAt(PRUint32 aIndex)
 {
-  Accessible* accessible = mObjects.SafeElementAt(aIndex, nsnull);
+  Accessible* accessible = mObjects.SafeElementAt(aIndex, nullptr);
   if (accessible)
     return accessible;
 
   return EnsureNGetObject(aIndex);
 }
 
 PRInt32
 AccCollector::GetIndexAt(Accessible* aAccessible)
@@ -59,17 +59,17 @@ AccCollector::EnsureNGetObject(PRUint32 
     if (!mFilterFunc(child))
       continue;
 
     AppendObject(child);
     if (mObjects.Length() - 1 == aIndex)
       return mObjects[aIndex];
   }
 
-  return nsnull;
+  return nullptr;
 }
 
 PRInt32
 AccCollector::EnsureNGetIndex(Accessible* aAccessible)
 {
   PRUint32 childCount = mRoot->ChildCount();
   while (mRootChildIdx < childCount) {
     Accessible* child = mRoot->GetChildAt(mRootChildIdx++);
--- a/accessible/src/base/AccEvent.cpp
+++ b/accessible/src/base/AccEvent.cpp
@@ -68,17 +68,17 @@ AccEvent::GetDocAccessible()
 {
   if (mAccessible)
     return mAccessible->Document();
 
   nsINode* node = GetNode();
   if (node)
     return GetAccService()->GetDocAccessible(node->OwnerDoc());
 
-  return nsnull;
+  return nullptr;
 }
 
 already_AddRefed<nsAccEvent>
 AccEvent::CreateXPCOMObject()
 {
   nsAccEvent* event = new nsAccEvent(this);
   NS_IF_ADDREF(event);
   return event;
@@ -109,17 +109,17 @@ AccEvent::GetAccessibleForNode() const
 {
   if (mNode) {
     DocAccessible* document =
       GetAccService()->GetDocAccessible(mNode->OwnerDoc());
     if (document)
       return document->GetAccessible(mNode);
   }
 
-  return nsnull;
+  return nullptr;
 }
 
 void
 AccEvent::CaptureIsFromUserInput(EIsFromUserInput aIsFromUserInput)
 {
   nsINode *targetNode = GetNode();
 
 #ifdef DEBUG
@@ -321,17 +321,17 @@ AccCaretMoveEvent::CreateXPCOMObject()
 // AccSelChangeEvent
 ////////////////////////////////////////////////////////////////////////////////
 
 AccSelChangeEvent::
   AccSelChangeEvent(Accessible* aWidget, Accessible* aItem,
                     SelChangeType aSelChangeType) :
     AccEvent(0, aItem, eAutoDetect, eCoalesceSelectionChange),
     mWidget(aWidget), mItem(aItem), mSelChangeType(aSelChangeType),
-    mPreceedingCount(0), mPackedEvent(nsnull)
+    mPreceedingCount(0), mPackedEvent(nullptr)
 {
   if (aSelChangeType == eSelectionAdd) {
     if (mWidget->GetSelectedItem(1))
       mEventType = nsIAccessibleEvent::EVENT_SELECTION_ADD;
     else
       mEventType = nsIAccessibleEvent::EVENT_SELECTION;
   } else {
     mEventType = nsIAccessibleEvent::EVENT_SELECTION_REMOVE;
--- a/accessible/src/base/AccEvent.h
+++ b/accessible/src/base/AccEvent.h
@@ -406,20 +406,20 @@ private:
 class downcast_accEvent
 {
 public:
   downcast_accEvent(AccEvent* e) : mRawPtr(e) { }
 
   template<class Destination>
   operator Destination*() {
     if (!mRawPtr)
-      return nsnull;
+      return nullptr;
 
     return mRawPtr->GetEventGroups() & (1U << Destination::kEventGroup) ?
-      static_cast<Destination*>(mRawPtr) : nsnull;
+      static_cast<Destination*>(mRawPtr) : nullptr;
   }
 
 private:
   AccEvent* mRawPtr;
 };
 
 #endif
 
--- a/accessible/src/base/AccGroupInfo.cpp
+++ b/accessible/src/base/AccGroupInfo.cpp
@@ -5,17 +5,17 @@
 #include "AccGroupInfo.h"
 
 #include "Role.h"
 #include "States.h"
 
 using namespace mozilla::a11y;
 
 AccGroupInfo::AccGroupInfo(Accessible* aItem, role aRole) :
-  mPosInSet(0), mSetSize(0), mParent(nsnull)
+  mPosInSet(0), mSetSize(0), mParent(nullptr)
 {
   MOZ_COUNT_CTOR(AccGroupInfo);
   Accessible* parent = aItem->Parent();
   if (!parent)
     return;
 
   PRInt32 indexInParent = aItem->IndexInParent();
   PRUint32 siblingCount = parent->ChildCount();
--- a/accessible/src/base/AccGroupInfo.h
+++ b/accessible/src/base/AccGroupInfo.h
@@ -36,17 +36,17 @@ public:
         role != mozilla::a11y::roles::COMBOBOX_OPTION &&
         role != mozilla::a11y::roles::RICH_OPTION &&
         role != mozilla::a11y::roles::CHECK_RICH_OPTION &&
         role != mozilla::a11y::roles::PARENT_MENUITEM &&
         role != mozilla::a11y::roles::CHECK_MENU_ITEM &&
         role != mozilla::a11y::roles::RADIO_MENU_ITEM &&
         role != mozilla::a11y::roles::RADIOBUTTON &&
         role != mozilla::a11y::roles::PAGETAB)
-      return nsnull;
+      return nullptr;
 
     AccGroupInfo* info = new AccGroupInfo(aAccessible, BaseRole(role));
     return info;
   }
 
 private:
   AccGroupInfo(const AccGroupInfo&);
   AccGroupInfo& operator =(const AccGroupInfo&);
--- a/accessible/src/base/AccIterator.cpp
+++ b/accessible/src/base/AccIterator.cpp
@@ -52,17 +52,17 @@ AccIterator::Next()
       return child;
 
     if (mIsDeep) {
       IteratorState *childState = new IteratorState(child, mState);
       mState = childState;
     }
   }
 
-  return nsnull;
+  return nullptr;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccIterator::IteratorState
 
 AccIterator::IteratorState::IteratorState(Accessible* aParent,
                                           IteratorState *mParentState) :
   mParent(aParent), mIndex(0), mParentState(mParentState)
@@ -72,33 +72,33 @@ AccIterator::IteratorState::IteratorStat
 
 ////////////////////////////////////////////////////////////////////////////////
 // RelatedAccIterator
 ////////////////////////////////////////////////////////////////////////////////
 
 RelatedAccIterator::
   RelatedAccIterator(DocAccessible* aDocument, nsIContent* aDependentContent,
                      nsIAtom* aRelAttr) :
-  mDocument(aDocument), mRelAttr(aRelAttr), mProviders(nsnull),
-  mBindingParent(nsnull), mIndex(0)
+  mDocument(aDocument), mRelAttr(aRelAttr), mProviders(nullptr),
+  mBindingParent(nullptr), mIndex(0)
 {
   mBindingParent = aDependentContent->GetBindingParent();
   nsIAtom* IDAttr = mBindingParent ?
     nsGkAtoms::anonid : aDependentContent->GetIDAttributeName();
 
   nsAutoString id;
   if (aDependentContent->GetAttr(kNameSpaceID_None, IDAttr, id))
     mProviders = mDocument->mDependentIDsHash.Get(id);
 }
 
 Accessible*
 RelatedAccIterator::Next()
 {
   if (!mProviders)
-    return nsnull;
+    return nullptr;
 
   while (mIndex < mProviders->Length()) {
     DocAccessible::AttrRelProvider* provider = (*mProviders)[mIndex++];
 
     // Return related accessible for the given attribute and if the provider
     // content is in the same binding in the case of XBL usage.
     if (provider->mRelAttr == mRelAttr) {
       nsIContent* bindingParent = provider->mContent->GetBindingParent();
@@ -113,17 +113,17 @@ RelatedAccIterator::Next()
         // If the document content is pointed by relation then return the document
         // itself.
         if (provider->mContent == mDocument->GetContent())
           return mDocument;
       }
     }
   }
 
-  return nsnull;
+  return nullptr;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLLabelIterator
 ////////////////////////////////////////////////////////////////////////////////
 
 HTMLLabelIterator::
@@ -134,25 +134,25 @@ HTMLLabelIterator::
 {
 }
 
 Accessible*
 HTMLLabelIterator::Next()
 {
   // Get either <label for="[id]"> element which explicitly points to given
   // element, or <label> ancestor which implicitly point to it.
-  Accessible* label = nsnull;
+  Accessible* label = nullptr;
   while ((label = mRelIter.Next())) {
     if (label->GetContent()->Tag() == nsGkAtoms::label)
       return label;
   }
 
   // Ignore ancestor label on not widget accessible.
   if (mLabelFilter == eSkipAncestorLabel || !mAcc->IsWidget())
-    return nsnull;
+    return nullptr;
 
   // Go up tree to get a name of ancestor label if there is one (an ancestor
   // <label> implicitly points to us). Don't go up farther than form or
   // document.
   Accessible* walkUp = mAcc->Parent();
   while (walkUp && !walkUp->IsDoc()) {
     nsIContent* walkUpElm = walkUp->GetContent();
     if (walkUpElm->IsHTML()) {
@@ -164,86 +164,86 @@ HTMLLabelIterator::Next()
 
       if (walkUpElm->Tag() == nsGkAtoms::form)
         break;
     }
 
     walkUp = walkUp->Parent();
   }
 
-  return nsnull;
+  return nullptr;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLOutputIterator
 ////////////////////////////////////////////////////////////////////////////////
 
 HTMLOutputIterator::
 HTMLOutputIterator(DocAccessible* aDocument, nsIContent* aElement) :
   mRelIter(aDocument, aElement, nsGkAtoms::_for)
 {
 }
 
 Accessible*
 HTMLOutputIterator::Next()
 {
-  Accessible* output = nsnull;
+  Accessible* output = nullptr;
   while ((output = mRelIter.Next())) {
     if (output->GetContent()->Tag() == nsGkAtoms::output)
       return output;
   }
 
-  return nsnull;
+  return nullptr;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULLabelIterator
 ////////////////////////////////////////////////////////////////////////////////
 
 XULLabelIterator::
   XULLabelIterator(DocAccessible* aDocument, nsIContent* aElement) :
   mRelIter(aDocument, aElement, nsGkAtoms::control)
 {
 }
 
 Accessible*
 XULLabelIterator::Next()
 {
-  Accessible* label = nsnull;
+  Accessible* label = nullptr;
   while ((label = mRelIter.Next())) {
     if (label->GetContent()->Tag() == nsGkAtoms::label)
       return label;
   }
 
-  return nsnull;
+  return nullptr;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULDescriptionIterator
 ////////////////////////////////////////////////////////////////////////////////
 
 XULDescriptionIterator::
   XULDescriptionIterator(DocAccessible* aDocument, nsIContent* aElement) :
   mRelIter(aDocument, aElement, nsGkAtoms::control)
 {
 }
 
 Accessible*
 XULDescriptionIterator::Next()
 {
-  Accessible* descr = nsnull;
+  Accessible* descr = nullptr;
   while ((descr = mRelIter.Next())) {
     if (descr->GetContent()->Tag() == nsGkAtoms::description)
       return descr;
   }
 
-  return nsnull;
+  return nullptr;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // IDRefsIterator
 ////////////////////////////////////////////////////////////////////////////////
 
 IDRefsIterator::
   IDRefsIterator(DocAccessible* aDoc, nsIContent* aContent,
@@ -282,17 +282,17 @@ IDRefsIterator::NextElem()
     if (id.IsEmpty())
       break;
 
     nsIContent* refContent = GetElem(id);
     if (refContent)
       return refContent;
   }
 
-  return nsnull;
+  return nullptr;
 }
 
 nsIContent*
 IDRefsIterator::GetElem(const nsDependentSubstring& aID)
 {
   // Get elements in DOM tree by ID attribute if this is an explicit content.
   // In case of bound element check its anonymous subtree.
   if (!mContent->IsInAnonymousSubtree()) {
@@ -315,26 +315,26 @@ IDRefsIterator::GetElem(const nsDependen
   }
 
   // Check inside the binding of the element.
   if (mContent->OwnerDoc()->BindingManager()->GetBinding(mContent)) {
     return mContent->OwnerDoc()->
       GetAnonymousElementByAttribute(mContent, nsGkAtoms::anonid, aID);
   }
 
-  return nsnull;
+  return nullptr;
 }
 
 Accessible*
 IDRefsIterator::Next()
 {
   nsIContent* nextElm = NextElem();
-  return nextElm ? mDoc->GetAccessible(nextElm) : nsnull;
+  return nextElm ? mDoc->GetAccessible(nextElm) : nullptr;
 }
 
 Accessible*
 SingleAccIterator::Next()
 {
   nsRefPtr<Accessible> nextAcc;
   mAcc.swap(nextAcc);
-  return (nextAcc && !nextAcc->IsDefunct()) ? nextAcc : nsnull;
+  return (nextAcc && !nextAcc->IsDefunct()) ? nextAcc : nullptr;
 }
 
--- a/accessible/src/base/AccIterator.h
+++ b/accessible/src/base/AccIterator.h
@@ -61,17 +61,17 @@ public:
 
 private:
   AccIterator();
   AccIterator(const AccIterator&);
   AccIterator& operator =(const AccIterator&);
 
   struct IteratorState
   {
-    IteratorState(Accessible* aParent, IteratorState* mParentState = nsnull);
+    IteratorState(Accessible* aParent, IteratorState* mParentState = nullptr);
 
     Accessible* mParent;
     PRInt32 mIndex;
     IteratorState *mParentState;
   };
 
   filters::FilterFuncPtr mFilterFunc;
   bool mIsDeep;
--- a/accessible/src/base/FocusManager.cpp
+++ b/accessible/src/base/FocusManager.cpp
@@ -31,20 +31,20 @@ FocusManager::FocusedAccessible() const
 {
   if (mActiveItem)
     return mActiveItem;
 
   nsINode* focusedNode = FocusedDOMNode();
   if (focusedNode) {
     DocAccessible* doc = 
       GetAccService()->GetDocAccessible(focusedNode->OwnerDoc());
-    return doc ? doc->GetAccessibleOrContainer(focusedNode) : nsnull;
+    return doc ? doc->GetAccessibleOrContainer(focusedNode) : nullptr;
   }
 
-  return nsnull;
+  return nullptr;
 }
 
 bool
 FocusManager::IsFocused(const Accessible* aAccessible) const
 {
   if (mActiveItem)
     return mActiveItem == aAccessible;
 
@@ -55,17 +55,17 @@ FocusManager::IsFocused(const Accessible
     // accessible creation for temporary about:blank document. Without this
     // peculiarity we would end up with plain implementation based on
     // FocusedAccessible() method call. Make sure this issue is fixed in
     // bug 638465.
     if (focusedNode->OwnerDoc() == aAccessible->GetNode()->OwnerDoc()) {
       DocAccessible* doc = 
         GetAccService()->GetDocAccessible(focusedNode->OwnerDoc());
       return aAccessible ==
-	(doc ? doc->GetAccessibleOrContainer(focusedNode) : nsnull);
+	(doc ? doc->GetAccessibleOrContainer(focusedNode) : nullptr);
     }
   }
   return false;
 }
 
 bool
 FocusManager::IsFocusWithin(const Accessible* aContainer) const
 {
@@ -112,17 +112,17 @@ FocusManager::IsInOrContainsFocus(const 
 }
 
 void
 FocusManager::NotifyOfDOMFocus(nsISupports* aTarget)
 {
   A11YDEBUG_FOCUS_NOTIFICATION_SUPPORTSTARGET("DOM focus", "DOM focus target",
                                               aTarget)
 
-  mActiveItem = nsnull;
+  mActiveItem = nullptr;
 
   nsCOMPtr<nsINode> targetNode(do_QueryInterface(aTarget));
   if (targetNode) {
     DocAccessible* document =
       GetAccService()->GetDocAccessible(targetNode->OwnerDoc());
     if (document) {
       // Set selection listener for focused element.
       if (targetNode->IsElement()) {
@@ -138,17 +138,17 @@ FocusManager::NotifyOfDOMFocus(nsISuppor
 }
 
 void
 FocusManager::NotifyOfDOMBlur(nsISupports* aTarget)
 {
   A11YDEBUG_FOCUS_NOTIFICATION_SUPPORTSTARGET("DOM blur", "DOM blur target",
                                               aTarget)
 
-  mActiveItem = nsnull;
+  mActiveItem = nullptr;
 
   // If DOM document stays focused then fire accessible focus event to process
   // the case when no element within this DOM document will be focused.
   nsCOMPtr<nsINode> targetNode(do_QueryInterface(aTarget));
   if (targetNode && targetNode->OwnerDoc() == FocusedDOMDocument()) {
     nsIDocument* DOMDoc = targetNode->OwnerDoc();
     DocAccessible* document =
       GetAccService()->GetDocAccessible(DOMDoc);
@@ -164,17 +164,17 @@ FocusManager::ActiveItemChanged(Accessib
 {
   A11YDEBUG_FOCUS_NOTIFICATION_ACCTARGET("active item changed",
                                          "Active item", aItem)
 
   // Nothing changed, happens for XUL trees and HTML selects.
   if (aItem && aItem == mActiveItem)
     return;
 
-  mActiveItem = nsnull;
+  mActiveItem = nullptr;
 
   if (aItem && aCheckIfActive) {
     Accessible* widget = aItem->ContainerWidget();
     A11YDEBUG_FOCUS_LOG_WIDGET("Active item widget", widget)
     if (!widget || !widget->IsActiveWidget() || !widget->AreItemsOperable())
       return;
   }
   mActiveItem = aItem;
@@ -300,17 +300,17 @@ FocusManager::ProcessFocusEvent(AccEvent
     }
   } else if (mActiveARIAMenubar) {
     // Focus left a menu. Fire menu_end event.
     nsRefPtr<AccEvent> menuEndEvent =
       new AccEvent(nsIAccessibleEvent::EVENT_MENU_END, mActiveARIAMenubar,
                    fromUserInputFlag);
     nsEventShell::FireEvent(menuEndEvent);
 
-    mActiveARIAMenubar = nsnull;
+    mActiveARIAMenubar = nullptr;
   }
 
   A11YDEBUG_FOCUS_NOTIFICATION_ACCTARGET("FIRE FOCUS EVENT", "Focus target",
                                          target)
 
   nsRefPtr<AccEvent> focusEvent =
     new AccEvent(nsIAccessibleEvent::EVENT_FOCUS, target, fromUserInputFlag);
   nsEventShell::FireEvent(focusEvent);
@@ -322,38 +322,38 @@ FocusManager::ProcessFocusEvent(AccEvent
   Accessible* anchorJump = targetDocument->AnchorJump();
   if (anchorJump) {
     if (target == targetDocument) {
       // XXX: bug 625699, note in some cases the node could go away before we
       // we receive focus event, for example if the node is removed from DOM.
       nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_SCROLLING_START,
                               anchorJump, fromUserInputFlag);
     }
-    targetDocument->SetAnchorJump(nsnull);
+    targetDocument->SetAnchorJump(nullptr);
   }
 }
 
 nsINode*
 FocusManager::FocusedDOMNode() const
 {
   nsFocusManager* DOMFocusManager = nsFocusManager::GetFocusManager();
   nsIContent* focusedElm = DOMFocusManager->GetFocusedContent();
 
   // No focus on remote target elements like xul:browser having DOM focus and
   // residing in chrome process because it means an element in content process
   // keeps the focus.
   if (focusedElm) {
     if (nsEventStateManager::IsRemoteTarget(focusedElm))
-      return nsnull;
+      return nullptr;
     return focusedElm;
   }
 
   // Otherwise the focus can be on DOM document.
   nsPIDOMWindow* focusedWnd = DOMFocusManager->GetFocusedWindow();
-  return focusedWnd ? focusedWnd->GetExtantDoc() : nsnull;
+  return focusedWnd ? focusedWnd->GetExtantDoc() : nullptr;
 }
 
 nsIDocument*
 FocusManager::FocusedDOMDocument() const
 {
   nsINode* focusedNode = FocusedDOMNode();
-  return focusedNode ? focusedNode->OwnerDoc() : nsnull;
+  return focusedNode ? focusedNode->OwnerDoc() : nullptr;
 }
--- a/accessible/src/base/Logging.cpp
+++ b/accessible/src/base/Logging.cpp
@@ -133,17 +133,17 @@ LogDocShellTree(nsIDocument* aDocumentNo
            static_cast<void*>(parentTreeItem), static_cast<void*>(rootTreeItem),
            (nsCoreUtils::IsTabDocument(aDocumentNode) ? "yes" : "no"));
   }
 }
 
 static void
 LogDocState(nsIDocument* aDocumentNode)
 {
-  const char* docState = nsnull;
+  const char* docState = nullptr;
   nsIDocument::ReadyState docStateFlag = aDocumentNode->GetReadyStateEnum();
   switch (docStateFlag) {
     case nsIDocument::READYSTATE_UNINITIALIZED:
      docState = "uninitialized";
       break;
     case nsIDocument::READYSTATE_LOADING:
       docState = "loading";
       break;
@@ -163,17 +163,17 @@ LogDocState(nsIDocument* aDocumentNode)
 }
 
 static void
 LogPresShell(nsIDocument* aDocumentNode)
 {
   nsIPresShell* ps = aDocumentNode->GetShell();
   printf("presshell: %p", static_cast<void*>(ps));
   nsIScrollableFrame *sf = ps ?
-    ps->GetRootScrollFrameAsScrollableExternal() : nsnull;
+    ps->GetRootScrollFrameAsScrollableExternal() : nullptr;
   printf(", root scroll frame: %p", static_cast<void*>(sf));
 }
 
 static void
 LogDocLoadGroup(nsIDocument* aDocumentNode)
 {
   nsCOMPtr<nsILoadGroup> loadGroup = aDocumentNode->GetDocumentLoadGroup();
   printf("load group: %p", static_cast<void*>(loadGroup));
--- a/accessible/src/base/Logging.h
+++ b/accessible/src/base/Logging.h
@@ -66,23 +66,23 @@ void DocLoadEventFired(AccEvent* aEvent)
  * Log that document laod event was handled.
  */
 void DocLoadEventHandled(AccEvent* aEvent);
 
 /**
  * Log the document was created.
  */
 void DocCreate(const char* aMsg, nsIDocument* aDocumentNode,
-               DocAccessible* aDocument = nsnull);
+               DocAccessible* aDocument = nullptr);
 
 /**
  * Log the document was destroyed.
  */
 void DocDestroy(const char* aMsg, nsIDocument* aDocumentNode,
-                DocAccessible* aDocument = nsnull);
+                DocAccessible* aDocument = nullptr);
 
 /**
  * Log the outer document was destroyed.
  */
 void OuterDocDestroy(OuterDocAccessible* OuterDoc);
 
 /**
  * Log the selection change.
--- a/accessible/src/base/NotificationController.cpp
+++ b/accessible/src/base/NotificationController.cpp
@@ -93,18 +93,18 @@ NotificationController::Shutdown()
   PRInt32 childDocCount = mHangingChildDocuments.Length();
   for (PRInt32 idx = childDocCount - 1; idx >= 0; idx--) {
     if (!mHangingChildDocuments[idx]->IsDefunct())
       mHangingChildDocuments[idx]->Shutdown();
   }
 
   mHangingChildDocuments.Clear();
 
-  mDocument = nsnull;
-  mPresShell = nsnull;
+  mDocument = nullptr;
+  mPresShell = nullptr;
 
   mTextHash.Clear();
   mContentInsertions.Clear();
   mNotifications.Clear();
   mEvents.Clear();
 }
 
 void
@@ -585,17 +585,17 @@ NotificationController::CoalesceSelChang
       aThisEvent->mPackedEvent->mEventType =
         aThisEvent->mPackedEvent->mSelChangeType == AccSelChangeEvent::eSelectionAdd ?
           nsIAccessibleEvent::EVENT_SELECTION_ADD :
           nsIAccessibleEvent::EVENT_SELECTION_REMOVE;
 
       aThisEvent->mPackedEvent->mEventRule =
         AccEvent::eCoalesceSelectionChange;
 
-      aThisEvent->mPackedEvent = nsnull;
+      aThisEvent->mPackedEvent = nullptr;
     }
 
     aThisEvent->mEventType =
       aThisEvent->mSelChangeType == AccSelChangeEvent::eSelectionAdd ?
         nsIAccessibleEvent::EVENT_SELECTION_ADD :
         nsIAccessibleEvent::EVENT_SELECTION_REMOVE;
 
     return;
@@ -715,17 +715,17 @@ NotificationController::TextEnumerator(n
   nsIFrame* textFrame = textNode->GetPrimaryFrame();
   if (!textFrame) {
     NS_ASSERTION(!textAcc,
                  "Text node isn't rendered but accessible is kept alive!");
     return PL_DHASH_NEXT;
   }
 
   nsIContent* containerElm = containerNode->IsElement() ?
-    containerNode->AsElement() : nsnull;
+    containerNode->AsElement() : nullptr;
 
   nsAutoString text;
   textFrame->GetRenderedText(&text);
 
   // Remove text accessible if rendered text is empty.
   if (textAcc) {
     if (text.IsEmpty()) {
 #ifdef DEBUG
@@ -832,13 +832,13 @@ NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(Not
 NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(NotificationController::ContentInsertion,
                                        Release)
 
 void
 NotificationController::ContentInsertion::Process()
 {
   mDocument->ProcessContentInserted(mContainer, &mInsertedContent);
 
-  mDocument = nsnull;
-  mContainer = nsnull;
+  mDocument = nullptr;
+  mContainer = nullptr;
   mInsertedContent.Clear();
 }
 
--- a/accessible/src/base/NotificationController.h
+++ b/accessible/src/base/NotificationController.h
@@ -52,25 +52,25 @@ private:
 template<class Class, class Arg>
 class TNotification : public Notification
 {
 public:
   typedef void (Class::*Callback)(Arg*);
 
   TNotification(Class* aInstance, Callback aCallback, Arg* aArg) :
     mInstance(aInstance), mCallback(aCallback), mArg(aArg) { }
-  virtual ~TNotification() { mInstance = nsnull; }
+  virtual ~TNotification() { mInstance = nullptr; }
 
   virtual void Process()
   {
     (mInstance->*mCallback)(mArg);
 
-    mInstance = nsnull;
-    mCallback = nsnull;
-    mArg = nsnull;
+    mInstance = nullptr;
+    mCallback = nullptr;
+    mArg = nullptr;
   }
 
 private:
   TNotification(const TNotification&);
   TNotification& operator = (const TNotification&);
 
   Class* mInstance;
   Callback mCallback;
@@ -265,17 +265,17 @@ private:
 
   /**
    * Storage for content inserted notification information.
    */
   class ContentInsertion
   {
   public:
     ContentInsertion(DocAccessible* aDocument, Accessible* aContainer);
-    virtual ~ContentInsertion() { mDocument = nsnull; }
+    virtual ~ContentInsertion() { mDocument = nullptr; }
 
     NS_INLINE_DECL_REFCOUNTING(ContentInsertion)
     NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(ContentInsertion)
 
     bool InitChildList(nsIContent* aStartChildNode, nsIContent* aEndChildNode);
     void Process();
 
   private:
--- a/accessible/src/base/Relation.h
+++ b/accessible/src/base/Relation.h
@@ -28,29 +28,29 @@ struct RelationCopyHelper
 
 /**
  * A collection of relation targets of a certain type.  Targets are computed
  * lazily while enumerating.
  */
 class Relation
 {
 public:
-  Relation() : mFirstIter(nsnull), mLastIter(nsnull) { }
+  Relation() : mFirstIter(nullptr), mLastIter(nullptr) { }
 
   Relation(const RelationCopyHelper aRelation) :
     mFirstIter(aRelation.mFirstIter), mLastIter(aRelation.mLastIter) { }
 
   Relation(AccIterable* aIter) : mFirstIter(aIter), mLastIter(aIter) { }
 
   Relation(Accessible* aAcc) :
-    mFirstIter(nsnull), mLastIter(nsnull)
+    mFirstIter(nullptr), mLastIter(nullptr)
     { AppendTarget(aAcc); }
 
   Relation(DocAccessible* aDocument, nsIContent* aContent) :
-    mFirstIter(nsnull), mLastIter(nsnull)
+    mFirstIter(nullptr), mLastIter(nullptr)
     { AppendTarget(aDocument, aContent); }
 
   Relation& operator = (const RelationCopyHelper& aRH)
   {
     mFirstIter = aRH.mFirstIter;
     mLastIter = aRH.mLastIter;
     return *this;
   }
@@ -96,24 +96,24 @@ public:
       AppendTarget(aDocument->GetAccessible(aContent));
   }
 
   /**
    * compute and return the next related accessible.
    */
   inline Accessible* Next()
   {
-    Accessible* target = nsnull;
+    Accessible* target = nullptr;
 
     // a trick nsAutoPtr deletes what it used to point to when assigned to
     while (mFirstIter && !(target = mFirstIter->Next()))
       mFirstIter = mFirstIter->mNextIter;
 
     if (!mFirstIter)
-      mLastIter = nsnull;
+      mLastIter = nullptr;
 
     return target;
   }
 
 private:
   Relation& operator = (const Relation&);
 
   nsAutoPtr<AccIterable> mFirstIter;
--- a/accessible/src/base/StyleInfo.cpp
+++ b/accessible/src/base/StyleInfo.cpp
@@ -12,17 +12,17 @@
 using namespace mozilla;
 using namespace mozilla::a11y;
 
 StyleInfo::StyleInfo(dom::Element* aElement, nsIPresShell* aPresShell) :
   mElement(aElement)
 {
   mStyleContext =
     nsComputedDOMStyle::GetStyleContextForElementNoFlush(aElement,
-                                                         nsnull,
+                                                         nullptr,
                                                          aPresShell);
 }
 
 void
 StyleInfo::Display(nsAString& aValue)
 {
   aValue.Truncate();
   AppendASCIItoUTF16(
--- a/accessible/src/base/TextAttrs.cpp
+++ b/accessible/src/base/TextAttrs.cpp
@@ -67,18 +67,18 @@ TextAttrsMgr::GetAttributes(nsIPersisten
   // Get the content and frame of the accessible. In the case of document
   // accessible it's role content and root frame.
   nsIContent *hyperTextElm = mHyperTextAcc->GetContent();
   nsIFrame *rootFrame = mHyperTextAcc->GetFrame();
   NS_ASSERTION(rootFrame, "No frame for accessible!");
   if (!rootFrame)
     return;
 
-  nsIContent *offsetNode = nsnull, *offsetElm = nsnull;
-  nsIFrame *frame = nsnull;
+  nsIContent *offsetNode = nullptr, *offsetElm = nullptr;
+  nsIFrame *frame = nullptr;
   if (mOffsetAcc) {
     offsetNode = mOffsetAcc->GetContent();
     offsetElm = nsCoreUtils::GetDOMElementFor(offsetNode);
     frame = offsetElm->GetPrimaryFrame();
   }
 
   // "language" text attribute
   LangTextAttr langTextAttr(mHyperTextAcc, hyperTextElm, offsetNode);
--- a/accessible/src/base/TextAttrs.h
+++ b/accessible/src/base/TextAttrs.h
@@ -25,17 +25,17 @@ namespace a11y {
  */
 class TextAttrsMgr
 {
 public:
   /**
    * Constructor. Used to expose default text attributes.
    */
   TextAttrsMgr(HyperTextAccessible* aHyperTextAcc) :
-    mOffsetAcc(nsnull),  mHyperTextAcc(aHyperTextAcc),
+    mOffsetAcc(nullptr),  mHyperTextAcc(aHyperTextAcc),
     mOffsetAccIdx(-1), mIncludeDefAttrs(true) { }
 
   /**
    * Constructor. Used to expose text attributes at the given offset.
    *
    * @param aHyperTextAcc    [in] hyper text accessible text attributes are
    *                          calculated for
    * @param aIncludeDefAttrs [optional] indicates whether default text
@@ -59,18 +59,18 @@ public:
    * @note In the case of default attributes pointers on hyper text offsets
    *       must be skipped.
    *
    * @param aAttributes    [in, out] text attributes list
    * @param aStartHTOffset [out, optional] start hyper text offset
    * @param aEndHTOffset   [out, optional] end hyper text offset
    */
   void GetAttributes(nsIPersistentProperties* aAttributes,
-                     PRInt32* aStartHTOffset = nsnull,
-                     PRInt32* aEndHTOffset = nsnull);
+                     PRInt32* aStartHTOffset = nullptr,
+                     PRInt32* aEndHTOffset = nullptr);
 
 protected:
   /**
    * Calculates range (start and end offsets) of text where the text attributes
    * are stretched. New offsets may be smaller if one of text attributes changes
    * its value before or after the given offsets.
    *
    * @param aTextAttrArray  [in] text attributes array
--- a/accessible/src/base/TextUpdater.h
+++ b/accessible/src/base/TextUpdater.h
@@ -22,21 +22,21 @@ public:
   /**
    * Start text of the text leaf update.
    */
   static void Run(DocAccessible* aDocument, TextLeafAccessible* aTextLeaf,
                   const nsAString& aNewText);
 
 private:
   TextUpdater(DocAccessible* aDocument, TextLeafAccessible* aTextLeaf) :
-    mDocument(aDocument), mTextLeaf(aTextLeaf), mHyperText(nsnull),
+    mDocument(aDocument), mTextLeaf(aTextLeaf), mHyperText(nullptr),
     mTextOffset(-1) { }
 
   ~TextUpdater()
-    { mDocument = nsnull; mTextLeaf = nsnull; mHyperText = nsnull; }
+    { mDocument = nullptr; mTextLeaf = nullptr; mHyperText = nullptr; }
 
   /**
    * Update text of the text leaf accessible, fire text change and value change
    * (if applicable) events for its container hypertext accessible.
    */
   void DoUpdate(const nsAString& aNewText, const nsAString& aOldText,
                 PRUint32 aSkipStart);
 
--- a/accessible/src/base/nsARIAMap.cpp
+++ b/accessible/src/base/nsARIAMap.cpp
@@ -642,17 +642,17 @@ nsRoleMapEntry*
 aria::GetRoleMap(nsINode* aNode)
 {
   nsIContent* content = nsCoreUtils::GetRoleContent(aNode);
   nsAutoString roles;
   if (!content ||
       !content->GetAttr(kNameSpaceID_None, nsGkAtoms::role, roles) ||
       roles.IsEmpty()) {
     // We treat role="" as if the role attribute is absent (per aria spec:8.1.1)
-    return nsnull;
+    return nullptr;
   }
 
   nsWhitespaceTokenizer tokenizer(roles);
   while (tokenizer.hasMoreTokens()) {
     // Do a binary search through table for the next role in role list
     const nsDependentSubstring role = tokenizer.nextToken();
     PRUint32 low = 0;
     PRUint32 high = ArrayLength(sWAIRoleMaps);
--- a/accessible/src/base/nsARIAMap.h
+++ b/accessible/src/base/nsARIAMap.h
@@ -210,17 +210,17 @@ namespace mozilla {
 namespace a11y {
 namespace aria {
 
 /**
  * Get the role map entry for a given DOM node. This will use the first
  * ARIA role if the role attribute provides a space delimited list of roles.
  *
  * @param aNode  [in] the DOM node to get the role map entry for
- * @return        a pointer to the role map entry for the ARIA role, or nsnull
+ * @return        a pointer to the role map entry for the ARIA role, or nullptr
  *                if none
  */
 nsRoleMapEntry* GetRoleMap(nsINode* aNode);
 
 /**
  * Return accessible state from ARIA universal states applied to the given
  * element.
  */
--- a/accessible/src/base/nsAccCache.h
+++ b/accessible/src/base/nsAccCache.h
@@ -30,17 +30,17 @@ ClearCacheEntry(const void* aKey, nsRefP
 
 /**
  * Clear the cache and shutdown the accessibles.
  */
 
 static void
 ClearCache(AccessibleHashtable& aCache)
 {
-  aCache.Enumerate(ClearCacheEntry<Accessible>, nsnull);
+  aCache.Enumerate(ClearCacheEntry<Accessible>, nullptr);
 }
 
 /**
  * Traverse the accessible cache entry for cycle collector.
  */
 template <class T>
 static PLDHashOperator
 CycleCollectorTraverseCacheEntry(const void *aKey, T *aAccessible,
--- a/accessible/src/base/nsAccDocManager.cpp
+++ b/accessible/src/base/nsAccDocManager.cpp
@@ -37,17 +37,17 @@ using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccDocManager public
 
 DocAccessible*
 nsAccDocManager::GetDocAccessible(nsIDocument *aDocument)
 {
   if (!aDocument)
-    return nsnull;
+    return nullptr;
 
   // Ensure CacheChildren is called before we query cache.
   nsAccessNode::GetApplicationAccessible()->EnsureChildren();
 
   DocAccessible* docAcc = mDocAccessibleCache.GetWeak(aDocument);
   if (docAcc)
     return docAcc;
 
@@ -347,64 +347,64 @@ nsAccDocManager::AddListeners(nsIDocumen
 
 DocAccessible*
 nsAccDocManager::CreateDocOrRootAccessible(nsIDocument* aDocument)
 {
   // Ignore temporary, hiding, resource documents and documents without
   // docshell.
   if (aDocument->IsInitialDocument() || !aDocument->IsVisible() ||
       aDocument->IsResourceDoc() || !aDocument->IsActive())
-    return nsnull;
+    return nullptr;
 
   // Ignore documents without presshell and not having root frame.
   nsIPresShell* presShell = aDocument->GetShell();
   if (!presShell || !presShell->GetRootFrame())
-    return nsnull;
+    return nullptr;
 
   // Do not create document accessible until role content is loaded, otherwise
   // we get accessible document with wrong role.
   nsIContent *rootElm = nsCoreUtils::GetRoleContent(aDocument);
   if (!rootElm)
-    return nsnull;
+    return nullptr;
 
   bool isRootDoc = nsCoreUtils::IsRootDocument(aDocument);
 
-  DocAccessible* parentDocAcc = nsnull;
+  DocAccessible* parentDocAcc = nullptr;
   if (!isRootDoc) {
     // XXXaaronl: ideally we would traverse the presshell chain. Since there's
     // no easy way to do that, we cheat and use the document hierarchy.
     parentDocAcc = GetDocAccessible(aDocument->GetParentDocument());
     NS_ASSERTION(parentDocAcc,
                  "Can't create an accessible for the document!");
     if (!parentDocAcc)
-      return nsnull;
+      return nullptr;
   }
 
   // We only create root accessibles for the true root, otherwise create a
   // doc accessible.
   nsRefPtr<DocAccessible> docAcc = isRootDoc ?
     new RootAccessibleWrap(aDocument, rootElm, presShell) :
     new DocAccessibleWrap(aDocument, rootElm, presShell);
 
   // Cache the document accessible into document cache.
   mDocAccessibleCache.Put(aDocument, docAcc);
 
   // Initialize the document accessible.
   if (!docAcc->Init()) {
     docAcc->Shutdown();
-    return nsnull;
+    return nullptr;
   }
   docAcc->SetRoleMapEntry(aria::GetRoleMap(aDocument));
 
   // Bind the document to the tree.
   if (isRootDoc) {
     Accessible* appAcc = nsAccessNode::GetApplicationAccessible();
     if (!appAcc->AppendChild(docAcc)) {
       docAcc->Shutdown();
-      return nsnull;
+      return nullptr;
     }
 
     // Fire reorder event to notify new accessible document has been attached to
     // the tree. The reorder event is delivered after the document tree is
     // constructed because event processing and tree construction are done by
     // the same document.
     nsRefPtr<AccEvent> reorderEvent =
       new AccEvent(nsIAccessibleEvent::EVENT_REORDER, appAcc, eAutoDetect,
@@ -439,17 +439,17 @@ nsAccDocManager::GetFirstEntryInDocCache
   *reinterpret_cast<DocAccessible**>(aUserArg) = aDocAccessible;
 
   return PL_DHASH_STOP;
 }
 
 void
 nsAccDocManager::ClearDocCache()
 {
-  DocAccessible* docAcc = nsnull;
+  DocAccessible* docAcc = nullptr;
   while (mDocAccessibleCache.EnumerateRead(GetFirstEntryInDocCache, static_cast<void*>(&docAcc))) {
     if (docAcc)
       docAcc->Shutdown();
   }
 }
 
 PLDHashOperator
 nsAccDocManager::SearchAccessibleInDocCache(const nsIDocument* aKey,
--- a/accessible/src/base/nsAccDocManager.h
+++ b/accessible/src/base/nsAccDocManager.h
@@ -35,17 +35,17 @@ public:
    */
   DocAccessible* GetDocAccessible(nsIDocument* aDocument);
 
   /**
    * Return document accessible for the given presshell.
    */
   DocAccessible* GetDocAccessible(const nsIPresShell* aPresShell)
   {
-    return aPresShell ? GetDocAccessible(aPresShell->GetDocument()) : nsnull;
+    return aPresShell ? GetDocAccessible(aPresShell->GetDocument()) : nullptr;
   }
 
   /**
    * Search through all document accessibles for an accessible with the given
    * unique id.
    */
   Accessible* FindAccessibleInCache(nsINode* aNode) const;
 
--- a/accessible/src/base/nsAccTreeWalker.cpp
+++ b/accessible/src/base/nsAccTreeWalker.cpp
@@ -13,32 +13,32 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 // WalkState
 ////////////////////////////////////////////////////////////////////////////////
 
 struct WalkState
 {
   WalkState(nsIContent *aContent) :
-    content(aContent), childIdx(0), prevState(nsnull) {}
+    content(aContent), childIdx(0), prevState(nullptr) {}
 
   nsCOMPtr<nsIContent> content;
   nsCOMPtr<nsINodeList> childList;
   PRUint32 childIdx;
   WalkState *prevState;
 };
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccTreeWalker
 ////////////////////////////////////////////////////////////////////////////////
 
 nsAccTreeWalker::
   nsAccTreeWalker(DocAccessible* aDoc, nsIContent* aContent,
                   bool aWalkAnonContent, bool aWalkCache) :
-  mDoc(aDoc), mWalkCache(aWalkCache), mState(nsnull)
+  mDoc(aDoc), mWalkCache(aWalkCache), mState(nullptr)
 {
   NS_ASSERTION(aContent, "No node for the accessible tree walker!");
 
   if (aContent)
     mState = new WalkState(aContent);
 
   mChildFilter = aWalkAnonContent ? nsIContent::eAllChildren :
                                   nsIContent::eAllButXBL;
@@ -59,17 +59,17 @@ nsAccTreeWalker::~nsAccTreeWalker()
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccTreeWalker: private
 
 Accessible*
 nsAccTreeWalker::NextChildInternal(bool aNoWalkUp)
 {
   if (!mState || !mState->content)
-    return nsnull;
+    return nullptr;
 
   if (!mState->childList)
     mState->childList = mState->content->GetChildren(mChildFilter);
 
   PRUint32 length = 0;
   if (mState->childList)
     mState->childList->GetLength(&length);
 
@@ -93,17 +93,17 @@ nsAccTreeWalker::NextChildInternal(bool 
       if (accessible)
         return accessible;
     }
   }
 
   // No more children, get back to the parent.
   PopState();
 
-  return aNoWalkUp ? nsnull : NextChildInternal(false);
+  return aNoWalkUp ? nullptr : NextChildInternal(false);
 }
 
 void
 nsAccTreeWalker::PopState()
 {
   WalkState* prevToLastState = mState->prevState;
   delete mState;
   mState = prevToLastState;
--- a/accessible/src/base/nsAccUtils.cpp
+++ b/accessible/src/base/nsAccUtils.cpp
@@ -197,55 +197,55 @@ nsAccUtils::HasDefinedARIAToken(nsIConte
 nsIAtom*
 nsAccUtils::GetARIAToken(dom::Element* aElement, nsIAtom* aAttr)
 {
   if (!nsAccUtils::HasDefinedARIAToken(aElement, aAttr))
     return nsGkAtoms::_empty;
 
   static nsIContent::AttrValuesArray tokens[] =
     { &nsGkAtoms::_false, &nsGkAtoms::_true,
-      &nsGkAtoms::mixed, nsnull};
+      &nsGkAtoms::mixed, nullptr};
 
   PRInt32 idx = aElement->FindAttrValueIn(kNameSpaceID_None,
                                           aAttr, tokens, eCaseMatters);
   if (idx >= 0)
     return *(tokens[idx]);
 
-  return nsnull;
+  return nullptr;
 }
 
 Accessible*
 nsAccUtils::GetAncestorWithRole(Accessible* aDescendant, PRUint32 aRole)
 {
   Accessible* document = aDescendant->Document();
   Accessible* parent = aDescendant;
   while ((parent = parent->Parent())) {
     PRUint32 testRole = parent->Role();
     if (testRole == aRole)
       return parent;
 
     if (parent == document)
       break;
   }
-  return nsnull;
+  return nullptr;
 }
 
 Accessible*
 nsAccUtils::GetSelectableContainer(Accessible* aAccessible, PRUint64 aState)
 {
   if (!aAccessible)
-    return nsnull;
+    return nullptr;
 
   if (!(aState & states::SELECTABLE))
-    return nsnull;
+    return nullptr;
 
   Accessible* parent = aAccessible;
   while ((parent = parent->Parent()) && !parent->IsSelect()) {
     if (Role(parent) == nsIAccessibleRole::ROLE_PANE)
-      return nsnull;
+      return nullptr;
   }
   return parent;
 }
 
 bool
 nsAccUtils::IsARIASelected(Accessible* aAccessible)
 {
   return aAccessible->GetContent()->
@@ -257,45 +257,45 @@ HyperTextAccessible*
 nsAccUtils::GetTextAccessibleFromSelection(nsISelection* aSelection)
 {
   // Get accessible from selection's focus DOM point (the DOM point where
   // selection is ended).
 
   nsCOMPtr<nsIDOMNode> focusDOMNode;
   aSelection->GetFocusNode(getter_AddRefs(focusDOMNode));
   if (!focusDOMNode)
-    return nsnull;
+    return nullptr;
 
   PRInt32 focusOffset = 0;
   aSelection->GetFocusOffset(&focusOffset);
 
   nsCOMPtr<nsINode> focusNode(do_QueryInterface(focusDOMNode));
   nsCOMPtr<nsINode> resultNode =
     nsCoreUtils::GetDOMNodeFromDOMPoint(focusNode, focusOffset);
 
   // Get text accessible containing the result node.
   DocAccessible* doc = 
     GetAccService()->GetDocAccessible(resultNode->OwnerDoc());
   Accessible* accessible = doc ? 
-    doc->GetAccessibleOrContainer(resultNode) : nsnull;
+    doc->GetAccessibleOrContainer(resultNode) : nullptr;
   if (!accessible) {
     NS_NOTREACHED("No nsIAccessibleText for selection change event!");
-    return nsnull;
+    return nullptr;
   }
 
   do {
     HyperTextAccessible* textAcc = accessible->AsHyperText();
     if (textAcc)
       return textAcc;
 
     accessible = accessible->Parent();
   } while (accessible);
 
   NS_NOTREACHED("We must reach document accessible implementing nsIAccessibleText!");
-  return nsnull;
+  return nullptr;
 }
 
 nsresult
 nsAccUtils::ConvertToScreenCoords(PRInt32 aX, PRInt32 aY,
                                   PRUint32 aCoordinateType,
                                   nsAccessNode *aAccessNode,
                                   nsIntPoint *aCoords)
 {
--- a/accessible/src/base/nsAccUtils.h
+++ b/accessible/src/base/nsAccUtils.h
@@ -121,17 +121,17 @@ public:
   }
 
   /**
     * Return ancestor in this document with the given role if it exists.
     *
     * @param  aDescendant  [in] descendant to start search with
     * @param  aRole        [in] role to find matching ancestor for
     * @return               the ancestor accessible with the given role, or
-    *                       nsnull if no match is found
+    *                       nullptr if no match is found
     */
    static Accessible* GetAncestorWithRole(Accessible* aDescendant,
                                           PRUint32 aRole);
 
   /**
    * Return single or multi selectable container for the given item.
    *
    * @param  aAccessible  [in] the item accessible
--- a/accessible/src/base/nsAccessNode.cpp
+++ b/accessible/src/base/nsAccessNode.cpp
@@ -23,17 +23,17 @@
 #include "mozilla/Services.h"
 
 using namespace mozilla::a11y;
 
 /* For documentation of the accessibility architecture, 
  * see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
  */
 
-ApplicationAccessible* nsAccessNode::gApplicationAccessible = nsnull;
+ApplicationAccessible* nsAccessNode::gApplicationAccessible = nullptr;
 
 /*
  * Class nsAccessNode
  */
  
 ////////////////////////////////////////////////////////////////////////////////
 // AccessNode. nsISupports
 
@@ -73,18 +73,18 @@ void nsAccessNode::LastRelease()
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccessNode public
 
 
 void
 nsAccessNode::Shutdown()
 {
-  mContent = nsnull;
-  mDoc = nsnull;
+  mContent = nullptr;
+  mDoc = nullptr;
 }
 
 ApplicationAccessible*
 nsAccessNode::GetApplicationAccessible()
 {
   NS_ASSERTION(!nsAccessibilityService::IsShutdown(),
                "Accessibility wasn't initialized!");
 
@@ -95,17 +95,17 @@ nsAccessNode::GetApplicationAccessible()
 
     // Addref on create. Will Release in ShutdownXPAccessibility()
     NS_ADDREF(gApplicationAccessible);
 
     nsresult rv = gApplicationAccessible->Init();
     if (NS_FAILED(rv)) {
       gApplicationAccessible->Shutdown();
       NS_RELEASE(gApplicationAccessible);
-      return nsnull;
+      return nullptr;
     }
   }
 
   return gApplicationAccessible;
 }
 
 void nsAccessNode::ShutdownXPAccessibility()
 {
@@ -124,48 +124,48 @@ void nsAccessNode::ShutdownXPAccessibili
 
 RootAccessible*
 nsAccessNode::RootAccessible() const
 {
   nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
     nsCoreUtils::GetDocShellTreeItemFor(mContent);
   NS_ASSERTION(docShellTreeItem, "No docshell tree item for mContent");
   if (!docShellTreeItem) {
-    return nsnull;
+    return nullptr;
   }
   nsCOMPtr<nsIDocShellTreeItem> root;
   docShellTreeItem->GetRootTreeItem(getter_AddRefs(root));
   NS_ASSERTION(root, "No root content tree item");
   if (!root) {
-    return nsnull;
+    return nullptr;
   }
 
   DocAccessible* docAcc = nsAccUtils::GetDocAccessibleFor(root);
-  return docAcc ? docAcc->AsRoot() : nsnull;
+  return docAcc ? docAcc->AsRoot() : nullptr;
 }
 
 nsIFrame*
 nsAccessNode::GetFrame() const
 {
-  return mContent ? mContent->GetPrimaryFrame() : nsnull;
+  return mContent ? mContent->GetPrimaryFrame() : nullptr;
 }
 
 bool
 nsAccessNode::IsPrimaryForNode() const
 {
   return true;
 }
 
 void
 nsAccessNode::Language(nsAString& aLanguage)
 {
   aLanguage.Truncate();
 
   if (!mDoc)
     return;
 
-  nsCoreUtils::GetLanguageFor(mContent, nsnull, aLanguage);
+  nsCoreUtils::GetLanguageFor(mContent, nullptr, aLanguage);
   if (aLanguage.IsEmpty()) { // Nothing found, so use document's language
     mContent->OwnerDoc()->GetHeaderData(nsGkAtoms::headerContentLanguage,
                                         aLanguage);
   }
 }
 
--- a/accessible/src/base/nsAccessNode.h
+++ b/accessible/src/base/nsAccessNode.h
@@ -73,17 +73,17 @@ public:
    */
   virtual nsIFrame* GetFrame() const;
   /**
    * Return DOM node associated with the accessible.
    */
   virtual nsINode* GetNode() const { return mContent; }
   nsIContent* GetContent() const { return mContent; }
   virtual nsIDocument* GetDocumentNode() const
-    { return mContent ? mContent->OwnerDoc() : nsnull; }
+    { return mContent ? mContent->OwnerDoc() : nullptr; }
 
   /**
    * Return node type information of DOM node associated with the accessible.
    */
   bool IsContent() const
   {
     return GetNode() && GetNode()->IsNodeOfType(nsINode::eCONTENT);
   }
--- a/accessible/src/base/nsAccessibilityService.cpp
+++ b/accessible/src/base/nsAccessibilityService.cpp
@@ -76,29 +76,29 @@
 
 using namespace mozilla;
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccessibilityService
 ////////////////////////////////////////////////////////////////////////////////
 
-nsAccessibilityService *nsAccessibilityService::gAccessibilityService = nsnull;
+nsAccessibilityService *nsAccessibilityService::gAccessibilityService = nullptr;
 bool nsAccessibilityService::gIsShutdown = true;
 
 nsAccessibilityService::nsAccessibilityService() :
   nsAccDocManager(), FocusManager()
 {
   NS_TIME_FUNCTION;
 }
 
 nsAccessibilityService::~nsAccessibilityService()
 {
   NS_ASSERTION(gIsShutdown, "Accessibility wasn't shutdown!");
-  gAccessibilityService = nsnull;
+  gAccessibilityService = nullptr;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsISupports
 
 NS_IMPL_ISUPPORTS_INHERITED3(nsAccessibilityService,
                              nsAccDocManager,
                              nsIAccessibilityService,
@@ -158,17 +158,17 @@ nsAccessibilityService::GetRootDocumentA
         docShell->GetPresShell(getter_AddRefs(presShell));
         documentNode = presShell->GetDocument();
       }
 
       return aCanCreate ?
         GetDocAccessible(documentNode) : GetDocAccessibleFromCache(documentNode);
     }
   }
-  return nsnull;
+  return nullptr;
 }
 
 already_AddRefed<Accessible>
 nsAccessibilityService::CreateOuterDocAccessible(nsIContent* aContent,
                                                  nsIPresShell* aPresShell)
 {
   Accessible* accessible =
     new OuterDocAccessible(aContent, GetDocAccessible(aPresShell));
@@ -306,17 +306,17 @@ nsAccessibilityService::CreateHTMLObject
   // 1) a text or html embedded document where the contentDocument variable in
   //    the object element holds the content;
   // 2) web content that uses a plugin, which means we will have to go to
   //    the plugin to get the accessible content;
   // 3) an image or imagemap, where the image frame points back to the object
   //    element DOMNode.
 
   if (aFrame->GetRect().IsEmpty())
-    return nsnull;
+    return nullptr;
 
 
   // 1) for object elements containing either HTML or TXT documents
   nsCOMPtr<nsIDOMHTMLObjectElement> obj(do_QueryInterface(aContent));
   if (obj) {
     nsCOMPtr<nsIDOMDocument> domDoc;
     obj->GetContentDocument(getter_AddRefs(domDoc));
     if (domDoc)
@@ -325,29 +325,29 @@ nsAccessibilityService::CreateHTMLObject
 
 #if defined(XP_WIN) || defined(MOZ_ACCESSIBILITY_ATK)
   // 2) for plugins
   nsRefPtr<nsNPAPIPluginInstance> pluginInstance;
   if (NS_SUCCEEDED(aFrame->GetPluginInstance(getter_AddRefs(pluginInstance))) &&
       pluginInstance) {
 #ifdef XP_WIN
     // Note: pluginPort will be null if windowless.
-    HWND pluginPort = nsnull;
+    HWND pluginPort = nullptr;
     aFrame->GetPluginPort(&pluginPort);
 
     Accessible* accessible =
       new nsHTMLWin32ObjectOwnerAccessible(aContent,
                                            GetDocAccessible(aPresShell),
                                            pluginPort);
     NS_ADDREF(accessible);
     return accessible;
 
 #elif MOZ_ACCESSIBILITY_ATK
     if (!AtkSocketAccessible::gCanEmbed)
-      return nsnull;
+      return nullptr;
 
     nsCString plugId;
     nsresult rv = pluginInstance->GetValueFromPlugin(
       NPPVpluginNativeAccessibleAtkPlugId, &plugId);
     if (NS_SUCCEEDED(rv) && !plugId.IsEmpty()) {
       AtkSocketAccessible* socketAccessible =
         new AtkSocketAccessible(aContent, GetDocAccessible(aPresShell),
                                 plugId);
@@ -357,17 +357,17 @@ nsAccessibilityService::CreateHTMLObject
     }
 #endif
   }
 #endif
 
   // 3) for images and imagemaps, or anything else with a child frame
   // we have the object frame, get the image frame
   nsIFrame* frame = aFrame->GetFirstPrincipalChild();
-  return frame ? frame->CreateAccessible() : nsnull;
+  return frame ? frame->CreateAccessible() : nullptr;
 }
 
 already_AddRefed<Accessible>
 nsAccessibilityService::CreateHTMLRadioButtonAccessible(nsIContent* aContent,
                                                         nsIPresShell* aPresShell)
 {
   Accessible* accessible =
     new HTMLRadioButtonAccessible(aContent, GetDocAccessible(aPresShell));
@@ -606,17 +606,17 @@ nsAccessibilityService::GetApplicationAc
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAccessibilityService::GetAccessibleFor(nsIDOMNode *aNode,
                                          nsIAccessible **aAccessible)
 {
   NS_ENSURE_ARG_POINTER(aAccessible);
-  *aAccessible = nsnull;
+  *aAccessible = nullptr;
   if (!aNode)
     return NS_OK;
 
   nsCOMPtr<nsINode> node(do_QueryInterface(aNode));
   if (!node)
     return NS_ERROR_INVALID_ARG;
 
   DocAccessible* document = GetDocAccessible(node->OwnerDoc());
@@ -793,17 +793,17 @@ nsAccessibilityService::GetStringRelatio
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAccessibilityService::GetAccessibleFromCache(nsIDOMNode* aNode,
                                                nsIAccessible** aAccessible)
 {
   NS_ENSURE_ARG_POINTER(aAccessible);
-  *aAccessible = nsnull;
+  *aAccessible = nullptr;
   if (!aNode)
     return NS_OK;
 
   nsCOMPtr<nsINode> node(do_QueryInterface(aNode));
   if (!node)
     return NS_ERROR_INVALID_ARG;
 
   // Search for an accessible in each of our per document accessible object
@@ -824,17 +824,17 @@ nsAccessibilityService::GetAccessibleFro
 }
 
 NS_IMETHODIMP
 nsAccessibilityService::CreateAccessiblePivot(nsIAccessible* aRoot,
                                               nsIAccessiblePivot** aPivot)
 {
   NS_ENSURE_ARG_POINTER(aPivot);
   NS_ENSURE_ARG(aRoot);
-  *aPivot = nsnull;
+  *aPivot = nullptr;
 
   nsRefPtr<Accessible> accessibleRoot(do_QueryObject(aRoot));
   NS_ENSURE_TRUE(accessibleRoot, NS_ERROR_INVALID_ARG);
 
   nsAccessiblePivot* pivot = new nsAccessiblePivot(accessibleRoot);
   NS_ADDREF(*aPivot = pivot);
 
   return NS_OK;
@@ -866,17 +866,17 @@ static bool HasRelatedContent(nsIContent
 }
 
 Accessible*
 nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
                                               DocAccessible* aDoc,
                                               bool* aIsSubtreeHidden)
 {
   if (!aDoc || !aNode || gIsShutdown)
-    return nsnull;
+    return nullptr;
 
   if (aIsSubtreeHidden)
     *aIsSubtreeHidden = false;
 
   // Check to see if we already have an accessible for this node in the cache.
   Accessible* cachedAccessible = aDoc->GetAccessible(aNode);
   if (cachedAccessible)
     return cachedAccessible;
@@ -888,93 +888,93 @@ nsAccessibilityService::GetOrCreateAcces
     // document accessible, otherwise return null.
     nsCOMPtr<nsIDocument> document(do_QueryInterface(aNode));
     return GetDocAccessible(document);
   }
 
   // We have a content node.
   if (!aNode->IsInDoc()) {
     NS_WARNING("Creating accessible for node with no document");
-    return nsnull;
+    return nullptr;
   }
 
   if (aNode->OwnerDoc() != aDoc->GetDocumentNode()) {
     NS_ERROR("Creating accessible for wrong document");
-    return nsnull;
+    return nullptr;
   }
 
   nsCOMPtr<nsIContent> content(do_QueryInterface(aNode));
   if (!content)
-    return nsnull;
+    return nullptr;
 
   // Frames can be deallocated when we flush layout, or when we call into code
   // that can flush layout, either directly, or via DOM manipulation, or some
   // CSS styles like :hover. We use the weak frame checks to avoid calling
   // methods on a dead frame pointer.
   nsWeakFrame weakFrame = content->GetPrimaryFrame();
 
   // Check frame and its visibility. Note, hidden frame allows visible
   // elements in subtree.
   if (!weakFrame.GetFrame() || !weakFrame->GetStyleVisibility()->IsVisible()) {
     if (aIsSubtreeHidden && !weakFrame.GetFrame())
       *aIsSubtreeHidden = true;
 
-    return nsnull;
+    return nullptr;
   }
 
   if (weakFrame.GetFrame()->GetContent() != content) {
     // Not the main content for this frame. This happens because <area>
     // elements return the image frame as their primary frame. The main content
     // for the image frame is the image content. If the frame is not an image
     // frame or the node is not an area element then null is returned.
     // This setup will change when bug 135040 is fixed. Make sure we don't
     // create area accessible here. Hopefully assertion below will handle that.
 
 #ifdef DEBUG
   nsImageFrame* imageFrame = do_QueryFrame(weakFrame.GetFrame());
   NS_ASSERTION(imageFrame && content->IsHTML() && content->Tag() == nsGkAtoms::area,
                "Unknown case of not main content for the frame!");
 #endif
-    return nsnull;
+    return nullptr;
   }
 
 #ifdef DEBUG
   nsImageFrame* imageFrame = do_QueryFrame(weakFrame.GetFrame());
   NS_ASSERTION(!imageFrame || !content->IsHTML() || content->Tag() != nsGkAtoms::area,
                "Image map manages the area accessible creation!");
 #endif
 
   DocAccessible* docAcc =
     GetAccService()->GetDocAccessible(aNode->OwnerDoc());
   if (!docAcc) {
     NS_NOTREACHED("Node has no host document accessible!");
-    return nsnull;
+    return nullptr;
   }
 
   // Attempt to create an accessible based on what we know.
   nsRefPtr<Accessible> newAcc;
 
   // Create accessible for visible text frames.
   if (content->IsNodeOfType(nsINode::eTEXT)) {
     nsAutoString text;
-    weakFrame->GetRenderedText(&text, nsnull, nsnull, 0, PR_UINT32_MAX);
+    weakFrame->GetRenderedText(&text, nullptr, nullptr, 0, PR_UINT32_MAX);
     if (text.IsEmpty()) {
       if (aIsSubtreeHidden)
         *aIsSubtreeHidden = true;
 
-      return nsnull;
+      return nullptr;
     }
 
     newAcc = weakFrame->CreateAccessible();
-    if (docAcc->BindToDocument(newAcc, nsnull)) {
+    if (docAcc->BindToDocument(newAcc, nullptr)) {
       newAcc->AsTextLeaf()->SetText(text);
       return newAcc;
     }
 
-    return nsnull;
+    return nullptr;
   }
 
   bool isHTML = content->IsHTML();
   if (isHTML && content->Tag() == nsGkAtoms::map) {
     // Create hyper text accessible for HTML map if it is used to group links
     // (see http://www.w3.org/TR/WCAG10-HTML-TECHS/#group-bypass). If the HTML
     // map rect is empty then it is used for links grouping. Otherwise it should
     // be used in conjunction with HTML image element and in this case we don't
@@ -982,33 +982,33 @@ nsAccessibilityService::GetOrCreateAcces
     // HTML area (HTMLAreaAccessible) the map contains are attached as
     // children of the appropriate accessible for HTML image
     // (ImageAccessible).
     if (nsLayoutUtils::GetAllInFlowRectsUnion(weakFrame,
                                               weakFrame->GetParent()).IsEmpty()) {
       if (aIsSubtreeHidden)
         *aIsSubtreeHidden = true;
 
-      return nsnull;
+      return nullptr;
     }
 
     newAcc = new HyperTextAccessibleWrap(content, docAcc);
     if (docAcc->BindToDocument(newAcc, aria::GetRoleMap(aNode)))
       return newAcc;
-    return nsnull;
+    return nullptr;
   }
 
   nsRoleMapEntry* roleMapEntry = aria::GetRoleMap(aNode);
   if (roleMapEntry && roleMapEntry->Is(nsGkAtoms::presentation)) {
     // Ignore presentation role if element is focusable (focus event shouldn't
     // be ever lost and should be sensible).
     if (content->IsFocusable())
-      roleMapEntry = nsnull;
+      roleMapEntry = nullptr;
     else
-      return nsnull;
+      return nullptr;
   }
 
   if (weakFrame.IsAlive() && !newAcc && isHTML) {  // HTML accessibles
     bool tryTagNameOrFrame = true;
 
     nsIAtom *frameType = weakFrame.GetFrame()->GetType();
 
     bool partOfHTMLTable =
@@ -1017,17 +1017,17 @@ nsAccessibilityService::GetOrCreateAcces
       frameType == nsGkAtoms::tableRowGroupFrame ||
       frameType == nsGkAtoms::tableRowFrame;
 
     if (partOfHTMLTable) {
       // Table-related frames don't get table-related roles
       // unless they are inside a table, but they may still get generic
       // accessibles
       nsIContent *tableContent = content;
-      while ((tableContent = tableContent->GetParent()) != nsnull) {
+      while ((tableContent = tableContent->GetParent()) != nullptr) {
         nsIFrame *tableFrame = tableContent->GetPrimaryFrame();
         if (!tableFrame)
           continue;
 
         if (tableFrame->GetType() == nsGkAtoms::tableOuterFrame) {
           Accessible* tableAccessible = aDoc->GetAccessible(tableContent);
 
           if (tableAccessible) {
@@ -1048,17 +1048,17 @@ nsAccessibilityService::GetOrCreateAcces
                        "No accessible for parent table and it didn't have role of presentation");
 #endif
 
           if (!roleMapEntry && !content->IsFocusable()) {
             // Table-related descendants of presentation table are also
             // presentation if they aren't focusable and have not explicit ARIA
             // role (don't create accessibles for them unless they need to fire
             // focus events).
-            return nsnull;
+            return nullptr;
           }
 
           // otherwise create ARIA based accessible.
           tryTagNameOrFrame = false;
           break;
         }
 
         if (tableContent->Tag() == nsGkAtoms::table) {
@@ -1113,17 +1113,17 @@ nsAccessibilityService::GetOrCreateAcces
         }
         if (f->GetType() == nsGkAtoms::tableCaptionFrame &&
            f->GetRect().IsEmpty()) {
           // XXX This is not the ideal place for this code, but right now there
           // is no better place:
           if (aIsSubtreeHidden)
             *aIsSubtreeHidden = true;
 
-          return nsnull;
+          return nullptr;
         }
 
         // Try using frame to do it.
         newAcc = f->CreateAccessible();
       }
     }
   }
 
@@ -1168,17 +1168,17 @@ nsAccessibilityService::GetOrCreateAcces
       newAcc = new HyperTextAccessibleWrap(content, docAcc);
     }
     else {  // XUL, SVG, MathML etc.
       // Interesting generic non-HTML container
       newAcc = new AccessibleWrap(content, docAcc);
     }
   }
 
-  return docAcc->BindToDocument(newAcc, roleMapEntry) ? newAcc : nsnull;
+  return docAcc->BindToDocument(newAcc, roleMapEntry) ? newAcc : nullptr;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccessibilityService private
 
 bool
 nsAccessibilityService::Init()
 {
@@ -1190,17 +1190,17 @@ nsAccessibilityService::Init()
   nsCOMPtr<nsIObserverService> observerService =
     mozilla::services::GetObserverService();
   if (!observerService)
     return false;
 
   observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
 
   static const PRUnichar kInitIndicator[] = { '1', 0 };
-  observerService->NotifyObservers(nsnull, "a11y-init-or-shutdown", kInitIndicator);
+  observerService->NotifyObservers(nullptr, "a11y-init-or-shutdown", kInitIndicator);
 
 #ifdef DEBUG
   logging::CheckEnv();
 #endif
 
   // Initialize accessibility.
   nsAccessNodeWrap::InitAccessibility();
 
@@ -1219,17 +1219,17 @@ nsAccessibilityService::Shutdown()
 {
   // Remove observers.
   nsCOMPtr<nsIObserverService> observerService =
       mozilla::services::GetObserverService();
   if (observerService) {
     observerService->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
 
     static const PRUnichar kShutdownIndicator[] = { '0', 0 };
-    observerService->NotifyObservers(nsnull, "a11y-init-or-shutdown", kShutdownIndicator);
+    observerService->NotifyObservers(nullptr, "a11y-init-or-shutdown", kShutdownIndicator);
   }
 
   // Stop accessible document loader.
   nsAccDocManager::Shutdown();
 
   // Application is going to be closed, shutdown accessibility and mark
   // accessibility service as shutdown to prevent calls of its methods.
   // Don't null accessibility service static member at this point to be safe
@@ -1266,35 +1266,35 @@ nsAccessibilityService::HasUniversalAria
 }
 
 already_AddRefed<Accessible>
 nsAccessibilityService::CreateAccessibleByType(nsIContent* aContent,
                                                DocAccessible* aDoc)
 {
   nsCOMPtr<nsIAccessibleProvider> accessibleProvider(do_QueryInterface(aContent));
   if (!accessibleProvider)
-    return nsnull;
+    return nullptr;
 
   PRInt32 type;
   nsresult rv = accessibleProvider->GetAccessibleType(&type);
   if (NS_FAILED(rv))
-    return nsnull;
+    return nullptr;
 
   if (type == nsIAccessibleProvider::OuterDoc) {
     Accessible* accessible = new OuterDocAccessible(aContent, aDoc);
     NS_IF_ADDREF(accessible);
     return accessible;
   }
 
-  Accessible* accessible = nsnull;
+  Accessible* accessible = nullptr;
   switch (type)
   {
 #ifdef MOZ_XUL
     case nsIAccessibleProvider::NoAccessible:
-      return nsnull;
+      return nullptr;
 
     // XUL controls
     case nsIAccessibleProvider::XULAlert:
       accessible = new XULAlertAccessible(aContent, aDoc);
       break;
 
     case nsIAccessibleProvider::XULButton:
       accessible = new XULButtonAccessible(aContent, aDoc);
@@ -1328,17 +1328,17 @@ nsAccessibilityService::CreateAccessible
       accessible = new XULGroupboxAccessible(aContent, aDoc);
       break;
 
     case nsIAccessibleProvider::XULImage:
     {
       // Don't include nameless images in accessible tree.
       if (!aContent->HasAttr(kNameSpaceID_None,
                              nsGkAtoms::tooltiptext))
-        return nsnull;
+        return nullptr;
 
       accessible = new ImageAccessibleWrap(aContent, aDoc);
       break;
 
     }
     case nsIAccessibleProvider::XULLink:
       accessible = new XULLinkAccessible(aContent, aDoc);
       break;
@@ -1377,17 +1377,17 @@ nsAccessibilityService::CreateAccessible
       // ATK considers this node to be redundant when within menubars, and it makes menu
       // navigation with assistive technologies more difficult
       // XXX In the future we will should this for consistency across the nsIAccessible
       // implementations on each platform for a consistent scripting environment, but
       // then strip out redundant accessibles in the AccessibleWrap class for each platform.
       nsIContent *parent = aContent->GetParent();
       if (parent && parent->NodeInfo()->Equals(nsGkAtoms::menu,
                                                kNameSpaceID_XUL))
-        return nsnull;
+        return nullptr;
 #endif
       accessible = new XULMenupopupAccessible(aContent, aDoc);
       break;
 
     }
     case nsIAccessibleProvider::XULMenuSeparator:
       accessible = new XULMenuSeparatorAccessible(aContent, aDoc);
       break;
@@ -1538,17 +1538,17 @@ nsAccessibilityService::CreateAccessible
       accessible = new nsXFormsCalendarWidgetAccessible(aContent, aDoc);
       break;
 
     case nsIAccessibleProvider::XFormsComboboxPopupWidget:
       accessible = new nsXFormsComboboxPopupWidgetAccessible(aContent, aDoc);
       break;
 
     default:
-      return nsnull;
+      return nullptr;
   }
 
   NS_IF_ADDREF(accessible);
   return accessible;
 }
 
 already_AddRefed<Accessible>
 nsAccessibilityService::CreateHTMLAccessibleByMarkup(nsIFrame* aFrame,
@@ -1652,41 +1652,41 @@ nsAccessibilityService::CreateHTMLAccess
 
   if (tag == nsGkAtoms::progress) {
     Accessible* accessible =
       new HTMLProgressMeterAccessible(aContent, aDoc);
     NS_IF_ADDREF(accessible);
     return accessible;
   }
 
-  return nsnull;
+  return nullptr;
  }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsIAccessibilityService (DON'T put methods here)
 
 Accessible*
 nsAccessibilityService::AddNativeRootAccessible(void* aAtkAccessible)
 {
 #ifdef MOZ_ACCESSIBILITY_ATK
   ApplicationAccessible* applicationAcc =
     nsAccessNode::GetApplicationAccessible();
   if (!applicationAcc)
-    return nsnull;
+    return nullptr;
 
   nsRefPtr<NativeRootAccessibleWrap> nativeRootAcc =
     new NativeRootAccessibleWrap(static_cast<AtkObject*>(aAtkAccessible));
   if (!nativeRootAcc)
-    return nsnull;
+    return nullptr;
 
   if (applicationAcc->AppendChild(nativeRootAcc))
     return nativeRootAcc;
 #endif
 
-  return nsnull;
+  return nullptr;
 }
 
 void
 nsAccessibilityService::RemoveNativeRootAccessible(Accessible* aAccessible)
 {
 #ifdef MOZ_ACCESSIBILITY_ATK
   ApplicationAccessible* applicationAcc =
     nsAccessNode::GetApplicationAccessible();
@@ -1702,17 +1702,17 @@ nsAccessibilityService::RemoveNativeRoot
 
 /**
  * Return accessibility service; creating one if necessary.
  */
 nsresult
 NS_GetAccessibilityService(nsIAccessibilityService** aResult)
 {
   NS_ENSURE_TRUE(aResult, NS_ERROR_NULL_POINTER);
-  *aResult = nsnull;
+  *aResult = nullptr;
  
   if (nsAccessibilityService::gAccessibilityService) {
     NS_ADDREF(*aResult = nsAccessibilityService::gAccessibilityService);
     return NS_OK;
   }
 
   nsRefPtr<nsAccessibilityService> service = new nsAccessibilityService();
   NS_ENSURE_TRUE(service, NS_ERROR_OUT_OF_MEMORY);
@@ -1756,32 +1756,32 @@ nsAccessibilityService::CreateAccessible
 #endif
       Accessible* accessible = new EnumRoleAccessible(aContent, aDoc,
                                                       roles::PROPERTYPAGE);
       NS_IF_ADDREF(accessible);
       return accessible;
     }
   }
 
-  return nsnull;
+  return nullptr;
 }
 
 #ifdef MOZ_XUL
 already_AddRefed<Accessible>
 nsAccessibilityService::CreateAccessibleForXULTree(nsIContent* aContent,
                                                    DocAccessible* aDoc)
 {
   nsCOMPtr<nsITreeBoxObject> treeBoxObj = nsCoreUtils::GetTreeBoxObject(aContent);
   if (!treeBoxObj)
-    return nsnull;
+    return nullptr;
 
   nsCOMPtr<nsITreeColumns> treeColumns;
   treeBoxObj->GetColumns(getter_AddRefs(treeColumns));
   if (!treeColumns)
-    return nsnull;
+    return nullptr;
 
   PRInt32 count = 0;
   treeColumns->GetCount(&count);
 
   // Outline of list accessible.
   if (count == 1) {
     Accessible* accessible = new XULTreeAccessible(aContent, aDoc);
     NS_IF_ADDREF(accessible);
--- a/accessible/src/base/nsAccessibilityService.h
+++ b/accessible/src/base/nsAccessibilityService.h
@@ -192,17 +192,17 @@ public:
    * one.
    *
    * @param  aNode             [in] the given node
    * @param  aDoc              [in] the doc accessible of the node
    * @param  aIsSubtreeHidden  [out, optional] indicates whether the node's
    *                             frame and its subtree is hidden
    */
   Accessible* GetOrCreateAccessible(nsINode* aNode, DocAccessible* aDoc,
-                                    bool* aIsSubtreeHidden = nsnull);
+                                    bool* aIsSubtreeHidden = nullptr);
 
 private:
   // nsAccessibilityService creation is controlled by friend
   // NS_GetAccessibilityService, keep constructors private.
   nsAccessibilityService();
   nsAccessibilityService(const nsAccessibilityService&);
   nsAccessibilityService& operator =(const nsAccessibilityService&);
 
--- a/accessible/src/base/nsAccessiblePivot.cpp
+++ b/accessible/src/base/nsAccessiblePivot.cpp
@@ -21,17 +21,17 @@ using namespace mozilla::a11y;
 
 /**
  * An object that stores a given traversal rule during 
  */
 class RuleCache
 {
 public:
   RuleCache(nsIAccessibleTraversalRule* aRule) : mRule(aRule),
-                                                 mAcceptRoles(nsnull) { }
+                                                 mAcceptRoles(nullptr) { }
   ~RuleCache () {
     if (mAcceptRoles)
       nsMemory::Free(mAcceptRoles);
   }
 
   nsresult ApplyFilter(Accessible* aAccessible, PRUint16* aResult);
 
 private:
@@ -40,17 +40,17 @@ private:
   PRUint32 mAcceptRolesLength;
   PRUint32 mPreFilter;
 };
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccessiblePivot
 
 nsAccessiblePivot::nsAccessiblePivot(Accessible* aRoot) :
-  mRoot(aRoot), mPosition(nsnull),
+  mRoot(aRoot), mPosition(nullptr),
   mStartOffset(-1), mEndOffset(-1)
 {
   NS_ASSERTION(aRoot, "A root accessible is required");
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsISupports
 
@@ -264,17 +264,17 @@ nsAccessiblePivot::MoveLast(nsIAccessibl
   NS_ENSURE_ARG(aRule);
 
   if (mRoot && mRoot->IsDefunct())
     return NS_ERROR_NOT_IN_TREE;
 
   *aResult = false;
   nsresult rv = NS_OK;
   Accessible* lastAccessible = mRoot;
-  Accessible* accessible = nsnull;
+  Accessible* accessible = nullptr;
 
   // First got to the last accessible in pre-order
   while (lastAccessible->HasChildren())
     lastAccessible = lastAccessible->LastChild();
 
   // Search backwards from last accessible and find the last occurrence in the doc
   accessible = SearchBackward(lastAccessible, aRule, true, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
@@ -316,26 +316,26 @@ nsAccessiblePivot::MoveToPoint(nsIAccess
   NS_ENSURE_ARG_POINTER(aRule);
 
   *aResult = false;
 
   if (mRoot && mRoot->IsDefunct())
     return NS_ERROR_NOT_IN_TREE;
 
   RuleCache cache(aRule);
-  Accessible* match = nsnull;
+  Accessible* match = nullptr;
   Accessible* child = mRoot->ChildAtPoint(aX, aY, Accessible::eDeepestChild);
   while (child && mRoot != child) {
     PRUint16 filtered = nsIAccessibleTraversalRule::FILTER_IGNORE;
     nsresult rv = cache.ApplyFilter(child, &filtered);
     NS_ENSURE_SUCCESS(rv, rv);
 
     // Ignore any matching nodes that were below this one
     if (filtered & nsIAccessibleTraversalRule::FILTER_IGNORE_SUBTREE)
-      match = nsnull;
+      match = nullptr;
 
     // Match if no node below this is a match
     if ((filtered & nsIAccessibleTraversalRule::FILTER_MATCH) && !match) {
       PRInt32 childX, childY, childWidth, childHeight;
       child->GetBounds(&childX, &childY, &childWidth, &childHeight);
       // Double-check child's bounds since the deepest child may have been out
       // of bounds. This assures we don't return a false positive.
       if (aX >= childX && aX < childX + childWidth &&
@@ -407,65 +407,65 @@ nsAccessiblePivot::SearchBackward(Access
                                   nsIAccessibleTraversalRule* aRule,
                                   bool aSearchCurrent,
                                   nsresult* aResult)
 {
   *aResult = NS_OK;
 
   // Initial position could be unset, in that case return null.
   if (!aAccessible)
-    return nsnull;
+    return nullptr;
 
   RuleCache cache(aRule);
   Accessible* accessible = aAccessible;
 
   PRUint16 filtered = nsIAccessibleTraversalRule::FILTER_IGNORE;
 
   if (aSearchCurrent) {
     *aResult = cache.ApplyFilter(accessible, &filtered);
-    NS_ENSURE_SUCCESS(*aResult, nsnull);
+    NS_ENSURE_SUCCESS(*aResult, nullptr);
     if (filtered & nsIAccessibleTraversalRule::FILTER_MATCH)
       return accessible;
   }
 
   while (accessible != mRoot) {
     Accessible* parent = accessible->Parent();
     PRInt32 idxInParent = accessible->IndexInParent();
     while (idxInParent > 0) {
       if (!(accessible = parent->GetChildAt(--idxInParent)))
         continue;
 
       *aResult = cache.ApplyFilter(accessible, &filtered);
-      NS_ENSURE_SUCCESS(*aResult, nsnull);
+      NS_ENSURE_SUCCESS(*aResult, nullptr);
 
-      Accessible* lastChild = nsnull;
+      Accessible* lastChild = nullptr;
       while (!(filtered & nsIAccessibleTraversalRule::FILTER_IGNORE_SUBTREE) &&
              (lastChild = accessible->LastChild())) {
         parent = accessible;
         accessible = lastChild;
         idxInParent = accessible->IndexInParent();
         *aResult = cache.ApplyFilter(accessible, &filtered);
-        NS_ENSURE_SUCCESS(*aResult, nsnull);
+        NS_ENSURE_SUCCESS(*aResult, nullptr);
       }
 
       if (filtered & nsIAccessibleTraversalRule::FILTER_MATCH)
         return accessible;
     }
 
     if (!(accessible = parent))
       break;
 
     *aResult = cache.ApplyFilter(accessible, &filtered);
-    NS_ENSURE_SUCCESS(*aResult, nsnull);
+    NS_ENSURE_SUCCESS(*aResult, nullptr);
 
     if (filtered & nsIAccessibleTraversalRule::FILTER_MATCH)
       return accessible;
   }
 
-  return nsnull;
+  return nullptr;
 }
 
 Accessible*
 nsAccessiblePivot::SearchForward(Accessible* aAccessible,
                                  nsIAccessibleTraversalRule* aRule,
                                  bool aSearchCurrent,
                                  nsresult* aResult)
 {
@@ -473,56 +473,56 @@ nsAccessiblePivot::SearchForward(Accessi
 
   // Initial position could be not set, in that case begin search from root.
   Accessible* accessible = (!aAccessible) ? mRoot.get() : aAccessible;
 
   RuleCache cache(aRule);
 
   PRUint16 filtered = nsIAccessibleTraversalRule::FILTER_IGNORE;
   *aResult = cache.ApplyFilter(accessible, &filtered);
-  NS_ENSURE_SUCCESS(*aResult, nsnull);
+  NS_ENSURE_SUCCESS(*aResult, nullptr);
   if (aSearchCurrent && (filtered & nsIAccessibleTraversalRule::FILTER_MATCH))
     return accessible;
 
   while (true) {
-    Accessible* firstChild = nsnull;
+    Accessible* firstChild = nullptr;
     while (!(filtered & nsIAccessibleTraversalRule::FILTER_IGNORE_SUBTREE) &&
            (firstChild = accessible->FirstChild())) {
       accessible = firstChild;
       *aResult = cache.ApplyFilter(accessible, &filtered);
-      NS_ENSURE_SUCCESS(*aResult, nsnull);
+      NS_ENSURE_SUCCESS(*aResult, nullptr);
 
       if (filtered & nsIAccessibleTraversalRule::FILTER_MATCH)
         return accessible;
     }
 
-    Accessible* sibling = nsnull;
+    Accessible* sibling = nullptr;
     Accessible* temp = accessible;
     do {
       if (temp == mRoot)
         break;
 
       sibling = temp->NextSibling();
 
       if (sibling)
         break;
     } while ((temp = temp->Parent()));
 
     if (!sibling)
       break;
 
     accessible = sibling;
     *aResult = cache.ApplyFilter(accessible, &filtered);
-    NS_ENSURE_SUCCESS(*aResult, nsnull);
+    NS_ENSURE_SUCCESS(*aResult, nullptr);
 
     if (filtered & nsIAccessibleTraversalRule::FILTER_MATCH)
       return accessible;
   }
 
-  return nsnull;
+  return nullptr;
 }
 
 bool
 nsAccessiblePivot::NotifyOfPivotChange(Accessible* aOldPosition,
                                        PRInt32 aOldStart, PRInt32 aOldEnd,
                                        PRInt16 aReason)
 {
   if (aOldPosition == mPosition &&
--- a/accessible/src/base/nsCaretAccessible.cpp
+++ b/accessible/src/base/nsCaretAccessible.cpp
@@ -39,27 +39,27 @@ nsCaretAccessible::~nsCaretAccessible()
 
 void nsCaretAccessible::Shutdown()
 {
   // The caret accessible isn't shut down until the RootAccessible owning it is shut down
   // Each DocAccessible, including the RootAccessible, is responsible for clearing the
   // doc selection listeners they registered in this nsCaretAccessible
 
   ClearControlSelectionListener(); // Clear the selection listener for the currently focused control
-  mLastTextAccessible = nsnull;
-  mLastUsedSelection = nsnull;
-  mRootAccessible = nsnull;
+  mLastTextAccessible = nullptr;
+  mLastUsedSelection = nullptr;
+  mRootAccessible = nullptr;
 }
 
 nsresult nsCaretAccessible::ClearControlSelectionListener()
 {
   nsCOMPtr<nsISelectionController> controller =
     GetSelectionControllerForNode(mCurrentControl);
 
-  mCurrentControl = nsnull;
+  mCurrentControl = nullptr;
 
   if (!controller)
     return NS_OK;
 
   // Remove 'this' registered as selection listener for the normal selection.
   nsCOMPtr<nsISelection> normalSel;
   controller->GetSelection(nsISelectionController::SELECTION_NORMAL,
                            getter_AddRefs(normalSel));
@@ -83,17 +83,17 @@ nsresult nsCaretAccessible::ClearControl
 nsresult
 nsCaretAccessible::SetControlSelectionListener(nsIContent *aCurrentNode)
 {
   NS_ENSURE_TRUE(mRootAccessible, NS_ERROR_FAILURE);
 
   ClearControlSelectionListener();
 
   mCurrentControl = aCurrentNode;
-  mLastTextAccessible = nsnull;
+  mLastTextAccessible = nullptr;
 
   // When focus moves such that the caret is part of a new frame selection
   // this removes the old selection listener and attaches a new one for
   // the current focus.
 
   nsCOMPtr<nsISelectionController> controller =
     GetSelectionControllerForNode(mCurrentControl);
 #ifdef DEBUG
@@ -217,17 +217,17 @@ nsCaretAccessible::ProcessSelectionChang
 void
 nsCaretAccessible::NormalSelectionChanged(nsISelection* aSelection)
 {
   mLastUsedSelection = do_GetWeakReference(aSelection);
 
   PRInt32 rangeCount = 0;
   aSelection->GetRangeCount(&rangeCount);
   if (rangeCount == 0) {
-    mLastTextAccessible = nsnull;
+    mLastTextAccessible = nullptr;
     return; // No selection
   }
 
   HyperTextAccessible* textAcc =
     nsAccUtils::GetTextAccessibleFromSelection(aSelection);
   if (!textAcc)
     return;
 
@@ -272,17 +272,17 @@ nsCaretAccessible::SpellcheckSelectionCh
     textAcc->Document()->FireDelayedAccessibleEvent(event);
 }
 
 nsIntRect
 nsCaretAccessible::GetCaretRect(nsIWidget **aOutWidget)
 {
   nsIntRect caretRect;
   NS_ENSURE_TRUE(aOutWidget, caretRect);
-  *aOutWidget = nsnull;
+  *aOutWidget = nullptr;
   NS_ENSURE_TRUE(mRootAccessible, caretRect);
 
   if (!mLastTextAccessible) {
     return caretRect;    // Return empty rect
   }
 
   nsINode *lastNodeWithCaret = mLastTextAccessible->GetNode();
   NS_ENSURE_TRUE(lastNodeWithCaret, caretRect);
@@ -332,27 +332,27 @@ nsCaretAccessible::GetCaretRect(nsIWidge
 
   return caretRect;
 }
 
 already_AddRefed<nsISelectionController>
 nsCaretAccessible::GetSelectionControllerForNode(nsIContent *aContent)
 {
   if (!aContent)
-    return nsnull;
+    return nullptr;
 
   nsIPresShell *presShell = aContent->OwnerDoc()->GetShell();
   if (!presShell)
-    return nsnull;
+    return nullptr;
 
   nsIFrame *frame = aContent->GetPrimaryFrame();
   if (!frame)
-    return nsnull;
+    return nullptr;
 
   nsPresContext *presContext = presShell->GetPresContext();
   if (!presContext)
-    return nsnull;
+    return nullptr;
 
-  nsISelectionController *controller = nsnull;
+  nsISelectionController *controller = nullptr;
   frame->GetSelectionController(presContext, &controller);
   return controller;
 }
 
--- a/accessible/src/base/nsCoreUtils.cpp
+++ b/accessible/src/base/nsCoreUtils.cpp
@@ -61,17 +61,17 @@ nsCoreUtils::DispatchClickEvent(nsITreeB
   if (!tcElm)
     return;
 
   nsCOMPtr<nsIContent> tcContent(do_QueryInterface(tcElm));
   nsIDocument *document = tcContent->GetCurrentDoc();
   if (!document)
     return;
 
-  nsIPresShell *presShell = nsnull;
+  nsIPresShell *presShell = nullptr;
   presShell = document->GetShell();
   if (!presShell)
     return;
 
   // Ensure row is visible.
   aTreeBoxObj->EnsureRowIsVisible(aRowIndex);
 
   // Calculate x and y coordinates.
@@ -190,17 +190,17 @@ nsIContent *
 nsCoreUtils::GetDOMElementFor(nsIContent *aContent)
 {
   if (aContent->IsElement())
     return aContent;
 
   if (aContent->IsNodeOfType(nsINode::eTEXT))
     return aContent->GetParent();
 
-  return nsnull;
+  return nullptr;
 }
 
 nsINode *
 nsCoreUtils::GetDOMNodeFromDOMPoint(nsINode *aNode, PRUint32 aOffset)
 {
   if (aNode && aNode->IsElement()) {
     PRUint32 childCount = aNode->GetChildCount();
     NS_ASSERTION(aOffset <= childCount, "Wrong offset of the DOM point!");
@@ -400,20 +400,20 @@ nsCoreUtils::GetScreenCoordsForWindow(ns
   window->GetScreenY(&coords.y);
   return coords;
 }
 
 already_AddRefed<nsIDocShellTreeItem>
 nsCoreUtils::GetDocShellTreeItemFor(nsINode *aNode)
 {
   if (!aNode)
-    return nsnull;
+    return nullptr;
 
   nsCOMPtr<nsISupports> container = aNode->OwnerDoc()->GetContainer();
-  nsIDocShellTreeItem *docShellTreeItem = nsnull;
+  nsIDocShellTreeItem *docShellTreeItem = nullptr;
   if (container)
     CallQueryInterface(container, &docShellTreeItem);
 
   return docShellTreeItem;
 }
 
 bool
 nsCoreUtils::IsRootDocument(nsIDocument *aDocument)
@@ -484,23 +484,23 @@ already_AddRefed<nsIDOMNode>
 nsCoreUtils::GetDOMNodeForContainer(nsIDocShellTreeItem *aContainer)
 {
   nsCOMPtr<nsIDocShell> shell = do_QueryInterface(aContainer);
 
   nsCOMPtr<nsIContentViewer> cv;
   shell->GetContentViewer(getter_AddRefs(cv));
 
   if (!cv)
-    return nsnull;
+    return nullptr;
 
   nsIDocument* doc = cv->GetDocument();
   if (!doc)
-    return nsnull;
+    return nullptr;
 
-  nsIDOMNode* node = nsnull;
+  nsIDOMNode* node = nullptr;
   CallQueryInterface(doc, &node);
   return node;
 }
 
 bool
 nsCoreUtils::GetID(nsIContent *aContent, nsAString& aID)
 {
   nsIAtom *idAttribute = aContent->GetIDAttributeName();
@@ -549,19 +549,19 @@ nsCoreUtils::GetLanguageFor(nsIContent *
 
 already_AddRefed<nsIBoxObject>
 nsCoreUtils::GetTreeBodyBoxObject(nsITreeBoxObject *aTreeBoxObj)
 {
   nsCOMPtr<nsIDOMElement> tcElm;
   aTreeBoxObj->GetTreeBody(getter_AddRefs(tcElm));
   nsCOMPtr<nsIDOMXULElement> tcXULElm(do_QueryInterface(tcElm));
   if (!tcXULElm)
-    return nsnull;
+    return nullptr;
 
-  nsIBoxObject *boxObj = nsnull;
+  nsIBoxObject *boxObj = nullptr;
   tcXULElm->GetBoxObject(&boxObj);
   return boxObj;
 }
 
 already_AddRefed<nsITreeBoxObject>
 nsCoreUtils::GetTreeBoxObject(nsIContent *aContent)
 {
   // Find DOMNode's parents recursively until reach the <tree> tag
@@ -577,26 +577,26 @@ nsCoreUtils::GetTreeBoxObject(nsIContent
         nsCOMPtr<nsITreeBoxObject> treeBox(do_QueryInterface(box));
         if (treeBox)
           return treeBox.forget();
       }
     }
     currentContent = currentContent->GetParent();
   }
 
-  return nsnull;
+  return nullptr;
 }
 
 already_AddRefed<nsITreeColumn>
 nsCoreUtils::GetFirstSensibleColumn(nsITreeBoxObject *aTree)
 {
   nsCOMPtr<nsITreeColumns> cols;
   aTree->GetColumns(getter_AddRefs(cols));
   if (!cols)
-    return nsnull;
+    return nullptr;
 
   nsCOMPtr<nsITreeColumn> column;
   cols->GetFirstColumn(getter_AddRefs(column));
   if (column && IsColumnHidden(column))
     return GetNextSensibleColumn(column);
 
   return column.forget();
 }
@@ -635,17 +635,17 @@ nsCoreUtils::GetSensibleColumnAt(nsITree
   while (column) {
     if (idx == 0)
       return column.forget();
 
     idx--;
     column = GetNextSensibleColumn(column);
   }
 
-  return nsnull;
+  return nullptr;
 }
 
 already_AddRefed<nsITreeColumn>
 nsCoreUtils::GetNextSensibleColumn(nsITreeColumn *aColumn)
 {
   nsCOMPtr<nsITreeColumn> nextColumn;
   aColumn->GetNext(getter_AddRefs(nextColumn));
 
--- a/accessible/src/base/nsCoreUtils.h
+++ b/accessible/src/base/nsCoreUtils.h
@@ -82,17 +82,17 @@ public:
    * @param aContent - the given element.
    */
   static PRUint32 GetAccessKeyFor(nsIContent *aContent);
 
   /**
    * Return DOM element related with the given node, i.e.
    * a) itself if it is DOM element
    * b) parent element if it is text node
-   * c) otherwise nsnull
+   * c) otherwise nullptr
    *
    * @param aNode  [in] the given DOM node
    */
   static nsIContent* GetDOMElementFor(nsIContent *aContent);
 
   /**
    * Return DOM node for the given DOM point.
    */
@@ -119,17 +119,17 @@ public:
    *                                   aPossibleAncestorNode
    * @param  aRootNode               [in, optional] the root node that search
    *                                   search should be performed within
    * @return true                     if aPossibleAncestorNode is an ancestor of
    *                                   aPossibleDescendantNode
    */
    static bool IsAncestorOf(nsINode *aPossibleAncestorNode,
                               nsINode *aPossibleDescendantNode,
-                              nsINode *aRootNode = nsnull);
+                              nsINode *aRootNode = nullptr);
 
   /**
    * Helper method to scroll range into view, used for implementation of
    * nsIAccessibleText::scrollSubstringTo().
    *
    * @param aFrame        the frame for accessible the range belongs to.
    * @param aRange    the range to scroll to
    * @param aScrollType   the place a range should be scrolled to
@@ -320,17 +320,17 @@ class nsAccessibleDOMStringList : public
 public:
   nsAccessibleDOMStringList() {};
   virtual ~nsAccessibleDOMStringList() {};
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIDOMDOMSTRINGLIST
 
   bool Add(const nsAString& aName) {
-    return mNames.AppendElement(aName) != nsnull;
+    return mNames.AppendElement(aName) != nullptr;
   }
 
 private:
   nsTArray<nsString> mNames;
 };
 
 #endif
 
--- a/accessible/src/base/nsEventShell.cpp
+++ b/accessible/src/base/nsEventShell.cpp
@@ -23,17 +23,17 @@ nsEventShell::FireEvent(AccEvent* aEvent
   nsINode* node = aEvent->GetNode();
   if (node) {
     sEventTargetNode = node;
     sEventFromUserInput = aEvent->IsFromUserInput();
   }
 
   accessible->HandleAccEvent(aEvent);
 
-  sEventTargetNode = nsnull;
+  sEventTargetNode = nullptr;
 }
 
 void
 nsEventShell::FireEvent(PRUint32 aEventType, Accessible* aAccessible,
                         EIsFromUserInput aIsFromUserInput)
 {
   NS_ENSURE_TRUE(aAccessible,);
 
--- a/accessible/src/base/nsTextEquivUtils.cpp
+++ b/accessible/src/base/nsTextEquivUtils.cpp
@@ -40,33 +40,33 @@ nsTextEquivUtils::GetNameFromSubtree(Acc
       nsAutoString name;
       AppendFromAccessibleChildren(aAccessible, &name);
       name.CompressWhitespace();
       if (!IsWhitespaceString(name))
         aName = name;
     }
   }
 
-  gInitiatorAcc = nsnull;
+  gInitiatorAcc = nullptr;
 
   return NS_OK;
 }
 
 nsresult
 nsTextEquivUtils::GetTextEquivFromIDRefs(Accessible* aAccessible,
                                          nsIAtom *aIDRefsAttr,
                                          nsAString& aTextEquiv)
 {
   aTextEquiv.Truncate();
 
   nsIContent* content = aAccessible->GetContent();
   if (!content)
     return NS_OK;
 
-  nsIContent* refContent = nsnull;
+  nsIContent* refContent = nullptr;
   IDRefsIterator iter(aAccessible->Document(), content, aIDRefsAttr);
   while ((refContent = iter.NextElem())) {
     if (!aTextEquiv.IsEmpty())
       aTextEquiv += ' ';
 
     nsresult rv = AppendTextEquivFromContent(aAccessible, refContent,
                                              &aTextEquiv);
     NS_ENSURE_SUCCESS(rv, rv);
@@ -102,17 +102,17 @@ nsTextEquivUtils::AppendTextEquivFromCon
       rv = AppendFromAccessible(accessible, aString);
       goThroughDOMSubtree = false;
     }
   }
 
   if (goThroughDOMSubtree)
     rv = AppendFromDOMNode(aContent, aString);
 
-  gInitiatorAcc = nsnull;
+  gInitiatorAcc = nullptr;
   return rv;
 }
 
 nsresult
 nsTextEquivUtils::AppendTextEquivFromTextContent(nsIContent *aContent,
                                                  nsAString *aString)
 {
   if (aContent->IsNodeOfType(nsINode::eTEXT)) {
--- a/accessible/src/generic/ARIAGridAccessible.cpp
+++ b/accessible/src/generic/ARIAGridAccessible.cpp
@@ -39,33 +39,33 @@ NS_IMPL_ISUPPORTS_INHERITED1(ARIAGridAcc
                              nsIAccessibleTable)
 
 ////////////////////////////////////////////////////////////////////////////////
 //nsAccessNode
 
 void
 ARIAGridAccessible::Shutdown()
 {
-  mTable = nsnull;
+  mTable = nullptr;
   AccessibleWrap::Shutdown();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsIAccessibleTable
 
 PRUint32
 ARIAGridAccessible::ColCount()
 {
   AccIterator rowIter(this, filters::GetRow);
   Accessible* row = rowIter.Next();
   if (!row)
     return 0;
 
   AccIterator cellIter(row, filters::GetCell);
-  Accessible* cell = nsnull;
+  Accessible* cell = nullptr;
 
   PRUint32 colCount = 0;
   while ((cell = cellIter.Next()))
     colCount++;
 
   return colCount;
 }
 
@@ -80,17 +80,17 @@ ARIAGridAccessible::RowCount()
   return rowCount;
 }
 
 Accessible*
 ARIAGridAccessible::CellAt(PRUint32 aRowIndex, PRUint32 aColumnIndex)
 { 
   Accessible* row = GetRowAt(aRowIndex);
   if (!row)
-    return nsnull;
+    return nullptr;
 
   return GetCellInRowAt(row, aColumnIndex);
 }
 
 bool
 ARIAGridAccessible::IsColSelected(PRUint32 aColIdx)
 {
   AccIterator rowIter(this, filters::GetRow);
@@ -113,17 +113,17 @@ bool
 ARIAGridAccessible::IsRowSelected(PRUint32 aRowIdx)
 {
   Accessible* row = GetRowAt(aRowIdx);
   if(!row)
     return false;
 
   if (!nsAccUtils::IsARIASelected(row)) {
     AccIterator cellIter(row, filters::GetCell);
-    Accessible* cell = nsnull;
+    Accessible* cell = nullptr;
     while ((cell = cellIter.Next())) {
       if (!nsAccUtils::IsARIASelected(cell))
         return false;
     }
   }
 
   return true;
 }
@@ -145,26 +145,26 @@ ARIAGridAccessible::IsCellSelected(PRUin
 }
 
 PRUint32
 ARIAGridAccessible::SelectedCellCount()
 {
   PRUint32 count = 0, colCount = ColCount();
 
   AccIterator rowIter(this, filters::GetRow);
-  Accessible* row = nsnull;
+  Accessible* row = nullptr;
 
   while ((row = rowIter.Next())) {
     if (nsAccUtils::IsARIASelected(row)) {
       count += colCount;
       continue;
     }
 
     AccIterator cellIter(row, filters::GetCell);
-    Accessible* cell = nsnull;
+    Accessible* cell = nullptr;
 
     while ((cell = cellIter.Next())) {
       if (nsAccUtils::IsARIASelected(cell))
         count++;
     }
   }
 
   return count;
@@ -187,17 +187,17 @@ ARIAGridAccessible::SelectedColCount()
   memset(isColSelArray.Elements(), true, colCount * sizeof(bool));
 
   PRUint32 selColCount = colCount;
   do {
     if (nsAccUtils::IsARIASelected(row))
       continue;
 
     AccIterator cellIter(row, filters::GetCell);
-    Accessible* cell = nsnull;
+    Accessible* cell = nullptr;
     for (PRUint32 colIdx = 0;
          (cell = cellIter.Next()) && colIdx < colCount; colIdx++)
       if (isColSelArray[colIdx] && !nsAccUtils::IsARIASelected(cell)) {
         isColSelArray[colIdx] = false;
         selColCount--;
       }
   } while ((row = rowIter.Next()));
 
@@ -205,17 +205,17 @@ ARIAGridAccessible::SelectedColCount()
 }
 
 PRUint32
 ARIAGridAccessible::SelectedRowCount()
 {
   PRUint32 count = 0;
 
   AccIterator rowIter(this, filters::GetRow);
-  Accessible* row = nsnull;
+  Accessible* row = nullptr;
 
   while ((row = rowIter.Next())) {
     if (nsAccUtils::IsARIASelected(row)) {
       count++;
       continue;
     }
 
     AccIterator cellIter(row, filters::GetCell);
@@ -238,20 +238,20 @@ ARIAGridAccessible::SelectedRowCount()
   return count;
 }
 
 void
 ARIAGridAccessible::SelectedCells(nsTArray<Accessible*>* aCells)
 {
   AccIterator rowIter(this, filters::GetRow);
 
-  Accessible* row = nsnull;
+  Accessible* row = nullptr;
   while ((row = rowIter.Next())) {
     AccIterator cellIter(row, filters::GetCell);
-    Accessible* cell = nsnull;
+    Accessible* cell = nullptr;
 
     if (nsAccUtils::IsARIASelected(row)) {
       while ((cell = cellIter.Next()))
         aCells->AppendElement(cell);
 
       continue;
     }
 
@@ -263,27 +263,27 @@ ARIAGridAccessible::SelectedCells(nsTArr
 }
 
 void
 ARIAGridAccessible::SelectedCellIndices(nsTArray<PRUint32>* aCells)
 {
   PRUint32 colCount = ColCount();
 
   AccIterator rowIter(this, filters::GetRow);
-  Accessible* row = nsnull;
+  Accessible* row = nullptr;
   for (PRUint32 rowIdx = 0; (row = rowIter.Next()); rowIdx++) {
     if (nsAccUtils::IsARIASelected(row)) {
       for (PRUint32 colIdx = 0; colIdx < colCount; colIdx++)
         aCells->AppendElement(rowIdx * colCount + colIdx);
 
       continue;
     }
 
     AccIterator cellIter(row, filters::GetCell);
-    Accessible* cell = nsnull;
+    Accessible* cell = nullptr;
     for (PRUint32 colIdx = 0; (cell = cellIter.Next()); colIdx++) {
       if (nsAccUtils::IsARIASelected(cell))
         aCells->AppendElement(rowIdx * colCount + colIdx);
     }
   }
 }
 
 void
@@ -302,34 +302,34 @@ ARIAGridAccessible::SelectedColIndices(n
   isColSelArray.AppendElements(colCount);
   memset(isColSelArray.Elements(), true, colCount * sizeof(bool));
 
   do {
     if (nsAccUtils::IsARIASelected(row))
       continue;
 
     AccIterator cellIter(row, filters::GetCell);
-    Accessible* cell = nsnull;
+    Accessible* cell = nullptr;
     for (PRUint32 colIdx = 0;
          (cell = cellIter.Next()) && colIdx < colCount; colIdx++)
       if (isColSelArray[colIdx] && !nsAccUtils::IsARIASelected(cell)) {
         isColSelArray[colIdx] = false;
       }
   } while ((row = rowIter.Next()));
 
   for (PRUint32 colIdx = 0; colIdx < colCount; colIdx++)
     if (isColSelArray[colIdx])
       aCols->AppendElement(colIdx);
 }
 
 void
 ARIAGridAccessible::SelectedRowIndices(nsTArray<PRUint32>* aRows)
 {
   AccIterator rowIter(this, filters::GetRow);
-  Accessible* row = nsnull;
+  Accessible* row = nullptr;
   for (PRUint32 rowIdx = 0; (row = rowIter.Next()); rowIdx++) {
     if (nsAccUtils::IsARIASelected(row)) {
       aRows->AppendElement(rowIdx);
       continue;
     }
 
     AccIterator cellIter(row, filters::GetCell);
     Accessible* cell = cellIter.Next();
@@ -349,29 +349,29 @@ ARIAGridAccessible::SelectedRowIndices(n
   }
 }
 
 void
 ARIAGridAccessible::SelectRow(PRUint32 aRowIdx)
 {
   AccIterator rowIter(this, filters::GetRow);
 
-  Accessible* row = nsnull;
+  Accessible* row = nullptr;
   for (PRInt32 rowIdx = 0; (row = rowIter.Next()); rowIdx++) {
     nsresult rv = SetARIASelected(row, rowIdx == aRowIdx);
     NS_ASSERTION(NS_SUCCEEDED(rv), "SetARIASelected() Shouldn't fail!");
   }
 }
 
 void
 ARIAGridAccessible::SelectCol(PRUint32 aColIdx)
 {
   AccIterator rowIter(this, filters::GetRow);
 
-  Accessible* row = nsnull;
+  Accessible* row = nullptr;
   while ((row = rowIter.Next())) {
     // Unselect all cells in the row.
     nsresult rv = SetARIASelected(row, false);
     NS_ASSERTION(NS_SUCCEEDED(rv), "SetARIASelected() Shouldn't fail!");
 
     // Select cell at the column index.
     Accessible* cell = GetCellInRowAt(row, aColIdx);
     if (cell)
@@ -388,17 +388,17 @@ ARIAGridAccessible::UnselectRow(PRUint32
     SetARIASelected(row, false);
 }
 
 void
 ARIAGridAccessible::UnselectCol(PRUint32 aColIdx)
 {
   AccIterator rowIter(this, filters::GetRow);
 
-  Accessible* row = nsnull;
+  Accessible* row = nullptr;
   while ((row = rowIter.Next())) {
     Accessible* cell = GetCellInRowAt(row, aColIdx);
     if (cell)
       SetARIASelected(cell, false);
   }
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -481,17 +481,17 @@ ARIAGridAccessible::SetARIASelected(Acce
     return NS_OK;
 
   roles::Role role = aAccessible->Role();
 
   // If the given accessible is row that was unselected then remove
   // aria-selected from cell accessible.
   if (role == roles::ROW) {
     AccIterator cellIter(aAccessible, filters::GetCell);
-    Accessible* cell = nsnull;
+    Accessible* cell = nullptr;
 
     while ((cell = cellIter.Next())) {
       rv = SetARIASelected(cell, false, false);
       NS_ENSURE_SUCCESS(rv, rv);
     }
     return NS_OK;
   }
 
@@ -503,17 +503,17 @@ ARIAGridAccessible::SetARIASelected(Acce
     Accessible* row = aAccessible->Parent();
 
     if (row && row->Role() == roles::ROW &&
         nsAccUtils::IsARIASelected(row)) {
       rv = SetARIASelected(row, false, false);
       NS_ENSURE_SUCCESS(rv, rv);
 
       AccIterator cellIter(row, filters::GetCell);
-      Accessible* cell = nsnull;
+      Accessible* cell = nullptr;
       while ((cell = cellIter.Next())) {
         if (cell != aAccessible) {
           rv = SetARIASelected(cell, true, false);
           NS_ENSURE_SUCCESS(rv, rv);
         }
       }
     }
   }
@@ -544,17 +544,17 @@ NS_IMPL_ISUPPORTS_INHERITED1(ARIAGridCel
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsIAccessibleTableCell
 
 NS_IMETHODIMP
 ARIAGridCellAccessible::GetTable(nsIAccessibleTable** aTable)
 {
   NS_ENSURE_ARG_POINTER(aTable);
-  *aTable = nsnull;
+  *aTable = nullptr;
 
   Accessible* thisRow = Parent();
   if (!thisRow || thisRow->Role() != roles::ROW)
     return NS_OK;
 
   Accessible* table = thisRow->Parent();
   if (!table)
     return NS_OK;
@@ -648,17 +648,17 @@ ARIAGridCellAccessible::GetRowExtent(PRI
   *aExtentCount = 1;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 ARIAGridCellAccessible::GetColumnHeaderCells(nsIArray** aHeaderCells)
 {
   NS_ENSURE_ARG_POINTER(aHeaderCells);
-  *aHeaderCells = nsnull;
+  *aHeaderCells = nullptr;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsCOMPtr<nsIAccessibleTable> table;
   GetTable(getter_AddRefs(table));
   if (!table)
     return NS_OK;
@@ -667,17 +667,17 @@ ARIAGridCellAccessible::GetColumnHeaderC
                                        nsAccUtils::eColumnHeaderCells,
                                        aHeaderCells);
 }
 
 NS_IMETHODIMP
 ARIAGridCellAccessible::GetRowHeaderCells(nsIArray** aHeaderCells)
 {
   NS_ENSURE_ARG_POINTER(aHeaderCells);
-  *aHeaderCells = nsnull;
+  *aHeaderCells = nullptr;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsCOMPtr<nsIAccessibleTable> table;
   GetTable(getter_AddRefs(table));
   if (!table)
     return NS_OK;
@@ -788,11 +788,11 @@ ARIAGridCellAccessible::GetAttributesInt
                          stringIdx);
 
   return NS_OK;
 }
 
 void
 ARIAGridCellAccessible::Shutdown()
 {
-  mTableCell = nsnull;
+  mTableCell = nullptr;
   HyperTextAccessibleWrap::Shutdown();
 }
--- a/accessible/src/generic/Accessible.cpp
+++ b/accessible/src/generic/Accessible.cpp
@@ -104,17 +104,17 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 NS_IMPL_ADDREF_INHERITED(Accessible, nsAccessNode)
 NS_IMPL_RELEASE_INHERITED(Accessible, nsAccessNode)
 
 nsresult
 Accessible::QueryInterface(REFNSIID aIID, void** aInstancePtr)
 {
   // Custom-built QueryInterface() knows when we support nsIAccessibleSelectable
   // based on role attribute and aria-multiselectable
-  *aInstancePtr = nsnull;
+  *aInstancePtr = nullptr;
 
   if (aIID.Equals(NS_GET_IID(nsXPCOMCycleCollectionParticipant))) {
     *aInstancePtr = NS_CYCLE_COLLECTION_PARTICIPANT(Accessible);
     return NS_OK;
   }
 
   if (aIID.Equals(NS_GET_IID(nsIAccessible))) {
     *aInstancePtr = static_cast<nsIAccessible*>(this);
@@ -154,18 +154,18 @@ Accessible::QueryInterface(REFNSIID aIID
     return NS_ERROR_NO_INTERFACE;
   }
 
   return nsAccessNodeWrap::QueryInterface(aIID, aInstancePtr);
 }
 
 Accessible::Accessible(nsIContent* aContent, DocAccessible* aDoc) :
   nsAccessNodeWrap(aContent, aDoc),
-  mParent(nsnull), mIndexInParent(-1), mFlags(eChildrenUninitialized),
-  mIndexOfEmbeddedChild(-1), mRoleMapEntry(nsnull)
+  mParent(nullptr), mIndexInParent(-1), mFlags(eChildrenUninitialized),
+  mIndexOfEmbeddedChild(-1), mRoleMapEntry(nullptr)
 {
 #ifdef NS_DEBUG_X
    {
      nsCOMPtr<nsIPresShell> shell(do_QueryReferent(aShell));
      printf(">>> %p Created Acc - DOM: %p  PS: %p", 
             (void*)static_cast<nsIAccessible*>(this), (void*)aNode,
             (void*)shell.get());
     nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
@@ -209,17 +209,17 @@ Accessible::GetDocument(nsIAccessibleDoc
   NS_IF_ADDREF(*aDocument = Document());
   return NS_OK;
 }
 
 NS_IMETHODIMP
 Accessible::GetDOMNode(nsIDOMNode** aDOMNode)
 {
   NS_ENSURE_ARG_POINTER(aDOMNode);
-  *aDOMNode = nsnull;
+  *aDOMNode = nullptr;
 
   nsINode *node = GetNode();
   if (node)
     CallQueryInterface(node, aDOMNode);
 
   return NS_OK;
 }
 
@@ -324,17 +324,17 @@ Accessible::Description(nsString& aDescr
     GetTextEquivFromIDRefs(this, nsGkAtoms::aria_describedby,
                            aDescription);
 
   if (aDescription.IsEmpty()) {
     bool isXUL = mContent->IsXUL();
     if (isXUL) {
       // Try XUL <description control="[id]">description text</description>
       XULDescriptionIterator iter(Document(), mContent);
-      Accessible* descr = nsnull;
+      Accessible* descr = nullptr;
       while ((descr = iter.Next()))
         nsTextEquivUtils::AppendTextEquivFromContent(this, descr->GetContent(),
                                                      &aDescription);
       }
 
       if (aDescription.IsEmpty()) {
         nsIAtom *descAtom = isXUL ? nsGkAtoms::tooltiptext :
                                     nsGkAtoms::title;
@@ -363,17 +363,17 @@ Accessible::GetAccessKey(nsAString& aAcc
   return NS_OK;
 }
 
 KeyBinding
 Accessible::AccessKey() const
 {
   PRUint32 key = nsCoreUtils::GetAccessKeyFor(mContent);
   if (!key && mContent->IsElement()) {
-    Accessible* label = nsnull;
+    Accessible* label = nullptr;
 
     // Copy access key from label node.
     if (mContent->IsHTML()) {
       // Unless it is labeled via an ancestor <label>, in which case that would
       // be redundant.
       HTMLLabelIterator iter(Document(), this,
                              HTMLLabelIterator::eSkipAncestorLabel);
       label = iter.Next();
@@ -449,74 +449,74 @@ Accessible::GetParent(nsIAccessible** aP
   return *aParent ? NS_OK : NS_ERROR_FAILURE;
 }
 
   /* readonly attribute nsIAccessible nextSibling; */
 NS_IMETHODIMP
 Accessible::GetNextSibling(nsIAccessible** aNextSibling)
 {
   NS_ENSURE_ARG_POINTER(aNextSibling);
-  *aNextSibling = nsnull;
+  *aNextSibling = nullptr;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsresult rv = NS_OK;
   NS_IF_ADDREF(*aNextSibling = GetSiblingAtOffset(1, &rv));
   return rv;
 }
 
   /* readonly attribute nsIAccessible previousSibling; */
 NS_IMETHODIMP
 Accessible::GetPreviousSibling(nsIAccessible ** aPreviousSibling)
 {
   NS_ENSURE_ARG_POINTER(aPreviousSibling);
-  *aPreviousSibling = nsnull;
+  *aPreviousSibling = nullptr;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsresult rv = NS_OK;
   NS_IF_ADDREF(*aPreviousSibling = GetSiblingAtOffset(-1, &rv));
   return rv;
 }
 
   /* readonly attribute nsIAccessible firstChild; */
 NS_IMETHODIMP
 Accessible::GetFirstChild(nsIAccessible** aFirstChild)
 {
   NS_ENSURE_ARG_POINTER(aFirstChild);
-  *aFirstChild = nsnull;
+  *aFirstChild = nullptr;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   NS_IF_ADDREF(*aFirstChild = FirstChild());
   return NS_OK;
 }
 
   /* readonly attribute nsIAccessible lastChild; */
 NS_IMETHODIMP
 Accessible::GetLastChild(nsIAccessible** aLastChild)
 {
   NS_ENSURE_ARG_POINTER(aLastChild);
-  *aLastChild = nsnull;
+  *aLastChild = nullptr;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   NS_IF_ADDREF(*aLastChild = LastChild());
   return NS_OK;
 }
 
 NS_IMETHODIMP
 Accessible::GetChildAt(PRInt32 aChildIndex, nsIAccessible** aChild)
 {
   NS_ENSURE_ARG_POINTER(aChild);
-  *aChild = nsnull;
+  *aChild = nullptr;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   // If child index is negative, then return last child.
   // XXX: do we really need this?
   if (aChildIndex < 0)
     aChildIndex = ChildCount() - 1;
@@ -529,17 +529,17 @@ Accessible::GetChildAt(PRInt32 aChildInd
   return NS_OK;
 }
 
 // readonly attribute nsIArray children;
 NS_IMETHODIMP
 Accessible::GetChildren(nsIArray** aOutChildren)
 {
   NS_ENSURE_ARG_POINTER(aOutChildren);
-  *aOutChildren = nsnull;
+  *aOutChildren = nullptr;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsresult rv = NS_OK;
   nsCOMPtr<nsIMutableArray> children =
     do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
@@ -632,17 +632,17 @@ Accessible::VisibilityState()
   // in which case the rendered text is not empty and the frame should not be
   // marked invisible.
   // XXX Can we just remove this check? Why do we need to mark empty
   // text invisible?
   if (frame->GetType() == nsGkAtoms::textFrame &&
       !(frame->GetStateBits() & NS_FRAME_OUT_OF_FLOW) &&
       frame->GetRect().IsEmpty()) {
     nsAutoString renderedText;
-    frame->GetRenderedText(&renderedText, nsnull, nsnull, 0, 1);
+    frame->GetRenderedText(&renderedText, nullptr, nullptr, 0, 1);
     if (renderedText.IsEmpty())
       return vstates;
 
   }
 
   // XXX Do we really need to cross from content to chrome ancestor?
   if (!frame->IsVisibleConsideringAncestors(nsIFrame::VISIBILITY_CROSS_CHROME_CONTENT_BOUNDARY))
     return vstates;
@@ -741,74 +741,74 @@ Accessible::NativelyUnavailable() const
                                nsGkAtoms::_true, eCaseMatters);
 }
 
   /* readonly attribute boolean focusedChild; */
 NS_IMETHODIMP
 Accessible::GetFocusedChild(nsIAccessible** aChild)
 {
   NS_ENSURE_ARG_POINTER(aChild);
-  *aChild = nsnull;
+  *aChild = nullptr;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   NS_IF_ADDREF(*aChild = FocusedChild());
   return NS_OK;
 }
 
 Accessible*
 Accessible::FocusedChild()
 {
   Accessible* focus = FocusMgr()->FocusedAccessible();
   if (focus && (focus == this || focus->Parent() == this))
     return focus;
 
-  return nsnull;
+  return nullptr;
 }
 
 Accessible*
 Accessible::ChildAtPoint(PRInt32 aX, PRInt32 aY,
                          EWhichChildAtPoint aWhichChild)
 {
   // If we can't find the point in a child, we will return the fallback answer:
-  // we return |this| if the point is within it, otherwise nsnull.
+  // we return |this| if the point is within it, otherwise nullptr.
   PRInt32 x = 0, y = 0, width = 0, height = 0;
   nsresult rv = GetBounds(&x, &y, &width, &height);
-  NS_ENSURE_SUCCESS(rv, nsnull);
-
-  Accessible* fallbackAnswer = nsnull;
+  NS_ENSURE_SUCCESS(rv, nullptr);
+
+  Accessible* fallbackAnswer = nullptr;
   if (aX >= x && aX < x + width && aY >= y && aY < y + height)
     fallbackAnswer = this;
 
   if (nsAccUtils::MustPrune(this))  // Do not dig any further
     return fallbackAnswer;
 
   // Search an accessible at the given point starting from accessible document
   // because containing block (see CSS2) for out of flow element (for example,
   // absolutely positioned element) may be different from its DOM parent and
   // therefore accessible for containing block may be different from accessible
   // for DOM parent but GetFrameForPoint() should be called for containing block
   // to get an out of flow element.
   DocAccessible* accDocument = Document();
-  NS_ENSURE_TRUE(accDocument, nsnull);
+  NS_ENSURE_TRUE(accDocument, nullptr);
 
   nsIFrame *frame = accDocument->GetFrame();
-  NS_ENSURE_TRUE(frame, nsnull);
+  NS_ENSURE_TRUE(frame, nullptr);
 
   nsPresContext *presContext = frame->PresContext();
 
   nsRect screenRect = frame->GetScreenRectInAppUnits();
   nsPoint offset(presContext->DevPixelsToAppUnits(aX) - screenRect.x,
                  presContext->DevPixelsToAppUnits(aY) - screenRect.y);
 
   nsIPresShell* presShell = presContext->PresShell();
   nsIFrame *foundFrame = presShell->GetFrameForPoint(frame, offset);
 
-  nsIContent* content = nsnull;
+  nsIContent* content = nullptr;
   if (!foundFrame || !(content = foundFrame->GetContent()))
     return fallbackAnswer;
 
   // Get accessible for the node with the point or the first accessible in
   // the DOM parent chain.
   DocAccessible* contentDocAcc = GetAccService()->
     GetDocAccessible(content->OwnerDoc());
 
@@ -867,32 +867,32 @@ Accessible::ChildAtPoint(PRInt32 aX, PRI
 }
 
 // nsIAccessible getChildAtPoint(in long x, in long y)
 NS_IMETHODIMP
 Accessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY,
                             nsIAccessible** aAccessible)
 {
   NS_ENSURE_ARG_POINTER(aAccessible);
-  *aAccessible = nsnull;
+  *aAccessible = nullptr;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   NS_IF_ADDREF(*aAccessible = ChildAtPoint(aX, aY, eDirectChild));
   return NS_OK;
 }
 
 // nsIAccessible getDeepestChildAtPoint(in long x, in long y)
 NS_IMETHODIMP
 Accessible::GetDeepestChildAtPoint(PRInt32 aX, PRInt32 aY,
                                    nsIAccessible** aAccessible)
 {
   NS_ENSURE_ARG_POINTER(aAccessible);
-  *aAccessible = nsnull;
+  *aAccessible = nullptr;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   NS_IF_ADDREF(*aAccessible = ChildAtPoint(aX, aY, eDeepestChild));
   return NS_OK;
 }
 
@@ -929,17 +929,17 @@ Accessible::GetBounds(PRInt32* aX, PRInt
 
   // This routine will get the entire rectangle for all the frames in this node.
   // -------------------------------------------------------------------------
   //      Primary Frame for node
   //  Another frame, same node                <- Example
   //  Another frame, same node
 
   nsRect unionRectTwips;
-  nsIFrame* boundingFrame = nsnull;
+  nsIFrame* boundingFrame = nullptr;
   GetBoundsRect(unionRectTwips, &boundingFrame);   // Unions up all primary frames for this node and all siblings after it
   NS_ENSURE_STATE(boundingFrame);
 
   nsPresContext* presContext = presShell->GetPresContext();
   *aX = presContext->AppUnitsToDevPixels(unionRectTwips.x);
   *aY = presContext->AppUnitsToDevPixels(unionRectTwips.y);
   *aWidth = presContext->AppUnitsToDevPixels(unionRectTwips.width);
   *aHeight = presContext->AppUnitsToDevPixels(unionRectTwips.height);
@@ -1030,17 +1030,17 @@ Accessible::TakeFocus()
   return NS_OK;
 }
 
 nsresult
 Accessible::GetHTMLName(nsAString& aLabel)
 {
   nsAutoString label;
 
-  Accessible* labelAcc = nsnull;
+  Accessible* labelAcc = nullptr;
   HTMLLabelIterator iter(Document(), this);
   while ((labelAcc = iter.Next())) {
     nsresult rv = nsTextEquivUtils::
       AppendTextEquivFromContent(this, labelAcc->GetContent(), &label);
     NS_ENSURE_SUCCESS(rv, rv);
 
     label.CompressWhitespace();
   }
@@ -1092,17 +1092,17 @@ Accessible::GetXULName(nsAString& aLabel
       }
     }
   }
 
   // CASES #2 and #3 ------ label as a child or <label control="id" ... > </label>
   if (NS_FAILED(rv) || label.IsEmpty()) {
     label.Truncate();
 
-    Accessible* labelAcc = nsnull;
+    Accessible* labelAcc = nullptr;
     XULLabelIterator iter(Document(), mContent);
     while ((labelAcc = iter.Next())) {
       nsCOMPtr<nsIDOMXULLabelElement> xulLabel =
         do_QueryInterface(labelAcc->GetContent());
       // Check if label's value attribute is used
       if (xulLabel && NS_SUCCEEDED(xulLabel->GetValue(label)) && label.IsEmpty()) {
         // If no value attribute, a non-empty label must contain
         // children that define its text -- possibly using HTML
@@ -1150,17 +1150,17 @@ Accessible::HandleAccEvent(AccEvent* aEv
                                  getter_AddRefs(observers));
 
   NS_ENSURE_STATE(observers);
 
   bool hasObservers = false;
   observers->HasMoreElements(&hasObservers);
   if (hasObservers) {
     nsRefPtr<nsAccEvent> evnt(aEvent->CreateXPCOMObject());
-    return obsService->NotifyObservers(evnt, NS_ACCESSIBLE_EVENT_TOPIC, nsnull);
+    return obsService->NotifyObservers(evnt, NS_ACCESSIBLE_EVENT_TOPIC, nullptr);
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 Accessible::GetRole(PRUint32 *aRole)
 {
@@ -1467,17 +1467,17 @@ Accessible::State()
     // Special case for tabs: focused tab or focus inside related tab panel
     // implies selected state.
     if (mRoleMapEntry->role == roles::PAGETAB) {
       if (state & states::FOCUSED) {
         state |= states::SELECTED;
       } else {
         // If focus is in a child of the tab panel surely the tab is selected!
         Relation rel = RelationByType(nsIAccessibleRelation::RELATION_LABEL_FOR);
-        Accessible* relTarget = nsnull;
+        Accessible* relTarget = nullptr;
         while ((relTarget = rel.Next())) {
           if (relTarget->Role() == roles::PROPERTYPAGE &&
               FocusMgr()->IsFocusWithin(relTarget))
             state |= states::SELECTED;
         }
       }
     } else if (state & states::FOCUSED) {
       Accessible* container = nsAccUtils::GetSelectableContainer(this, state);
@@ -1546,30 +1546,30 @@ Accessible::ApplyARIAState(PRUint64* aSt
     // role. This preserves the ability for screen readers to use readonly
     // (primarily on the document) as the hint for creating a virtual buffer.
     if (mRoleMapEntry->role != roles::NOTHING)
       *aState &= ~states::READONLY;
 
     if (mContent->HasAttr(kNameSpaceID_None, mContent->GetIDAttributeName())) {
       // If has a role & ID and aria-activedescendant on the container, assume focusable
       nsIContent *ancestorContent = mContent;
-      while ((ancestorContent = ancestorContent->GetParent()) != nsnull) {
+      while ((ancestorContent = ancestorContent->GetParent()) != nullptr) {
         if (ancestorContent->HasAttr(kNameSpaceID_None, nsGkAtoms::aria_activedescendant)) {
             // ancestor has activedescendant property, this content could be active
           *aState |= states::FOCUSABLE;
           break;
         }
       }
     }
   }
 
   if (*aState & states::FOCUSABLE) {
     // Special case: aria-disabled propagates from ancestors down to any focusable descendant
     nsIContent *ancestorContent = mContent;
-    while ((ancestorContent = ancestorContent->GetParent()) != nsnull) {
+    while ((ancestorContent = ancestorContent->GetParent()) != nullptr) {
       if (ancestorContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::aria_disabled,
                                        nsGkAtoms::_true, eCaseMatters)) {
           // ancestor has aria-disabled property, this is disabled
         *aState |= states::UNAVAILABLE;
         break;
       }
     }    
   }
@@ -1718,17 +1718,17 @@ Accessible::ARIATransformRole(role aRole
 
   } else if (aRole == roles::LISTBOX) {
     // A listbox inside of a combobox needs a special role because of ATK
     // mapping to menu.
     if (mParent && mParent->Role() == roles::COMBOBOX) {
       return roles::COMBOBOX_LIST;
 
       Relation rel = RelationByType(nsIAccessibleRelation::RELATION_NODE_CHILD_OF);
-      Accessible* targetAcc = nsnull;
+      Accessible* targetAcc = nullptr;
       while ((targetAcc = rel.Next()))
         if (targetAcc->Role() == roles::COMBOBOX)
           return roles::COMBOBOX_LIST;
     }
 
   } else if (aRole == roles::OPTION) {
     if (mParent && mParent->Role() == roles::COMBOBOX_LIST)
       return roles::COMBOBOX_OPTION;
@@ -1875,26 +1875,26 @@ NS_IMETHODIMP Accessible::GetHelp(nsAStr
 nsIContent*
 Accessible::GetAtomicRegion() const
 {
   nsIContent *loopContent = mContent;
   nsAutoString atomic;
   while (loopContent && !loopContent->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_atomic, atomic))
     loopContent = loopContent->GetParent();
 
-  return atomic.EqualsLiteral("true") ? loopContent : nsnull;
+  return atomic.EqualsLiteral("true") ? loopContent : nullptr;
 }
 
 // nsIAccessible getRelationByType()
 NS_IMETHODIMP
 Accessible::GetRelationByType(PRUint32 aType,
                                 nsIAccessibleRelation** aRelation)
 {
   NS_ENSURE_ARG_POINTER(aRelation);
-  *aRelation = nsnull;
+  *aRelation = nullptr;
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   Relation rel = RelationByType(aType);
   NS_ADDREF(*aRelation = new nsAccessibleRelation(aType, &rel));
   return *aRelation ? NS_OK : NS_ERROR_FAILURE;
 }
 
@@ -2053,17 +2053,17 @@ Accessible::RelationByType(PRUint32 aTyp
     return Relation();
   }
 }
 
 NS_IMETHODIMP
 Accessible::GetRelations(nsIArray **aRelations)
 {
   NS_ENSURE_ARG_POINTER(aRelations);
-  *aRelations = nsnull;
+  *aRelations = nullptr;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsCOMPtr<nsIMutableArray> relations = do_CreateInstance(NS_ARRAY_CONTRACTID);
   NS_ENSURE_TRUE(relations, NS_ERROR_OUT_OF_MEMORY);
 
   for (PRUint32 relType = nsIAccessibleRelation::RELATION_FIRST;
@@ -2158,17 +2158,17 @@ Accessible::ScrollToPoint(PRUint32 aCoor
   return NS_OK;
 }
 
 // nsIAccessibleSelectable
 NS_IMETHODIMP
 Accessible::GetSelectedChildren(nsIArray** aSelectedAccessibles)
 {
   NS_ENSURE_ARG_POINTER(aSelectedAccessibles);
-  *aSelectedAccessibles = nsnull;
+  *aSelectedAccessibles = nullptr;
 
   if (IsDefunct() || !IsSelect())
     return NS_ERROR_FAILURE;
 
   nsCOMPtr<nsIArray> items = SelectedItems();
   if (items) {
     PRUint32 length = 0;
     items->GetLength(&length);
@@ -2179,17 +2179,17 @@ Accessible::GetSelectedChildren(nsIArray
   return NS_OK;
 }
 
 // return the nth selected descendant nsIAccessible object
 NS_IMETHODIMP
 Accessible::RefSelection(PRInt32 aIndex, nsIAccessible** aSelected)
 {
   NS_ENSURE_ARG_POINTER(aSelected);
-  *aSelected = nsnull;
+  *aSelected = nullptr;
 
   if (IsDefunct() || !IsSelect())
     return NS_ERROR_FAILURE;
 
   if (aIndex < 0) {
     return NS_ERROR_INVALID_ARG;
   }
 
@@ -2332,17 +2332,17 @@ Accessible::GetURI(PRInt32 aIndex, nsIUR
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
 Accessible::GetAnchor(PRInt32 aIndex, nsIAccessible** aAccessible)
 {
   NS_ENSURE_ARG_POINTER(aAccessible);
-  *aAccessible = nsnull;
+  *aAccessible = nullptr;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   if (aIndex < 0 || aIndex >= static_cast<PRInt32>(AnchorCount()))
     return NS_ERROR_INVALID_ARG;
 
   NS_IF_ADDREF(*aAccessible = AnchorAt(aIndex));
@@ -2479,32 +2479,32 @@ Accessible::BindToParent(Accessible* aPa
 
   mParent = aParent;
   mIndexInParent = aIndexInParent;
 }
 
 void
 Accessible::UnbindFromParent()
 {
-  mParent = nsnull;
+  mParent = nullptr;
   mIndexInParent = -1;
   mIndexOfEmbeddedChild = -1;
-  mGroupInfo = nsnull;
+  mGroupInfo = nullptr;
 }
 
 void
 Accessible::InvalidateChildren()
 {
   PRInt32 childCount = mChildren.Length();
   for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
     Accessible* child = mChildren.ElementAt(childIdx);
     child->UnbindFromParent();
   }
 
-  mEmbeddedObjCollector = nsnull;
+  mEmbeddedObjCollector = nullptr;
   mChildren.Clear();
   SetChildrenFlag(eChildrenUninitialized);
 }
 
 bool
 Accessible::AppendChild(Accessible* aChild)
 {
   if (!aChild)
@@ -2532,17 +2532,17 @@ Accessible::InsertChildAt(PRUint32 aInde
   for (PRUint32 idx = aIndex + 1; idx < mChildren.Length(); idx++) {
     NS_ASSERTION(mChildren[idx]->mIndexInParent == idx - 1, "Accessible child index doesn't match");
     mChildren[idx]->mIndexInParent = idx;
   }
 
   if (nsAccUtils::IsText(aChild))
     SetChildrenFlag(eMixedChildren);
 
-  mEmbeddedObjCollector = nsnull;
+  mEmbeddedObjCollector = nullptr;
 
   aChild->BindToParent(this, aIndex);
   return true;
 }
 
 bool
 Accessible::RemoveChild(Accessible* aChild)
 {
@@ -2561,27 +2561,27 @@ Accessible::RemoveChild(Accessible* aChi
 
   for (PRUint32 idx = index + 1; idx < mChildren.Length(); idx++) {
     NS_ASSERTION(mChildren[idx]->mIndexInParent == idx, "Accessible child index doesn't match");
     mChildren[idx]->mIndexInParent = idx - 1;
   }
 
   aChild->UnbindFromParent();
   mChildren.RemoveElementAt(index);
-  mEmbeddedObjCollector = nsnull;
+  mEmbeddedObjCollector = nullptr;
 
   return true;
 }
 
 Accessible*
 Accessible::GetChildAt(PRUint32 aIndex)
 {
-  Accessible* child = mChildren.SafeElementAt(aIndex, nsnull);
+  Accessible* child = mChildren.SafeElementAt(aIndex, nullptr);
   if (!child)
-    return nsnull;
+    return nullptr;
 
 #ifdef DEBUG
   Accessible* realParent = child->mParent;
   NS_ASSERTION(!realParent || realParent == this,
                "Two accessibles have the same first child accessible!");
 #endif
 
   return child;
@@ -2619,17 +2619,17 @@ Accessible::EmbeddedChildCount()
 
 Accessible*
 Accessible::GetEmbeddedChildAt(PRUint32 aIndex)
 {
   if (IsChildrenFlag(eMixedChildren)) {
     if (!mEmbeddedObjCollector)
       mEmbeddedObjCollector = new EmbeddedObjCollector(this);
     return mEmbeddedObjCollector ?
-      mEmbeddedObjCollector->GetAccessibleAt(aIndex) : nsnull;
+      mEmbeddedObjCollector->GetAccessibleAt(aIndex) : nullptr;
   }
 
   return GetChildAt(aIndex);
 }
 
 PRInt32
 Accessible::GetIndexOfEmbeddedChild(Accessible* aChild)
 {
@@ -2654,26 +2654,26 @@ Accessible::IsLink()
   return mParent && mParent->IsHyperText() && nsAccUtils::IsEmbeddedObject(this);
 }
 
 PRUint32
 Accessible::StartOffset()
 {
   NS_PRECONDITION(IsLink(), "StartOffset is called not on hyper link!");
 
-  HyperTextAccessible* hyperText = mParent ? mParent->AsHyperText() : nsnull;
+  HyperTextAccessible* hyperText = mParent ? mParent->AsHyperText() : nullptr;
   return hyperText ? hyperText->GetChildOffset(this) : 0;
 }
 
 PRUint32
 Accessible::EndOffset()
 {
   NS_PRECONDITION(IsLink(), "EndOffset is called on not hyper link!");
 
-  HyperTextAccessible* hyperText = mParent ? mParent->AsHyperText() : nsnull;
+  HyperTextAccessible* hyperText = mParent ? mParent->AsHyperText() : nullptr;
   return hyperText ? (hyperText->GetChildOffset(this) + 1) : 0;
 }
 
 bool
 Accessible::IsLinkSelected()
 {
   NS_PRECONDITION(IsLink(),
                   "IsLinkSelected() called on something that is not a hyper link!");
@@ -2686,42 +2686,42 @@ Accessible::AnchorCount()
   NS_PRECONDITION(IsLink(), "AnchorCount is called on not hyper link!");
   return 1;
 }
 
 Accessible*
 Accessible::AnchorAt(PRUint32 aAnchorIndex)
 {
   NS_PRECONDITION(IsLink(), "GetAnchor is called on not hyper link!");
-  return aAnchorIndex == 0 ? this : nsnull;
+  return aAnchorIndex == 0 ? this : nullptr;
 }
 
 already_AddRefed<nsIURI>
 Accessible::AnchorURIAt(PRUint32 aAnchorIndex)
 {
   NS_PRECONDITION(IsLink(), "AnchorURIAt is called on not hyper link!");
 
   if (aAnchorIndex != 0)
-    return nsnull;
+    return nullptr;
 
   // Check if it's a simple xlink.
   if (nsCoreUtils::IsXLink(mContent)) {
     nsAutoString href;
     mContent->GetAttr(kNameSpaceID_XLink, nsGkAtoms::href, href);
 
     nsCOMPtr<nsIURI> baseURI = mContent->GetBaseURI();
     nsCOMPtr<nsIDocument> document = mContent->OwnerDoc();
-    nsIURI* anchorURI = nsnull;
+    nsIURI* anchorURI = nullptr;
     NS_NewURI(&anchorURI, href,
-              document ? document->GetDocumentCharacterSet().get() : nsnull,
+              document ? document->GetDocumentCharacterSet().get() : nullptr,
               baseURI);
     return anchorURI;
   }
 
-  return nsnull;
+  return nullptr;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // SelectAccessible
 
 bool
 Accessible::IsSelect()
@@ -2737,115 +2737,115 @@ Accessible::IsSelect()
      mRoleMapEntry->attributeMap3 == aria::eARIAMultiSelectable);
 }
 
 already_AddRefed<nsIArray>
 Accessible::SelectedItems()
 {
   nsCOMPtr<nsIMutableArray> selectedItems = do_CreateInstance(NS_ARRAY_CONTRACTID);
   if (!selectedItems)
-    return nsnull;
+    return nullptr;
 
   AccIterator iter(this, filters::GetSelected, AccIterator::eTreeNav);
-  nsIAccessible* selected = nsnull;
+  nsIAccessible* selected = nullptr;
   while ((selected = iter.Next()))
     selectedItems->AppendElement(selected, false);
 
-  nsIMutableArray* items = nsnull;
+  nsIMutableArray* items = nullptr;
   selectedItems.forget(&items);
   return items;
 }
 
 PRUint32
 Accessible::SelectedItemCount()
 {
   PRUint32 count = 0;
   AccIterator iter(this, filters::GetSelected, AccIterator::eTreeNav);
-  Accessible* selected = nsnull;
+  Accessible* selected = nullptr;
   while ((selected = iter.Next()))
     ++count;
 
   return count;
 }
 
 Accessible*
 Accessible::GetSelectedItem(PRUint32 aIndex)
 {
   AccIterator iter(this, filters::GetSelected, AccIterator::eTreeNav);
-  Accessible* selected = nsnull;
+  Accessible* selected = nullptr;
 
   PRUint32 index = 0;
   while ((selected = iter.Next()) && index < aIndex)
     index++;
 
   return selected;
 }
 
 bool
 Accessible::IsItemSelected(PRUint32 aIndex)
 {
   PRUint32 index = 0;
   AccIterator iter(this, filters::GetSelectable, AccIterator::eTreeNav);
-  Accessible* selected = nsnull;
+  Accessible* selected = nullptr;
   while ((selected = iter.Next()) && index < aIndex)
     index++;
 
   return selected &&
     selected->State() & states::SELECTED;
 }
 
 bool
 Accessible::AddItemToSelection(PRUint32 aIndex)
 {
   PRUint32 index = 0;
   AccIterator iter(this, filters::GetSelectable, AccIterator::eTreeNav);
-  Accessible* selected = nsnull;
+  Accessible* selected = nullptr;
   while ((selected = iter.Next()) && index < aIndex)
     index++;
 
   if (selected)
     selected->SetSelected(true);
 
   return static_cast<bool>(selected);
 }
 
 bool
 Accessible::RemoveItemFromSelection(PRUint32 aIndex)
 {
   PRUint32 index = 0;
   AccIterator iter(this, filters::GetSelectable, AccIterator::eTreeNav);
-  Accessible* selected = nsnull;
+  Accessible* selected = nullptr;
   while ((selected = iter.Next()) && index < aIndex)
     index++;
 
   if (selected)
     selected->SetSelected(false);
 
   return static_cast<bool>(selected);
 }
 
 bool
 Accessible::SelectAll()
 {
   bool success = false;
-  Accessible* selectable = nsnull;
+  Accessible* selectable = nullptr;
 
   AccIterator iter(this, filters::GetSelectable, AccIterator::eTreeNav);
   while((selectable = iter.Next())) {
     success = true;
     selectable->SetSelected(true);
   }
   return success;
 }
 
 bool
 Accessible::UnselectAll()
 {
   bool success = false;
-  Accessible* selected = nsnull;
+  Accessible* selected = nullptr;
 
   AccIterator iter(this, filters::GetSelected, AccIterator::eTreeNav);
   while ((selected = iter.Next())) {
     success = true;
     selected->SetSelected(false);
   }
   return success;
 }
@@ -2884,17 +2884,17 @@ Accessible::CurrentItem()
     nsIDocument* DOMDoc = mContent->OwnerDoc();
     dom::Element* activeDescendantElm = DOMDoc->GetElementById(id);
     if (activeDescendantElm) {
       DocAccessible* document = Document();
       if (document)
         return document->GetAccessible(activeDescendantElm);
     }
   }
-  return nsnull;
+  return nullptr;
 }
 
 void
 Accessible::SetCurrentItem(Accessible* aItem)
 {
   nsIAtom* id = aItem->GetContent()->GetID();
   if (id) {
     nsAutoString idStr;
@@ -2916,46 +2916,46 @@ Accessible::ContainerWidget() const
         return parent;
       }
 
       // Don't cross DOM document boundaries.
       if (parent->IsDocumentNode())
         break;
     }
   }
-  return nsnull;
+  return nullptr;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // Accessible protected methods
 
 void
 Accessible::CacheChildren()
 {
   DocAccessible* doc = Document();
   NS_ENSURE_TRUE(doc,);
 
   nsAccTreeWalker walker(doc, mContent, CanHaveAnonChildren());
 
-  Accessible* child = nsnull;
+  Accessible* child = nullptr;
   while ((child = walker.NextChild()) && AppendChild(child));
 }
 
 void
 Accessible::TestChildCache(Accessible* aCachedChild) const
 {
 #ifdef DEBUG
   PRInt32 childCount = mChildren.Length();
   if (childCount == 0) {
     NS_ASSERTION(IsChildrenFlag(eChildrenUninitialized),
                  "No children but initialized!");
     return;
   }
 
-  Accessible* child = nsnull;
+  Accessible* child = nullptr;
   for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
     child = mChildren[childIdx];
     if (child == aCachedChild)
       break;
   }
 
   NS_ASSERTION(child == aCachedChild,
                "[TestChildCache] cached accessible wasn't found. Wrong accessible tree!");  
@@ -2983,23 +2983,23 @@ Accessible::EnsureChildren()
 
 Accessible*
 Accessible::GetSiblingAtOffset(PRInt32 aOffset, nsresult* aError) const
 {
   if (!mParent || mIndexInParent == -1) {
     if (aError)
       *aError = NS_ERROR_UNEXPECTED;
 
-    return nsnull;
+    return nullptr;
   }
 
   if (aError &&
       mIndexInParent + aOffset >= static_cast<PRInt32>(mParent->ChildCount())) {
     *aError = NS_OK; // fail peacefully
-    return nsnull;
+    return nullptr;
   }
 
   Accessible* child = mParent->GetChildAt(mIndexInParent + aOffset);
   if (aError && !child)
     *aError = NS_ERROR_UNEXPECTED;
 
   return child;
 }
@@ -3007,39 +3007,39 @@ Accessible::GetSiblingAtOffset(PRInt32 a
 Accessible* 
 Accessible::GetFirstAvailableAccessible(nsINode *aStartNode) const
 {
   Accessible* accessible = mDoc->GetAccessible(aStartNode);
   if (accessible)
     return accessible;
 
   nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(aStartNode->OwnerDoc());
-  NS_ENSURE_TRUE(domDoc, nsnull);
+  NS_ENSURE_TRUE(domDoc, nullptr);
 
   nsCOMPtr<nsIDOMNode> currentNode = do_QueryInterface(aStartNode);
   nsCOMPtr<nsIDOMNode> rootNode = do_QueryInterface(GetNode());
   nsCOMPtr<nsIDOMTreeWalker> walker;
   domDoc->CreateTreeWalker(rootNode,
                            nsIDOMNodeFilter::SHOW_ELEMENT | nsIDOMNodeFilter::SHOW_TEXT,
-                           nsnull, false, getter_AddRefs(walker));
-  NS_ENSURE_TRUE(walker, nsnull);
+                           nullptr, false, getter_AddRefs(walker));
+  NS_ENSURE_TRUE(walker, nullptr);
 
   walker->SetCurrentNode(currentNode);
   while (true) {
     walker->NextNode(getter_AddRefs(currentNode));
     if (!currentNode)
-      return nsnull;
+      return nullptr;
 
     nsCOMPtr<nsINode> node(do_QueryInterface(currentNode));
     Accessible* accessible = mDoc->GetAccessible(node);
     if (accessible)
       return accessible;
   }
 
-  return nsnull;
+  return nullptr;
 }
 
 nsresult
 Accessible::GetAttrValue(nsIAtom *aProperty, double *aValue)
 {
   NS_ENSURE_ARG_POINTER(aValue);
   *aValue = 0;
 
--- a/accessible/src/generic/Accessible.h
+++ b/accessible/src/generic/Accessible.h
@@ -146,17 +146,17 @@ public:
    */
   virtual mozilla::a11y::ENameValueFlag Name(nsString& aName);
 
   /**
    * Return DOM node associated with this accessible.
    */
   inline already_AddRefed<nsIDOMNode> DOMNode() const
   {
-    nsIDOMNode *DOMNode = nsnull;
+    nsIDOMNode *DOMNode = nullptr;
     if (GetNode())
       CallQueryInterface(GetNode(), &DOMNode);
     return DOMNode;
   }
 
   /**
    * Returns the accessible name specified by ARIA.
    */
@@ -316,17 +316,17 @@ public:
   //////////////////////////////////////////////////////////////////////////////
   // Initializing methods
 
   /**
    * Set the ARIA role map entry for a new accessible.
    * For a newly created accessible, specify which role map entry should be used.
    *
    * @param aRoleMapEntry The ARIA nsRoleMapEntry* for the accessible, or
-   *                      nsnull if none.
+   *                      nullptr if none.
    */
   virtual void SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry);
 
   /**
    * Update the children cache.
    */
   inline bool UpdateChildren()
   {
@@ -394,17 +394,17 @@ public:
     {  return GetSiblingAtOffset(1); }
   inline Accessible* PrevSibling() const
     { return GetSiblingAtOffset(-1); }
   inline Accessible* FirstChild()
     { return GetChildAt(0); }
   inline Accessible* LastChild()
   {
     PRUint32 childCount = ChildCount();
-    return childCount != 0 ? GetChildAt(childCount - 1) : nsnull;
+    return childCount != 0 ? GetChildAt(childCount - 1) : nullptr;
   }
 
 
   /**
    * Return embedded accessible children count.
    */
   PRUint32 EmbeddedChildCount();
 
@@ -519,17 +519,17 @@ public:
 
   inline bool IsMenuButton() const { return mFlags & eMenuButtonAccessible; }
 
   inline bool IsMenuPopup() const { return mFlags & eMenuPopupAccessible; }
 
   inline bool IsRoot() const { return mFlags & eRootAccessible; }
   mozilla::a11y::RootAccessible* AsRoot();
 
-  virtual mozilla::a11y::TableAccessible* AsTable() { return nsnull; }
+  virtual mozilla::a11y::TableAccessible* AsTable() { return nullptr; }
 
   inline bool IsTextLeaf() const { return mFlags & eTextLeafAccessible; }
   mozilla::a11y::TextLeafAccessible* AsTextLeaf();
 
   //////////////////////////////////////////////////////////////////////////////
   // ActionAccessible
 
   /**
@@ -716,17 +716,17 @@ protected:
    */
   virtual void BindToParent(Accessible* aParent, PRUint32 aIndexInParent);
   virtual void UnbindFromParent();
 
   /**
    * Return sibling accessible at the given offset.
    */
   virtual Accessible* GetSiblingAtOffset(PRInt32 aOffset,
-                                         nsresult *aError = nsnull) const;
+                                         nsresult *aError = nullptr) const;
 
   /**
    * Flags used to describe the state and type of children.
    */
   enum ChildrenFlags {
     eChildrenUninitialized = 0, // children aren't initialized
     eMixedChildren = 1 << 0, // text leaf children are presented
     eEmbeddedChildren = 1 << 1 // all children are embedded objects
@@ -821,17 +821,17 @@ protected:
    *  command opens a modal dialog/window, it won't return until the
    *  dialog/window is closed. If executing action command directly in
    *  nsIAccessible::DoAction() method, it will block AT tools (e.g. GOK) that
    *  invoke action of mozilla accessibles direclty (see bug 277888 for details).
    *
    * @param  aContent      [in, optional] element to click
    * @param  aActionIndex  [in, optional] index of accessible action
    */
-  void DoCommand(nsIContent *aContent = nsnull, PRUint32 aActionIndex = 0);
+  void DoCommand(nsIContent *aContent = nullptr, PRUint32 aActionIndex = 0);
 
   /**
    * Dispatch click event.
    */
   virtual void DispatchClickEvent(nsIContent *aContent, PRUint32 aActionIndex);
 
   NS_DECL_RUNNABLEMETHOD_ARG2(Accessible, DispatchClickEvent,
                               nsCOMPtr<nsIContent>, PRUint32)
--- a/accessible/src/generic/ApplicationAccessible.cpp
+++ b/accessible/src/generic/ApplicationAccessible.cpp
@@ -18,17 +18,17 @@
 #include "nsIDOMWindow.h"
 #include "nsIWindowMediator.h"
 #include "nsServiceManagerUtils.h"
 #include "mozilla/Services.h"
 
 using namespace mozilla::a11y;
 
 ApplicationAccessible::ApplicationAccessible() :
-  AccessibleWrap(nsnull, nsnull)
+  AccessibleWrap(nullptr, nullptr)
 {
   mFlags |= eApplicationAccessible;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsISupports
 
 NS_IMPL_ISUPPORTS_INHERITED1(ApplicationAccessible, Accessible,
@@ -36,33 +36,33 @@ NS_IMPL_ISUPPORTS_INHERITED1(Application
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsIAccessible
 
 NS_IMETHODIMP
 ApplicationAccessible::GetParent(nsIAccessible** aAccessible)
 {
   NS_ENSURE_ARG_POINTER(aAccessible);
-  *aAccessible = nsnull;
+  *aAccessible = nullptr;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 ApplicationAccessible::GetNextSibling(nsIAccessible** aNextSibling)
 {
   NS_ENSURE_ARG_POINTER(aNextSibling);
-  *aNextSibling = nsnull;
+  *aNextSibling = nullptr;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 ApplicationAccessible::GetPreviousSibling(nsIAccessible** aPreviousSibling)
 {
   NS_ENSURE_ARG_POINTER(aPreviousSibling);
-  *aPreviousSibling = nsnull;
+  *aPreviousSibling = nullptr;
   return NS_OK;
 }
 
 ENameValueFlag
 ApplicationAccessible::Name(nsString& aName)
 {
   aName.Truncate();
 
@@ -108,41 +108,41 @@ ApplicationAccessible::State()
 {
   return IsDefunct() ? states::DEFUNCT : 0;
 }
 
 NS_IMETHODIMP
 ApplicationAccessible::GetAttributes(nsIPersistentProperties** aAttributes)
 {
   NS_ENSURE_ARG_POINTER(aAttributes);
-  *aAttributes = nsnull;
+  *aAttributes = nullptr;
   return NS_OK;
 }
 
 GroupPos
 ApplicationAccessible::GroupPosition()
 {
   return GroupPos();
 }
 
 Accessible*
 ApplicationAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY,
                                     EWhichChildAtPoint aWhichChild)
 {
-  return nsnull;
+  return nullptr;
 }
 
 Accessible*
 ApplicationAccessible::FocusedChild()
 {
   Accessible* focus = FocusMgr()->FocusedAccessible();
   if (focus && focus->Parent() == this)
     return focus;
 
-  return nsnull;
+  return nullptr;
 }
 
 Relation
 ApplicationAccessible::RelationByType(PRUint32 aRelationType)
 {
   return Relation();
 }
 
@@ -272,17 +272,17 @@ ApplicationAccessible::Init()
 {
   mAppInfo = do_GetService("@mozilla.org/xre/app-info;1");
   return true;
 }
 
 void
 ApplicationAccessible::Shutdown()
 {
-  mAppInfo = nsnull;
+  mAppInfo = nullptr;
 }
 
 bool
 ApplicationAccessible::IsPrimaryForNode() const
 {
   return false;
 }
 
@@ -334,17 +334,17 @@ ApplicationAccessible::CacheChildren()
   // then we need to make sure root accessibles for open windows are created so
   // that all root accessibles are stored in application accessible children
   // array.
 
   nsCOMPtr<nsIWindowMediator> windowMediator =
     do_GetService(NS_WINDOWMEDIATOR_CONTRACTID);
 
   nsCOMPtr<nsISimpleEnumerator> windowEnumerator;
-  nsresult rv = windowMediator->GetEnumerator(nsnull,
+  nsresult rv = windowMediator->GetEnumerator(nullptr,
                                               getter_AddRefs(windowEnumerator));
   if (NS_FAILED(rv))
     return;
 
   bool hasMore = false;
   windowEnumerator->HasMoreElements(&hasMore);
   while (hasMore) {
     nsCOMPtr<nsISupports> window;
@@ -364,43 +364,43 @@ ApplicationAccessible::CacheChildren()
 
 Accessible*
 ApplicationAccessible::GetSiblingAtOffset(PRInt32 aOffset,
                                           nsresult* aError) const
 {
   if (aError)
     *aError = NS_OK; // fail peacefully
 
-  return nsnull;
+  return nullptr;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsIAccessible
 
 NS_IMETHODIMP
 ApplicationAccessible::GetDOMNode(nsIDOMNode** aDOMNode)
 {
   NS_ENSURE_ARG_POINTER(aDOMNode);
-  *aDOMNode = nsnull;
+  *aDOMNode = nullptr;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 ApplicationAccessible::GetDocument(nsIAccessibleDocument** aDocument)
 {
   NS_ENSURE_ARG_POINTER(aDocument);
-  *aDocument = nsnull;
+  *aDocument = nullptr;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 ApplicationAccessible::GetRootDocument(nsIAccessibleDocument** aRootDocument)
 {
   NS_ENSURE_ARG_POINTER(aRootDocument);
-  *aRootDocument = nsnull;
+  *aRootDocument = nullptr;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 ApplicationAccessible::ScrollTo(PRUint32 aScrollType)
 {
   return NS_OK;
 }
--- a/accessible/src/generic/ApplicationAccessible.h
+++ b/accessible/src/generic/ApplicationAccessible.h
@@ -86,17 +86,17 @@ public:
   virtual PRUint8 ActionCount();
   virtual KeyBinding AccessKey() const;
 
 protected:
 
   // Accessible
   virtual void CacheChildren();
   virtual Accessible* GetSiblingAtOffset(PRInt32 aOffset,
-                                         nsresult *aError = nsnull) const;
+                                         nsresult *aError = nullptr) const;
 
 private:
   nsCOMPtr<nsIXULAppInfo> mAppInfo;
 };
 
 } // namespace a11y
 } // namespace mozilla
 
--- a/accessible/src/generic/BaseAccessibles.cpp
+++ b/accessible/src/generic/BaseAccessibles.cpp
@@ -56,17 +56,17 @@ LeafAccessible::CacheChildren()
 
 ////////////////////////////////////////////////////////////////////////////////
 // LinkableAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 LinkableAccessible::
   LinkableAccessible(nsIContent* aContent, DocAccessible* aDoc) :
   AccessibleWrap(aContent, aDoc),
-  mActionAcc(nsnull),
+  mActionAcc(nullptr),
   mIsLink(false),
   mIsOnclick(false)
 {
 }
 
 NS_IMPL_ISUPPORTS_INHERITED0(LinkableAccessible, AccessibleWrap)
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -147,17 +147,17 @@ LinkableAccessible::AccessKey() const
 ////////////////////////////////////////////////////////////////////////////////
 // LinkableAccessible. nsAccessNode
 
 void
 LinkableAccessible::Shutdown()
 {
   mIsLink = false;
   mIsOnclick = false;
-  mActionAcc = nsnull;
+  mActionAcc = nullptr;
   AccessibleWrap::Shutdown();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // LinkableAccessible: HyperLinkAccessible
 
 already_AddRefed<nsIURI>
 LinkableAccessible::AnchorURIAt(PRUint32 aAnchorIndex)
@@ -165,30 +165,30 @@ LinkableAccessible::AnchorURIAt(PRUint32
   if (mIsLink) {
     NS_ASSERTION(mActionAcc->IsLink(),
                  "nsIAccessibleHyperLink isn't implemented.");
 
     if (mActionAcc->IsLink())
       return mActionAcc->AnchorURIAt(aAnchorIndex);
   }
 
-  return nsnull;
+  return nullptr;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // LinkableAccessible: Accessible protected
 
 void
 LinkableAccessible::BindToParent(Accessible* aParent,
                                  PRUint32 aIndexInParent)
 {
   AccessibleWrap::BindToParent(aParent, aIndexInParent);
 
   // Cache action content.
-  mActionAcc = nsnull;
+  mActionAcc = nullptr;
   mIsLink = false;
   mIsOnclick = false;
 
   if (nsCoreUtils::HasClickListener(mContent)) {
     mIsOnclick = true;
     return;
   }
 
@@ -209,17 +209,17 @@ LinkableAccessible::BindToParent(Accessi
       return;
     }
   }
 }
 
 void
 LinkableAccessible::UnbindFromParent()
 {
-  mActionAcc = nsnull;
+  mActionAcc = nullptr;
   mIsLink = false;
   mIsOnclick = false;
 
   AccessibleWrap::UnbindFromParent();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // EnumRoleAccessible
--- a/accessible/src/generic/DocAccessible.cpp
+++ b/accessible/src/generic/DocAccessible.cpp
@@ -76,17 +76,17 @@ static const PRUint32 kRelationAttrsLen 
 // Constructor/desctructor
 
 DocAccessible::
   DocAccessible(nsIDocument* aDocument, nsIContent* aRootContent,
                   nsIPresShell* aPresShell) :
   HyperTextAccessibleWrap(aRootContent, this),
   mDocument(aDocument), mScrollPositionChangedTicks(0),
   mLoadState(eTreeConstructionPending), mLoadEventType(0),
-  mVirtualCursor(nsnull),
+  mVirtualCursor(nullptr),
   mPresShell(aPresShell)
 {
   mFlags |= eDocAccessible;
   mPresShell->SetAccDocument(this);
 
   mDependentIDsHash.Init();
   // XXX aaronl should we use an algorithm for the initial cache size?
   mAccessibleCache.Init(kDefaultCacheSize);
@@ -363,17 +363,17 @@ DocAccessible::TakeFocus()
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   // Focus the document.
   nsFocusManager* fm = nsFocusManager::GetFocusManager();
   NS_ENSURE_STATE(fm);
 
   nsCOMPtr<nsIDOMElement> newFocus;
-  return fm->MoveFocus(mDocument->GetWindow(), nsnull,
+  return fm->MoveFocus(mDocument->GetWindow(), nullptr,
                        nsIFocusManager::MOVEFOCUS_ROOT, 0,
                        getter_AddRefs(newFocus));
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsIAccessibleDocument
 
@@ -454,17 +454,17 @@ DocAccessible::GetWindowHandle(void** aW
   NS_ENSURE_ARG_POINTER(aWindow);
   *aWindow = GetNativeWindow();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 DocAccessible::GetWindow(nsIDOMWindow** aDOMWin)
 {
-  *aDOMWin = nsnull;
+  *aDOMWin = nullptr;
   if (!mDocument) {
     return NS_ERROR_FAILURE;  // Accessible is Shutdown()
   }
   *aDOMWin = mDocument->GetWindow();
 
   if (!*aDOMWin)
     return NS_ERROR_FAILURE;  // No DOM Window
 
@@ -472,29 +472,29 @@ DocAccessible::GetWindow(nsIDOMWindow** 
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 DocAccessible::GetDOMDocument(nsIDOMDocument** aDOMDocument)
 {
   NS_ENSURE_ARG_POINTER(aDOMDocument);
-  *aDOMDocument = nsnull;
+  *aDOMDocument = nullptr;
 
   if (mDocument)
     CallQueryInterface(mDocument, aDOMDocument);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 DocAccessible::GetParentDocument(nsIAccessibleDocument** aDocument)
 {
   NS_ENSURE_ARG_POINTER(aDocument);
-  *aDocument = nsnull;
+  *aDocument = nullptr;
 
   if (!IsDefunct())
     NS_IF_ADDREF(*aDocument = ParentDocument());
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
@@ -509,31 +509,31 @@ DocAccessible::GetChildDocumentCount(PRU
   return NS_OK;
 }
 
 NS_IMETHODIMP
 DocAccessible::GetChildDocumentAt(PRUint32 aIndex,
                                   nsIAccessibleDocument** aDocument)
 {
   NS_ENSURE_ARG_POINTER(aDocument);
-  *aDocument = nsnull;
+  *aDocument = nullptr;
 
   if (IsDefunct())
     return NS_OK;
 
   NS_IF_ADDREF(*aDocument = GetChildDocumentAt(aIndex));
   return *aDocument ? NS_OK : NS_ERROR_INVALID_ARG;
 }
 
 // nsIAccessibleVirtualCursor method
 NS_IMETHODIMP
 DocAccessible::GetVirtualCursor(nsIAccessiblePivot** aVirtualCursor)
 {
   NS_ENSURE_ARG_POINTER(aVirtualCursor);
-  *aVirtualCursor = nsnull;
+  *aVirtualCursor = nullptr;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   NS_ENSURE_TRUE(mIsCursorable, NS_ERROR_NOT_IMPLEMENTED);
 
   if (!mVirtualCursor) {
     mVirtualCursor = new nsAccessiblePivot(this);
@@ -547,47 +547,47 @@ DocAccessible::GetVirtualCursor(nsIAcces
 // HyperTextAccessible method
 already_AddRefed<nsIEditor>
 DocAccessible::GetEditor() const
 {
   // Check if document is editable (designMode="on" case). Otherwise check if
   // the html:body (for HTML document case) or document element is editable.
   if (!mDocument->HasFlag(NODE_IS_EDITABLE) &&
       !mContent->HasFlag(NODE_IS_EDITABLE))
-    return nsnull;
+    return nullptr;
 
   nsCOMPtr<nsISupports> container = mDocument->GetContainer();
   nsCOMPtr<nsIEditingSession> editingSession(do_GetInterface(container));
   if (!editingSession)
-    return nsnull; // No editing session interface
+    return nullptr; // No editing session interface
 
   nsCOMPtr<nsIEditor> editor;
   editingSession->GetEditorForWindow(mDocument->GetWindow(), getter_AddRefs(editor));
   if (!editor)
-    return nsnull;
+    return nullptr;
 
   bool isEditable = false;
   editor->GetIsDocumentEditable(&isEditable);
   if (isEditable)
     return editor.forget();
 
-  return nsnull;
+  return nullptr;
 }
 
 // DocAccessible public method
 Accessible*
 DocAccessible::GetAccessible(nsINode* aNode) const
 {
   Accessible* accessible = mNodeToAccessibleMap.Get(aNode);
 
   // No accessible in the cache, check if the given ID is unique ID of this
   // document accessible.
   if (!accessible) {
     if (GetNode() != aNode)
-      return nsnull;
+      return nullptr;
 
     accessible = const_cast<DocAccessible*>(this);
   }
 
 #ifdef DEBUG
   // All cached accessible nodes should be in the parent
   // It will assert if not all the children were created
   // when they were first cached, and no invalidation
@@ -632,31 +632,31 @@ DocAccessible::Shutdown()
   if (!mPresShell) // already shutdown
     return;
 
 #ifdef DEBUG
   if (logging::IsEnabled(logging::eDocDestroy))
     logging::DocDestroy("document shutdown", mDocument, this);
 #endif
 
-  mPresShell->SetAccDocument(nsnull);
+  mPresShell->SetAccDocument(nullptr);
 
   if (mNotificationController) {
     mNotificationController->Shutdown();
-    mNotificationController = nsnull;
+    mNotificationController = nullptr;
   }
 
   RemoveEventListeners();
 
   // Mark the document as shutdown before AT is notified about the document
   // removal from its container (valid for root documents on ATK and due to
   // some reason for MSAA, refer to bug 757392 for details).
   mFlags |= eIsDefunct;
   nsCOMPtr<nsIDocument> kungFuDeathGripDoc = mDocument;
-  mDocument = nsnull;
+  mDocument = nullptr;
 
   if (mParent) {
     DocAccessible* parentDocument = mParent->Document();
     if (parentDocument)
       parentDocument->RemoveChildDocument(this);
 
     mParent->RemoveChild(this);
   }
@@ -666,48 +666,48 @@ DocAccessible::Shutdown()
   PRInt32 childDocCount = mChildDocuments.Length();
   for (PRInt32 idx = childDocCount - 1; idx >= 0; idx--)
     mChildDocuments[idx]->Shutdown();
 
   mChildDocuments.Clear();
 
   if (mVirtualCursor) {
     mVirtualCursor->RemoveObserver(this);
-    mVirtualCursor = nsnull;
+    mVirtualCursor = nullptr;
   }
 
-  mPresShell = nsnull;  // Avoid reentrancy
+  mPresShell = nullptr;  // Avoid reentrancy
 
   mDependentIDsHash.Clear();
   mNodeToAccessibleMap.Clear();
   ClearCache(mAccessibleCache);
 
   HyperTextAccessibleWrap::Shutdown();
 
   GetAccService()->NotifyOfDocumentShutdown(kungFuDeathGripDoc);
 }
 
 nsIFrame*
 DocAccessible::GetFrame() const
 {
-  nsIFrame* root = nsnull;
+  nsIFrame* root = nullptr;
   if (mPresShell)
     root = mPresShell->GetRootFrame();
 
   return root;
 }
 
 // DocAccessible protected member
 void
 DocAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame** aRelativeFrame)
 {
   *aRelativeFrame = GetFrame();
 
   nsIDocument *document = mDocument;
-  nsIDocument *parentDoc = nsnull;
+  nsIDocument *parentDoc = nullptr;
 
   while (document) {
     nsIPresShell *presShell = document->GetShell();
     if (!presShell) {
       return;
     }
 
     nsRect scrollPort;
@@ -807,17 +807,17 @@ DocAccessible::RemoveEventListeners()
           commandManager->RemoveCommandObserver(this, "obs_documentCreated");
         }
       }
     }
   }
 
   if (mScrollWatchTimer) {
     mScrollWatchTimer->Cancel();
-    mScrollWatchTimer = nsnull;
+    mScrollWatchTimer = nullptr;
     NS_RELEASE_THIS(); // Kung fu death grip
   }
 
   a11y::RootAccessible* rootAccessible = RootAccessible();
   if (rootAccessible) {
     nsRefPtr<nsCaretAccessible> caretAccessible = rootAccessible->GetCaretAccessible();
     if (caretAccessible)
       caretAccessible->RemoveDocSelectionListener(mPresShell);
@@ -837,17 +837,17 @@ DocAccessible::ScrollTimerCallback(nsITi
     // We only want to fire accessibilty scroll event when scrolling stops or pauses
     // Therefore, we wait for no scroll events to occur between 2 ticks of this timer
     // That indicates a pause in scrolling, so we fire the accessibilty scroll event
     nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_SCROLLING_END, docAcc);
 
     docAcc->mScrollPositionChangedTicks = 0;
     if (docAcc->mScrollWatchTimer) {
       docAcc->mScrollWatchTimer->Cancel();
-      docAcc->mScrollWatchTimer = nsnull;
+      docAcc->mScrollWatchTimer = nullptr;
       NS_RELEASE(docAcc); // Release kung fu death grip
     }
   }
 }
 
 // DocAccessible protected member
 void
 DocAccessible::AddScrollListener()
@@ -973,17 +973,17 @@ DocAccessible::AttributeWillChange(nsIDo
 
   // XXX TODO: bugs 472142, 472143.
   // Here we will want to cache whatever attribute values we are interested
   // in, such as the existence of aria-pressed for button (so we know if we
   // need to newly expose it as a toggle button) etc.
   if (aAttribute == nsGkAtoms::aria_checked ||
       aAttribute == nsGkAtoms::aria_pressed) {
     mARIAAttrOldValue = (aModType != nsIDOMMutationEvent::ADDITION) ?
-      nsAccUtils::GetARIAToken(aElement, aAttribute) : nsnull;
+      nsAccUtils::GetARIAToken(aElement, aAttribute) : nullptr;
   }
 }
 
 void
 DocAccessible::AttributeChanged(nsIDocument* aDocument,
                                 dom::Element* aElement,
                                 PRInt32 aNameSpaceID, nsIAtom* aAttribute,
                                 PRInt32 aModType)
@@ -1330,28 +1330,28 @@ DocAccessible::HandleAccEvent(AccEvent* 
 
 ////////////////////////////////////////////////////////////////////////////////
 // Public members
 
 void*
 DocAccessible::GetNativeWindow() const
 {
   if (!mPresShell)
-    return nsnull;
+    return nullptr;
 
   nsIViewManager* vm = mPresShell->GetViewManager();
   if (!vm)
-    return nsnull;
+    return nullptr;
 
   nsCOMPtr<nsIWidget> widget;
   vm->GetRootWidget(getter_AddRefs(widget));
   if (widget)
     return widget->GetNativeData(NS_NATIVE_WINDOW);
 
-  return nsnull;
+  return nullptr;
 }
 
 Accessible*
 DocAccessible::GetAccessibleByUniqueIDInSubtree(void* aUniqueID)
 {
   Accessible* child = GetAccessibleByUniqueID(aUniqueID);
   if (child)
     return child;
@@ -1359,27 +1359,27 @@ DocAccessible::GetAccessibleByUniqueIDIn
   PRUint32 childDocCount = mChildDocuments.Length();
   for (PRUint32 childDocIdx= 0; childDocIdx < childDocCount; childDocIdx++) {
     DocAccessible* childDocument = mChildDocuments.ElementAt(childDocIdx);
     child = childDocument->GetAccessibleByUniqueIDInSubtree(aUniqueID);
     if (child)
       return child;
   }
 
-  return nsnull;
+  return nullptr;
 }
 
 Accessible*
 DocAccessible::GetAccessibleOrContainer(nsINode* aNode)
 {
   if (!aNode || !aNode->IsInDoc())
-    return nsnull;
+    return nullptr;
 
   nsINode* currNode = aNode;
-  Accessible* accessible = nsnull;
+  Accessible* accessible = nullptr;
   while (!(accessible = GetAccessible(currNode)) &&
          (currNode = currNode->GetNodeParent()));
 
   return accessible;
 }
 
 bool
 DocAccessible::BindToDocument(Accessible* aAccessible,
@@ -1414,17 +1414,17 @@ void
 DocAccessible::UnbindFromDocument(Accessible* aAccessible)
 {
   NS_ASSERTION(mAccessibleCache.GetWeak(aAccessible->UniqueID()),
                "Unbinding the unbound accessible!");
 
   // Fire focus event on accessible having DOM focus if active item was removed
   // from the tree.
   if (FocusMgr()->IsActiveItem(aAccessible)) {
-    FocusMgr()->ActiveItemChanged(nsnull);
+    FocusMgr()->ActiveItemChanged(nullptr);
     A11YDEBUG_FOCUS_ACTIVEITEMCHANGE_CAUSE("tree shutdown", aAccessible)
   }
 
   // Remove an accessible from node-to-accessible map if it exists there.
   if (aAccessible->IsPrimaryForNode() &&
       mNodeToAccessibleMap.Get(aAccessible->GetNode()) == aAccessible)
     mNodeToAccessibleMap.Remove(aAccessible->GetNode());
 
@@ -1510,17 +1510,17 @@ DocAccessible::ProcessInvalidationList()
 void
 DocAccessible::CacheChildren()
 {
   // Search for accessible children starting from the document element since
   // some web pages tend to insert elements under it rather than document body.
   nsAccTreeWalker walker(this, mDocument->GetRootElement(),
                          CanHaveAnonChildren());
 
-  Accessible* child = nsnull;
+  Accessible* child = nullptr;
   while ((child = walker.NextChild()) && AppendChild(child));
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // Protected members
 
 void
 DocAccessible::NotifyOfLoading(bool aIsReloading)
--- a/accessible/src/generic/DocAccessible.h
+++ b/accessible/src/generic/DocAccessible.h
@@ -150,29 +150,29 @@ public:
    * Return a native window handler or pointer depending on platform.
    */
   virtual void* GetNativeWindow() const;
 
   /**
    * Return the parent document.
    */
   DocAccessible* ParentDocument() const
-    { return mParent ? mParent->Document() : nsnull; }
+    { return mParent ? mParent->Document() : nullptr; }
 
   /**
    * Return the child document count.
    */
   PRUint32 ChildDocumentCount() const
     { return mChildDocuments.Length(); }
 
   /**
    * Return the child document at the given index.
    */
   DocAccessible* GetChildDocumentAt(PRUint32 aIndex) const
-    { return mChildDocuments.SafeElementAt(aIndex, nsnull); }
+    { return mChildDocuments.SafeElementAt(aIndex, nullptr); }
 
   /**
    * Non-virtual method to fire a delayed event after a 0 length timeout.
    *
    * @param aEventType   [in] the nsIAccessibleEvent event type
    * @param aDOMNode     [in] DOM node the accesible event should be fired for
    * @param aAllowDupes  [in] rule to process an event (see EEventRule constants)
    */
@@ -257,34 +257,34 @@ public:
    */
   Accessible* GetAccessibleOrContainer(nsINode* aNode);
 
   /**
    * Return a container accessible for the given DOM node.
    */
   Accessible* GetContainerAccessible(nsINode* aNode)
   {
-    return aNode ? GetAccessibleOrContainer(aNode->GetNodeParent()) : nsnull;
+    return aNode ? GetAccessibleOrContainer(aNode->GetNodeParent()) : nullptr;
   }
 
   /**
    * Return true if the given ID is referred by relation attribute.
    *
    * @note Different elements may share the same ID if they are hosted inside
    *       XBL bindings. Be careful the result of this method may be  senseless
    *       while it's called for XUL elements (where XBL is used widely).
    */
   bool IsDependentID(const nsAString& aID) const
-    { return mDependentIDsHash.Get(aID, nsnull); }
+    { return mDependentIDsHash.Get(aID, nullptr); }
 
   /**
    * Initialize the newly created accessible and put it into document caches.
    *
    * @param  aAccessible    [in] created accessible
-   * @param  aRoleMapEntry  [in] the role map entry role the ARIA role or nsnull
+   * @param  aRoleMapEntry  [in] the role map entry role the ARIA role or nullptr
    *                          if none
    */
   bool BindToDocument(Accessible* aAccessible, nsRoleMapEntry* aRoleMapEntry);
 
   /**
    * Remove from document and shutdown the given accessible.
    */
   void UnbindFromDocument(Accessible* aAccessible);
@@ -372,28 +372,28 @@ protected:
    * Add dependent IDs pointed by accessible element by relation attribute to
    * cache. If the relation attribute is missed then all relation attributes
    * are checked.
    *
    * @param aRelProvider [in] accessible that element has relation attribute
    * @param aRelAttr     [in, optional] relation attribute
    */
   void AddDependentIDsFor(Accessible* aRelProvider,
-                          nsIAtom* aRelAttr = nsnull);
+                          nsIAtom* aRelAttr = nullptr);
 
   /**
    * Remove dependent IDs pointed by accessible element by relation attribute
    * from cache. If the relation attribute is absent then all relation
    * attributes are checked.
    *
    * @param aRelProvider [in] accessible that element has relation attribute
    * @param aRelAttr     [in, optional] relation attribute
    */
   void RemoveDependentIDsFor(Accessible* aRelProvider,
-                             nsIAtom* aRelAttr = nsnull);
+                             nsIAtom* aRelAttr = nullptr);
 
   /**
    * Update or recreate an accessible depending on a changed attribute.
    *
    * @param aElement   [in] the element the attribute was changed on
    * @param aAttribute [in] the changed attribute
    * @return            true if an action was taken on the attribute change
    */
@@ -588,12 +588,12 @@ private:
 
   nsIPresShell* mPresShell;
 };
 
 inline DocAccessible*
 Accessible::AsDoc()
 {
   return mFlags & eDocAccessible ?
-    static_cast<DocAccessible*>(this) : nsnull;
+    static_cast<DocAccessible*>(this) : nullptr;
 }
 
 #endif
--- a/accessible/src/generic/HyperTextAccessible.cpp
+++ b/accessible/src/generic/HyperTextAccessible.cpp
@@ -45,17 +45,17 @@ HyperTextAccessible::
 }
 
 NS_IMPL_ADDREF_INHERITED(HyperTextAccessible, AccessibleWrap)
 NS_IMPL_RELEASE_INHERITED(HyperTextAccessible, AccessibleWrap)
 
 nsresult
 HyperTextAccessible::QueryInterface(REFNSIID aIID, void** aInstancePtr)
 {
-  *aInstancePtr = nsnull;
+  *aInstancePtr = nullptr;
 
   // ARIA roles that these interfaces are not appropriate for.
   if (!IsTextRole())
     return Accessible::QueryInterface(aIID, aInstancePtr);
 
   if (aIID.Equals(NS_GET_IID(nsIAccessibleText))) {
     *aInstancePtr = static_cast<nsIAccessibleText*>(this);
     NS_ADDREF_THIS();
@@ -236,33 +236,33 @@ HyperTextAccessible::GetPosAndText(PRInt
   if (aText) {
     aText->Truncate();
   }
   if (endOffset < 0) {
     const PRInt32 kMaxTextLength = 32767;
     endOffset = kMaxTextLength; // Max end offset
   }
   else if (startOffset > endOffset) {
-    return nsnull;
+    return nullptr;
   }
 
-  nsIFrame *startFrame = nsnull;
+  nsIFrame *startFrame = nullptr;
   if (aEndFrame) {
-    *aEndFrame = nsnull;
+    *aEndFrame = nullptr;
   }
   if (aBoundsRect) {
     aBoundsRect->SetEmpty();
   }
   if (aStartAcc)
-    *aStartAcc = nsnull;
+    *aStartAcc = nullptr;
   if (aEndAcc)
-    *aEndAcc = nsnull;
+    *aEndAcc = nullptr;
 
   nsIntRect unionRect;
-  Accessible* lastAccessible = nsnull;
+  Accessible* lastAccessible = nullptr;
 
   gfxSkipChars skipChars;
   gfxSkipCharsIterator iter;
 
   // Loop through children and collect valid offsets, text and bounds
   // depending on what we need for out parameters.
   PRUint32 childCount = ChildCount();
   for (PRUint32 childIdx = 0; childIdx < childCount; childIdx++) {
@@ -276,17 +276,17 @@ HyperTextAccessible::GetPosAndText(PRInt
     nsIFrame *primaryFrame = frame;
     if (nsAccUtils::IsText(childAcc)) {
       // We only need info up to rendered offset -- that is what we're
       // converting to content offset
       PRInt32 substringEndOffset = -1;
       PRUint32 ourRenderedStart = 0;
       PRInt32 ourContentStart = 0;
       if (frame->GetType() == nsGkAtoms::textFrame) {
-        nsresult rv = frame->GetRenderedText(nsnull, &skipChars, &iter);
+        nsresult rv = frame->GetRenderedText(nullptr, &skipChars, &iter);
         if (NS_SUCCEEDED(rv)) {
           ourRenderedStart = iter.GetSkippedOffset();
           ourContentStart = iter.GetOriginalOffset();
           substringEndOffset =
             iter.ConvertOriginalToSkipped(skipChars.GetOriginalCharCount() +
                                           ourContentStart) - ourRenderedStart;
         }
       }
@@ -498,36 +498,36 @@ HyperTextAccessible::GetCharacterAtOffse
 
 Accessible*
 HyperTextAccessible::DOMPointToHypertextOffset(nsINode* aNode,
                                                PRInt32 aNodeOffset,
                                                PRInt32* aHyperTextOffset,
                                                bool aIsEndOffset)
 {
   if (!aHyperTextOffset)
-    return nsnull;
+    return nullptr;
   *aHyperTextOffset = 0;
 
   if (!aNode)
-    return nsnull;
+    return nullptr;
 
   PRUint32 addTextOffset = 0;
-  nsINode* findNode = nsnull;
+  nsINode* findNode = nullptr;
 
   if (aNodeOffset == -1) {
     findNode = aNode;
 
   } else if (aNode->IsNodeOfType(nsINode::eTEXT)) {
     // For text nodes, aNodeOffset comes in as a character offset
     // Text offset will be added at the end, if we find the offset in this hypertext
     // We want the "skipped" offset into the text (rendered text without the extra whitespace)
     nsIFrame *frame = aNode->AsContent()->GetPrimaryFrame();
-    NS_ENSURE_TRUE(frame, nsnull);
+    NS_ENSURE_TRUE(frame, nullptr);
     nsresult rv = ContentToRenderedOffset(frame, aNodeOffset, &addTextOffset);
-    NS_ENSURE_SUCCESS(rv, nsnull);
+    NS_ENSURE_SUCCESS(rv, nullptr);
     // Get the child node and 
     findNode = aNode;
 
   } else {
     // findNode could be null if aNodeOffset == # of child nodes, which means
     // one of two things:
     // 1) we're at the end of the children, keep findNode = null, so that we get
     //    the last possible offset
@@ -537,42 +537,42 @@ HyperTextAccessible::DOMPointToHypertext
     //    parentContent for the node to find
 
     findNode = aNode->GetChildAt(aNodeOffset);
     if (!findNode && !aNodeOffset) {
       if (aNode == GetNode()) {
         // There are no children, which means this is an empty nsIAccessibleText, in which
         // case we can only be at hypertext offset 0
         *aHyperTextOffset = 0;
-        return nsnull;
+        return nullptr;
       }
       findNode = aNode; // Case #2: there are no children
     }
   }
 
   // Get accessible for this findNode, or if that node isn't accessible, use the
   // accessible for the next DOM node which has one (based on forward depth first search)
-  Accessible* descendantAcc = nsnull;
+  Accessible* descendantAcc = nullptr;
   if (findNode) {
     nsCOMPtr<nsIContent> findContent(do_QueryInterface(findNode));
     if (findContent && findContent->IsHTML() &&
         findContent->NodeInfo()->Equals(nsGkAtoms::br) &&
         findContent->AttrValueIs(kNameSpaceID_None,
                                  nsGkAtoms::mozeditorbogusnode,
                                  nsGkAtoms::_true,
                                  eIgnoreCase)) {
       // This <br> is the hacky "bogus node" used when there is no text in a control
       *aHyperTextOffset = 0;
-      return nsnull;
+      return nullptr;
     }
     descendantAcc = GetFirstAvailableAccessible(findNode);
   }
 
   // From the descendant, go up and get the immediate child of this hypertext
-  Accessible* childAccAtOffset = nsnull;
+  Accessible* childAccAtOffset = nullptr;
   while (descendantAcc) {
     Accessible* parentAcc = descendantAcc->Parent();
     if (parentAcc == this) {
       childAccAtOffset = descendantAcc;
       break;
     }
 
     // This offset no longer applies because the passed-in text object is not a child
@@ -600,38 +600,38 @@ HyperTextAccessible::DOMPointToHypertext
 
   // Loop through, adding offsets until we reach childAccessible
   // If childAccessible is null we will end up adding up the entire length of
   // the hypertext, which is good -- it just means our offset node
   // came after the last accessible child's node
   PRUint32 childCount = ChildCount();
 
   PRUint32 childIdx = 0;
-  Accessible* childAcc = nsnull;
+  Accessible* childAcc = nullptr;
   for (; childIdx < childCount; childIdx++) {
     childAcc = mChildren[childIdx];
     if (childAcc == childAccAtOffset)
       break;
 
     *aHyperTextOffset += nsAccUtils::TextLength(childAcc);
   }
 
   if (childIdx < childCount) {
     *aHyperTextOffset += addTextOffset;
     NS_ASSERTION(childAcc == childAccAtOffset,
-                 "These should be equal whenever we exit loop and childAcc != nsnull");
+                 "These should be equal whenever we exit loop and childAcc != nullptr");
 
     if (childIdx < childCount - 1 ||
         addTextOffset < nsAccUtils::TextLength(childAccAtOffset)) {
       // If not at end of last text node, we will return the accessible we were in
       return childAccAtOffset;
     }
   }
 
-  return nsnull;
+  return nullptr;
 }
 
 nsresult
 HyperTextAccessible::HypertextOffsetsToDOMRange(PRInt32 aStartHTOffset,
                                                 PRInt32 aEndHTOffset,
                                                 nsRange* aRange)
 {
   // If the given offsets are 0 and associated editor is empty then return
@@ -653,19 +653,19 @@ HyperTextAccessible::HypertextOffsetsToD
           return NS_OK;
         }
       }
     }
   }
 
   nsRefPtr<Accessible> startAcc, endAcc;
   PRInt32 startOffset = aStartHTOffset, endOffset = aEndHTOffset;
-  nsIFrame *startFrame = nsnull, *endFrame = nsnull;
+  nsIFrame *startFrame = nullptr, *endFrame = nullptr;
 
-  startFrame = GetPosAndText(startOffset, endOffset, nsnull, &endFrame, nsnull,
+  startFrame = GetPosAndText(startOffset, endOffset, nullptr, &endFrame, nullptr,
                              getter_AddRefs(startAcc), getter_AddRefs(endAcc));
   if (!startAcc || !endAcc)
     return NS_ERROR_FAILURE;
 
   DOMPoint startPoint, endPoint;
   nsresult rv = GetDOMPointByFrameOffset(startFrame, startOffset, startAcc,
                                          &startPoint);
   NS_ENSURE_SUCCESS(rv, rv);
@@ -734,29 +734,29 @@ HyperTextAccessible::GetRelativeOffset(n
     }
   }
 
   // Turn the resulting node and offset into a hyperTextOffset
   PRInt32 hyperTextOffset;
   if (!pos.mResultContent)
     return -1;
 
-  // If finalAccessible is nsnull, then DOMPointToHypertextOffset() searched
+  // If finalAccessible is nullptr, then DOMPointToHypertextOffset() searched
   // through the hypertext children without finding the node/offset position.
   Accessible* finalAccessible =
     DOMPointToHypertextOffset(pos.mResultContent, pos.mContentOffset,
                               &hyperTextOffset, aDirection == eDirNext);
 
   if (!finalAccessible && aDirection == eDirPrevious) {
     // If we reached the end during search, this means we didn't find the DOM point
     // and we're actually at the start of the paragraph
     hyperTextOffset = 0;
   }  
   else if (aAmount == eSelectBeginLine) {
-    Accessible* firstChild = mChildren.SafeElementAt(0, nsnull);
+    Accessible* firstChild = mChildren.SafeElementAt(0, nullptr);
     // For line selection with needsStart, set start of line exactly to line break
     if (pos.mContentOffset == 0 && firstChild &&
         firstChild->Role() == roles::STATICTEXT &&
         static_cast<PRInt32>(nsAccUtils::TextLength(firstChild)) == hyperTextOffset) {
       // XXX Bullet hack -- we should remove this once list bullets use anonymous content
       hyperTextOffset = 0;
     }
     if (!aNeedsStart && hyperTextOffset > 0) {
@@ -863,33 +863,33 @@ HyperTextAccessible::GetTextHelper(EGetT
       // the BOUNDARY_END_START gets the text from the line-end to the next
       //line-end, the newline is included at the beginning of the string.
       amount = eSelectLine;
       break;
 
     case BOUNDARY_ATTRIBUTE_RANGE:
     {
       nsresult rv = GetTextAttributes(false, aOffset,
-                                      aStartOffset, aEndOffset, nsnull);
+                                      aStartOffset, aEndOffset, nullptr);
       NS_ENSURE_SUCCESS(rv, rv);
       
       return GetText(*aStartOffset, *aEndOffset, aText);
     }
 
     default:  // Note, sentence support is deprecated and falls through to here
       return NS_ERROR_INVALID_ARG;
   }
 
   PRInt32 startOffset = aOffset + (aBoundaryType == BOUNDARY_LINE_END);  // Avoid getting the previous line
   PRInt32 endOffset = startOffset;
 
   // Convert offsets to frame-relative
   nsRefPtr<Accessible> startAcc;
-  nsIFrame *startFrame = GetPosAndText(startOffset, endOffset, nsnull, nsnull,
-                                       nsnull, getter_AddRefs(startAcc));
+  nsIFrame *startFrame = GetPosAndText(startOffset, endOffset, nullptr, nullptr,
+                                       nullptr, getter_AddRefs(startAcc));
 
   if (!startFrame) {
     PRInt32 textLength = CharacterCount();
     if (aBoundaryType == BOUNDARY_LINE_START && aOffset > 0 && aOffset == textLength) {
       // Asking for start of line, while on last character
       if (startAcc)
         startFrame = startAcc->GetFrame();
     }
@@ -921,27 +921,27 @@ HyperTextAccessible::GetTextHelper(EGetT
   }
   else {
     // Start moving forward from the start so that we don't get 
     // 2 words/lines if the offset occurred on whitespace boundary
     // Careful, startOffset and endOffset are passed by reference to GetPosAndText() and changed
     // For BOUNDARY_LINE_END, make sure we start of this line
     startOffset = endOffset = finalStartOffset + (aBoundaryType == BOUNDARY_LINE_END);
     nsRefPtr<Accessible> endAcc;
-    nsIFrame *endFrame = GetPosAndText(startOffset, endOffset, nsnull, nsnull,
-                                       nsnull, getter_AddRefs(endAcc));
+    nsIFrame *endFrame = GetPosAndText(startOffset, endOffset, nullptr, nullptr,
+                                       nullptr, getter_AddRefs(endAcc));
     if (endAcc && endAcc->Role() == roles::STATICTEXT) {
       // Static text like list bullets will ruin our forward calculation,
       // since the caret cannot be in the static text. Start just after the static text.
       startOffset = endOffset = finalStartOffset +
                                 (aBoundaryType == BOUNDARY_LINE_END) +
                                 nsAccUtils::TextLength(endAcc);
 
-      endFrame = GetPosAndText(startOffset, endOffset, nsnull, nsnull,
-                               nsnull, getter_AddRefs(endAcc));
+      endFrame = GetPosAndText(startOffset, endOffset, nullptr, nullptr,
+                               nullptr, getter_AddRefs(endAcc));
     }
     if (!endFrame) {
       return NS_ERROR_FAILURE;
     }
     finalEndOffset = GetRelativeOffset(presShell, endFrame, endOffset, endAcc,
                                        amount, eDirNext, needsStart);
     NS_ENSURE_TRUE(endOffset >= 0, NS_ERROR_FAILURE);
     if (finalEndOffset == aOffset) {
@@ -1036,17 +1036,17 @@ HyperTextAccessible::GetTextAttributes(b
 
   NS_ENSURE_ARG_POINTER(aEndOffset);
   *aEndOffset = 0;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   if (aAttributes) {
-    *aAttributes = nsnull;
+    *aAttributes = nullptr;
 
     nsCOMPtr<nsIPersistentProperties> attributes =
       do_CreateInstance(NS_PERSISTENTPROPERTIES_CONTRACTID);
     NS_ENSURE_TRUE(attributes, NS_ERROR_OUT_OF_MEMORY);
 
     NS_ADDREF(*aAttributes = attributes);
   }
 
@@ -1079,32 +1079,32 @@ HyperTextAccessible::GetTextAttributes(b
     PRInt32 nodeOffset = 0;
     nsresult rv = RenderedToContentOffset(offsetFrame, offsetInAcc,
                                           &nodeOffset);
     NS_ENSURE_SUCCESS(rv, rv);
 
     // Set 'misspelled' text attribute.
     rv = GetSpellTextAttribute(accAtOffset->GetNode(), nodeOffset,
                                &startOffset, &endOffset,
-                               aAttributes ? *aAttributes : nsnull);
+                               aAttributes ? *aAttributes : nullptr);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   *aStartOffset = startOffset;
   *aEndOffset = endOffset;
   return NS_OK;
 }
 
 // nsIPersistentProperties
 // nsIAccessibleText::defaultTextAttributes
 NS_IMETHODIMP
 HyperTextAccessible::GetDefaultTextAttributes(nsIPersistentProperties** aAttributes)
 {
   NS_ENSURE_ARG_POINTER(aAttributes);
-  *aAttributes = nsnull;
+  *aAttributes = nullptr;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsCOMPtr<nsIPersistentProperties> attributes =
     do_CreateInstance(NS_PERSISTENTPROPERTIES_CONTRACTID);
   NS_ENSURE_TRUE(attributes, NS_ERROR_OUT_OF_MEMORY);
 
@@ -1202,17 +1202,17 @@ HyperTextAccessible::GetCharacterExtents
 NS_IMETHODIMP
 HyperTextAccessible::GetRangeExtents(PRInt32 aStartOffset, PRInt32 aEndOffset,
                                      PRInt32* aX, PRInt32* aY,
                                      PRInt32* aWidth, PRInt32* aHeight,
                                      PRUint32 aCoordType)
 {
   nsIntRect boundsRect;
   nsIFrame *endFrameUnused;
-  if (!GetPosAndText(aStartOffset, aEndOffset, nsnull, &endFrameUnused, &boundsRect) ||
+  if (!GetPosAndText(aStartOffset, aEndOffset, nullptr, &endFrameUnused, &boundsRect) ||
       boundsRect.IsEmpty()) {
     return NS_ERROR_FAILURE;
   }
 
   *aX = boundsRect.x;
   *aY = boundsRect.y;
   *aWidth = boundsRect.width;
   *aHeight = boundsRect.height;
@@ -1317,17 +1317,17 @@ HyperTextAccessible::GetLinkCount(PRInt3
   *aLinkCount = GetLinkCount();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HyperTextAccessible::GetLinkAt(PRInt32 aIndex, nsIAccessibleHyperLink** aLink)
 {
   NS_ENSURE_ARG_POINTER(aLink);
-  *aLink = nsnull;
+  *aLink = nullptr;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   Accessible* link = GetLinkAt(aIndex);
   if (link)
     CallQueryInterface(link, aLink);
 
@@ -1470,24 +1470,24 @@ HyperTextAccessible::GetEditor() const
         // Recursion will stop at container doc because it has its own impl
         // of GetEditor()
         return hyperText->GetEditor();
       }
 
       ancestor = ancestor->Parent();
     }
 
-    return nsnull;
+    return nullptr;
   }
 
   nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
     nsCoreUtils::GetDocShellTreeItemFor(mContent);
   nsCOMPtr<nsIEditingSession> editingSession(do_GetInterface(docShellTreeItem));
   if (!editingSession)
-    return nsnull; // No editing session interface
+    return nullptr; // No editing session interface
 
   nsCOMPtr<nsIEditor> editor;
   nsIDocument* docNode = mDoc->GetDocumentNode();
   editingSession->GetEditorForWindow(docNode->GetWindow(),
                                      getter_AddRefs(editor));
   return editor.forget();
 }
 
@@ -1530,17 +1530,17 @@ HyperTextAccessible::SetSelectionRange(P
 
   nsFocusManager* DOMFocusManager = nsFocusManager::GetFocusManager();
   if (DOMFocusManager) {
     NS_ENSURE_TRUE(mDoc, NS_ERROR_FAILURE);
     nsIDocument* docNode = mDoc->GetDocumentNode();
     NS_ENSURE_TRUE(docNode, NS_ERROR_FAILURE);
     nsCOMPtr<nsPIDOMWindow> window = docNode->GetWindow();
     nsCOMPtr<nsIDOMElement> result;
-    DOMFocusManager->MoveFocus(window, nsnull, nsIFocusManager::MOVEFOCUS_CARET,
+    DOMFocusManager->MoveFocus(window, nullptr, nsIFocusManager::MOVEFOCUS_CARET,
                                nsIFocusManager::FLAG_BYMOVEFOCUS, getter_AddRefs(result));
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 HyperTextAccessible::SetCaretOffset(PRInt32 aCaretOffset)
@@ -1628,17 +1628,17 @@ HyperTextAccessible::CaretLineNumber()
   PRInt32 caretOffset = domSel->GetFocusOffset();
   nsFrameSelection::HINT hint = frameSelection->GetHint();
   nsIFrame *caretFrame = frameSelection->GetFrameForNodeOffset(caretContent, caretOffset,
                                                                hint, &returnOffsetUnused);
   NS_ENSURE_TRUE(caretFrame, -1);
 
   PRInt32 lineNumber = 1;
   nsAutoLineIterator lineIterForCaret;
-  nsIContent *hyperTextContent = IsContent() ? mContent.get() : nsnull;
+  nsIContent *hyperTextContent = IsContent() ? mContent.get() : nullptr;
   while (caretFrame) {
     if (hyperTextContent == caretFrame->GetContent()) {
       return lineNumber; // Must be in a single line hyper text, there is no line iterator
     }
     nsIFrame *parentFrame = caretFrame->GetParent();
     if (!parentFrame)
       break;
 
@@ -1670,17 +1670,17 @@ HyperTextAccessible::CaretLineNumber()
   NS_NOTREACHED("DOM ancestry had this hypertext but frame ancestry didn't");
   return lineNumber;
 }
 
 already_AddRefed<nsFrameSelection>
 HyperTextAccessible::FrameSelection()
 {
   nsIFrame* frame = GetFrame();
-  return frame ? frame->GetFrameSelection() : nsnull;
+  return frame ? frame->GetFrameSelection() : nullptr;
 }
 
 void
 HyperTextAccessible::GetSelectionDOMRanges(PRInt16 aType,
                                            nsTArray<nsRange*>* aRanges)
 {
   nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
   if (!frameSelection)
@@ -1997,23 +1997,23 @@ HyperTextAccessible::ContentToRenderedOf
   if (!aFrame) {
     // Current frame not rendered -- this can happen if text is set on
     // something with display: none
     *aRenderedOffset = 0;
     return NS_OK;
   }
   NS_ASSERTION(aFrame->GetType() == nsGkAtoms::textFrame,
                "Need text frame for offset conversion");
-  NS_ASSERTION(aFrame->GetPrevContinuation() == nsnull,
+  NS_ASSERTION(aFrame->GetPrevContinuation() == nullptr,
                "Call on primary frame only");
 
   gfxSkipChars skipChars;
   gfxSkipCharsIterator iter;
   // Only get info up to original offset, we know that will be larger than skipped offset
-  nsresult rv = aFrame->GetRenderedText(nsnull, &skipChars, &iter, 0, aContentOffset);
+  nsresult rv = aFrame->GetRenderedText(nullptr, &skipChars, &iter, 0, aContentOffset);
   NS_ENSURE_SUCCESS(rv, rv);
 
   PRUint32 ourRenderedStart = iter.GetSkippedOffset();
   PRInt32 ourContentStart = iter.GetOriginalOffset();
 
   *aRenderedOffset = iter.ConvertOriginalToSkipped(aContentOffset + ourContentStart) -
                     ourRenderedStart;
 
@@ -2024,23 +2024,23 @@ nsresult
 HyperTextAccessible::RenderedToContentOffset(nsIFrame* aFrame, PRUint32 aRenderedOffset,
                                              PRInt32* aContentOffset)
 {
   *aContentOffset = 0;
   NS_ENSURE_TRUE(aFrame, NS_ERROR_FAILURE);
 
   NS_ASSERTION(aFrame->GetType() == nsGkAtoms::textFrame,
                "Need text frame for offset conversion");
-  NS_ASSERTION(aFrame->GetPrevContinuation() == nsnull,
+  NS_ASSERTION(aFrame->GetPrevContinuation() == nullptr,
                "Call on primary frame only");
 
   gfxSkipChars skipChars;
   gfxSkipCharsIterator iter;
   // We only need info up to skipped offset -- that is what we're converting to original offset
-  nsresult rv = aFrame->GetRenderedText(nsnull, &skipChars, &iter, 0, aRenderedOffset);
+  nsresult rv = aFrame->GetRenderedText(nullptr, &skipChars, &iter, 0, aRenderedOffset);
   NS_ENSURE_SUCCESS(rv, rv);
 
   PRUint32 ourRenderedStart = iter.GetSkippedOffset();
   PRInt32 ourContentStart = iter.GetOriginalOffset();
 
   *aContentOffset = iter.ConvertSkippedToOriginal(aRenderedOffset + ourRenderedStart) - ourContentStart;
 
   return NS_OK;
@@ -2194,17 +2194,17 @@ HyperTextAccessible::GetDOMPointByFrameO
 
 // HyperTextAccessible
 nsresult
 HyperTextAccessible::RangeBoundToHypertextOffset(nsRange* aRange,
                                                  bool aIsStartBound,
                                                  bool aIsStartHTOffset,
                                                  PRInt32* aHTOffset)
 {
-  nsINode* node = nsnull;
+  nsINode* node = nullptr;
   PRInt32 nodeOffset = 0;
 
   if (aIsStartBound) {
     node = aRange->GetStartParent();
     nodeOffset = aRange->StartOffset();
   } else {
     node = aRange->GetEndParent();
     nodeOffset = aRange->EndOffset();
--- a/accessible/src/generic/HyperTextAccessible.h
+++ b/accessible/src/generic/HyperTextAccessible.h
@@ -126,17 +126,17 @@ public:
     *                       if the passed-in offset is really in a descendant, then the offset returned
     *                       will come just after the relevant embedded object characer.
     *                       If false, then the offset is inclusive. The character indicated
     *                       by the offset returned is at [offset]. If the passed-in offset in inside a
     *                       descendant, then the returned offset will be on the relevant embedded object char.
     *
     * @return               the accessible child which contained the offset, if
     *                       it is within the current HyperTextAccessible,
-    *                       otherwise nsnull
+    *                       otherwise nullptr
     */
   Accessible* DOMPointToHypertextOffset(nsINode *aNode,
                                         PRInt32 aNodeOffset,
                                         PRInt32* aHypertextOffset,
                                         bool aIsEndOffset = false);
 
   /**
    * Turn a start and end hypertext offsets into DOM range.
@@ -173,17 +173,17 @@ public:
    * @param aShift        [in] specifies whether to get a char before/at/after
    *                        offset
    * @param aChar         [out] the character
    * @param aStartOffset  [out, optional] the start offset of the character
    * @param aEndOffset    [out, optional] the end offset of the character
    * @return               false if offset at the given shift is out of range
    */
   bool GetCharAt(PRInt32 aOffset, EGetTextType aShift, nsAString& aChar,
-                 PRInt32* aStartOffset = nsnull, PRInt32* aEndOffset = nsnull);
+                 PRInt32* aStartOffset = nullptr, PRInt32* aEndOffset = nullptr);
 
   /**
    * Return text offset of the given child accessible within hypertext
    * accessible.
    *
    * @param  aChild           [in] accessible child to get text offset for
    * @param  aInvalidateAfter [in, optional] indicates whether invalidate
    *                           cached offsets for next siblings of the child
@@ -219,17 +219,17 @@ public:
   }
 
   /**
    * Return the bounds of the text between given start and end offset.
    */
   nsIntRect GetTextBounds(PRInt32 aStartOffset, PRInt32 aEndOffset)
   {
     nsIntRect bounds;
-    GetPosAndText(aStartOffset, aEndOffset, nsnull, nsnull, &bounds);
+    GetPosAndText(aStartOffset, aEndOffset, nullptr, nullptr, &bounds);
     return bounds;
   }
 
   /**
    * Provide the line number for the caret.
    * @return 1-based index for the line number with the caret
    */
   PRInt32 CaretLineNumber();
@@ -316,21 +316,21 @@ protected:
     *                       substring
     * @param  aStartAcc     [out, optional] return the start accessible for this
     *                       substring
     * @param  aEndAcc       [out, optional] return the end accessible for this
     *                       substring
     * @return               the start frame for this substring
     */
   nsIFrame* GetPosAndText(PRInt32& aStartOffset, PRInt32& aEndOffset,
-                          nsAString *aText = nsnull,
-                          nsIFrame **aEndFrame = nsnull,
-                          nsIntRect *aBoundsRect = nsnull,
-                          Accessible** aStartAcc = nsnull,
-                          Accessible** aEndAcc = nsnull);
+                          nsAString *aText = nullptr,
+                          nsIFrame **aEndFrame = nullptr,
+                          nsIntRect *aBoundsRect = nullptr,
+                          Accessible** aStartAcc = nullptr,
+                          Accessible** aEndAcc = nullptr);
 
   nsIntRect GetBoundsForString(nsIFrame *aFrame, PRUint32 aStartRenderedOffset, PRUint32 aEndRenderedOffset);
 
   // Selection helpers
 
   /**
    * Return frame selection object for the accessible.
    */
@@ -395,13 +395,13 @@ private:
 
 ////////////////////////////////////////////////////////////////////////////////
 // Accessible downcasting method
 
 inline HyperTextAccessible*
 Accessible::AsHyperText()
 {
   return mFlags & eHyperTextAccessible ?
-    static_cast<HyperTextAccessible*>(this) : nsnull;
+    static_cast<HyperTextAccessible*>(this) : nullptr;
 }
 
 #endif
 
--- a/accessible/src/generic/ImageAccessible.cpp
+++ b/accessible/src/generic/ImageAccessible.cpp
@@ -195,38 +195,38 @@ ImageAccessible::GetAttributesInternal(n
 already_AddRefed<nsIURI>
 ImageAccessible::GetLongDescURI() const
 {
   if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::longdesc)) {
     nsGenericHTMLElement* element =
       nsGenericHTMLElement::FromContent(mContent);
     if (element) {
       nsCOMPtr<nsIURI> uri;
-      element->GetURIAttr(nsGkAtoms::longdesc, nsnull, getter_AddRefs(uri));
+      element->GetURIAttr(nsGkAtoms::longdesc, nullptr, getter_AddRefs(uri));
       return uri.forget();
     }
   }
 
   DocAccessible* document = Document();
   if (document) {
     IDRefsIterator iter(document, mContent, nsGkAtoms::aria_describedby);
     while (nsIContent* target = iter.NextElem()) {
       if ((target->IsHTML(nsGkAtoms::a) || target->IsHTML(nsGkAtoms::area)) &&
           target->HasAttr(kNameSpaceID_None, nsGkAtoms::href)) {
         nsGenericHTMLElement* element =
           nsGenericHTMLElement::FromContent(target);
 
         nsCOMPtr<nsIURI> uri;
-        element->GetURIAttr(nsGkAtoms::href, nsnull, getter_AddRefs(uri));
+        element->GetURIAttr(nsGkAtoms::href, nullptr, getter_AddRefs(uri));
         return uri.forget();
       }
     }
   }
 
-  return nsnull;
+  return nullptr;
 }
 
 bool
 ImageAccessible::IsLongDescIndex(PRUint8 aIndex)
 {
   return aIndex == LinkableAccessible::ActionCount();
 }
 
--- a/accessible/src/generic/ImageAccessible.h
+++ b/accessible/src/generic/ImageAccessible.h
@@ -79,13 +79,13 @@ private:
 
 ////////////////////////////////////////////////////////////////////////////////
 // Accessible downcasting method
 
 inline mozilla::a11y::ImageAccessible*
 Accessible::AsImage()
 {
   return IsImage() ?
-    static_cast<mozilla::a11y::ImageAccessible*>(this) : nsnull;
+    static_cast<mozilla::a11y::ImageAccessible*>(this) : nullptr;
 }
 
 #endif
 
--- a/accessible/src/generic/OuterDocAccessible.cpp
+++ b/accessible/src/generic/OuterDocAccessible.cpp
@@ -47,25 +47,25 @@ OuterDocAccessible::NativeRole()
 }
 
 Accessible*
 OuterDocAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY,
                                  EWhichChildAtPoint aWhichChild)
 {
   PRInt32 docX = 0, docY = 0, docWidth = 0, docHeight = 0;
   nsresult rv = GetBounds(&docX, &docY, &docWidth, &docHeight);
-  NS_ENSURE_SUCCESS(rv, nsnull);
+  NS_ENSURE_SUCCESS(rv, nullptr);
 
   if (aX < docX || aX >= docX + docWidth || aY < docY || aY >= docY + docHeight)
-    return nsnull;
+    return nullptr;
 
   // Always return the inner doc as direct child accessible unless bounds
   // outside of it.
   Accessible* child = GetChildAt(0);
-  NS_ENSURE_TRUE(child, nsnull);
+  NS_ENSURE_TRUE(child, nullptr);
 
   if (aWhichChild == eDeepestChild)
     return child->ChildAtPoint(aX, aY, eDeepestChild);
   return child;
 }
 
 nsresult
 OuterDocAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes)
@@ -123,17 +123,17 @@ OuterDocAccessible::Shutdown()
   // change however the presshell of underlying document isn't destroyed and
   // the document doesn't get pagehide events. Shutdown underlying document if
   // any to avoid hanging document accessible.
 #ifdef DEBUG
   if (logging::IsEnabled(logging::eDocDestroy))
     logging::OuterDocDestroy(this);
 #endif
 
-  Accessible* childAcc = mChildren.SafeElementAt(0, nsnull);
+  Accessible* childAcc = mChildren.SafeElementAt(0, nullptr);
   if (childAcc) {
 #ifdef DEBUG
     if (logging::IsEnabled(logging::eDocDestroy)) {
       logging::DocDestroy("outerdoc's child document shutdown",
                           childAcc->GetDocumentNode());
     }
 #endif
     childAcc->Shutdown();
@@ -183,17 +183,17 @@ OuterDocAccessible::AppendChild(Accessib
 #endif
 
   return true;
 }
 
 bool
 OuterDocAccessible::RemoveChild(Accessible* aAccessible)
 {
-  Accessible* child = mChildren.SafeElementAt(0, nsnull);
+  Accessible* child = mChildren.SafeElementAt(0, nullptr);
   if (child != aAccessible) {
     NS_ERROR("Wrong child to remove!");
     return false;
   }
 
 #ifdef DEBUG
   if (logging::IsEnabled(logging::eDocDestroy)) {
     logging::DocDestroy("remove document from outerdoc", child->GetDocumentNode(),
--- a/accessible/src/generic/RootAccessible.cpp
+++ b/accessible/src/generic/RootAccessible.cpp
@@ -231,17 +231,17 @@ RootAccessible::RemoveEventListeners()
   }
 
   // Do this before removing clearing caret accessible, so that it can use
   // shutdown the caret accessible's selection listener
   DocAccessible::RemoveEventListeners();
 
   if (mCaretAccessible) {
     mCaretAccessible->Shutdown();
-    mCaretAccessible = nsnull;
+    mCaretAccessible = nullptr;
   }
 
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // public
 
@@ -366,17 +366,17 @@ RootAccessible::ProcessDOMEvent(nsIDOMEv
 
     nsRefPtr<AccEvent> accEvent =
       new AccStateChangeEvent(accessible, states::CHECKED, isEnabled);
 
     nsEventShell::FireEvent(accEvent);
     return;
   }
 
-  Accessible* treeItemAcc = nsnull;
+  Accessible* treeItemAcc = nullptr;
 #ifdef MOZ_XUL
   // If it's a tree element, need the currently selected item.
   if (treeAcc) {
     treeItemAcc = accessible->CurrentItem();
     if (treeItemAcc)
       accessible = treeItemAcc;
   }
 
@@ -437,17 +437,17 @@ RootAccessible::ProcessDOMEvent(nsIDOMEv
   else if (eventType.EqualsLiteral("DOMMenuItemInactive")) {
     // Process DOMMenuItemInactive event for autocomplete only because this is
     // unique widget that may acquire focus from autocomplete popup while popup
     // stays open and has no active item. In case of XUL tree autocomplete
     // popup this event is fired for tree accessible.
     Accessible* widget =
       accessible->IsWidget() ? accessible : accessible->ContainerWidget();
     if (widget && widget->IsAutoCompletePopup()) {
-      FocusMgr()->ActiveItemChanged(nsnull);
+      FocusMgr()->ActiveItemChanged(nullptr);
       A11YDEBUG_FOCUS_ACTIVEITEMCHANGE_CAUSE("DOMMenuItemInactive", accessible)
     }
   }
   else if (eventType.EqualsLiteral("DOMMenuBarActive")) {  // Always from user input
     nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_MENU_START,
                             accessible, eFromUserInput);
 
     // Notify of active item change when menubar gets active and if it has
@@ -461,17 +461,17 @@ RootAccessible::ProcessDOMEvent(nsIDOMEv
       FocusMgr()->ActiveItemChanged(activeItem);
       A11YDEBUG_FOCUS_ACTIVEITEMCHANGE_CAUSE("DOMMenuBarActive", accessible)
     }
   }
   else if (eventType.EqualsLiteral("DOMMenuBarInactive")) {  // Always from user input
     nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_MENU_END,
                             accessible, eFromUserInput);
 
-    FocusMgr()->ActiveItemChanged(nsnull);
+    FocusMgr()->ActiveItemChanged(nullptr);
     A11YDEBUG_FOCUS_ACTIVEITEMCHANGE_CAUSE("DOMMenuBarInactive", accessible)
   }
   else if (eventType.EqualsLiteral("ValueChange")) {
     targetDocument->
       FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE,
                                  targetNode, AccEvent::eRemoveDupes);
   }
 #ifdef DEBUG_DRAGDROPSTART
@@ -604,17 +604,17 @@ RootAccessible::HandlePopupHidingEvent(n
 
   static const PRUint32 kNotifyOfFocus = 1;
   static const PRUint32 kNotifyOfState = 2;
   PRUint32 notifyOf = 0;
 
   // HTML select is target of popuphidding event. Otherwise get container
   // widget. No container widget means this is either tooltip or menupopup.
   // No events in the former case.
-  Accessible* widget = nsnull;
+  Accessible* widget = nullptr;
   if (popup->IsCombobox()) {
     widget = popup;
   } else {
     widget = popup->ContainerWidget();
     if (!widget) {
       if (!popup->IsMenuPopup())
         return;
 
@@ -652,17 +652,17 @@ RootAccessible::HandlePopupHidingEvent(n
     // container menuitem takes a focus via DOMMenuItemActive notification.
     // For menubars processing we listen DOMMenubarActive/Inactive
     // notifications.
     notifyOf = kNotifyOfFocus;
   }
 
   // Restore focus to where it was.
   if (notifyOf & kNotifyOfFocus) {
-    FocusMgr()->ActiveItemChanged(nsnull);
+    FocusMgr()->ActiveItemChanged(nullptr);
     A11YDEBUG_FOCUS_ACTIVEITEMCHANGE_CAUSE("popuphiding", popup)
   }
 
   // Fire expanded state change event.
   if (notifyOf & kNotifyOfState) {
     nsRefPtr<AccEvent> event =
       new AccStateChangeEvent(widget, states::EXPANDED, false);
     document->FireDelayedAccessibleEvent(event);
--- a/accessible/src/generic/RootAccessible.h
+++ b/accessible/src/generic/RootAccessible.h
@@ -85,12 +85,12 @@ protected:
 
 } // namespace a11y
 } // namespace mozilla
 
 inline mozilla::a11y::RootAccessible*
 Accessible::AsRoot()
 {
   return mFlags & eRootAccessible ?
-    static_cast<mozilla::a11y::RootAccessible*>(this) : nsnull;
+    static_cast<mozilla::a11y::RootAccessible*>(this) : nullptr;
 }
 
 #endif
--- a/accessible/src/generic/TableAccessible.h
+++ b/accessible/src/generic/TableAccessible.h
@@ -21,17 +21,17 @@ namespace a11y {
  */
 class TableAccessible
 {
 public:
 
   /**
    * Return the caption accessible if any for this table.
    */
-  virtual Accessible* Caption() { return nsnull; }
+  virtual Accessible* Caption() { return nullptr; }
 
   /**
    * Get the summary for this table.
    */
   virtual void Summary(nsString& aSummary) { aSummary.Truncate(); }
 
   /**
    * Return the number of columns in the table.
@@ -41,17 +41,17 @@ public:
   /**
    * Return the number of rows in the table.
    */
   virtual PRUint32 RowCount() { return 0; }
 
   /**
    * Return the accessible for the cell at the given row and column indices.
    */
-  virtual Accessible* CellAt(PRUint32 aRowIdx, PRUint32 aColIdx) { return nsnull; }
+  virtual Accessible* CellAt(PRUint32 aRowIdx, PRUint32 aColIdx) { return nullptr; }
 
   /**
    * Return the index of the cell at the given row and column.
    */
   virtual PRInt32 CellIndexAt(PRUint32 aRowIdx, PRUint32 aColIdx)
     { return ColCount() * aRowIdx + aColIdx; }
 
   /**
--- a/accessible/src/generic/TextLeafAccessible.h
+++ b/accessible/src/generic/TextLeafAccessible.h
@@ -43,13 +43,13 @@ protected:
 
 ////////////////////////////////////////////////////////////////////////////////
 // Accessible downcast method
 
 inline mozilla::a11y::TextLeafAccessible*
 Accessible::AsTextLeaf()
 {
   return mFlags & eTextLeafAccessible ?
-    static_cast<mozilla::a11y::TextLeafAccessible*>(this) : nsnull;
+    static_cast<mozilla::a11y::TextLeafAccessible*>(this) : nullptr;
 }
 
 #endif
 
--- a/accessible/src/html/HTMLFormControlAccessible.cpp
+++ b/accessible/src/html/HTMLFormControlAccessible.cpp
@@ -508,24 +508,24 @@ HTMLTextFieldAccessible::DoAction(PRUint
   return NS_ERROR_INVALID_ARG;
 }
 
 already_AddRefed<nsIEditor>
 HTMLTextFieldAccessible::GetEditor() const
 {
   nsCOMPtr<nsIDOMNSEditableElement> editableElt(do_QueryInterface(mContent));
   if (!editableElt)
-    return nsnull;
+    return nullptr;
 
   // nsGenericHTMLElement::GetEditor has a security check.
   // Make sure we're not restricted by the permissions of
   // whatever script is currently running.
   nsCOMPtr<nsIJSContextStack> stack =
     do_GetService("@mozilla.org/js/xpc/ContextStack;1");
-  bool pushed = stack && NS_SUCCEEDED(stack->Push(nsnull));
+  bool pushed = stack && NS_SUCCEEDED(stack->Push(nullptr));
 
   nsCOMPtr<nsIEditor> editor;
   editableElt->GetEditor(getter_AddRefs(editor));
 
   if (pushed) {
     JSContext* cx;
     stack->Pop(&cx);
     NS_ASSERTION(!cx, "context should be null");
@@ -541,17 +541,17 @@ bool
 HTMLTextFieldAccessible::IsWidget() const
 {
   return true;
 }
 
 Accessible*
 HTMLTextFieldAccessible::ContainerWidget() const
 {
-  return mParent && mParent->Role() == roles::AUTOCOMPLETE ? mParent : nsnull;
+  return mParent && mParent->Role() == roles::AUTOCOMPLETE ? mParent : nullptr;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLFileInputAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 HTMLFileInputAccessible::
@@ -628,17 +628,17 @@ HTMLGroupboxAccessible::GetLegend()
        legendContent = legendContent->GetNextSibling()) {
     if (legendContent->NodeInfo()->Equals(nsGkAtoms::legend,
                                           mContent->GetNameSpaceID())) {
       // Either XHTML namespace or no namespace
       return legendContent;
     }
   }
 
-  return nsnull;
+  return nullptr;
 }
 
 nsresult
 HTMLGroupboxAccessible::GetNameInternal(nsAString& aName)
 {
   nsresult rv = Accessible::GetNameInternal(aName);
   NS_ENSURE_SUCCESS(rv, rv);
 
@@ -757,17 +757,17 @@ HTMLFigureAccessible::Caption() const
   for (nsIContent* childContent = mContent->GetFirstChild(); childContent;
        childContent = childContent->GetNextSibling()) {
     if (childContent->NodeInfo()->Equals(nsGkAtoms::figcaption,
                                          mContent->GetNameSpaceID())) {
       return childContent;
     }
   }
 
-  return nsnull;
+  return nullptr;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLFigcaptionAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 HTMLFigcaptionAccessible::
   HTMLFigcaptionAccessible(nsIContent* aContent, DocAccessible* aDoc) :
--- a/accessible/src/html/HTMLImageMapAccessible.cpp
+++ b/accessible/src/html/HTMLImageMapAccessible.cpp
@@ -60,20 +60,20 @@ HTMLImageMapAccessible::AnchorAt(PRUint3
   return GetChildAt(aAnchorIndex);
 }
 
 already_AddRefed<nsIURI>
 HTMLImageMapAccessible::AnchorURIAt(PRUint32 aAnchorIndex)
 {
   Accessible* area = GetChildAt(aAnchorIndex);
   if (!area)
-    return nsnull;
+    return nullptr;
 
   nsIContent* linkContent = area->GetContent();
-  return linkContent ? linkContent->GetHrefURI() : nsnull;
+  return linkContent ? linkContent->GetHrefURI() : nullptr;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLImageMapAccessible: public
 
 void
 HTMLImageMapAccessible::UpdateChildAreas(bool aDoFireEvents)
 {
--- a/accessible/src/html/HTMLImageMapAccessible.h
+++ b/accessible/src/html/HTMLImageMapAccessible.h
@@ -78,12 +78,12 @@ protected:
 
 ////////////////////////////////////////////////////////////////////////////////
 // Accessible downcasting method
 
 inline mozilla::a11y::HTMLImageMapAccessible*
 Accessible::AsImageMap()
 {
   return IsImageMapAccessible() ?
-    static_cast<mozilla::a11y::HTMLImageMapAccessible*>(this) : nsnull;
+    static_cast<mozilla::a11y::HTMLImageMapAccessible*>(this) : nullptr;
 }
 
 #endif
--- a/accessible/src/html/HTMLLinkAccessible.cpp
+++ b/accessible/src/html/HTMLLinkAccessible.cpp
@@ -132,17 +132,17 @@ HTMLLinkAccessible::IsLink()
 {
   // Expose HyperLinkAccessible unconditionally.
   return true;
 }
 
 already_AddRefed<nsIURI>
 HTMLLinkAccessible::AnchorURIAt(PRUint32 aAnchorIndex)
 {
-  return aAnchorIndex == 0 ? mContent->GetHrefURI() : nsnull;
+  return aAnchorIndex == 0 ? mContent->GetHrefURI() : nullptr;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // Protected members
 
 bool
 HTMLLinkAccessible::IsLinked()
 {
--- a/accessible/src/html/HTMLListAccessible.cpp
+++ b/accessible/src/html/HTMLListAccessible.cpp
@@ -39,34 +39,34 @@ HTMLListAccessible::NativeState()
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLLIAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 HTMLLIAccessible::
   HTMLLIAccessible(nsIContent* aContent, DocAccessible* aDoc) :
-  HyperTextAccessibleWrap(aContent, aDoc), mBullet(nsnull)
+  HyperTextAccessibleWrap(aContent, aDoc), mBullet(nullptr)
 {
   mFlags |= eHTMLListItemAccessible;
 
   nsBlockFrame* blockFrame = do_QueryFrame(GetFrame());
   if (blockFrame && blockFrame->HasBullet()) {
     mBullet = new HTMLListBulletAccessible(mContent, mDoc);
-    if (!Document()->BindToDocument(mBullet, nsnull))
-      mBullet = nsnull;
+    if (!Document()->BindToDocument(mBullet, nullptr))
+      mBullet = nullptr;
   }
 }
 
 NS_IMPL_ISUPPORTS_INHERITED0(HTMLLIAccessible, HyperTextAccessible)
 
 void
 HTMLLIAccessible::Shutdown()
 {
-  mBullet = nsnull;
+  mBullet = nullptr;
 
   HyperTextAccessibleWrap::Shutdown();
 }
 
 role
 HTMLLIAccessible::NativeRole()
 {
   if (mContent->Tag() == nsGkAtoms::dt)
@@ -107,23 +107,23 @@ HTMLLIAccessible::UpdateBullet(bool aHas
   if (aHasBullet == !!mBullet) {
     NS_NOTREACHED("Bullet and accessible are in sync already!");
     return;
   }
 
   DocAccessible* document = Document();
   if (aHasBullet) {
     mBullet = new HTMLListBulletAccessible(mContent, mDoc);
-    if (document->BindToDocument(mBullet, nsnull)) {
+    if (document->BindToDocument(mBullet, nullptr)) {
       InsertChildAt(0, mBullet);
     }
   } else {
     RemoveChild(mBullet);
     document->UnbindFromDocument(mBullet);
-    mBullet = nsnull;
+    mBullet = nullptr;
   }
 
   // XXXtodo: fire show/hide and reorder events. That's hard to make it
   // right now because coalescence happens by DOM node.
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLLIAccessible: Accessible protected
@@ -144,17 +144,17 @@ HTMLLIAccessible::CacheChildren()
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLListBulletAccessible: nsAccessNode
 
 nsIFrame*
 HTMLListBulletAccessible::GetFrame() const
 {
   nsBlockFrame* blockFrame = do_QueryFrame(mContent->GetPrimaryFrame());
-  return blockFrame ? blockFrame->GetBullet() : nsnull;
+  return blockFrame ? blockFrame->GetBullet() : nullptr;
 }
 
 bool
 HTMLListBulletAccessible::IsPrimaryForNode() const
 {
   return false;
 }
 
--- a/accessible/src/html/HTMLListAccessible.h
+++ b/accessible/src/html/HTMLListAccessible.h
@@ -101,12 +101,12 @@ public:
 } // namespace a11y
 } // namespace mozilla
 
 
 inline mozilla::a11y::HTMLLIAccessible*
 Accessible::AsHTMLListItem()
 {
   return mFlags & eHTMLListItemAccessible ?
-    static_cast<mozilla::a11y::HTMLLIAccessible*>(this) : nsnull;
+    static_cast<mozilla::a11y::HTMLLIAccessible*>(this) : nullptr;
 }
 
 #endif
--- a/accessible/src/html/HTMLSelectAccessible.cpp
+++ b/accessible/src/html/HTMLSelectAccessible.cpp
@@ -109,17 +109,17 @@ HTMLSelectListAccessible::CurrentItem()
   if (listControlFrame) {
     nsCOMPtr<nsIContent> activeOptionNode = listControlFrame->GetCurrentOption();
     if (activeOptionNode) {
       DocAccessible* document = Document();
       if (document)
         return document->GetAccessible(activeOptionNode);
     }
   }
-  return nsnull;
+  return nullptr;
 }
 
 void
 HTMLSelectListAccessible::SetCurrentItem(Accessible* aItem)
 {
   aItem->GetContent()->SetAttr(kNameSpaceID_None,
                                nsGkAtoms::selected, NS_LITERAL_STRING("true"),
                                true);
@@ -353,17 +353,17 @@ HTMLSelectOptionAccessible::SetSelected(
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLSelectOptionAccessible: Widgets
 
 Accessible*
 HTMLSelectOptionAccessible::ContainerWidget() const
 {
-  return mParent && mParent->IsListControl() ? mParent : nsnull;
+  return mParent && mParent->IsListControl() ? mParent : nullptr;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLSelectOptGroupAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 HTMLSelectOptGroupAccessible::
   HTMLSelectOptGroupAccessible(nsIContent* aContent, DocAccessible* aDoc) :
@@ -459,17 +459,17 @@ HTMLComboboxAccessible::CacheChildren()
   if (!listFrame)
     return;
 
   if (!mListAccessible) {
     mListAccessible = 
       new HTMLComboboxListAccessible(mParent, mContent, mDoc);
 
     // Initialize and put into cache.
-    if (!Document()->BindToDocument(mListAccessible, nsnull))
+    if (!Document()->BindToDocument(mListAccessible, nullptr))
       return;
   }
 
   if (AppendChild(mListAccessible)) {
     // Cache combobox option accessibles so that we build complete accessible
     // tree for combobox.
     mListAccessible->EnsureChildren();
   }
@@ -477,17 +477,17 @@ HTMLComboboxAccessible::CacheChildren()
 
 void
 HTMLComboboxAccessible::Shutdown()
 {
   AccessibleWrap::Shutdown();
 
   if (mListAccessible) {
     mListAccessible->Shutdown();
-    mListAccessible = nsnull;
+    mListAccessible = nullptr;
   }
 }
 
 PRUint64
 HTMLComboboxAccessible::NativeState()
 {
   // As a HTMLComboboxAccessible we can have the following states:
   // FOCUSED, FOCUSABLE, HASPOPUP, EXPANDED, COLLAPSED
@@ -596,17 +596,17 @@ HTMLComboboxAccessible::AreItemsOperable
 {
   nsIComboboxControlFrame* comboboxFrame = do_QueryFrame(GetFrame());
   return comboboxFrame && comboboxFrame->IsDroppedDown();
 }
 
 Accessible*
 HTMLComboboxAccessible::CurrentItem()
 {
-  return AreItemsOperable() ? mListAccessible->CurrentItem() : nsnull;
+  return AreItemsOperable() ? mListAccessible->CurrentItem() : nullptr;
 }
 
 void
 HTMLComboboxAccessible::SetCurrentItem(Accessible* aItem)
 {
   if (AreItemsOperable())
     mListAccessible->SetCurrentItem(aItem);
 }
@@ -615,30 +615,30 @@ HTMLComboboxAccessible::SetCurrentItem(A
 // HTMLComboboxAccessible: protected
 
 Accessible*
 HTMLComboboxAccessible::SelectedOption() const
 {
   nsIFrame* frame = GetFrame();
   nsIComboboxControlFrame* comboboxFrame = do_QueryFrame(frame);
   if (!comboboxFrame)
-    return nsnull;
+    return nullptr;
 
   nsIListControlFrame* listControlFrame =
     do_QueryFrame(comboboxFrame->GetDropDown());
   if (listControlFrame) {
     nsCOMPtr<nsIContent> activeOptionNode = listControlFrame->GetCurrentOption();
     if (activeOptionNode) {
       DocAccessible* document = Document();
       if (document)
         return document->GetAccessible(activeOptionNode);
     }
   }
 
-  return nsnull;
+  return nullptr;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLComboboxListAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 HTMLComboboxListAccessible::
@@ -658,17 +658,17 @@ HTMLComboboxListAccessible::GetFrame() c
 
   if (frame) {
     nsIComboboxControlFrame* comboBox = do_QueryFrame(frame);
     if (comboBox) {
       return comboBox->GetDropDown();
     }
   }
 
-  return nsnull;
+  return nullptr;
 }
 
 bool
 HTMLComboboxListAccessible::IsPrimaryForNode() const
 {
   return false;
 }
 
@@ -700,17 +700,17 @@ HTMLComboboxListAccessible::NativeState(
 
 /**
   * Gets the bounds for the areaFrame.
   *     Walks the Frame tree and checks for proper frames.
   */
 void
 HTMLComboboxListAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame** aBoundingFrame)
 {
-  *aBoundingFrame = nsnull;
+  *aBoundingFrame = nullptr;
 
   Accessible* comboAcc = Parent();
   if (!comboAcc)
     return;
 
   if (0 == (comboAcc->State() & states::COLLAPSED)) {
     HTMLSelectListAccessible::GetBoundsRect(aBounds, aBoundingFrame);
     return;
@@ -718,17 +718,17 @@ HTMLComboboxListAccessible::GetBoundsRec
 
   // Get the first option.
   nsIContent* content = mContent->GetFirstChild();
   if (!content) {
     return;
   }
   nsIFrame* frame = content->GetPrimaryFrame();
   if (!frame) {
-    *aBoundingFrame = nsnull;
+    *aBoundingFrame = nullptr;
     return;
   }
 
   *aBoundingFrame = frame->GetParent();
   aBounds = (*aBoundingFrame)->GetRect();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
--- a/accessible/src/html/HTMLSelectAccessible.h
+++ b/accessible/src/html/HTMLSelectAccessible.h
@@ -108,30 +108,30 @@ private:
    */
   Accessible* GetSelect() const
   {
     if (mParent && mParent->IsListControl()) {
       Accessible* combobox = mParent->Parent();
       return combobox && combobox->IsCombobox() ? combobox : mParent.get();
     }
 
-    return nsnull;
+    return nullptr;
   }
 
   /**
    * Return a combobox accessible the option belongs to if any.
    */
   Accessible* GetCombobox() const
   {
     if (mParent && mParent->IsListControl()) {
       Accessible* combobox = mParent->Parent();
-      return combobox && combobox->IsCombobox() ? combobox : nsnull;
+      return combobox && combobox->IsCombobox() ? combobox : nullptr;
     }
 
-    return nsnull;
+    return nullptr;
   }
 };
 
 /*
  * Opt Groups inside the select, contained within the list
  */
 class HTMLSelectOptGroupAccessible : public HTMLSelectOptionAccessible
 {
--- a/accessible/src/html/HTMLTableAccessible.cpp
+++ b/accessible/src/html/HTMLTableAccessible.cpp
@@ -57,17 +57,17 @@ NS_IMPL_ISUPPORTS_INHERITED1(HTMLTableCe
                              nsIAccessibleTableCell)
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLTableCellAccessible: Accessible implementation
 
   void
   HTMLTableCellAccessible::Shutdown()
 {
-  mTableCell = nsnull;
+  mTableCell = nullptr;
   HyperTextAccessibleWrap::Shutdown();
 }
 
 role
 HTMLTableCellAccessible::NativeRole()
 {
   return roles::CELL;
 }
@@ -148,17 +148,17 @@ HTMLTableCellAccessible::GetAttributesIn
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLTableCellAccessible: nsIAccessibleTableCell implementation
 
 NS_IMETHODIMP
 HTMLTableCellAccessible::GetTable(nsIAccessibleTable** aTable)
 {
   NS_ENSURE_ARG_POINTER(aTable);
-  *aTable = nsnull;
+  *aTable = nullptr;
 
   if (IsDefunct())
     return NS_OK;
 
   nsCOMPtr<nsIAccessibleTable> table = GetTableAccessible();
   table.swap(*aTable);
 
   return NS_OK;
@@ -223,29 +223,29 @@ HTMLTableCellAccessible::GetRowExtent(PR
 
   return table->GetRowExtentAt(rowIdx, colIdx, aExtentCount);
 }
 
 NS_IMETHODIMP
 HTMLTableCellAccessible::GetColumnHeaderCells(nsIArray** aHeaderCells)
 {
   NS_ENSURE_ARG_POINTER(aHeaderCells);
-  *aHeaderCells = nsnull;
+  *aHeaderCells = nullptr;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   return GetHeaderCells(nsAccUtils::eColumnHeaderCells, aHeaderCells);
 }
 
 NS_IMETHODIMP
 HTMLTableCellAccessible::GetRowHeaderCells(nsIArray** aHeaderCells)
 {
   NS_ENSURE_ARG_POINTER(aHeaderCells);
-  *aHeaderCells = nsnull;
+  *aHeaderCells = nullptr;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   return GetHeaderCells(nsAccUtils::eRowHeaderCells, aHeaderCells);
 }
 
 NS_IMETHODIMP
@@ -271,32 +271,32 @@ HTMLTableCellAccessible::IsSelected(bool
 
 already_AddRefed<nsIAccessibleTable>
 HTMLTableCellAccessible::GetTableAccessible()
 {
   Accessible* parent = this;
   while ((parent = parent->Parent())) {
     roles::Role role = parent->Role();
     if (role == roles::TABLE || role == roles::TREE_TABLE) {
-      nsIAccessibleTable* tableAcc = nsnull;
+      nsIAccessibleTable* tableAcc = nullptr;
       CallQueryInterface(parent, &tableAcc);
       return tableAcc;
     }
   }
 
-  return nsnull;
+  return nullptr;
 }
 
 nsITableCellLayout*
 HTMLTableCellAccessible::GetCellLayout()
 {
   nsIFrame *frame = mContent->GetPrimaryFrame();
   NS_ASSERTION(frame, "The frame cannot be obtaied for HTML table cell.");
   if (!frame)
-    return nsnull;
+    return nullptr;
 
   nsITableCellLayout *cellLayout = do_QueryFrame(frame);
   return cellLayout;
 }
 
 nsresult
 HTMLTableCellAccessible::GetCellIndexes(PRInt32& aRowIndex, PRInt32& aColIndex)
 {
@@ -360,17 +360,17 @@ HTMLTableHeaderCellAccessible::
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLTableHeaderCellAccessible: Accessible implementation
 
 role
 HTMLTableHeaderCellAccessible::NativeRole()
 {
   // Check value of @scope attribute.
   static nsIContent::AttrValuesArray scopeValues[] =
-    {&nsGkAtoms::col, &nsGkAtoms::row, nsnull};
+    {&nsGkAtoms::col, &nsGkAtoms::row, nullptr};
   PRInt32 valueIdx =
     mContent->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::scope,
                               scopeValues, eCaseMatters);
 
   switch (valueIdx) {
     case 0:
       return roles::COLUMNHEADER;
     case 1:
@@ -423,34 +423,34 @@ NS_IMPL_ISUPPORTS_INHERITED1(HTMLTableAc
                              nsIAccessibleTable)
 
 ////////////////////////////////////////////////////////////////////////////////
 //nsAccessNode
 
 void
 HTMLTableAccessible::Shutdown()
 {
-  mTable = nsnull;
+  mTable = nullptr;
   AccessibleWrap::Shutdown();
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLTableAccessible: Accessible implementation
 
 void
 HTMLTableAccessible::CacheChildren()
 {
   // Move caption accessible so that it's the first child. Check for the first
   // caption only, because nsAccessibilityService ensures we don't create
   // accessibles for the other captions, since only the first is actually
   // visible.
   nsAccTreeWalker walker(mDoc, mContent, CanHaveAnonChildren());
 
-  Accessible* child = nsnull;
+  Accessible* child = nullptr;
   while ((child = walker.NextChild())) {
     if (child->Role() == roles::CAPTION) {
       InsertChildAt(0, child);
       while ((child = walker.NextChild()) && AppendChild(child));
       break;
     }
     AppendChild(child);
   }
@@ -520,18 +520,18 @@ HTMLTableAccessible::RelationByType(PRUi
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLTableAccessible: nsIAccessibleTable implementation
 
 Accessible*
 HTMLTableAccessible::Caption()
 {
-  Accessible* child = mChildren.SafeElementAt(0, nsnull);
-  return child && child->Role() == roles::CAPTION ? child : nsnull;
+  Accessible* child = mChildren.SafeElementAt(0, nullptr);
+  return child && child->Role() == roles::CAPTION ? child : nullptr;
 }
 
 void
 HTMLTableAccessible::Summary(nsString& aSummary)
 {
   nsCOMPtr<nsIDOMHTMLTableElement> table(do_QueryInterface(mContent));
 
   if (table)
@@ -700,27 +700,27 @@ HTMLTableAccessible::SelectedRowIndices(
 }
 
 Accessible*
 HTMLTableAccessible::CellAt(PRUint32 aRowIndex, PRUint32 aColumnIndex)
 { 
   nsCOMPtr<nsIDOMElement> cellElement;
   GetCellAt(aRowIndex, aColumnIndex, *getter_AddRefs(cellElement));
   if (!cellElement)
-    return nsnull;
+    return nullptr;
 
   nsCOMPtr<nsIContent> cellContent(do_QueryInterface(cellElement));
   if (!cellContent)
-    return nsnull;
+    return nullptr;
 
   Accessible* cell = mDoc->GetAccessible(cellContent);
 
   // XXX bug 576838: crazy tables (like table6 in tables/test_table2.html) may
   // return itself as a cell what makes Orca hang.
-  return cell == this ? nsnull : cell;
+  return cell == this ? nullptr : cell;
 }
 
 PRInt32
 HTMLTableAccessible::CellIndexAt(PRUint32 aRowIdx, PRUint32 aColIdx)
 {
   nsITableLayout* tableLayout = GetTableLayout();
 
   PRInt32 index = -1;
@@ -973,17 +973,17 @@ HTMLTableAccessible::RemoveRowsOrColumns
                                                   endRowIdx, endColIdx);
 }
 
 nsITableLayout*
 HTMLTableAccessible::GetTableLayout()
 {
   nsIFrame *frame = mContent->GetPrimaryFrame();
   if (!frame)
-    return nsnull;
+    return nullptr;
 
   nsITableLayout *tableLayout = do_QueryFrame(frame);
   return tableLayout;
 }
 
 nsresult
 HTMLTableAccessible::GetCellAt(PRInt32 aRowIndex, PRInt32 aColIndex,
                                nsIDOMElement*& aCell)
--- a/accessible/src/mac/mozAccessible.mm
+++ b/accessible/src/mac/mozAccessible.mm
@@ -679,17 +679,17 @@ GetClosestInterestingAccessible(id anObj
 }
 
 - (void)expire
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   [self invalidateChildren];
 
-  mGeckoAccessible = nsnull;
+  mGeckoAccessible = nullptr;
   
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 - (BOOL)isExpired
 {
   return !mGeckoAccessible;
 }
--- a/accessible/src/mac/mozActionElements.mm
+++ b/accessible/src/mac/mozActionElements.mm
@@ -339,19 +339,19 @@ enum CheckboxValue {
 @implementation mozPaneAccessible
 
 - (NSArray*)children
 {
   if (!mGeckoAccessible)
     return nil;
 
   nsDeckFrame* deckFrame = do_QueryFrame(mGeckoAccessible->GetFrame());
-  nsIFrame* selectedFrame = deckFrame ? deckFrame->GetSelectedBox() : nsnull;
+  nsIFrame* selectedFrame = deckFrame ? deckFrame->GetSelectedBox() : nullptr;
 
-  Accessible* selectedAcc = nsnull;
+  Accessible* selectedAcc = nullptr;
   if (selectedFrame) {
     nsINode* node = selectedFrame->GetContent();
     selectedAcc = mGeckoAccessible->Document()->GetAccessible(node);
   }
 
   if (selectedAcc) {
     mozAccessible *curNative = GetNativeFromGeckoAccessible(selectedAcc);
     if (curNative)
--- a/accessible/src/mac/mozTextAccessible.mm
+++ b/accessible/src/mac/mozTextAccessible.mm
@@ -313,17 +313,17 @@ ToNSString(id aValue)
 
   return nil;
 }
 
 - (void)expire
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
-  mGeckoTextAccessible = nsnull;
+  mGeckoTextAccessible = nullptr;
   NS_IF_RELEASE(mGeckoEditableTextAccessible);
   [super expire];
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 #pragma mark -
 
--- a/accessible/src/msaa/AccessibleWrap.cpp
+++ b/accessible/src/msaa/AccessibleWrap.cpp
@@ -460,17 +460,17 @@ AccessibleWrap::get_accState(
   // are the same states as MSAA.
   // Note: we map the following Gecko states to different MSAA states:
   //   REQUIRED -> ALERT_LOW
   //   ALERT -> ALERT_MEDIUM
   //   INVALID -> ALERT_HIGH
   //   CHECKABLE -> MARQUEED
 
   PRUint32 msaaState = 0;
-  nsAccUtils::To32States(xpAccessible->State(), &msaaState, nsnull);
+  nsAccUtils::To32States(xpAccessible->State(), &msaaState, nullptr);
   pvarState->lVal = msaaState;
 } __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return S_OK;
 }
 
 
 STDMETHODIMP
 AccessibleWrap::get_accHelp(
@@ -866,17 +866,17 @@ AccessibleWrap::accNavigate(
   if (!accessible)
     return E_INVALIDARG;
 
   if (accessible->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   VariantInit(pvarEndUpAt);
 
-  Accessible* navAccessible = nsnull;
+  Accessible* navAccessible = nullptr;
   PRUint32 xpRelation = 0;
 
   switch(navDir) {
     case NAVDIR_FIRSTCHILD:
       if (!nsAccUtils::MustPrune(accessible))
         navAccessible = accessible->FirstChild();
       break;
     case NAVDIR_LASTCHILD:
@@ -1615,17 +1615,17 @@ AccessibleWrap::GetChildIDFor(Accessible
 }
 
 HWND
 AccessibleWrap::GetHWNDFor(Accessible* aAccessible)
 {
   if (aAccessible) {
     DocAccessible* document = aAccessible->Document();
     if(!document)
-      return nsnull;
+      return nullptr;
 
     // Popup lives in own windows, use its HWND until the popup window is
     // hidden to make old JAWS versions work with collapsed comboboxes (see
     // discussion in bug 379678).
     nsIFrame* frame = aAccessible->GetFrame();
     if (frame) {
       nsIWidget* widget = frame->GetNearestWidget();
       if (widget && widget->IsVisible()) {
@@ -1640,17 +1640,17 @@ AccessibleWrap::GetHWNDFor(Accessible* a
           if (rootWidget != widget)
             return static_cast<HWND>(widget->GetNativeData(NS_NATIVE_WINDOW));
         }
       }
     }
 
     return static_cast<HWND>(document->GetNativeWindow());
   }
-  return nsnull;
+  return nullptr;
 }
 
 HRESULT
 AccessibleWrap::ConvertToIA2Attributes(nsIPersistentProperties *aAttributes,
                                        BSTR *aIA2Attributes)
 {
   *aIA2Attributes = NULL;
 
@@ -1714,33 +1714,33 @@ AccessibleWrap::ConvertToIA2Attributes(n
 IDispatch*
 AccessibleWrap::NativeAccessible(nsIAccessible* aAccessible)
 {
   if (!aAccessible) {
    NS_WARNING("Not passing in an aAccessible");
    return NULL;
   }
 
-  IAccessible* msaaAccessible = nsnull;
+  IAccessible* msaaAccessible = nullptr;
   aAccessible->GetNativeInterface(reinterpret_cast<void**>(&msaaAccessible));
   return static_cast<IDispatch*>(msaaAccessible);
 }
 
 Accessible*
 AccessibleWrap::GetXPAccessibleFor(const VARIANT& aVarChild)
 {
   if (aVarChild.vt != VT_I4)
-    return nsnull;
+    return nullptr;
 
   // if its us real easy - this seems to always be the case
   if (aVarChild.lVal == CHILDID_SELF)
     return this;
 
   if (nsAccUtils::MustPrune(this))
-    return nsnull;
+    return nullptr;
 
   // If lVal negative then it is treated as child ID and we should look for
   // accessible through whole accessible subtree including subdocuments.
   // Otherwise we treat lVal as index in parent.
 
   if (aVarChild.lVal < 0) {
     // Convert child ID to unique ID.
     void* uniqueID = reinterpret_cast<void*>(-aVarChild.lVal);
@@ -1752,26 +1752,26 @@ AccessibleWrap::GetXPAccessibleFor(const
     // ARIA document.
     if (ARIARole() == roles::DOCUMENT) {
       DocAccessible* document = Document();
       Accessible* child =
         document->GetAccessibleByUniqueIDInSubtree(uniqueID);
 
       // Check whether the accessible for the given ID is a child of ARIA
       // document.
-      Accessible* parent = child ? child->Parent() : nsnull;
+      Accessible* parent = child ? child->Parent() : nullptr;
       while (parent && parent != document) {
         if (parent == this)
           return child;
 
         parent = parent->Parent();
       }
     }
 
-    return nsnull;
+    return nullptr;
   }
 
   // Gecko child indices are 0-based in contrast to indices used in MSAA.
   return GetChildAt(aVarChild.lVal - 1);
 }
 
 void
 AccessibleWrap::UpdateSystemCaret()
--- a/accessible/src/msaa/ApplicationAccessibleWrap.cpp
+++ b/accessible/src/msaa/ApplicationAccessibleWrap.cpp
@@ -20,17 +20,17 @@ using namespace mozilla::a11y;
 // nsISupports
 NS_IMPL_ISUPPORTS_INHERITED0(ApplicationAccessibleWrap,
                              ApplicationAccessible)
 
 NS_IMETHODIMP
 ApplicationAccessibleWrap::GetAttributes(nsIPersistentProperties** aAttributes)
 {
   NS_ENSURE_ARG_POINTER(aAttributes);
-  *aAttributes = nsnull;
+  *aAttributes = nullptr;
 
   nsCOMPtr<nsIPersistentProperties> attributes =
     do_CreateInstance(NS_PERSISTENTPROPERTIES_CONTRACTID);
   NS_ENSURE_STATE(attributes);
 
   nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
   if (gfxInfo) {
     bool isD2DEnabled = false;
--- a/accessible/src/msaa/CAccessibleTable.cpp
+++ b/accessible/src/msaa/CAccessibleTable.cpp
@@ -746,17 +746,17 @@ CAccessibleTable::GetSelectedItems(long 
   *aItemsCount = 0;
 
   nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryObject(this));
   NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
   if (!tableAcc)
     return E_FAIL;
 
   PRUint32 size = 0;
-  PRInt32 *items = nsnull;
+  PRInt32 *items = nullptr;
 
   nsresult rv = NS_OK;
   switch (aType) {
     case ITEMSTYPE_CELLS:
       rv = tableAcc->GetSelectedCellIndices(&size, &items);
       break;
     case ITEMSTYPE_COLUMNS:
       rv = tableAcc->GetSelectedColumnIndices(&size, &items);
--- a/accessible/src/msaa/DocAccessibleWrap.cpp
+++ b/accessible/src/msaa/DocAccessibleWrap.cpp
@@ -223,17 +223,17 @@ DocAccessibleWrap::Shutdown()
   // Do window emulation specific shutdown if emulation was started.
   if (nsWinUtils::IsWindowEmulationStarted()) {
     // Destroy window created for root document.
     if (nsCoreUtils::IsTabDocument(mDocument)) {
       sHWNDCache.Remove(mHWND);
       ::DestroyWindow(static_cast<HWND>(mHWND));
     }
 
-    mHWND = nsnull;
+    mHWND = nullptr;
   }
 
   DocAccessible::Shutdown();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // DocAccessible public
 
--- a/accessible/src/msaa/TextLeafAccessibleWrap.cpp
+++ b/accessible/src/msaa/TextLeafAccessibleWrap.cpp
@@ -38,17 +38,17 @@ STDMETHODIMP_(ULONG)
 TextLeafAccessibleWrap::Release()
 {
   return nsAccessNode::Release();
 }
 
 STDMETHODIMP
 TextLeafAccessibleWrap::QueryInterface(REFIID iid, void** ppv)
 {
-  *ppv = nsnull;
+  *ppv = nullptr;
 
   if (IID_IUnknown == iid) {
     *ppv = static_cast<ISimpleDOMText*>(this);
   } else if (IID_ISimpleDOMText == iid) {
     statistics::ISimpleDOMUsed();
     *ppv = static_cast<ISimpleDOMText*>(this);
   } else {
     return AccessibleWrap::QueryInterface(iid, ppv);
@@ -172,21 +172,21 @@ TextLeafAccessibleWrap::scrollToSubstrin
 }
 
 nsIFrame*
 TextLeafAccessibleWrap::GetPointFromOffset(nsIFrame* aContainingFrame, 
                                            PRInt32 aOffset, 
                                            bool aPreferNext, 
                                            nsPoint& aOutPoint)
 {
-  nsIFrame *textFrame = nsnull;
+  nsIFrame *textFrame = nullptr;
   PRInt32 outOffset;
   aContainingFrame->GetChildFrameContainingOffset(aOffset, aPreferNext, &outOffset, &textFrame);
   if (!textFrame) {
-    return nsnull;
+    return nullptr;
   }
 
   textFrame->GetPointFromOffset(aOffset, &aOutPoint);
   return textFrame;
 }
 
 /*
  * Given an offset, the x, y, width, and height values are filled appropriately.
--- a/accessible/src/msaa/ia2AccessibleRelation.cpp
+++ b/accessible/src/msaa/ia2AccessibleRelation.cpp
@@ -14,17 +14,17 @@
 
 #include "AccessibleRelation_i.c"
 
 using namespace mozilla::a11y;
 
 ia2AccessibleRelation::ia2AccessibleRelation(PRUint32 aType, Relation* aRel) :
   mType(aType), mReferences(0)
 {
-  Accessible* target = nsnull;
+  Accessible* target = nullptr;
   while ((target = aRel->Next()))
     mTargets.AppendElement(target);
 }
 
 // IUnknown
 
 STDMETHODIMP
 ia2AccessibleRelation::QueryInterface(REFIID iid, void** ppv)
--- a/accessible/src/msaa/nsAccessNodeWrap.cpp
+++ b/accessible/src/msaa/nsAccessNodeWrap.cpp
@@ -23,17 +23,17 @@
 #include "nsIFrame.h"
 #include "nsINameSpaceManager.h"
 #include "nsPIDOMWindow.h"
 #include "nsIServiceManager.h"
 
 using namespace mozilla;
 using namespace mozilla::a11y;
 
-AccTextChangeEvent* nsAccessNodeWrap::gTextEvent = nsnull;
+AccTextChangeEvent* nsAccessNodeWrap::gTextEvent = nullptr;
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccessNodeWrap
 ////////////////////////////////////////////////////////////////////////////////
 
 nsAccessNodeWrap::
   nsAccessNodeWrap(nsIContent* aContent, DocAccessible* aDoc) :
   nsAccessNode(aContent, aDoc)
@@ -61,17 +61,17 @@ nsAccessNodeWrap::QueryNativeInterface(R
 }
 
 //-----------------------------------------------------
 // IUnknown interface methods - see iunknown.h for documentation
 //-----------------------------------------------------
 
 STDMETHODIMP nsAccessNodeWrap::QueryInterface(REFIID iid, void** ppv)
 {
-  *ppv = nsnull;
+  *ppv = nullptr;
 
   if (IID_IUnknown == iid) {
     *ppv = static_cast<ISimpleDOMNode*>(this);
   } else if (IID_ISimpleDOMNode == iid) {
     statistics::ISimpleDOMUsed();
     *ppv = static_cast<ISimpleDOMNode*>(this);
   } else {
     return E_NOINTERFACE;      //iid not supported.
@@ -79,17 +79,17 @@ STDMETHODIMP nsAccessNodeWrap::QueryInte
    
   (reinterpret_cast<IUnknown*>(*ppv))->AddRef(); 
   return S_OK;
 }
 
 STDMETHODIMP
 nsAccessNodeWrap::QueryService(REFGUID guidService, REFIID iid, void** ppv)
 {
-  *ppv = nsnull;
+  *ppv = nullptr;
 
   // Provide a special service ID for getting the accessible for the browser tab
   // document that contains this accessible object. If this accessible object
   // is not inside a browser tab then the service fails with E_NOINTERFACE.
   // A use case for this is for screen readers that need to switch context or
   // 'virtual buffer' when focus moves from one browser tab area to another.
   static const GUID SID_IAccessibleContentDocument =
     { 0xa5d8e1f3,0x3571,0x4d8f,0x95,0x21,0x07,0xed,0x28,0xfb,0x07,0x2e };
@@ -170,18 +170,18 @@ STDMETHODIMP nsAccessNodeWrap::get_nodeI
     /* [out] */ BSTR __RPC_FAR *aNodeName,
     /* [out] */ short __RPC_FAR *aNameSpaceID,
     /* [out] */ BSTR __RPC_FAR *aNodeValue,
     /* [out] */ unsigned int __RPC_FAR *aNumChildren,
     /* [out] */ unsigned int __RPC_FAR *aUniqueID,
     /* [out] */ unsigned short __RPC_FAR *aNodeType)
 {
 __try{
-  *aNodeName = nsnull;
-  *aNodeValue = nsnull;
+  *aNodeName = nullptr;
+  *aNodeValue = nullptr;
 
   nsINode* node = GetNode();
   if (!node)
     return E_FAIL;
 
   nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(node));
 
   PRUint16 nodeType = 0;
@@ -230,17 +230,17 @@ STDMETHODIMP nsAccessNodeWrap::get_attri
     return E_FAIL;
 
   PRUint32 numAttribs = mContent->GetAttrCount();
   if (numAttribs > aMaxAttribs)
     numAttribs = aMaxAttribs;
   *aNumAttribs = static_cast<unsigned short>(numAttribs);
 
   for (PRUint32 index = 0; index < numAttribs; index++) {
-    aNameSpaceIDs[index] = 0; aAttribValues[index] = aAttribNames[index] = nsnull;
+    aNameSpaceIDs[index] = 0; aAttribValues[index] = aAttribNames[index] = nullptr;
     nsAutoString attributeValue;
 
     const nsAttrName* name = mContent->GetAttrNameAt(index);
     aNameSpaceIDs[index] = static_cast<short>(name->NamespaceID());
     aAttribNames[index] = ::SysAllocString(name->LocalName()->GetUTF16String());
     mContent->GetAttr(name->NamespaceID(), name->LocalName(), attributeValue);
     aAttribValues[index] = ::SysAllocString(attributeValue.get());
   }
@@ -262,17 +262,17 @@ STDMETHODIMP nsAccessNodeWrap::get_attri
 
   nsCOMPtr<nsIDOMElement> domElement(do_QueryInterface(mContent));
   nsCOMPtr<nsINameSpaceManager> nameSpaceManager =
     do_GetService(NS_NAMESPACEMANAGER_CONTRACTID);
 
   PRInt32 index;
 
   for (index = 0; index < aNumAttribs; index++) {
-    aAttribValues[index] = nsnull;
+    aAttribValues[index] = nullptr;
     if (aAttribNames[index]) {
       nsAutoString attributeValue, nameSpaceURI;
       nsAutoString attributeName(nsDependentString(static_cast<PRUnichar*>(aAttribNames[index])));
       nsresult rv;
 
       if (aNameSpaceID[index]>0 && 
         NS_SUCCEEDED(nameSpaceManager->GetNameSpaceURI(aNameSpaceID[index], nameSpaceURI)))
           rv = domElement->GetAttributeNS(nameSpaceURI, attributeName, attributeValue);
@@ -373,17 +373,17 @@ nsAccessNodeWrap::MakeAccessNode(nsINode
   if (!aNode)
     return NULL;
 
   nsAccessNodeWrap *newNode = NULL;
 
   ISimpleDOMNode *iNode = NULL;
   Accessible* acc = mDoc->GetAccessible(aNode);
   if (acc) {
-    IAccessible *msaaAccessible = nsnull;
+    IAccessible *msaaAccessible = nullptr;
     acc->GetNativeInterface((void**)&msaaAccessible); // addrefs
     msaaAccessible->QueryInterface(IID_ISimpleDOMNode, (void**)&iNode); // addrefs
     msaaAccessible->Release(); // Release IAccessible
   }
   else {
     nsCOMPtr<nsIContent> content(do_QueryInterface(aNode));
     if (!content) {
       NS_NOTREACHED("The node is a document which is not accessible!");
@@ -472,34 +472,34 @@ STDMETHODIMP nsAccessNodeWrap::get_nextS
   return S_OK;
 }
 
 STDMETHODIMP 
 nsAccessNodeWrap::get_childAt(unsigned aChildIndex,
                               ISimpleDOMNode __RPC_FAR *__RPC_FAR *aNode)
 {
 __try {
-  *aNode = nsnull;
+  *aNode = nullptr;
 
   nsINode* node = GetNode();
   if (!node)
     return E_FAIL;
 
   *aNode = MakeAccessNode(node->GetChildAt(aChildIndex));
 
 } __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
 
   return S_OK;
 }
 
 STDMETHODIMP 
 nsAccessNodeWrap::get_innerHTML(BSTR __RPC_FAR *aInnerHTML)
 {
 __try {
-  *aInnerHTML = nsnull;
+  *aInnerHTML = nullptr;
 
   nsCOMPtr<nsIDOMHTMLElement> htmlElement = do_QueryInterface(GetNode());
   if (!htmlElement)
     return E_FAIL; // Node already shut down
 
   nsAutoString innerHTML;
   htmlElement->GetInnerHTML(innerHTML);
   if (innerHTML.IsEmpty())
--- a/accessible/src/msaa/nsHTMLWin32ObjectAccessible.cpp
+++ b/accessible/src/msaa/nsHTMLWin32ObjectAccessible.cpp
@@ -25,17 +25,17 @@ nsHTMLWin32ObjectOwnerAccessible::
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLWin32ObjectOwnerAccessible: nsAccessNode implementation
 
 void
 nsHTMLWin32ObjectOwnerAccessible::Shutdown()
 {
   AccessibleWrap::Shutdown();
-  mNativeAccessible = nsnull;
+  mNativeAccessible = nullptr;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLWin32ObjectOwnerAccessible: Accessible implementation
 
 role
 nsHTMLWin32ObjectOwnerAccessible::NativeRole()
 {
@@ -61,17 +61,17 @@ nsHTMLWin32ObjectOwnerAccessible::CacheC
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLWin32ObjectAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsHTMLWin32ObjectAccessible::nsHTMLWin32ObjectAccessible(void* aHwnd) :
-  LeafAccessible(nsnull, nsnull)
+  LeafAccessible(nullptr, nullptr)
 {
   // XXX: Mark it as defunct to make sure no single Accessible method is
   // running on it. We need to allow accessible without DOM nodes.
   mFlags |= eIsDefunct;
 
   mHwnd = aHwnd;
   if (mHwnd) {
     // The plugin is not windowless. In this situation we use 
--- a/accessible/src/msaa/nsWinUtils.cpp
+++ b/accessible/src/msaa/nsWinUtils.cpp
@@ -24,23 +24,23 @@ using namespace mozilla::a11y;
 // tab windows.
 const PRUnichar* kPropNameTabContent = L"AccessibleTabWindow";
 
 already_AddRefed<nsIDOMCSSStyleDeclaration>
 nsWinUtils::GetComputedStyleDeclaration(nsIContent* aContent)
 {
   nsIContent* elm = nsCoreUtils::GetDOMElementFor(aContent);
   if (!elm)
-    return nsnull;
+    return nullptr;
 
   // Returns number of items in style declaration
   nsCOMPtr<nsIDOMWindow> window =
     do_QueryInterface(elm->OwnerDoc()->GetWindow());
   if (!window)
-    return nsnull;
+    return nullptr;
 
   nsCOMPtr<nsIDOMCSSStyleDeclaration> cssDecl;
   nsCOMPtr<nsIDOMElement> domElement(do_QueryInterface(elm));
   window->GetComputedStyle(domElement, EmptyString(), getter_AddRefs(cssDecl));
   return cssDecl.forget();
 }
 
 HRESULT
--- a/accessible/src/xforms/nsXFormsAccessible.cpp
+++ b/accessible/src/xforms/nsXFormsAccessible.cpp
@@ -24,17 +24,17 @@
 #include "nsINodeList.h"
 
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXFormsAccessibleBase
 ////////////////////////////////////////////////////////////////////////////////
 
-nsIXFormsUtilityService *nsXFormsAccessibleBase::sXFormsService = nsnull;
+nsIXFormsUtilityService *nsXFormsAccessibleBase::sXFormsService = nullptr;
 
 nsXFormsAccessibleBase::nsXFormsAccessibleBase()
 {
   if (!sXFormsService) {
     nsresult rv = CallGetService("@mozilla.org/xforms-utility-service;1",
                                  &sXFormsService);
     if (NS_FAILED(rv))
       NS_WARNING("No XForms utility service.");
@@ -266,17 +266,17 @@ nsXFormsEditableAccessible::GetEditor() 
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXFormsSelectableAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXFormsSelectableAccessible::
   nsXFormsSelectableAccessible(nsIContent* aContent, DocAccessible* aDoc) :
-  nsXFormsEditableAccessible(aContent, aDoc), mIsSelect1Element(nsnull)
+  nsXFormsEditableAccessible(aContent, aDoc), mIsSelect1Element(nullptr)
 {
   mIsSelect1Element =
     mContent->NodeInfo()->Equals(nsGkAtoms::select1);
 }
 
 bool
 nsXFormsSelectableAccessible::IsSelect()
 {
@@ -284,60 +284,60 @@ nsXFormsSelectableAccessible::IsSelect()
 }
 
 already_AddRefed<nsIArray>
 nsXFormsSelectableAccessible::SelectedItems()
 {
   nsCOMPtr<nsIMutableArray> selectedItems =
     do_CreateInstance(NS_ARRAY_CONTRACTID);
   if (!selectedItems)
-    return nsnull;
+    return nullptr;
 
   nsresult rv;
   nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
 
   if (mIsSelect1Element) {
     nsCOMPtr<nsIDOMNode> itemDOMNode;
     rv = sXFormsService->GetSelectedItemForSelect1(DOMNode,
                                                    getter_AddRefs(itemDOMNode));
     if (NS_FAILED(rv) || !itemDOMNode || !mDoc)
-      return nsnull;
+      return nullptr;
 
     nsCOMPtr<nsINode> itemNode(do_QueryInterface(itemDOMNode));
     nsIAccessible* item = mDoc->GetAccessible(itemNode);
     if (item)
       selectedItems->AppendElement(item, false);
 
-    nsIMutableArray* items = nsnull;
+    nsIMutableArray* items = nullptr;
     selectedItems.forget(&items);
     return items;
   }
 
   nsCOMPtr<nsIDOMNodeList> itemNodeList;
   rv = sXFormsService->GetSelectedItemsForSelect(DOMNode,
                                                  getter_AddRefs(itemNodeList));
   if (NS_FAILED(rv) || !itemNodeList || !mDoc)
-    return nsnull;
+    return nullptr;
 
   PRUint32 length = 0;
   itemNodeList->GetLength(&length);
 
   for (PRUint32 index = 0; index < length; index++) {
     nsCOMPtr<nsIDOMNode> itemDOMNode;
     itemNodeList->Item(index, getter_AddRefs(itemDOMNode));
     if (!itemDOMNode)
-      return nsnull;
+      return nullptr;
 
     nsCOMPtr<nsINode> itemNode(do_QueryInterface(itemDOMNode));
     nsIAccessible* item = mDoc->GetAccessible(itemNode);
     if (item)
       selectedItems->AppendElement(item, false);
   }
 
-  nsIMutableArray* items = nsnull;
+  nsIMutableArray* items = nullptr;
   selectedItems.forget(&items);
   return items;
 }
 
 PRUint32
 nsXFormsSelectableAccessible::SelectedItemCount()
 {
   nsresult rv;
@@ -385,52 +385,52 @@ nsXFormsSelectableAccessible::RemoveItem
     return false;
 
   nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
   if (mIsSelect1Element) {
     nsCOMPtr<nsIDOMNode> selItemDOMNode;
     sXFormsService->GetSelectedItemForSelect1(DOMNode,
                                               getter_AddRefs(selItemDOMNode));
     if (selItemDOMNode == itemDOMNode)
-      sXFormsService->SetSelectedItemForSelect1(DOMNode, nsnull);
+      sXFormsService->SetSelectedItemForSelect1(DOMNode, nullptr);
 
     return true;
   }
 
   sXFormsService->RemoveItemFromSelectionForSelect(DOMNode, itemDOMNode);
   return true;
 }
 
 Accessible*
 nsXFormsSelectableAccessible::GetSelectedItem(PRUint32 aIndex)
 {
   if (!mDoc)
-    return nsnull;
+    return nullptr;
 
   nsresult rv;
   nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
   if (mIsSelect1Element) {
     if (aIndex != 0)
-      return nsnull;
+      return nullptr;
 
     nsCOMPtr<nsIDOMNode> itemDOMNode;
     rv = sXFormsService->GetSelectedItemForSelect1(DOMNode,
                                                    getter_AddRefs(itemDOMNode));
     if (NS_SUCCEEDED(rv) && itemDOMNode) {
       nsCOMPtr<nsINode> itemNode(do_QueryInterface(itemDOMNode));
       return mDoc->GetAccessible(itemNode);
     }
-    return nsnull;
+    return nullptr;
   }
 
   nsCOMPtr<nsIDOMNodeList> itemNodeList;
   rv = sXFormsService->GetSelectedItemsForSelect(DOMNode,
                                                  getter_AddRefs(itemNodeList));
   if (NS_FAILED(rv) || !itemNodeList)
-    return nsnull;
+    return nullptr;
 
   nsCOMPtr<nsIDOMNode> itemDOMNode;
   itemNodeList->Item(aIndex, getter_AddRefs(itemDOMNode));
 
   nsCOMPtr<nsINode> itemNode(do_QueryInterface(itemDOMNode));
   return mDoc->GetAccessible(itemNode);
 }
 
@@ -454,17 +454,17 @@ nsXFormsSelectableAccessible::IsItemSele
   return isSelected;
 }
 
 bool
 nsXFormsSelectableAccessible::UnselectAll()
 {
   nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
   if (mIsSelect1Element)
-    sXFormsService->SetSelectedItemForSelect1(DOMNode, nsnull);
+    sXFormsService->SetSelectedItemForSelect1(DOMNode, nullptr);
 
   sXFormsService->ClearSelectionForSelect(DOMNode);
   return true;
 }
 
 bool
 nsXFormsSelectableAccessible::SelectAll()
 {
@@ -495,17 +495,17 @@ nsXFormsSelectableAccessible::GetItemByI
       } else if (nodeInfo->Equals(nsGkAtoms::choices)) {
         nsIContent* itemContent = GetItemByIndex(aIndex, child);
         if (itemContent)
           return itemContent;
       }
     }
   }
 
-  return nsnull;
+  return nullptr;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXFormsSelectableItemAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXFormsSelectableItemAccessible::
--- a/accessible/src/xforms/nsXFormsAccessible.h
+++ b/accessible/src/xforms/nsXFormsAccessible.h
@@ -66,17 +66,17 @@ protected:
 
   // Cache accessible child item/choices elements. For example, the method is
   // used for full appearance select/select1 elements or for their child choices
   // element. Note, those select/select1 elements that use native widget
   // for representation don't use the method since their item/choices elements
   // are hidden and therefore aren't accessible.
   //
   // @param aContainerNode - node that contains item elements
-  void CacheSelectChildren(nsIDOMNode *aContainerNode = nsnull);
+  void CacheSelectChildren(nsIDOMNode *aContainerNode = nullptr);
 };
 
 
 /**
  * This class is accessible object for XForms elements that provide accessible
  * object for itself as well for anonymous content. You should use this class
  * if accessible XForms element is complex, i.e. it is composed from elements
  * that should be accessible too. Especially for elements that have multiple
@@ -135,17 +135,17 @@ public:
   virtual bool IsItemSelected(PRUint32 aIndex);
   virtual bool AddItemToSelection(PRUint32 aIndex);
   virtual bool RemoveItemFromSelection(PRUint32 aIndex);
   virtual bool SelectAll();
   virtual bool UnselectAll();
 
 protected:
   nsIContent* GetItemByIndex(PRUint32* aIndex,
-                             Accessible* aAccessible = nsnull);
+                             Accessible* aAccessible = nullptr);
 
   bool mIsSelect1Element;
 };
 
 
 /**
  * The class is base for accessible objects for XForms item elements.
  */
--- a/accessible/src/xpcom/nsAccEvent.cpp
+++ b/accessible/src/xpcom/nsAccEvent.cpp
@@ -26,27 +26,27 @@ nsAccEvent::GetEventType(PRUint32* aEven
   *aEventType = mEvent->GetEventType();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAccEvent::GetAccessible(nsIAccessible** aAccessible)
 {
   NS_ENSURE_ARG_POINTER(aAccessible);
-  *aAccessible = nsnull;
+  *aAccessible = nullptr;
 
   NS_IF_ADDREF(*aAccessible = mEvent->GetAccessible());
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAccEvent::GetDOMNode(nsIDOMNode** aDOMNode)
 {
   NS_ENSURE_ARG_POINTER(aDOMNode);
-  *aDOMNode = nsnull;
+  *aDOMNode = nullptr;
 
   nsINode* node = mEvent->GetNode();
   if (node)
     CallQueryInterface(node, aDOMNode);
 
   return NS_OK;
 }
 
--- a/accessible/src/xpcom/nsAccessibleRelation.cpp
+++ b/accessible/src/xpcom/nsAccessibleRelation.cpp
@@ -13,17 +13,17 @@
 
 using namespace mozilla::a11y;
 
 nsAccessibleRelation::nsAccessibleRelation(PRUint32 aType,
                                            Relation* aRel) :
   mType(aType)
 {
   mTargets = do_CreateInstance(NS_ARRAY_CONTRACTID);
-  nsIAccessible* targetAcc = nsnull;
+  nsIAccessible* targetAcc = nullptr;
   while ((targetAcc = aRel->Next()))
     mTargets->AppendElement(targetAcc, false);
 }
 
 // nsISupports
 NS_IMPL_ISUPPORTS1(nsAccessibleRelation, nsIAccessibleRelation)
 
 // nsIAccessibleRelation
--- a/accessible/src/xpcom/xpcAccessibleTable.cpp
+++ b/accessible/src/xpcom/xpcAccessibleTable.cpp
@@ -13,17 +13,17 @@
 #include "nsComponentManagerUtils.h"
 
 static const PRUint32 XPC_TABLE_DEFAULT_SIZE = 40;
 
 nsresult
 xpcAccessibleTable::GetCaption(nsIAccessible** aCaption)
 {
   NS_ENSURE_ARG_POINTER(aCaption);
-  *aCaption = nsnull;
+  *aCaption = nullptr;
   if (!mTable)
     return NS_ERROR_FAILURE;
 
   NS_IF_ADDREF(*aCaption = mTable->Caption());
   return NS_OK;
 }
 
 nsresult
@@ -52,17 +52,17 @@ xpcAccessibleTable::GetRowCount(PRInt32*
   return NS_OK;
 }
 
 nsresult
 xpcAccessibleTable::GetCellAt(PRInt32 aRowIdx, PRInt32 aColIdx,
                               nsIAccessible** aCell)
 {
   NS_ENSURE_ARG_POINTER(aCell);
-  *aCell = nsnull;
+  *aCell = nullptr;
 
   if (!mTable)
     return NS_ERROR_FAILURE;
 
   if (aRowIdx < 0 || static_cast<PRUint32>(aRowIdx) >= mTable->RowCount() ||
       aColIdx < 0 || static_cast<PRUint32>(aColIdx) >= mTable->ColCount())
     return NS_ERROR_INVALID_ARG;
 
@@ -245,17 +245,17 @@ xpcAccessibleTable::GetSelectedRowCount(
   *aSelectedRowCount = mTable->SelectedRowCount();
   return NS_OK;
 }
 
 nsresult
 xpcAccessibleTable::GetSelectedCells(nsIArray** aSelectedCells)
 {
   NS_ENSURE_ARG_POINTER(aSelectedCells);
-  *aSelectedCells = nsnull;
+  *aSelectedCells = nullptr;
 
   if (!mTable)
     return NS_ERROR_FAILURE;
 
   nsresult rv = NS_OK;
   nsCOMPtr<nsIMutableArray> selCells = 
     do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
--- a/accessible/src/xul/XULAlertAccessible.cpp
+++ b/accessible/src/xul/XULAlertAccessible.cpp
@@ -53,10 +53,10 @@ XULAlertAccessible::IsWidget() const
 }
 
 Accessible*
 XULAlertAccessible::ContainerWidget() const
 {
   // If a part of colorpicker widget.
   if (mParent && mParent->IsMenuButton())
     return mParent;
-  return nsnull;
+  return nullptr;
 }
--- a/accessible/src/xul/XULColorPickerAccessible.cpp
+++ b/accessible/src/xul/XULColorPickerAccessible.cpp
@@ -72,17 +72,17 @@ Accessible*
 XULColorPickerTileAccessible::ContainerWidget() const
 {
   Accessible* parent = Parent();
   if (parent) {
     Accessible* grandParent = parent->Parent();
     if (grandParent && grandParent->IsMenuButton())
       return grandParent;
   }
-  return nsnull;
+  return nullptr;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULColorPickerAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 XULColorPickerAccessible::
   XULColorPickerAccessible(nsIContent* aContent, DocAccessible* aDoc) :
@@ -120,17 +120,17 @@ bool
 XULColorPickerAccessible::IsActiveWidget() const
 {
   return FocusMgr()->HasDOMFocus(mContent);
 }
 
 bool
 XULColorPickerAccessible::AreItemsOperable() const
 {
-  Accessible* menuPopup = mChildren.SafeElementAt(0, nsnull);
+  Accessible* menuPopup = mChildren.SafeElementAt(0, nullptr);
   if (menuPopup) {
     nsMenuPopupFrame* menuPopupFrame = do_QueryFrame(menuPopup->GetFrame());
     return menuPopupFrame && menuPopupFrame->IsOpen();
   }
   return false;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -138,17 +138,17 @@ XULColorPickerAccessible::AreItemsOperab
 
 void
 XULColorPickerAccessible::CacheChildren()
 {
   NS_ENSURE_TRUE(mDoc,);
 
   nsAccTreeWalker walker(mDoc, mContent, true);
 
-  Accessible* child = nsnull;
+  Accessible* child = nullptr;
   while ((child = walker.NextChild())) {
     PRUint32 role = child->Role();
 
     // Get an accessible for menupopup or panel elements.
     if (role == roles::ALERT) {
       AppendChild(child);
       return;
     }
--- a/accessible/src/xul/XULElementAccessibles.cpp
+++ b/accessible/src/xul/XULElementAccessibles.cpp
@@ -205,23 +205,23 @@ XULLinkAccessible::EndOffset()
     return Accessible::EndOffset();
   return IndexInParent() + 1;
 }
 
 already_AddRefed<nsIURI>
 XULLinkAccessible::AnchorURIAt(PRUint32 aAnchorIndex)
 {
   if (aAnchorIndex != 0)
-    return nsnull;
+    return nullptr;
 
   nsAutoString href;
   mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::href, href);
 
   nsCOMPtr<nsIURI> baseURI = mContent->GetBaseURI();
   nsIDocument* document = mContent->OwnerDoc();
 
-  nsIURI* anchorURI = nsnull;
+  nsIURI* anchorURI = nullptr;
   NS_NewURI(&anchorURI, href,
             document->GetDocumentCharacterSet().get(),
             baseURI);
 
   return anchorURI;
 }
--- a/accessible/src/xul/XULFormControlAccessible.cpp
+++ b/accessible/src/xul/XULFormControlAccessible.cpp
@@ -138,31 +138,31 @@ XULButtonAccessible::IsActiveWidget() co
 {
   return FocusMgr()->HasDOMFocus(mContent);
 }
 
 bool
 XULButtonAccessible::AreItemsOperable() const
 {
   if (IsMenuButton()) {
-    Accessible* menuPopup = mChildren.SafeElementAt(0, nsnull);
+    Accessible* menuPopup = mChildren.SafeElementAt(0, nullptr);
     if (menuPopup) {
       nsMenuPopupFrame* menuPopupFrame = do_QueryFrame(menuPopup->GetFrame());
       return menuPopupFrame->IsOpen();
     }
   }
   return false; // no items
 }
 
 Accessible*
 XULButtonAccessible::ContainerWidget() const
 {
   if (IsMenuButton() && mParent && mParent->IsAutoComplete())
     return mParent;
-  return nsnull;
+  return nullptr;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULButtonAccessible: Accessible protected
 
 void
 XULButtonAccessible::CacheChildren()
 {
@@ -181,22 +181,22 @@ XULButtonAccessible::CacheChildren()
     false :
     mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
                           nsGkAtoms::menuButton, eCaseMatters);
 
   NS_ENSURE_TRUE(mDoc,);
   if (!isMenu && !isMenuButton)
     return;
 
-  Accessible* menupopup = nsnull;
-  Accessible* button = nsnull;
+  Accessible* menupopup = nullptr;
+  Accessible* button = nullptr;
 
   nsAccTreeWalker walker(mDoc, mContent, true);
 
-  Accessible* child = nsnull;
+  Accessible* child = nullptr;
   while ((child = walker.NextChild())) {
     roles::Role role = child->Role();
 
     if (role == roles::MENUPOPUP) {
       // Get an accessible for menupopup or panel elements.
       menupopup = child;
 
     } else if (isMenuButton && role == roles::PUSHBUTTON) {
@@ -221,17 +221,17 @@ XULButtonAccessible::CacheChildren()
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULButtonAccessible protected
 
 bool
 XULButtonAccessible::ContainsMenu()
 {
   static nsIContent::AttrValuesArray strings[] =
-    {&nsGkAtoms::menu, &nsGkAtoms::menuButton, nsnull};
+    {&nsGkAtoms::menu, &nsGkAtoms::menuButton, nullptr};
 
   return mContent->FindAttrValueIn(kNameSpaceID_None,
                                    nsGkAtoms::type,
                                    strings, eCaseMatters) >= 0;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULDropmarkerAccessible
@@ -438,17 +438,17 @@ XULGroupboxAccessible::RelationByType(PR
   // The xul:label has an accessible object but the xul:caption does not
   PRUint32 childCount = ChildCount();
   for (PRUint32 childIdx = 0; childIdx < childCount; childIdx++) {
     Accessible* childAcc = GetChildAt(childIdx);
     if (childAcc->Role() == roles::LABEL) {
       // Ensure that it's our label
       Relation reverseRel =
         childAcc->RelationByType(nsIAccessibleRelation::RELATION_LABEL_FOR);
-      Accessible* testGroupbox = nsnull;
+      Accessible* testGroupbox = nullptr;
       while ((testGroupbox = reverseRel.Next()))
         if (testGroupbox == this) {
           // The <label> points back to this groupbox
           rel.AppendTarget(childAcc);
         }
     }
   }
 
@@ -806,17 +806,17 @@ XULTextFieldAccessible::CanHaveAnonChild
 }
 
 already_AddRefed<nsIEditor>
 XULTextFieldAccessible::GetEditor() const
 {
   nsCOMPtr<nsIContent> inputField = GetInputField();
   nsCOMPtr<nsIDOMNSEditableElement> editableElt(do_QueryInterface(inputField));
   if (!editableElt)
-    return nsnull;
+    return nullptr;
 
   nsCOMPtr<nsIEditor> editor;
   editableElt->GetEditor(getter_AddRefs(editor));
   return editor.forget();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULTextFieldAccessible: Accessible protected
@@ -828,29 +828,29 @@ XULTextFieldAccessible::CacheChildren()
   // Create child accessibles for native anonymous content of underlying HTML
   // input element.
   nsCOMPtr<nsIContent> inputContent(GetInputField());
   if (!inputContent)
     return;
 
   nsAccTreeWalker walker(mDoc, inputContent, false);
 
-  Accessible* child = nsnull;
+  Accessible* child = nullptr;
   while ((child = walker.NextChild()) && AppendChild(child));
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULTextFieldAccessible: HyperTextAccessible protected
 
 already_AddRefed<nsFrameSelection>
 XULTextFieldAccessible::FrameSelection()
 {
   nsCOMPtr<nsIContent> inputContent(GetInputField());
   nsIFrame* frame = inputContent->GetPrimaryFrame();
-  return frame ? frame->GetFrameSelection() : nsnull;
+  return frame ? frame->GetFrameSelection() : nullptr;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULTextFieldAccessible protected
 
 already_AddRefed<nsIContent>
 XULTextFieldAccessible::GetInputField() const
 {
@@ -863,14 +863,14 @@ XULTextFieldAccessible::GetInputField() 
     // <xul:menulist droppable="false">
     nsCOMPtr<nsIDOMXULMenuListElement> menuList = do_QueryInterface(mContent);
     if (menuList)
       menuList->GetInputField(getter_AddRefs(inputFieldDOMNode));
   }
 
   NS_ASSERTION(inputFieldDOMNode, "No input field for XULTextFieldAccessible");
 
-  nsIContent* inputField = nsnull;
+  nsIContent* inputField = nullptr;
   if (inputFieldDOMNode)
     CallQueryInterface(inputFieldDOMNode, &inputField);
 
   return inputField;
 }
--- a/accessible/src/xul/XULListboxAccessible.cpp
+++ b/accessible/src/xul/XULListboxAccessible.cpp
@@ -131,17 +131,17 @@ XULListboxAccessible::QueryInterface(REF
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 //nsAccessNode
 
 void
 XULListboxAccessible::Shutdown()
 {
-  mTable = nsnull;
+  mTable = nullptr;
   XULSelectControlAccessible::Shutdown();
 }
 
 bool
 XULListboxAccessible::IsMulticolumn()
 {
   PRInt32 numColumns = 0;
   nsresult rv = GetColumnCount(&numColumns);
@@ -204,17 +204,17 @@ XULListboxAccessible::NativeRole()
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULListboxAccessible. nsIAccessibleTable
 
 PRUint32
 XULListboxAccessible::ColCount()
 {
-  nsIContent* headContent = nsnull;
+  nsIContent* headContent = nullptr;
   for (nsIContent* childContent = mContent->GetFirstChild(); childContent;
        childContent = childContent->GetNextSibling()) {
     if (childContent->NodeInfo()->Equals(nsGkAtoms::listcols,
                                          kNameSpaceID_XUL)) {
       headContent = childContent;
     }
   }
   if (!headContent)
@@ -244,29 +244,29 @@ XULListboxAccessible::RowCount()
   return itemCount;
 }
 
 Accessible*
 XULListboxAccessible::CellAt(PRUint32 aRowIndex, PRUint32 aColumnIndex)
 { 
   nsCOMPtr<nsIDOMXULSelectControlElement> control =
     do_QueryInterface(mContent);
-  NS_ENSURE_TRUE(control, nsnull);
+  NS_ENSURE_TRUE(control, nullptr);
 
   nsCOMPtr<nsIDOMXULSelectControlItemElement> item;
   control->GetItemAtIndex(aRowIndex, getter_AddRefs(item));
   if (!item)
-    return nsnull;
+    return nullptr;
 
   nsCOMPtr<nsIContent> itemContent(do_QueryInterface(item));
   if (!itemContent)
-    return nsnull;
+    return nullptr;
 
   Accessible* row = mDoc->GetAccessible(itemContent);
-  NS_ENSURE_TRUE(row, nsnull);
+  NS_ENSURE_TRUE(row, nullptr);
 
   return row->GetChildAt(aColumnIndex);
 }
 
 bool
 XULListboxAccessible::IsColSelected(PRUint32 aColIdx)
 {
   nsCOMPtr<nsIDOMXULMultiSelectControlElement> control =
@@ -555,22 +555,22 @@ XULListboxAccessible::ContainerWidget() 
     if (menuListElm) {
       nsCOMPtr<nsIDOMNode> inputElm;
       menuListElm->GetInputField(getter_AddRefs(inputElm));
       if (inputElm) {
         nsCOMPtr<nsINode> inputNode = do_QueryInterface(inputElm);
         if (inputNode) {
           Accessible* input = 
             mDoc->GetAccessible(inputNode);
-          return input ? input->ContainerWidget() : nsnull;
+          return input ? input->ContainerWidget() : nullptr;
         }
       }
     }
   }
-  return nsnull;
+  return nullptr;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULListitemAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 XULListitemAccessible::
   XULListitemAccessible(nsIContent* aContent, DocAccessible* aDoc) :
@@ -583,29 +583,29 @@ XULListitemAccessible::
 }
 
 NS_IMPL_ISUPPORTS_INHERITED0(XULListitemAccessible, Accessible)
 
 Accessible* 
 XULListitemAccessible::GetListAccessible()
 {
   if (IsDefunct())
-    return nsnull;
+    return nullptr;
   
   nsCOMPtr<nsIDOMXULSelectControlItemElement> listItem =
     do_QueryInterface(mContent);
   if (!listItem)
-    return nsnull;
+    return nullptr;
 
   nsCOMPtr<nsIDOMXULSelectControlElement> list;
   listItem->GetControl(getter_AddRefs(list));
 
   nsCOMPtr<nsIContent> listContent(do_QueryInterface(list));
   if (!listContent)
-    return nsnull;
+    return nullptr;
 
   return mDoc->GetAccessible(listContent);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULListitemAccessible Accessible
 
 void
@@ -740,17 +740,17 @@ NS_IMPL_ISUPPORTS_INHERITED1(XULListCell
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULListCellAccessible: nsIAccessibleTableCell implementation
 
 NS_IMETHODIMP
 XULListCellAccessible::GetTable(nsIAccessibleTable** aTable)
 {
   NS_ENSURE_ARG_POINTER(aTable);
-  *aTable = nsnull;
+  *aTable = nullptr;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   Accessible* thisRow = Parent();
   if (!thisRow || thisRow->Role() != roles::ROW)
     return NS_OK;
 
@@ -843,27 +843,27 @@ XULListCellAccessible::GetRowExtent(PRIn
   *aExtentCount = 1;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 XULListCellAccessible::GetColumnHeaderCells(nsIArray** aHeaderCells)
 {
   NS_ENSURE_ARG_POINTER(aHeaderCells);
-  *aHeaderCells = nsnull;
+  *aHeaderCells = nullptr;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsCOMPtr<nsIAccessibleTable> table;
   GetTable(getter_AddRefs(table));
   NS_ENSURE_STATE(table); // we expect to be in a listbox (table)
 
   // Get column header cell from XUL listhead.
-  Accessible* list = nsnull;
+  Accessible* list = nullptr;
 
   nsRefPtr<Accessible> tableAcc(do_QueryObject(table));
   PRUint32 tableChildCount = tableAcc->ChildCount();
   for (PRUint32 childIdx = 0; childIdx < tableChildCount; childIdx++) {
     Accessible* child = tableAcc->GetChildAt(childIdx);
     if (child->Role() == roles::LIST) {
       list = child;
       break;
@@ -892,17 +892,17 @@ XULListCellAccessible::GetColumnHeaderCe
                                        nsAccUtils::eColumnHeaderCells,
                                        aHeaderCells);
 }
 
 NS_IMETHODIMP
 XULListCellAccessible::GetRowHeaderCells(nsIArray** aHeaderCells)
 {
   NS_ENSURE_ARG_POINTER(aHeaderCells);
-  *aHeaderCells = nsnull;
+  *aHeaderCells = nullptr;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsCOMPtr<nsIAccessibleTable> table;
   GetTable(getter_AddRefs(table));
   NS_ENSURE_STATE(table); // we expect to be in a listbox (table)
 
@@ -932,17 +932,17 @@ XULListCellAccessible::IsSelected(bool* 
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULListCellAccessible. Accessible implementation
 
 void
 XULListCellAccessible::Shutdown()
 {
-  mTableCell = nsnull;
+  mTableCell = nullptr;
   HyperTextAccessibleWrap::Shutdown();
 }
 
 role
 XULListCellAccessible::NativeRole()
 {
   return roles::CELL;
 }
--- a/accessible/src/xul/XULMenuAccessible.cpp
+++ b/accessible/src/xul/XULMenuAccessible.cpp
@@ -55,17 +55,17 @@ XULMenuitemAccessible::NativeState()
     if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::open))
       state |= states::EXPANDED;
     else
       state |= states::COLLAPSED;
   }
 
   // Checkable/checked?
   static nsIContent::AttrValuesArray strings[] =
-    { &nsGkAtoms::radio, &nsGkAtoms::checkbox, nsnull };
+    { &nsGkAtoms::radio, &nsGkAtoms::checkbox, nullptr };
 
   if (mContent->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::type, strings,
                                 eCaseMatters) >= 0) {
 
     // Checkable?
     state |= states::CHECKABLE;
 
     // Checked?
@@ -369,17 +369,17 @@ XULMenuitemAccessible::ContainerWidget()
       // a menupoup or parent menu item
       if (menuParent->IsMenu())
         return mParent;
 
       // otherwise it's different kind of popups (like panel or tooltip), it
       // shouldn't be a real case.
     }
   }
-  return nsnull;
+  return nullptr;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULMenuSeparatorAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 XULMenuSeparatorAccessible::
@@ -531,40 +531,40 @@ XULMenupopupAccessible::ContainerWidget(
 {
   DocAccessible* document = Document();
 
   nsMenuPopupFrame* menuPopupFrame = do_QueryFrame(GetFrame());
   while (menuPopupFrame) {
     Accessible* menuPopup =
       document->GetAccessible(menuPopupFrame->GetContent());
     if (!menuPopup) // shouldn't be a real case
-      return nsnull;
+      return nullptr;
 
     nsMenuFrame* menuFrame = menuPopupFrame->GetParentMenu();
     if (!menuFrame) // context menu or popups
-      return nsnull;
+      return nullptr;
 
     nsMenuParent* menuParent = menuFrame->GetMenuParent();
     if (!menuParent) // menulist or menubutton
       return menuPopup->Parent();
 
     if (menuParent->IsMenuBar()) { // menubar menu
       nsMenuBarFrame* menuBarFrame = static_cast<nsMenuBarFrame*>(menuParent);
       return document->GetAccessible(menuBarFrame->GetContent());
     }
 
     // different kind of popups like panel or tooltip
     if (!menuParent->IsMenu())
-      return nsnull;
+      return nullptr;
 
     menuPopupFrame = static_cast<nsMenuPopupFrame*>(menuParent);
   }
 
   NS_NOTREACHED("Shouldn't be a real case.");
-  return nsnull;
+  return nullptr;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULMenubarAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 XULMenubarAccessible::
   XULMenubarAccessible(nsIContent* aContent, DocAccessible* aDoc) :
@@ -607,16 +607,16 @@ XULMenubarAccessible::CurrentItem()
   nsMenuBarFrame* menuBarFrame = do_QueryFrame(GetFrame());
   if (menuBarFrame) {
     nsMenuFrame* menuFrame = menuBarFrame->GetCurrentMenuItem();
     if (menuFrame) {
       nsIContent* menuItemNode = menuFrame->GetContent();
       return mDoc->GetAccessible(menuItemNode);
     }
   }
-  return nsnull;
+  return nullptr;
 }
 
 void
 XULMenubarAccessible::SetCurrentItem(Accessible* aItem)
 {
   NS_ERROR("XULMenubarAccessible::SetCurrentItem not implemented");
 }
--- a/accessible/src/xul/XULSelectControlAccessible.cpp
+++ b/accessible/src/xul/XULSelectControlAccessible.cpp
@@ -35,17 +35,17 @@ XULSelectControlAccessible::
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULSelectControlAccessible: nsAccessNode
 
 void
 XULSelectControlAccessible::Shutdown()
 {
-  mSelectControl = nsnull;
+  mSelectControl = nullptr;
   AccessibleWrap::Shutdown();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULSelectControlAccessible: SelectAccessible
 
 bool
 XULSelectControlAccessible::IsSelect()
@@ -55,17 +55,17 @@ XULSelectControlAccessible::IsSelect()
 
 // Interface methods
 already_AddRefed<nsIArray>
 XULSelectControlAccessible::SelectedItems()
 {
   nsCOMPtr<nsIMutableArray> selectedItems =
     do_CreateInstance(NS_ARRAY_CONTRACTID);
   if (!selectedItems || !mDoc)
-    return nsnull;
+    return nullptr;
 
   // For XUL multi-select control
   nsCOMPtr<nsIDOMXULMultiSelectControlElement> xulMultiSelect =
     do_QueryInterface(mSelectControl);
   if (xulMultiSelect) {
     PRInt32 length = 0;
     xulMultiSelect->GetSelectedCount(&length);
     for (PRInt32 index = 0; index < length; index++) {
@@ -84,17 +84,17 @@ XULSelectControlAccessible::SelectedItem
       if(itemNode) {
         Accessible* item = mDoc->GetAccessible(itemNode);
         if (item)
           selectedItems->AppendElement(static_cast<nsIAccessible*>(item),
                                      false);
       }
   }
 
-  nsIMutableArray* items = nsnull;
+  nsIMutableArray* items = nullptr;
   selectedItems.forget(&items);
   return items;
 }
 
 Accessible*
 XULSelectControlAccessible::GetSelectedItem(PRUint32 aIndex)
 {
   nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
@@ -102,17 +102,17 @@ XULSelectControlAccessible::GetSelectedI
 
   nsCOMPtr<nsIDOMXULSelectControlItemElement> itemElm;
   if (multiSelectControl)
     multiSelectControl->GetSelectedItem(aIndex, getter_AddRefs(itemElm));
   else if (aIndex == 0)
     mSelectControl->GetSelectedItem(getter_AddRefs(itemElm));
 
   nsCOMPtr<nsINode> itemNode(do_QueryInterface(itemElm));
-  return itemNode && mDoc ? mDoc->GetAccessible(itemNode) : nsnull;
+  return itemNode && mDoc ? mDoc->GetAccessible(itemNode) : nullptr;
 }
 
 PRUint32
 XULSelectControlAccessible::SelectedItemCount()
 {
   // For XUL multi-select control
   nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
     do_QueryInterface(mSelectControl);
@@ -174,17 +174,17 @@ XULSelectControlAccessible::RemoveItemFr
     return true;
 
   nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
     do_QueryInterface(mSelectControl);
 
   if (multiSelectControl)
     multiSelectControl->RemoveItemFromSelection(itemElm);
   else
-    mSelectControl->SetSelectedItem(nsnull);
+    mSelectControl->SetSelectedItem(nullptr);
 
   return true;
 }
 
 bool
 XULSelectControlAccessible::IsItemSelected(PRUint32 aIndex)
 {
   Accessible* item = GetChildAt(aIndex);
@@ -228,17 +228,17 @@ XULSelectControlAccessible::SelectAll()
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULSelectControlAccessible: Widgets
 
 Accessible*
 XULSelectControlAccessible::CurrentItem()
 {
   if (!mSelectControl)
-    return nsnull;
+    return nullptr;
 
   nsCOMPtr<nsIDOMXULSelectControlItemElement> currentItemElm;
   nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelectControl =
     do_QueryInterface(mSelectControl);
   if (multiSelectControl)
     multiSelectControl->GetCurrentItem(getter_AddRefs(currentItemElm));
   else
     mSelectControl->GetSelectedItem(getter_AddRefs(currentItemElm));
@@ -248,17 +248,17 @@ XULSelectControlAccessible::CurrentItem(
     DOMNode = do_QueryInterface(currentItemElm);
 
   if (DOMNode) {
     DocAccessible* document = Document();
     if (document)
       return document->GetAccessible(DOMNode);
   }
 
-  return nsnull;
+  return nullptr;
 }
 
 void
 XULSelectControlAccessible::SetCurrentItem(Accessible* aItem)
 {
   if (!mSelectControl)
     return;
 
--- a/accessible/src/xul/XULTreeAccessible.cpp
+++ b/accessible/src/xul/XULTreeAccessible.cpp
@@ -146,18 +146,18 @@ void
 XULTreeAccessible::Shutdown()
 {
   // XXX: we don't remove accessible from document cache if shutdown wasn't
   // initiated by document destroying. Note, we can't remove accessible from
   // document cache here while document is going to be shutdown. Note, this is
   // not unique place where we have similar problem.
   ClearCache(mAccessibleCache);
 
-  mTree = nsnull;
-  mTreeView = nsnull;
+  mTree = nullptr;
+  mTreeView = nullptr;
 
   AccessibleWrap::Shutdown();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULTreeAccessible: Accessible implementation (put methods here)
 
 role
@@ -179,23 +179,23 @@ XULTreeAccessible::NativeRole()
 // XULTreeAccessible: Accessible implementation (DON'T put methods here)
 
 Accessible*
 XULTreeAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY,
                                 EWhichChildAtPoint aWhichChild)
 {
   nsIFrame *frame = GetFrame();
   if (!frame)
-    return nsnull;
+    return nullptr;
 
   nsPresContext *presContext = frame->PresContext();
   nsIPresShell* presShell = presContext->PresShell();
 
   nsIFrame *rootFrame = presShell->GetRootFrame();
-  NS_ENSURE_TRUE(rootFrame, nsnull);
+  NS_ENSURE_TRUE(rootFrame, nullptr);
 
   nsIntRect rootRect = rootFrame->GetScreenRect();
 
   PRInt32 clientX = presContext->DevPixelsToIntCSSPixels(aX) - rootRect.x;
   PRInt32 clientY = presContext->DevPixelsToIntCSSPixels(aY) - rootRect.y;
 
   PRInt32 row = -1;
   nsCOMPtr<nsITreeColumn> column;
@@ -229,65 +229,65 @@ XULTreeAccessible::IsSelect()
 {
   return true;
 }
 
 Accessible*
 XULTreeAccessible::CurrentItem()
 {
   if (!mTreeView)
-    return nsnull;
+    return nullptr;
 
   nsCOMPtr<nsITreeSelection> selection;
   mTreeView->GetSelection(getter_AddRefs(selection));
   if (selection) {
     PRInt32 currentIndex = -1;
     selection->GetCurrentIndex(&currentIndex);
     if (currentIndex >= 0)
       return GetTreeItemAccessible(currentIndex);
   }
 
-  return nsnull;
+  return nullptr;
 }
 
 void
 XULTreeAccessible::SetCurrentItem(Accessible* aItem)
 {
   NS_ERROR("XULTreeAccessible::SetCurrentItem not implemented");
 }
 
 already_AddRefed<nsIArray>
 XULTreeAccessible::SelectedItems()
 {
   if (!mTreeView)
-    return nsnull;
+    return nullptr;
 
   nsCOMPtr<nsITreeSelection> selection;
   mTreeView->GetSelection(getter_AddRefs(selection));
   if (!selection)
-    return nsnull;
+    return nullptr;
 
   nsCOMPtr<nsIMutableArray> selectedItems =
     do_CreateInstance(NS_ARRAY_CONTRACTID);
   if (!selectedItems)
-    return nsnull;
+    return nullptr;
 
   PRInt32 rangeCount = 0;
   selection->GetRangeCount(&rangeCount);
   for (PRInt32 rangeIdx = 0; rangeIdx < rangeCount; rangeIdx++) {
     PRInt32 firstIdx = 0, lastIdx = -1;
     selection->GetRangeAt(rangeIdx, &firstIdx, &lastIdx);
     for (PRInt32 rowIdx = firstIdx; rowIdx <= lastIdx; rowIdx++) {
       nsIAccessible* item = GetTreeItemAccessible(rowIdx);
       if (item)
         selectedItems->AppendElement(item, false);
     }
   }
 
-  nsIMutableArray* items = nsnull;
+  nsIMutableArray* items = nullptr;
   selectedItems.forget(&items);
   return items;
 }
 
 PRUint32
 XULTreeAccessible::SelectedItemCount()
 {
   if (!mTreeView)
@@ -372,38 +372,38 @@ XULTreeAccessible::UnselectAll()
   selection->ClearSelection();
   return true;
 }
 
 Accessible*
 XULTreeAccessible::GetSelectedItem(PRUint32 aIndex)
 {
   if (!mTreeView)
-    return nsnull;
+    return nullptr;
 
   nsCOMPtr<nsITreeSelection> selection;
   mTreeView->GetSelection(getter_AddRefs(selection));
   if (!selection)
-    return nsnull;
+    return nullptr;
 
   PRUint32 selCount = 0;
   PRInt32 rangeCount = 0;
   selection->GetRangeCount(&rangeCount);
   for (PRInt32 rangeIdx = 0; rangeIdx < rangeCount; rangeIdx++) {
     PRInt32 firstIdx = 0, lastIdx = -1;
     selection->GetRangeAt(rangeIdx, &firstIdx, &lastIdx);
     for (PRInt32 rowIdx = firstIdx; rowIdx <= lastIdx; rowIdx++) {
       if (selCount == aIndex)
         return GetTreeItemAccessible(rowIdx);
 
       selCount++;
     }
   }
 
-  return nsnull;
+  return nullptr;
 }
 
 bool
 XULTreeAccessible::SelectAll()
 {
   // see if we are multiple select if so set ourselves as such
   if (!mTreeView)
     return false;
@@ -504,53 +504,53 @@ XULTreeAccessible::ContainerWidget() con
     if (menuListElm) {
       nsCOMPtr<nsIDOMNode> inputElm;
       menuListElm->GetInputField(getter_AddRefs(inputElm));
       if (inputElm) {
         nsCOMPtr<nsINode> inputNode = do_QueryInterface(inputElm);
         if (inputNode) {
           Accessible* input = 
             mDoc->GetAccessible(inputNode);
-          return input ? input->ContainerWidget() : nsnull;
+          return input ? input->ContainerWidget() : nullptr;
         }
       }
     }
   }
-  return nsnull;
+  return nullptr;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULTreeAccessible: public implementation
 
 Accessible*
 XULTreeAccessible::GetTreeItemAccessible(PRInt32 aRow)
 {
   if (aRow < 0 || IsDefunct() || !mTreeView)
-    return nsnull;
+    return nullptr;
 
   PRInt32 rowCount = 0;
   nsresult rv = mTreeView->GetRowCount(&rowCount);
   if (NS_FAILED(rv) || aRow >= rowCount)
-    return nsnull;
+    return nullptr;
 
   void *key = reinterpret_cast<void*>(aRow);
   Accessible* cachedTreeItem = mAccessibleCache.GetWeak(key);
   if (cachedTreeItem)
     return cachedTreeItem;
 
   nsRefPtr<Accessible> treeItem = CreateTreeItemAccessible(aRow);
   if (treeItem) {
     mAccessibleCache.Put(key, treeItem);
-    if (Document()->BindToDocument(treeItem, nsnull))
+    if (Document()->BindToDocument(treeItem, nullptr))
       return treeItem;
 
     mAccessibleCache.Remove(key);
   }
 
-  return nsnull;
+  return nullptr;
 }
 
 void
 XULTreeAccessible::InvalidateCache(PRInt32 aRow, PRInt32 aCount)
 {
   if (IsDefunct())
     return;
 
@@ -728,17 +728,17 @@ NS_IMPL_ADDREF_INHERITED(XULTreeItemAcce
 NS_IMPL_RELEASE_INHERITED(XULTreeItemAccessibleBase, Accessible)
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULTreeItemAccessibleBase: nsIAccessible implementation
 
 Accessible*
 XULTreeItemAccessibleBase::FocusedChild()
 {
-  return FocusMgr()->FocusedAccessible() == this ? this : nsnull;
+  return FocusMgr()->FocusedAccessible() == this ? this : nullptr;
 }
 
 NS_IMETHODIMP
 XULTreeItemAccessibleBase::GetBounds(PRInt32* aX, PRInt32* aY,
                                      PRInt32* aWidth, PRInt32* aHeight)
 {
   NS_ENSURE_ARG_POINTER(aX);
   *aX = 0;
@@ -874,28 +874,28 @@ XULTreeItemAccessibleBase::DoAction(PRUi
 {
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   if (aIndex != eAction_Click &&
       (aIndex != eAction_Expand || !IsExpandable()))
     return NS_ERROR_INVALID_ARG;
 
-  DoCommand(nsnull, aIndex);
+  DoCommand(nullptr, aIndex);
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULTreeItemAccessibleBase: nsAccessNode implementation
 
 void
 XULTreeItemAccessibleBase::Shutdown()
 {
-  mTree = nsnull;
-  mTreeView = nsnull;
+  mTree = nullptr;
+  mTreeView = nullptr;
   mRow = -1;
 
   AccessibleWrap::Shutdown();
 }
 
 bool
 XULTreeItemAccessibleBase::IsPrimaryForNode() const
 {
@@ -1158,17 +1158,17 @@ XULTreeItemAccessible::Init()
 
   Name(mCachedName);
   return true;
 }
 
 void
 XULTreeItemAccessible::Shutdown()
 {
-  mColumn = nsnull;
+  mColumn = nullptr;
   XULTreeItemAccessibleBase::Shutdown();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULTreeItemAccessible: Accessible implementation
 
 role
 XULTreeItemAccessible::NativeRole()
@@ -1241,11 +1241,11 @@ XULTreeColumAccessible::GetSiblingAtOffs
         XULTreeAccessible* treeAcc = Parent()->AsXULTree();
 
         if (treeAcc)
           return treeAcc->GetTreeItemAccessible(aOffset - 1);
       }
     }
   }
 
-  return nsnull;
+  return nullptr;
 }
 
--- a/accessible/src/xul/XULTreeAccessible.h
+++ b/accessible/src/xul/XULTreeAccessible.h
@@ -178,30 +178,30 @@ public:
    */
   PRInt32 GetRowIndex() const { return mRow; }
 
   /**
    * Return cell accessible for the given column. If XUL tree accessible is not
    * accessible table then return null.
    */
   virtual Accessible* GetCellAccessible(nsITreeColumn* aColumn)
-    { return nsnull; }
+    { return nullptr; }
 
   /**
    * Proccess row invalidation. Used to fires name change events.
    */
   virtual void RowInvalidated(PRInt32 aStartColIdx, PRInt32 aEndColIdx) = 0;
 
 protected:
   enum { eAction_Click = 0, eAction_Expand = 1 };
 
   // Accessible
   virtual void DispatchClickEvent(nsIContent *aContent, PRUint32 aActionIndex);
   virtual Accessible* GetSiblingAtOffset(PRInt32 aOffset,
-                                         nsresult *aError = nsnull) const;
+                                         nsresult *aError = nullptr) const;
 
   // XULTreeItemAccessibleBase
 
   /**
    * Return true if the tree item accessible is expandable (contains subrows).
    */
   bool IsExpandable();
 
@@ -263,25 +263,25 @@ class XULTreeColumAccessible : public XU
 {
 public:
   XULTreeColumAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
 protected:
 
   // Accessible
   virtual Accessible* GetSiblingAtOffset(PRInt32 aOffset,
-                                         nsresult *aError = nsnull) const;
+                                         nsresult *aError = nullptr) const;
 };
 
 } // namespace a11y
 } // namespace mozilla
 
 ////////////////////////////////////////////////////////////////////////////////
 // Accessible downcasting method
 
 inline mozilla::a11y::XULTreeAccessible*
 Accessible::AsXULTree()
 {
   return IsXULTree() ?
-    static_cast<mozilla::a11y::XULTreeAccessible*>(this) : nsnull;
+    static_cast<mozilla::a11y::XULTreeAccessible*>(this) : nullptr;
 }
 
 #endif
--- a/accessible/src/xul/XULTreeGridAccessible.cpp
+++ b/accessible/src/xul/XULTreeGridAccessible.cpp
@@ -132,26 +132,26 @@ XULTreeGridAccessible::SelectedRowIndice
       aRows->AppendElement(rowIdx);
 }
 
 Accessible*
 XULTreeGridAccessible::CellAt(PRUint32 aRowIndex, PRUint32 aColumnIndex)
 { 
   Accessible* row = GetTreeItemAccessible(aRowIndex);
   if (!row)
-    return nsnull;
+    return nullptr;
 
   nsCOMPtr<nsITreeColumn> column =
     nsCoreUtils::GetSensibleColumnAt(mTree, aColumnIndex);
   if (!column)
-    return nsnull;
+    return nullptr;
 
   nsRefPtr<XULTreeItemAccessibleBase> rowAcc = do_QueryObject(row);
   if (!rowAcc)
-    return nsnull;
+    return nullptr;
 
   return rowAcc->GetCellAccessible(column);
 }
 
 void
 XULTreeGridAccessible::ColDescription(PRUint32 aColIdx, nsString& aDescription)
 {
   aDescription.Truncate();
@@ -227,17 +227,17 @@ XULTreeGridAccessible::UnselectRow(PRUin
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULTreeGridAccessible: nsAccessNode implementation
 
 void
 XULTreeGridAccessible::Shutdown()
 {
-  mTable = nsnull;
+  mTable = nullptr;
   XULTreeAccessible::Shutdown();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULTreeGridAccessible: Accessible implementation
 
 role
 XULTreeGridAccessible::NativeRole()
@@ -346,52 +346,52 @@ XULTreeGridRowAccessible::Name(nsString&
 }
 
 Accessible*
 XULTreeGridRowAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY,
                                        EWhichChildAtPoint aWhichChild)
 {
   nsIFrame *frame = GetFrame();
   if (!frame)
-    return nsnull;
+    return nullptr;
 
   nsPresContext *presContext = frame->PresContext();
   nsIPresShell* presShell = presContext->PresShell();
 
   nsIFrame *rootFrame = presShell->GetRootFrame();
-  NS_ENSURE_TRUE(rootFrame, nsnull);
+  NS_ENSURE_TRUE(rootFrame, nullptr);
 
   nsIntRect rootRect = rootFrame->GetScreenRect();
 
   PRInt32 clientX = presContext->DevPixelsToIntCSSPixels(aX) - rootRect.x;
   PRInt32 clientY = presContext->DevPixelsToIntCSSPixels(aY) - rootRect.y;
 
   PRInt32 row = -1;
   nsCOMPtr<nsITreeColumn> column;
   nsCAutoString childEltUnused;
   mTree->GetCellAt(clientX, clientY, &row, getter_AddRefs(column),
                    childEltUnused);
 
   // Return if we failed to find tree cell in the row for the given point.
   if (row != mRow || !column)
-    return nsnull;
+    return nullptr;
 
   return GetCellAccessible(column);
 }
 
 Accessible*
 XULTreeGridRowAccessible::GetChildAt(PRUint32 aIndex)
 {
   if (IsDefunct())
-    return nsnull;
+    return nullptr;
 
   nsCOMPtr<nsITreeColumn> column =
     nsCoreUtils::GetSensibleColumnAt(mTree, aIndex);
   if (!column)
-    return nsnull;
+    return nullptr;
 
   return GetCellAccessible(column);
 }
 
 PRUint32
 XULTreeGridRowAccessible::ChildCount() const
 {
   return nsCoreUtils::GetSensibleColumnCount(mTree);
@@ -410,23 +410,23 @@ XULTreeGridRowAccessible::GetCellAccessi
   if (cachedCell)
     return cachedCell;
 
   nsRefPtr<Accessible> cell =
     new XULTreeGridCellAccessibleWrap(mContent, mDoc, this, mTree,
                                       mTreeView, mRow, aColumn);
   if (cell) {
     mAccessibleCache.Put(key, cell);
-    if (Document()->BindToDocument(cell, nsnull))
+    if (Document()->BindToDocument(cell, nullptr))
       return cell;
 
     mAccessibleCache.Remove(key);
   }
 
-  return nsnull;
+  return nullptr;
 }
 
 void
 XULTreeGridRowAccessible::RowInvalidated(PRInt32 aStartColIdx,
                                          PRInt32 aEndColIdx)
 {
   nsCOMPtr<nsITreeColumns> treeColumns;
   mTree->GetColumns(getter_AddRefs(treeColumns));
@@ -496,24 +496,24 @@ NS_IMPL_ADDREF_INHERITED(XULTreeGridCell
 NS_IMPL_RELEASE_INHERITED(XULTreeGridCellAccessible, LeafAccessible)
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULTreeGridCellAccessible: nsIAccessible implementation
 
   void
   XULTreeGridCellAccessible::Shutdown()
 {
-  mTableCell = nsnull;
+  mTableCell = nullptr;
   LeafAccessible::Shutdown();
 }
 
 Accessible*
 XULTreeGridCellAccessible::FocusedChild()
 {
-  return nsnull;
+  return nullptr;
 }
 
 ENameValueFlag
 XULTreeGridCellAccessible::Name(nsString& aName)
 {
   aName.Truncate();
 
   if (!mTreeView)
@@ -652,17 +652,17 @@ XULTreeGridCellAccessible::DoAction(PRUi
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULTreeGridCellAccessible: nsIAccessibleTableCell implementation
 
 NS_IMETHODIMP
 XULTreeGridCellAccessible::GetTable(nsIAccessibleTable** aTable)
 {
   NS_ENSURE_ARG_POINTER(aTable);
-  *aTable = nsnull;
+  *aTable = nullptr;
 
   if (IsDefunct())
     return NS_OK;
 
   Accessible* grandParent = mParent->Parent();
   if (grandParent)
     CallQueryInterface(grandParent, aTable);
 
@@ -712,17 +712,17 @@ XULTreeGridCellAccessible::GetRowExtent(
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 XULTreeGridCellAccessible::GetColumnHeaderCells(nsIArray** aHeaderCells)
 {
   NS_ENSURE_ARG_POINTER(aHeaderCells);
-  *aHeaderCells = nsnull;
+  *aHeaderCells = nullptr;
 
   if (IsDefunct() || !mDoc)
     return NS_ERROR_FAILURE;
 
   nsresult rv = NS_OK;
   nsCOMPtr<nsIMutableArray> headerCells =
     do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
@@ -740,17 +740,17 @@ XULTreeGridCellAccessible::GetColumnHead
   NS_ADDREF(*aHeaderCells = headerCells);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 XULTreeGridCellAccessible::GetRowHeaderCells(nsIArray** aHeaderCells)
 {
   NS_ENSURE_ARG_POINTER(aHeaderCells);
-  *aHeaderCells = nsnull;
+  *aHeaderCells = nullptr;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsresult rv = NS_OK;
   nsCOMPtr<nsIMutableArray> headerCells =
     do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
@@ -966,17 +966,17 @@ XULTreeGridCellAccessible::GetSiblingAtO
   } else {
     for (PRInt32 index = aOffset; index > 0 && columnAtOffset; index--) {
       column = nsCoreUtils::GetNextSensibleColumn(columnAtOffset);
       column.swap(columnAtOffset);
     }
   }
 
   if (!columnAtOffset)
-    return nsnull;
+    return nullptr;
 
   nsRefPtr<XULTreeItemAccessibleBase> rowAcc = do_QueryObject(Parent());
   return rowAcc->GetCellAccessible(columnAtOffset);
 }
 
 void
 XULTreeGridCellAccessible::DispatchClickEvent(nsIContent* aContent,
                                               PRUint32 aActionIndex)
--- a/accessible/src/xul/XULTreeGridAccessible.h
+++ b/accessible/src/xul/XULTreeGridAccessible.h
@@ -179,17 +179,17 @@ public:
    * Fire name or state change event if the accessible text or value has been
    * changed.
    */
   void CellInvalidated();
 
 protected:
   // Accessible
   virtual Accessible* GetSiblingAtOffset(PRInt32 aOffset,
-                                         nsresult* aError = nsnull) const;
+                                         nsresult* aError = nullptr) const;
   virtual void DispatchClickEvent(nsIContent* aContent, PRUint32 aActionIndex);
 
   // XULTreeGridCellAccessible
 
   /**
    * Return true if value of cell can be modified.
    */
   bool IsEditable() const;
--- a/b2g/app/nsBrowserApp.cpp
+++ b/b2g/app/nsBrowserApp.cpp
@@ -92,17 +92,17 @@ static const nsDynamicFunctionLoad kXULF
     { "XRE_GetFileFromPath", (NSFuncPtr*) &XRE_GetFileFromPath },
     { "XRE_CreateAppData", (NSFuncPtr*) &XRE_CreateAppData },
     { "XRE_FreeAppData", (NSFuncPtr*) &XRE_FreeAppData },
 #ifdef XRE_HAS_DLL_BLOCKLIST
     { "XRE_SetupDllBlocklist", (NSFuncPtr*) &XRE_SetupDllBlocklist },
 #endif
     { "XRE_TelemetryAccumulate", (NSFuncPtr*) &XRE_TelemetryAccumulate },
     { "XRE_main", (NSFuncPtr*) &XRE_main },
-    { nsnull, nsnull }
+    { nullptr, nullptr }
 };
 
 static int do_main(int argc, char* argv[])
 {
   nsCOMPtr<nsIFile> appini;
   nsresult rv;
 
   // Allow firefox.exe to launch XULRunner apps via -app <application.ini>
--- a/browser/app/nsBrowserApp.cpp
+++ b/browser/app/nsBrowserApp.cpp
@@ -113,17 +113,17 @@ static const nsDynamicFunctionLoad kXULF
     { "XRE_CreateAppData", (NSFuncPtr*) &XRE_CreateAppData },
     { "XRE_FreeAppData", (NSFuncPtr*) &XRE_FreeAppData },
 #ifdef XRE_HAS_DLL_BLOCKLIST
     { "XRE_SetupDllBlocklist", (NSFuncPtr*) &XRE_SetupDllBlocklist },
 #endif
     { "XRE_TelemetryAccumulate", (NSFuncPtr*) &XRE_TelemetryAccumulate },
     { "XRE_StartupTimelineRecord", (NSFuncPtr*) &XRE_StartupTimelineRecord },
     { "XRE_main", (NSFuncPtr*) &XRE_main },
-    { nsnull, nsnull }
+    { nullptr, nullptr }
 };
 
 static int do_main(int argc, char* argv[])
 {
   nsCOMPtr<nsIFile> appini;
   nsresult rv;
 
   // Allow firefox.exe to launch XULRunner apps via -app <application.ini>
--- a/browser/components/about/AboutRedirector.cpp
+++ b/browser/components/about/AboutRedirector.cpp
@@ -109,27 +109,27 @@ AboutRedirector::NewChannel(nsIURI *aURI
   nsresult rv;
   nsCOMPtr<nsIIOService> ioService = do_GetIOService(&rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   for (int i = 0; i < kRedirTotal; i++) {
     if (!strcmp(path.get(), kRedirMap[i].id)) {
       nsCOMPtr<nsIChannel> tempChannel;
       rv = ioService->NewChannel(nsDependentCString(kRedirMap[i].url),
-                                 nsnull, nsnull, getter_AddRefs(tempChannel));
+                                 nullptr, nullptr, getter_AddRefs(tempChannel));
       NS_ENSURE_SUCCESS(rv, rv);
 
       tempChannel->SetOriginalURI(aURI);
 
       // Keep the page from getting unnecessary privileges unless it needs them
       if (kRedirMap[i].flags & nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT) {
         // Setting the owner to null means that we'll go through the normal
         // path in GetChannelPrincipal and create a codebase principal based
         // on the channel's originalURI
-        rv = tempChannel->SetOwner(nsnull);
+        rv = tempChannel->SetOwner(nullptr);
         NS_ENSURE_SUCCESS(rv, rv);
       }
 
       NS_ADDREF(*result = tempChannel);
       return rv;
     }
   }
 
@@ -152,17 +152,17 @@ AboutRedirector::GetURIFlags(nsIURI *aUR
 
   return NS_ERROR_ILLEGAL_VALUE;
 }
 
 nsresult
 AboutRedirector::Create(nsISupports *aOuter, REFNSIID aIID, void **result)
 {
   AboutRedirector* about = new AboutRedirector();
-  if (about == nsnull)
+  if (about == nullptr)
     return NS_ERROR_OUT_OF_MEMORY;
   NS_ADDREF(about);
   nsresult rv = about->QueryInterface(aIID, result);
   NS_RELEASE(about);
   return rv;
 }
 
 } // namespace browser
--- a/browser/components/dirprovider/DirectoryProvider.cpp
+++ b/browser/components/dirprovider/DirectoryProvider.cpp
@@ -32,24 +32,24 @@ NS_IMPL_ISUPPORTS2(DirectoryProvider,
                    nsIDirectoryServiceProvider,
                    nsIDirectoryServiceProvider2)
 
 NS_IMETHODIMP
 DirectoryProvider::GetFile(const char *aKey, bool *aPersist, nsIFile* *aResult)
 {
   nsresult rv;
 
-  *aResult = nsnull;
+  *aResult = nullptr;
 
   // NOTE: This function can be reentrant through the NS_GetSpecialDirectory
   // call, so be careful not to cause infinite recursion.
 
   nsCOMPtr<nsIFile> file;
 
-  char const* leafName = nsnull;
+  char const* leafName = nullptr;
 
   if (!strcmp(aKey, NS_APP_BOOKMARKS_50_FILE)) {
     leafName = "bookmarks.html";
 
     nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
     if (prefs) {
       nsCString path;
       rv = prefs->GetCharPref("browser.bookmarks.file", getter_Copies(path));
@@ -246,17 +246,17 @@ DirectoryProvider::GetFiles(const char *
       return rv;
 
     nsCOMPtr<nsISimpleEnumerator> list;
     rv = dirSvc->Get(XRE_EXTENSIONS_DIR_LIST,
                      NS_GET_IID(nsISimpleEnumerator), getter_AddRefs(list));
     if (NS_FAILED(rv))
       return rv;
 
-    static char const *const kAppendSPlugins[] = {"searchplugins", nsnull};
+    static char const *const kAppendSPlugins[] = {"searchplugins", nullptr};
 
     nsCOMPtr<nsISimpleEnumerator> extEnum =
       new AppendingEnumerator(list, kAppendSPlugins);
     if (!extEnum)
       return NS_ERROR_OUT_OF_MEMORY;
 
     return NS_NewUnionEnumerator(aResult, extEnum, baseEnum);
   }
@@ -274,17 +274,17 @@ DirectoryProvider::AppendingEnumerator::
 }
 
 NS_IMETHODIMP
 DirectoryProvider::AppendingEnumerator::GetNext(nsISupports* *aResult)
 {
   if (aResult)
     NS_ADDREF(*aResult = mNext);
 
-  mNext = nsnull;
+  mNext = nullptr;
 
   nsresult rv;
 
   // Ignore all errors
 
   bool more;
   while (NS_SUCCEEDED(mBase->HasMoreElements(&more)) && more) {
     nsCOMPtr<nsISupports> nextbasesupp;
@@ -304,26 +304,26 @@ DirectoryProvider::AppendingEnumerator::
       ++i;
     }
 
     bool exists;
     rv = mNext->Exists(&exists);
     if (NS_SUCCEEDED(rv) && exists)
       break;
 
-    mNext = nsnull;
+    mNext = nullptr;
   }
 
   return NS_OK;
 }
 
 DirectoryProvider::AppendingEnumerator::AppendingEnumerator
     (nsISimpleEnumerator* aBase,
      char const *const *aAppendList) :
   mBase(aBase),
   mAppendList(aAppendList)
 {
   // Initialize mNext to begin.
-  GetNext(nsnull);
+  GetNext(nullptr);
 }
 
 } // namespace browser
 } // namespace mozilla
--- a/browser/components/feeds/src/nsFeedSniffer.cpp
+++ b/browser/components/feeds/src/nsFeedSniffer.cpp
@@ -60,34 +60,34 @@ nsFeedSniffer::ConvertEncodedData(nsIReq
                                  contentEncoding);
   if (!contentEncoding.IsEmpty()) {
     nsCOMPtr<nsIStreamConverterService> converterService(do_GetService(NS_STREAMCONVERTERSERVICE_CONTRACTID));
     if (converterService) {
       ToLowerCase(contentEncoding);
 
       nsCOMPtr<nsIStreamListener> converter;
       rv = converterService->AsyncConvertData(contentEncoding.get(), 
-                                              "uncompressed", this, nsnull, 
+                                              "uncompressed", this, nullptr, 
                                               getter_AddRefs(converter));
       NS_ENSURE_SUCCESS(rv, rv);
 
-      converter->OnStartRequest(request, nsnull);
+      converter->OnStartRequest(request, nullptr);
 
       nsCOMPtr<nsIStringInputStream> rawStream =
         do_CreateInstance(NS_STRINGINPUTSTREAM_CONTRACTID);
       if (!rawStream)
         return NS_ERROR_FAILURE;
 
       rv = rawStream->SetData((const char*)data, length);
       NS_ENSURE_SUCCESS(rv, rv);
 
-      rv = converter->OnDataAvailable(request, nsnull, rawStream, 0, length);
+      rv = converter->OnDataAvailable(request, nullptr, rawStream, 0, length);
       NS_ENSURE_SUCCESS(rv, rv);
 
-      converter->OnStopRequest(request, nsnull, NS_OK);
+      converter->OnStopRequest(request, nullptr, NS_OK);
     }
   }
   return rv;
 }
 
 template<int N>
 static bool
 StringBeginsWithLowercaseLiteral(nsAString& aString,
@@ -108,26 +108,26 @@ HasAttachmentDisposition(nsIHttpChannel*
   if (NS_SUCCEEDED(rv) && disp == nsIChannel::DISPOSITION_ATTACHMENT)
     return true;
 
   return false;
 }
 
 /**
  * @return the first occurrence of a character within a string buffer,
- *         or nsnull if not found
+ *         or nullptr if not found
  */
 static const char*
 FindChar(char c, const char *begin, const char *end)
 {
   for (; begin < end; ++begin) {
     if (*begin == c)
       return begin;
   }
-  return nsnull;
+  return nullptr;
 }
 
 /**
  *
  * Determine if a substring is the "documentElement" in the document.
  *
  * All of our sniffed substrings: <rss, <feed, <rdf:RDF must be the "document"
  * element within the XML DOM, i.e. the root container element. Otherwise,
--- a/browser/components/migration/src/nsIEHistoryEnumerator.cpp
+++ b/browser/components/migration/src/nsIEHistoryEnumerator.cpp
@@ -121,19 +121,19 @@ nsIEHistoryEnumerator::HasMoreElements(b
     ::CoTaskMemFree(statURL.pwcsTitle);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsIEHistoryEnumerator::GetNext(nsISupports** _retval)
 {
-  *_retval = nsnull;
+  *_retval = nullptr;
 
   if (!mCachedNextEntry)
     return NS_ERROR_FAILURE;
 
   NS_ADDREF(*_retval = mCachedNextEntry);
   // Release the cached entry, so it can't be returned twice.
-  mCachedNextEntry = nsnull;
+  mCachedNextEntry = nullptr;
 
   return NS_OK;
 }
--- a/browser/components/privatebrowsing/src/nsPrivateBrowsingServiceWrapper.cpp
+++ b/browser/components/privatebrowsing/src/nsPrivateBrowsingServiceWrapper.cpp
@@ -23,34 +23,34 @@ nsresult
 nsPrivateBrowsingServiceWrapper::Init()
 {
   nsresult rv;
   mPBService = do_GetService("@mozilla.org/privatebrowsing;1", &rv);
   return rv;
 }
 
 JSStackGuard::JSStackGuard()
-  : mJSStack(nsnull)
+  : mJSStack(nullptr)
 {
   nsresult rv;
   mJSStack = do_GetService("@mozilla.org/js/xpc/ContextStack;1", &rv);
 
   if (NS_SUCCEEDED(rv) && mJSStack) {
-    rv = mJSStack->Push(nsnull);
+    rv = mJSStack->Push(nullptr);
     if (NS_FAILED(rv))
-      mJSStack = nsnull;
+      mJSStack = nullptr;
   }
 }
 
 JSStackGuard::~JSStackGuard()
 {
   if (mJSStack) {
     JSContext *cx;
     mJSStack->Pop(&cx);
-    NS_ASSERTION(cx == nsnull, "JSContextStack mismatch");
+    NS_ASSERTION(cx == nullptr, "JSContextStack mismatch");
   }
 }
 
 NS_IMETHODIMP
 nsPrivateBrowsingServiceWrapper::GetPrivateBrowsingEnabled(bool *aPrivateBrowsingEnabled)
 {
   if (!aPrivateBrowsingEnabled)
     return NS_ERROR_NULL_POINTER;
--- a/browser/components/shell/src/nsGNOMEShellService.cpp
+++ b/browser/components/shell/src/nsGNOMEShellService.cpp
@@ -93,17 +93,17 @@ nsGNOMEShellService::Init()
   nsCOMPtr<nsIGSettingsService> gsettings =
     do_GetService(NS_GSETTINGSSERVICE_CONTRACTID);
 
   if (!gconf && !giovfs && !gsettings)
     return NS_ERROR_NOT_AVAILABLE;
 
   // Check G_BROKEN_FILENAMES.  If it's set, then filenames in glib use
   // the locale encoding.  If it's not set, they use UTF-8.
-  mUseLocaleFilenames = PR_GetEnv("G_BROKEN_FILENAMES") != nsnull;
+  mUseLocaleFilenames = PR_GetEnv("G_BROKEN_FILENAMES") != nullptr;
 
   if (GetAppPathFromLauncher())
     return NS_OK;
 
   nsCOMPtr<nsIProperties> dirSvc
     (do_GetService("@mozilla.org/file/directory_service;1"));
   NS_ENSURE_TRUE(dirSvc, NS_ERROR_NOT_AVAILABLE);
 
@@ -624,17 +624,17 @@ nsGNOMEShellService::OpenApplication(PRI
 
   // Run through the list of arguments.  Copy all of them to the new
   // argv except for %s, which we skip.
   for (int i = 0; i < argc; ++i) {
     if (strcmp(argv[i], "%s") != 0)
       newArgv[newArgc++] = argv[i];
   }
 
-  newArgv[newArgc] = nsnull;
+  newArgv[newArgc] = nullptr;
 
   gboolean err = g_spawn_async(NULL, newArgv, NULL, G_SPAWN_SEARCH_PATH,
                                NULL, NULL, NULL, NULL);
 
   g_strfreev(argv);
   delete[] newArgv;
 
   return err ? NS_OK : NS_ERROR_FAILURE;
--- a/browser/components/shell/src/nsMacShellService.cpp
+++ b/browser/components/shell/src/nsMacShellService.cpp
@@ -185,17 +185,17 @@ nsMacShellService::SetDesktopBackground(
 
   PRUint32 flags = nsIWebBrowserPersist::PERSIST_FLAGS_NO_CONVERSION | 
                    nsIWebBrowserPersist::PERSIST_FLAGS_REPLACE_EXISTING_FILES |
                    nsIWebBrowserPersist::PERSIST_FLAGS_FROM_CACHE;
 
   wbp->SetPersistFlags(flags);
   wbp->SetProgressListener(this);
 
-  return wbp->SaveURI(imageURI, nsnull, docURI, nsnull, nsnull,
+  return wbp->SaveURI(imageURI, nullptr, docURI, nullptr, nullptr,
                       mBackgroundFile);
 }
 
 NS_IMETHODIMP
 nsMacShellService::OnProgressChange(nsIWebProgress* aWebProgress,
                                     nsIRequest* aRequest,
                                     PRInt32 aCurSelfProgress,
                                     PRInt32 aMaxSelfProgress,
@@ -235,17 +235,17 @@ NS_IMETHODIMP
 nsMacShellService::OnStateChange(nsIWebProgress* aWebProgress,
                                  nsIRequest* aRequest,
                                  PRUint32 aStateFlags,
                                  nsresult aStatus)
 {
   if (aStateFlags & STATE_STOP) {
     nsCOMPtr<nsIObserverService> os(do_GetService("@mozilla.org/observer-service;1"));
     if (os)
-      os->NotifyObservers(nsnull, "shell:desktop-background-changed", nsnull);
+      os->NotifyObservers(nullptr, "shell:desktop-background-changed", nullptr);
 
     bool exists = false;
     mBackgroundFile->Exists(&exists);
     if (!exists)
       return NS_OK;
 
     nsCAutoString nativePath;
     mBackgroundFile->GetNativePath(nativePath);
@@ -417,17 +417,17 @@ nsMacShellService::OpenApplicationWithUR
   
   return err != noErr ? NS_ERROR_FAILURE : NS_OK;
 }
 
 NS_IMETHODIMP
 nsMacShellService::GetDefaultFeedReader(nsIFile** _retval)
 {
   nsresult rv = NS_ERROR_FAILURE;
-  *_retval = nsnull;
+  *_retval = nullptr;
 
   CFStringRef defaultHandlerID = ::LSCopyDefaultHandlerForURLScheme(CFSTR("feed"));
   if (!defaultHandlerID) {
     defaultHandlerID = ::CFStringCreateWithCString(kCFAllocatorDefault,
                                                    SAFARI_BUNDLE_IDENTIFIER,
                                                    kCFStringEncodingASCII);
   }
 
--- a/browser/components/shell/src/nsWindowsShellService.cpp
+++ b/browser/components/shell/src/nsWindowsShellService.cpp
@@ -280,17 +280,17 @@ nsWindowsShellService::ShortcutMaintenan
 
   NS_NAMED_LITERAL_CSTRING(prefName, "browser.taskbar.lastgroupid");
   nsCOMPtr<nsIPrefService> prefs =
     do_GetService(NS_PREFSERVICE_CONTRACTID);
   if (!prefs)
     return NS_ERROR_UNEXPECTED;
 
   nsCOMPtr<nsIPrefBranch> prefBranch;
-  prefs->GetBranch(nsnull, getter_AddRefs(prefBranch));
+  prefs->GetBranch(nullptr, getter_AddRefs(prefBranch));
   if (!prefBranch)
     return NS_ERROR_UNEXPECTED;
 
   nsCOMPtr<nsISupportsString> prefString;
   rv = prefBranch->GetComplexValue(prefName.get(),
                                    NS_GET_IID(nsISupportsString),
                                    getter_AddRefs(prefString));
   if (NS_SUCCEEDED(rv)) {
@@ -1021,47 +1021,47 @@ nsWindowsShellService::nsWindowsShellSer
 
   // check to see if we have attempted to do the one time operation of clearing
   // the prefetch.  We do it once per version upgrade.
   nsCString lastClearedVer;
   nsCOMPtr<nsIPrefBranch> prefBranch;
   nsCOMPtr<nsIPrefService> prefs =
     do_GetService(NS_PREFSERVICE_CONTRACTID);
   if (!prefs || 
-      NS_FAILED(prefs->GetBranch(nsnull, getter_AddRefs(prefBranch))) ||
+      NS_FAILED(prefs->GetBranch(nullptr, getter_AddRefs(prefBranch))) ||
       (NS_SUCCEEDED(prefBranch->GetCharPref(kPrefetchClearedPref, 
                                             getter_Copies(lastClearedVer))))) {
     // If the versions are the same, then bail out early.  We only want to clear
     // once per version.
     if (!strcmp(MOZ_APP_VERSION, lastClearedVer.get())) {
       return;
     }
   }
 
   // In a minute after startup is definitely complete, launch the
   // service command.
   mTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
   if (mTimer) {
     mTimer->InitWithFuncCallback(
       nsWindowsShellService::LaunchPrefetchClearCommand, 
-      nsnull, CLEAR_PREFETCH_TIMEOUT_MS, nsITimer::TYPE_ONE_SHOT);
+      nullptr, CLEAR_PREFETCH_TIMEOUT_MS, nsITimer::TYPE_ONE_SHOT);
   }
 #endif
 }
 
 nsWindowsShellService::~nsWindowsShellService()
 {
 #if defined(MOZ_MAINTENANCE_SERVICE)
  if (mTimer) {
     mTimer->Cancel();
-    mTimer = nsnull;
+    mTimer = nullptr;
   }
   if (sThread) {
     sThread->Shutdown();
-    sThread = nsnull;
+    sThread = nullptr;
   }
 #endif
 }
 
 #if defined(MOZ_MAINTENANCE_SERVICE)
 
 class ClearPrefetchEvent : public nsRunnable {
 public:
@@ -1098,17 +1098,17 @@ void
 nsWindowsShellService::LaunchPrefetchClearCommand(nsITimer *aTimer, void*)
 {
   // Make sure we don't call this again from the application, it will be
   // called on each application update instead.
   nsCOMPtr<nsIPrefBranch> prefBranch;
   nsCOMPtr<nsIPrefService> prefs =
     do_GetService(NS_PREFSERVICE_CONTRACTID);
   if (prefs) {
-    if (NS_SUCCEEDED(prefs->GetBranch(nsnull, getter_AddRefs(prefBranch)))) {
+    if (NS_SUCCEEDED(prefs->GetBranch(nullptr, getter_AddRefs(prefBranch)))) {
       prefBranch->SetCharPref(kPrefetchClearedPref, MOZ_APP_VERSION);
     }
   }
 
   // Starting the sevice can take a bit of time and we don't want to block the 
   // main thread, so start an event on another thread to handle the operation
   NS_NewThread(getter_AddRefs(sThread));
   if (sThread) {
@@ -1135,17 +1135,17 @@ nsWindowsShellService::OpenApplicationWi
   const nsCString spec(aURI);
   const char* specStr = spec.get();
   return process->Run(false, &specStr, 1);
 }
 
 NS_IMETHODIMP
 nsWindowsShellService::GetDefaultFeedReader(nsIFile** _retval)
 {
-  *_retval = nsnull;
+  *_retval = nullptr;
 
   nsresult rv;
   nsCOMPtr<nsIWindowsRegKey> regKey =
     do_CreateInstance("@mozilla.org/windows-registry-key;1", &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = regKey->Open(nsIWindowsRegKey::ROOT_KEY_CLASSES_ROOT,
                     NS_LITERAL_STRING("feed\\shell\\open\\command"),
--- a/caps/include/nsScriptSecurityManager.h
+++ b/caps/include/nsScriptSecurityManager.h
@@ -179,17 +179,17 @@ struct ClassPolicy : public PLDHashEntry
 
 static void
 ClearClassPolicyEntry(PLDHashTable *table, PLDHashEntryHdr *entry)
 {
     ClassPolicy* cp = (ClassPolicy *)entry;
     if (cp->key)
     {
         PL_strfree(cp->key);
-        cp->key = nsnull;
+        cp->key = nullptr;
     }
     PL_DHashTableDestroy(cp->mPolicy);
 }
 
 // Note: actual impl is going to be after the DomainPolicy class definition,
 // since we need to access members of DomainPolicy in the impl
 static void
 MoveClassPolicyEntry(PLDHashTable *table,
@@ -209,35 +209,35 @@ InitClassPolicyEntry(PLDHashTable *table
         PL_DHashMatchEntryStub,
         PL_DHashMoveEntryStub,
         ClearPropertyPolicyEntry,
         PL_DHashFinalizeStub,
         InitPropertyPolicyEntry
     };
 
     ClassPolicy* cp = (ClassPolicy*)entry;
-    cp->mDomainWeAreWildcardFor = nsnull;
+    cp->mDomainWeAreWildcardFor = nullptr;
     cp->key = PL_strdup((const char*)key);
     if (!cp->key)
         return false;
-    cp->mPolicy = PL_NewDHashTable(&classPolicyOps, nsnull,
+    cp->mPolicy = PL_NewDHashTable(&classPolicyOps, nullptr,
                                    sizeof(PropertyPolicy), 16);
     if (!cp->mPolicy) {
         PL_strfree(cp->key);
-        cp->key = nsnull;
+        cp->key = nullptr;
         return false;
     }
     return true;
 }
 
 // Domain Policy
 class DomainPolicy : public PLDHashTable
 {
 public:
-    DomainPolicy() : mWildcardPolicy(nsnull),
+    DomainPolicy() : mWildcardPolicy(nullptr),
                      mRefCount(0)
     {
         mGeneration = sGeneration;
 
 #ifdef DEBUG_CAPS_DomainPolicyLifeCycle
         ++sObjects;
         _printPopulationInfo();
 #endif
@@ -253,17 +253,17 @@ public:
             PL_DHashStringKey,
             PL_DHashMatchStringKey,
             MoveClassPolicyEntry,
             ClearClassPolicyEntry,
             PL_DHashFinalizeStub,
             InitClassPolicyEntry
         };
 
-        return PL_DHashTableInit(this, &domainPolicyOps, nsnull,
+        return PL_DHashTableInit(this, &domainPolicyOps, nullptr,
                                  sizeof(ClassPolicy), 16);
     }
 
     ~DomainPolicy()
     {
         PL_DHashTableFinish(this);
         NS_ASSERTION(mRefCount == 0, "Wrong refcount in DomainPolicy dtor");
 #ifdef DEBUG_CAPS_DomainPolicyLifeCycle
--- a/caps/src/nsNullPrincipal.cpp
+++ b/caps/src/nsNullPrincipal.cpp
@@ -125,21 +125,21 @@ void nsNullPrincipal::dumpImpl()
 
 NS_IMETHODIMP
 nsNullPrincipal::GetPreferences(char** aPrefName, char** aID,
                                 char** aSubjectName,
                                 char** aGrantedList, char** aDeniedList,
                                 bool* aIsTrusted)
 {
   // The null principal should never be written to preferences.
-  *aPrefName = nsnull;
-  *aID = nsnull;
-  *aSubjectName = nsnull;
-  *aGrantedList = nsnull;
-  *aDeniedList = nsnull;
+  *aPrefName = nullptr;
+  *aID = nullptr;
+  *aSubjectName = nullptr;
+  *aGrantedList = nullptr;
+  *aDeniedList = nullptr;
   *aIsTrusted = false;
 
   return NS_ERROR_FAILURE; 
 }
 
 NS_IMETHODIMP
 nsNullPrincipal::Equals(nsIPrincipal *aOther, bool *aResult)
 {
@@ -162,17 +162,17 @@ nsNullPrincipal::GetHashValue(PRUint32 *
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsNullPrincipal::GetSecurityPolicy(void** aSecurityPolicy)
 {
   // We don't actually do security policy caching.  And it's not like anyone
   // can set a security policy for us anyway.
-  *aSecurityPolicy = nsnull;
+  *aSecurityPolicy = nullptr;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsNullPrincipal::SetSecurityPolicy(void* aSecurityPolicy)
 {
   // We don't actually do security policy caching.  And it's not like anyone
   // can set a security policy for us anyway.
@@ -197,31 +197,31 @@ nsNullPrincipal::IsCapabilityEnabled(con
   *aResult = false;
   return NS_OK;
 }
 
 NS_IMETHODIMP 
 nsNullPrincipal::EnableCapability(const char *aCapability, void **aAnnotation)
 {
   NS_NOTREACHED("Didn't I say it?  NO CAPABILITIES!");
-  *aAnnotation = nsnull;
+  *aAnnotation = nullptr;
   return NS_OK;
 }
 
 NS_IMETHODIMP 
 nsNullPrincipal::GetURI(nsIURI** aURI)
 {
   return NS_EnsureSafeToReturn(mURI, aURI);
 }
 
 NS_IMETHODIMP
 nsNullPrincipal::GetCsp(nsIContentSecurityPolicy** aCsp)
 {
   // CSP on a null principal makes no sense
-  *aCsp = nsnull;
+  *aCsp = nullptr;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsNullPrincipal::SetCsp(nsIContentSecurityPolicy* aCsp)
 {
   // CSP on a null principal makes no sense
   return NS_ERROR_NOT_AVAILABLE;
@@ -239,17 +239,17 @@ nsNullPrincipal::SetDomain(nsIURI* aDoma
   // I think the right thing to do here is to just throw...  Silently failing
   // seems counterproductive.
   return NS_ERROR_NOT_AVAILABLE;
 }
 
 NS_IMETHODIMP 
 nsNullPrincipal::GetOrigin(char** aOrigin)
 {
-  *aOrigin = nsnull;
+  *aOrigin = nullptr;
   
   nsCAutoString str;
   nsresult rv = mURI->GetSpec(str);
   NS_ENSURE_SUCCESS(rv, rv);
 
   *aOrigin = ToNewCString(str);
   NS_ENSURE_TRUE(*aOrigin, NS_ERROR_OUT_OF_MEMORY);
 
@@ -291,32 +291,32 @@ nsNullPrincipal::SubsumesIgnoringDomain(
   return Subsumes(aOther, aResult);
 }
 
 NS_IMETHODIMP
 nsNullPrincipal::CheckMayLoad(nsIURI* aURI, bool aReport)
 {
   if (aReport) {
     nsScriptSecurityManager::ReportError(
-      nsnull, NS_LITERAL_STRING("CheckSameOriginError"), mURI, aURI);
+      nullptr, NS_LITERAL_STRING("CheckSameOriginError"), mURI, aURI);
   }
 
   return NS_ERROR_DOM_BAD_URI;
 }
 
 NS_IMETHODIMP 
 nsNullPrincipal::GetSubjectName(nsACString& aName)
 {
     return NS_ERROR_NOT_AVAILABLE;
 }
 
 NS_IMETHODIMP
 nsNullPrincipal::GetCertificate(nsISupports** aCertificate)
 {
-    *aCertificate = nsnull;
+    *aCertificate = nullptr;
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsNullPrincipal::GetExtendedOrigin(nsACString& aExtendedOrigin)
 {
   return GetOrigin(getter_Copies(aExtendedOrigin));
 }
--- a/caps/src/nsPrincipal.cpp
+++ b/caps/src/nsPrincipal.cpp
@@ -68,42 +68,42 @@ nsBasePrincipal::Release()
   if (count == 0) {
     delete this;
   }
 
   return count;
 }
 
 nsBasePrincipal::nsBasePrincipal()
-  : mCapabilities(nsnull),
-    mSecurityPolicy(nsnull),
+  : mCapabilities(nullptr),
+    mSecurityPolicy(nullptr),
     mTrusted(false)
 {
   if (!gIsObservingCodeBasePrincipalSupport) {
     nsresult rv =
       Preferences::AddBoolVarCache(&gCodeBasePrincipalSupport,
                                    "signed.applets.codebase_principal_support",
                                    false);
     gIsObservingCodeBasePrincipalSupport = NS_SUCCEEDED(rv);
     NS_WARN_IF_FALSE(gIsObservingCodeBasePrincipalSupport,
                      "Installing gCodeBasePrincipalSupport failed!");
   }
 }
 
 nsBasePrincipal::~nsBasePrincipal(void)
 {
-  SetSecurityPolicy(nsnull); 
+  SetSecurityPolicy(nullptr); 
   delete mCapabilities;
 }
 
 NS_IMETHODIMP
 nsBasePrincipal::GetSecurityPolicy(void** aSecurityPolicy)
 {
   if (mSecurityPolicy && mSecurityPolicy->IsInvalid()) 
-    SetSecurityPolicy(nsnull);
+    SetSecurityPolicy(nullptr);
   
   *aSecurityPolicy = (void *) mSecurityPolicy;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsBasePrincipal::SetSecurityPolicy(void* aSecurityPolicy)
 {
@@ -118,17 +118,17 @@ nsBasePrincipal::SetSecurityPolicy(void*
   return NS_OK;
 }
 
 bool
 nsBasePrincipal::CertificateEquals(nsIPrincipal *aOther)
 {
   bool otherHasCert;
   aOther->GetHasCertificate(&otherHasCert);
-  if (otherHasCert != (mCert != nsnull)) {
+  if (otherHasCert != (mCert != nullptr)) {
     // One has a cert while the other doesn't.  Not equal.
     return false;
   }
 
   if (!mCert)
     return true;
 
   nsCAutoString str;
@@ -283,17 +283,17 @@ nsBasePrincipal::EnableCapability(const 
 {
   return SetCapability(capability, annotation, AnnotationEnabled);
 }
 
 nsresult
 nsBasePrincipal::SetCapability(const char *capability, void **annotation,
                                AnnotationValue value)
 {
-  if (*annotation == nsnull) {
+  if (*annotation == nullptr) {
     nsHashtable* ht = new nsHashtable(5);
 
     if (!ht) {
        return NS_ERROR_OUT_OF_MEMORY;
      }
 
     // This object owns its annotations. Save them so we can release
     // them when we destroy this object.
@@ -321,17 +321,17 @@ nsBasePrincipal::SetCapability(const cha
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsBasePrincipal::GetHasCertificate(bool* aResult)
 {
-  *aResult = (mCert != nsnull);
+  *aResult = (mCert != nullptr);
 
   return NS_OK;
 }
 
 nsresult
 nsBasePrincipal::SetCertificate(const nsACString& aFingerprint,
                                 const nsACString& aSubjectName,
                                 const nsACString& aPrettyName,
@@ -383,17 +383,17 @@ nsBasePrincipal::GetSubjectName(nsACStri
 
 NS_IMETHODIMP
 nsBasePrincipal::GetCertificate(nsISupports** aCertificate)
 {
   if (mCert) {
     NS_IF_ADDREF(*aCertificate = mCert->cert);
   }
   else {
-    *aCertificate = nsnull;
+    *aCertificate = nullptr;
   }
   return NS_OK;