Bug 784739 - Switch from NULL to nullptr in widget/gtk/; r=ehsan
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Tue, 08 Oct 2013 14:47:37 -0400
changeset 150103 36d4de5601b431d430adcf55eed90d147dbab7b6
parent 150102 8cc13e82d47c958b679a3460f1d57c657cf10d9c
child 150104 89a576ec25cf9b52c087f6ecb6505e423f534d69
push id25423
push usercbook@mozilla.com
push dateWed, 09 Oct 2013 08:10:49 +0000
treeherderautoland@2a8a173a0ae1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs784739
milestone27.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 784739 - Switch from NULL to nullptr in widget/gtk/; r=ehsan
widget/gtk/WidgetTraceEvent.cpp
widget/gtk/nsAppShell.cpp
widget/gtk/nsBidiKeyboard.cpp
widget/gtk/nsCUPSShim.h
widget/gtk/nsClipboard.cpp
widget/gtk/nsDeviceContextSpecG.cpp
widget/gtk/nsDragService.cpp
widget/gtk/nsDragService.h
widget/gtk/nsFilePicker.cpp
widget/gtk/nsGtkCursors.h
widget/gtk/nsGtkIMModule.cpp
widget/gtk/nsGtkKeyUtils.cpp
widget/gtk/nsGtkKeyUtils.h
widget/gtk/nsLookAndFeel.cpp
widget/gtk/nsPSPrinters.cpp
widget/gtk/nsPrintDialogGTK.cpp
widget/gtk/nsPrintSettingsGTK.cpp
widget/gtk/nsPrintSettingsGTK.h
widget/gtk/nsScreenManagerGtk.cpp
widget/gtk/nsSound.cpp
widget/gtk/nsWidgetFactory.cpp
widget/gtk/nsWindow.cpp
--- a/widget/gtk/WidgetTraceEvent.cpp
+++ b/widget/gtk/WidgetTraceEvent.cpp
@@ -10,18 +10,18 @@
 #include <stdio.h>
 
 using mozilla::CondVar;
 using mozilla::Mutex;
 using mozilla::MutexAutoLock;
 
 namespace {
 
-Mutex* sMutex = NULL;
-CondVar* sCondVar = NULL;
+Mutex* sMutex = nullptr;
+CondVar* sCondVar = nullptr;
 bool sTracerProcessed = false;
 
 // This function is called from the main (UI) thread.
 gboolean TracerCallback(gpointer data)
 {
   mozilla::SignalTracerThread();
   return FALSE;
 }
@@ -36,33 +36,33 @@ bool InitWidgetTracing()
   sCondVar = new CondVar(*sMutex, "Event tracer thread condvar");
   return sMutex && sCondVar;
 }
 
 void CleanUpWidgetTracing()
 {
   delete sMutex;
   delete sCondVar;
-  sMutex = NULL;
-  sCondVar = NULL;
+  sMutex = nullptr;
+  sCondVar = nullptr;
 }
 
 // This function is called from the background tracer thread.
 bool FireAndWaitForTracerEvent()
 {
   NS_ABORT_IF_FALSE(sMutex && sCondVar, "Tracing not initialized!");
 
   // Send a default-priority idle event through the
   // event loop, and wait for it to finish.
   MutexAutoLock lock(*sMutex);
   NS_ABORT_IF_FALSE(!sTracerProcessed, "Tracer synchronization state is wrong");
   g_idle_add_full(G_PRIORITY_DEFAULT,
                   TracerCallback,
-                  NULL,
-                  NULL);
+                  nullptr,
+                  nullptr);
   while (!sTracerProcessed)
     sCondVar->Wait();
   sTracerProcessed = false;
   return true;
 }
 
 void SignalTracerThread()
 {
--- a/widget/gtk/nsAppShell.cpp
+++ b/widget/gtk/nsAppShell.cpp
@@ -75,18 +75,18 @@ nsAppShell::Init()
         gWidgetFocusLog = PR_NewLogModule("WidgetFocus");
     if (!gWidgetDragLog)
         gWidgetDragLog = PR_NewLogModule("WidgetDrag");
     if (!gWidgetDrawLog)
         gWidgetDrawLog = PR_NewLogModule("WidgetDraw");
 #endif
 
     if (!sPollFunc) {
-        sPollFunc = g_main_context_get_poll_func(NULL);
-        g_main_context_set_poll_func(NULL, &PollWrapper);
+        sPollFunc = g_main_context_get_poll_func(nullptr);
+        g_main_context_set_poll_func(nullptr, &PollWrapper);
     }
 
     if (PR_GetEnv("MOZ_DEBUG_PAINTS"))
         gdk_window_set_debug_updates(TRUE);
 
     int err = pipe(mPipeFDs);
     if (err)
         return NS_ERROR_OUT_OF_MEMORY;
@@ -130,10 +130,10 @@ nsAppShell::ScheduleNativeEventCallback(
 {
     unsigned char buf[] = { NOTIFY_TOKEN };
     unused << write(mPipeFDs[1], buf, 1);
 }
 
 bool
 nsAppShell::ProcessNextNativeEvent(bool mayWait)
 {
-    return g_main_context_iteration(NULL, mayWait);
+    return g_main_context_iteration(nullptr, mayWait);
 }
--- a/widget/gtk/nsBidiKeyboard.cpp
+++ b/widget/gtk/nsBidiKeyboard.cpp
@@ -34,17 +34,17 @@ nsBidiKeyboard::Reset()
                                             &gtklib);
         if (gtklib)
             PR_UnloadLibrary(gtklib);
     }
 #endif
 
     mHaveBidiKeyboards = false;
     if (GdkKeymapHaveBidiLayouts)
-        mHaveBidiKeyboards = (*GdkKeymapHaveBidiLayouts)(NULL);
+        mHaveBidiKeyboards = (*GdkKeymapHaveBidiLayouts)(nullptr);
 #else
     mHaveBidiKeyboards = gdk_keymap_have_bidi_layouts(gdk_keymap_get_default());
 #endif
     return NS_OK;
 }
 
 nsBidiKeyboard::~nsBidiKeyboard()
 {
--- a/widget/gtk/nsCUPSShim.h
+++ b/widget/gtk/nsCUPSShim.h
@@ -17,17 +17,17 @@ typedef struct                          
 {
     char          *name;                  /* Name of option */
     char          *value;                 /* Value of option */
 } cups_option_t;
 
 typedef struct               /**** Destination ****/
 {
     char          *name,       /* Printer or class name */
-                  *instance;   /* Local instance name or NULL */
+                  *instance;   /* Local instance name or nullptr */
     int           is_default;  /* Is this printer the default? */
     int           num_options; /* Number of options */
     cups_option_t *options;    /* Options */
 } cups_dest_t;
 
 typedef cups_dest_t* (*CupsGetDestType)(const char *printer,
                                         const char *instance,
                                         int num_dests,
--- a/widget/gtk/nsClipboard.cpp
+++ b/widget/gtk/nsClipboard.cpp
@@ -141,17 +141,17 @@ nsClipboard::SetData(nsITransferable *aT
     }
     rv = mPrivacyHandler->PrepareDataForClipboard(aTransferable);
     NS_ENSURE_SUCCESS(rv, rv);
 
     // Clear out the clipboard in order to set the new data
     EmptyClipboard(aWhichClipboard);
 
     // List of suported targets
-    GtkTargetList *list = gtk_target_list_new(NULL, 0);
+    GtkTargetList *list = gtk_target_list_new(nullptr, 0);
 
     // Get the types of supported flavors
     nsCOMPtr<nsISupportsArray> flavors;
 
     rv = aTransferable->FlavorsTransferableCanExport(getter_AddRefs(flavors));
     if (!flavors || NS_FAILED(rv))
         return NS_ERROR_FAILURE;
 
@@ -237,17 +237,17 @@ NS_IMETHODIMP
 nsClipboard::GetData(nsITransferable *aTransferable, int32_t aWhichClipboard)
 {
     if (!aTransferable)
         return NS_ERROR_FAILURE;
 
     GtkClipboard *clipboard;
     clipboard = gtk_clipboard_get(GetSelectionAtom(aWhichClipboard));
 
-    guchar        *data = NULL;
+    guchar        *data = nullptr;
     gint           length = 0;
     bool           foundData = false;
     nsAutoCString  foundFlavor;
 
     // Get a list of flavors this transferable can import
     nsCOMPtr<nsISupportsArray> flavors;
     nsresult rv;
     rv = aTransferable->FlavorsTransferableCanImport(getter_AddRefs(flavors));
@@ -394,17 +394,17 @@ nsClipboard::HasDataMatchingFlavors(cons
     *_retval = false;
 
     GtkSelectionData *selection_data =
         GetTargets(GetSelectionAtom(aWhichClipboard));
     if (!selection_data)
         return NS_OK;
 
     gint n_targets = 0;
-    GdkAtom *targets = NULL;
+    GdkAtom *targets = nullptr;
 
     if (!gtk_selection_data_get_targets(selection_data, 
                                         &targets, &n_targets) ||
         !n_targets)
         return NS_OK;
 
     // Walk through the provided types and try to match it to a
     // provided type.
@@ -837,17 +837,17 @@ checkEventProc(Display *display, XEvent 
     if (event->xany.type == SelectionNotify ||
         (event->xany.type == PropertyNotify &&
          event->xproperty.atom == context->selAtom)) {
 
         GdkWindow *cbWindow = 
             gdk_x11_window_lookup_for_display(gdk_x11_lookup_xdisplay(display),
                                               event->xany.window);
         if (cbWindow) {
-            GtkWidget *cbWidget = NULL;
+            GtkWidget *cbWidget = nullptr;
             gdk_window_get_user_data(cbWindow, (gpointer *)&cbWidget);
             if (cbWidget && GTK_IS_WIDGET(cbWidget)) {
                 context->cbWidget = cbWidget;
                 return True;
             }
         }
     }
 
@@ -911,17 +911,17 @@ RetrievalContext::Wait()
     if (mState == COMPLETED) { // the request completed synchronously
         void *data = mData;
         mData = nullptr;
         return data;
     }
 
     Display *xDisplay = GDK_DISPLAY_XDISPLAY(gdk_display_get_default()) ;
     checkEventContext context;
-    context.cbWidget = NULL;
+    context.cbWidget = nullptr;
     context.selAtom = gdk_x11_atom_to_xatom(gdk_atom_intern("GDK_SELECTION",
                                                             FALSE));
 
     // Send X events which are relevant to the ongoing selection retrieval
     // to the clipboard widget.  Wait until either the operation completes, or
     // we hit our timeout.  All other X events remain queued.
 
     int select_result;
@@ -951,17 +951,17 @@ RetrievalContext::Wait()
             }
         }
 
         TimeStamp now = TimeStamp::Now();
         struct timeval tv;
         tv.tv_sec = 0;
         tv.tv_usec = std::max<int32_t>(0,
             kClipboardTimeout - (now - start).ToMicroseconds());
-        select_result = select(cnumber, &select_set, NULL, NULL, &tv);
+        select_result = select(cnumber, &select_set, nullptr, nullptr, &tv);
     } while (select_result == 1 ||
              (select_result == -1 && errno == EINTR));
 
 #ifdef DEBUG_CLIPBOARD
     printf("exceeded clipboard timeout\n");
 #endif
     mState = TIMED_OUT;
     return nullptr;
--- a/widget/gtk/nsDeviceContextSpecG.cpp
+++ b/widget/gtk/nsDeviceContextSpecG.cpp
@@ -342,20 +342,20 @@ void nsPrinterFeatures::SetCanChangeNumC
 
 //---------------
 // static members
 GlobalPrinters GlobalPrinters::mGlobalPrinters;
 nsTArray<nsString>* GlobalPrinters::mGlobalPrinterList = nullptr;
 //---------------
 
 nsDeviceContextSpecGTK::nsDeviceContextSpecGTK()
-  : mPrintJob(NULL)
-  , mGtkPrinter(NULL)
-  , mGtkPrintSettings(NULL)
-  , mGtkPageSetup(NULL)
+  : mPrintJob(nullptr)
+  , mGtkPrinter(nullptr)
+  , mGtkPrintSettings(nullptr)
+  , mGtkPageSetup(nullptr)
 {
   DO_PR_DEBUG_LOG(("nsDeviceContextSpecGTK::nsDeviceContextSpecGTK()\n"));
 }
 
 nsDeviceContextSpecGTK::~nsDeviceContextSpecGTK()
 {
   DO_PR_DEBUG_LOG(("nsDeviceContextSpecGTK::~nsDeviceContextSpecGTK()\n"));
 
--- a/widget/gtk/nsDragService.cpp
+++ b/widget/gtk/nsDragService.cpp
@@ -43,17 +43,17 @@
 // directly) so that this code can be compiled against versions of GTK+ that
 // do not have GtkDragResult.
 // GtkDragResult is available from GTK+ version 2.12.
 enum {
   MOZ_GTK_DRAG_RESULT_SUCCESS,
   MOZ_GTK_DRAG_RESULT_NO_TARGET
 };
 
-static PRLogModuleInfo *sDragLm = NULL;
+static PRLogModuleInfo *sDragLm = nullptr;
 
 // data used for synthetic periodic motion events sent to the source widget
 // grabbing real events for the drag.
 static guint sMotionEventTimerID;
 static GdkEvent *sMotionEvent;
 static GtkWidget *sGrabWidget;
 
 static const char gMimeListType[] = "application/x-moz-internal-item-list";
@@ -109,17 +109,17 @@ nsDragService::nsDragService()
     g_signal_connect(mHiddenWidget, "drag_end",
                      G_CALLBACK(invisibleSourceDragEnd), this);
     // drag-failed is available from GTK+ version 2.12
     guint dragFailedID = g_signal_lookup("drag-failed",
                                          G_TYPE_FROM_INSTANCE(mHiddenWidget));
     if (dragFailedID) {
         g_signal_connect_closure_by_id(mHiddenWidget, dragFailedID, 0,
                                        g_cclosure_new(G_CALLBACK(invisibleSourceDragFailed),
-                                                      this, NULL),
+                                                      this, nullptr),
                                        FALSE);
     }
 
     // set up our logging module
     if (!sDragLm)
         sDragLm = PR_NewLogModule("nsDragService");
     PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::nsDragService"));
     mCanDrop = false;
@@ -189,17 +189,17 @@ nsDragService::Observe(nsISupports *aSub
 static gboolean
 DispatchMotionEventCopy(gpointer aData)
 {
     // Clear the timer id before OnSourceGrabEventAfter is called during event
     // dispatch.
     sMotionEventTimerID = 0;
 
     GdkEvent *event = sMotionEvent;
-    sMotionEvent = NULL;
+    sMotionEvent = nullptr;
     // If there is no longer a grab on the widget, then the drag is over and
     // there is no need to continue drag motion.
     if (gtk_widget_has_grab(sGrabWidget)) {
         gtk_propagate_event(sGrabWidget, event);
     }
     gdk_event_free(event);
 
     // Cancel this timer;
@@ -241,48 +241,48 @@ OnSourceGrabEventAfter(GtkWidget *widget
     // G_PRIORITY_DEFAULT_IDLE is lower priority than GDK's redraw idle source
     // and lower than GTK's idle source that sends drag position messages after
     // motion-notify signals.
     //
     // http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#drag-and-drop-processing-model
     // recommends an interval of 350ms +/- 200ms.
     sMotionEventTimerID = 
         g_timeout_add_full(G_PRIORITY_DEFAULT_IDLE, 350,
-                           DispatchMotionEventCopy, NULL, NULL);
+                           DispatchMotionEventCopy, nullptr, nullptr);
 }
 
 static GtkWindow*
 GetGtkWindow(nsIDOMDocument *aDocument)
 {
     nsCOMPtr<nsIDocument> doc = do_QueryInterface(aDocument);
     if (!doc)
-        return NULL;
+        return nullptr;
 
     nsCOMPtr<nsIPresShell> presShell = doc->GetShell();
     if (!presShell)
-        return NULL;
+        return nullptr;
 
     nsRefPtr<nsViewManager> vm = presShell->GetViewManager();
     if (!vm)
-        return NULL;
+        return nullptr;
 
     nsCOMPtr<nsIWidget> widget;
     vm->GetRootWidget(getter_AddRefs(widget));
     if (!widget)
-        return NULL;
+        return nullptr;
 
     GtkWidget *gtkWidget =
         static_cast<nsWindow*>(widget.get())->GetMozContainerWidget();
     if (!gtkWidget)
-        return NULL;
+        return nullptr;
 
-    GtkWidget *toplevel = NULL;
+    GtkWidget *toplevel = nullptr;
     toplevel = gtk_widget_get_toplevel(gtkWidget);
     if (!GTK_IS_WINDOW(toplevel))
-        return NULL;
+        return nullptr;
 
     return GTK_WINDOW(toplevel);
 }   
 
 // nsIDragService
 
 NS_IMETHODIMP
 nsDragService::InvokeDragSession(nsIDOMNode *aDOMNode,
@@ -337,17 +337,17 @@ nsDragService::InvokeDragSession(nsIDOMN
     GdkEvent event;
     memset(&event, 0, sizeof(GdkEvent));
     event.type = GDK_BUTTON_PRESS;
     event.button.window = gtk_widget_get_window(mHiddenWidget);
     event.button.time = nsWindow::GetLastUserInputTime();
 
     // Put the drag widget in the window group of the source node so that the
     // gtk_grab_add during gtk_drag_begin is effective.
-    // gtk_window_get_group(NULL) returns the default window group.
+    // gtk_window_get_group(nullptr) returns the default window group.
     GtkWindowGroup *window_group =
         gtk_window_get_group(GetGtkWindow(mSourceDocument));
     gtk_window_group_add_window(window_group,
                                 GTK_WINDOW(mHiddenWidget));
 
 #if (MOZ_WIDGET_GTK == 3)
     // Get device for event source
     GdkDisplay *display = gdk_display_get_default();
@@ -402,17 +402,17 @@ nsDragService::SetAlphaPixmap(gfxASurfac
     // a compositing X window manager
     if (!gdk_screen_is_composited(screen))
       return false;
 
     GdkColormap* alphaColormap = gdk_screen_get_rgba_colormap(screen);
     if (!alphaColormap)
       return false;
 
-    GdkPixmap* pixmap = gdk_pixmap_new(NULL, dragRect.width, dragRect.height,
+    GdkPixmap* pixmap = gdk_pixmap_new(nullptr, dragRect.width, dragRect.height,
                                        gdk_colormap_get_visual(alphaColormap)->depth);
     if (!pixmap)
       return false;
 
     gdk_drawable_set_colormap(GDK_DRAWABLE(pixmap), alphaColormap);
 
     // Make a gfxXlibSurface wrapped around the pixmap to render on
     nsRefPtr<gfxASurface> xPixmapSurface =
@@ -428,17 +428,17 @@ nsDragService::SetAlphaPixmap(gfxASurfac
     xPixmapCtx->Paint();
 
     // ...and paint the drag image with translucency
     xPixmapCtx->SetOperator(gfxContext::OPERATOR_SOURCE);
     xPixmapCtx->SetSource(aSurface);
     xPixmapCtx->Paint(DRAG_IMAGE_ALPHA_LEVEL);
 
     // The drag transaction addrefs the pixmap, so we can just unref it from us here
-    gtk_drag_set_icon_pixmap(aContext, alphaColormap, pixmap, NULL,
+    gtk_drag_set_icon_pixmap(aContext, alphaColormap, pixmap, nullptr,
                              aXOffset, aYOffset);
     g_object_unref(pixmap);
     return true;
 #else
     // TODO GTK3
     return false;
 #endif
 }
@@ -455,25 +455,25 @@ nsDragService::EndDragSession(bool aDone
 {
     PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::EndDragSession %d",
                                    aDoneDrag));
 
     if (sGrabWidget) {
         g_signal_handlers_disconnect_by_func(sGrabWidget,
              FuncToGpointer(OnSourceGrabEventAfter), this);
         g_object_unref(sGrabWidget);
-        sGrabWidget = NULL;
+        sGrabWidget = nullptr;
 
         if (sMotionEventTimerID) {
             g_source_remove(sMotionEventTimerID);
             sMotionEventTimerID = 0;
         }
         if (sMotionEvent) {
             gdk_event_free(sMotionEvent);
-            sMotionEvent = NULL;
+            sMotionEvent = nullptr;
         }
     }
 
     // unset our drag action
     SetDragAction(DRAGDROP_ACTION_NONE);
     return nsBaseDragService::EndDragSession(aDoneDrag);
 }
 
@@ -975,17 +975,17 @@ nsDragService::IsDataFlavorSupported(con
     }
 
     // check the target context vs. this flavor, one at a time
     GList *tmp;
     for (tmp = gdk_drag_context_list_targets(mTargetDragContext); 
          tmp; tmp = tmp->next) {
         /* Bug 331198 */
         GdkAtom atom = GDK_POINTER_TO_ATOM(tmp->data);
-        gchar *name = NULL;
+        gchar *name = nullptr;
         name = gdk_atom_name(atom);
         PR_LOG(sDragLm, PR_LOG_DEBUG,
                ("checking %s against %s\n", name, aDataFlavor));
         if (name && (strcmp(name, aDataFlavor) == 0)) {
             PR_LOG(sDragLm, PR_LOG_DEBUG, ("good!\n"));
             *_retval = true;
         }
         // check for automatic text/uri-list -> text/x-moz-url mapping
@@ -1076,32 +1076,32 @@ nsDragService::TargetDataReceived(GtkWid
     }
 }
 
 bool
 nsDragService::IsTargetContextList(void)
 {
     bool retval = false;
 
-    // gMimeListType drags only work for drags within a single process.
-    // The gtk_drag_get_source_widget() function will return NULL if the
-    // source of the drag is another app, so we use it to check if a
-    // gMimeListType drop will work or not.
-    if (gtk_drag_get_source_widget(mTargetDragContext) == NULL)
+    // gMimeListType drags only work for drags within a single process. The
+    // gtk_drag_get_source_widget() function will return nullptr if the source
+    // of the drag is another app, so we use it to check if a gMimeListType
+    // drop will work or not.
+    if (gtk_drag_get_source_widget(mTargetDragContext) == nullptr)
         return retval;
 
     GList *tmp;
 
     // walk the list of context targets and see if one of them is a list
     // of items.
     for (tmp = gdk_drag_context_list_targets(mTargetDragContext); 
          tmp; tmp = tmp->next) {
         /* Bug 331198 */
         GdkAtom atom = GDK_POINTER_TO_ATOM(tmp->data);
-        gchar *name = NULL;
+        gchar *name = nullptr;
         name = gdk_atom_name(atom);
         if (name && strcmp(name, gMimeListType) == 0)
             retval = true;
         g_free(name);
         if (retval)
             break;
     }
     return retval;
@@ -1142,17 +1142,17 @@ nsDragService::TargetResetData(void)
     mTargetDragData = 0;
     mTargetDragDataLen = 0;
 }
 
 GtkTargetList *
 nsDragService::GetSourceList(void)
 {
     if (!mSourceDataItems)
-        return NULL;
+        return nullptr;
     nsTArray<GtkTargetEntry*> targetArray;
     GtkTargetEntry *targets;
     GtkTargetList  *targetList = 0;
     uint32_t targetCount = 0;
     unsigned int numDragItems = 0;
 
     mSourceDataItems->Count(&numDragItems);
 
@@ -1321,32 +1321,33 @@ nsDragService::SourceEndDragSession(GdkD
         // or SourceEndDragSession on drag-failed
         return;
 
     if (mEndDragPoint.x < 0) {
         // We don't have a drag end point, so guess
         gint x, y;
         GdkDisplay* display = gdk_display_get_default();
         if (display) {
-            gdk_display_get_pointer(display, NULL, &x, &y, NULL);
+            gdk_display_get_pointer(display, nullptr, &x, &y, nullptr);
             SetDragEndPoint(nsIntPoint(x, y));
         }
     }
 
     // Either the drag was aborted or the drop occurred outside the app.
     // The dropEffect of mDataTransfer is not updated for motion outside the
     // app, but is needed for the dragend event, so set it now.
 
     uint32_t dropEffect;
 
     if (aResult == MOZ_GTK_DRAG_RESULT_SUCCESS) {
 
         // With GTK+ versions 2.10.x and prior the drag may have been
         // cancelled (but no drag-failed signal would have been sent).
-        // aContext->dest_window will be non-NULL only if the drop was sent.
+        // aContext->dest_window will be non-nullptr only if the drop was
+        // sent.
         GdkDragAction action =
             gdk_drag_context_get_dest_window(aContext) ? 
                 gdk_drag_context_get_actions(aContext) : (GdkDragAction)0;
 
         // Only one bit of action should be set, but, just in case someone
         // does something funny, erring away from MOVE, and not recording
         // unusual action combinations as NONE.
         if (!action)
@@ -1369,35 +1370,35 @@ nsDragService::SourceEndDragSession(GdkD
         }
     }
 
     if (mDataTransfer) {
         mDataTransfer->SetDropEffectInt(dropEffect);
     }
 
     // Schedule the appropriate drag end dom events.
-    Schedule(eDragTaskSourceEnd, nullptr, NULL, nsIntPoint(), 0);
+    Schedule(eDragTaskSourceEnd, nullptr, nullptr, nsIntPoint(), 0);
 }
 
 static void
 CreateUriList(nsISupportsArray *items, gchar **text, gint *length)
 {
     uint32_t i, count;
-    GString *uriList = g_string_new(NULL);
+    GString *uriList = g_string_new(nullptr);
 
     items->Count(&count);
     for (i = 0; i < count; i++) {
         nsCOMPtr<nsISupports> genericItem;
         items->GetElementAt(i, getter_AddRefs(genericItem));
         nsCOMPtr<nsITransferable> item;
         item = do_QueryInterface(genericItem);
 
         if (item) {
             uint32_t tmpDataLen = 0;
-            void    *tmpData = NULL;
+            void    *tmpData = nullptr;
             nsresult rv = NS_OK;
             nsCOMPtr<nsISupports> data;
             rv = item->GetTransferData(kURLMime,
                                        getter_AddRefs(data),
                                        &tmpDataLen);
 
             if (NS_SUCCEEDED(rv)) {
                 nsPrimitiveHelpers::CreateDataFromPrimitive(kURLMime,
@@ -1493,17 +1494,17 @@ nsDragService::SourceDataGet(GtkWidget  
         else if (strcmp(mimeFlavor, gTextUriListType) == 0) {
             actualFlavor = gTextUriListType;
             needToDoConversionToPlainText = true;
         }
         else
             actualFlavor = mimeFlavor;
 
         uint32_t tmpDataLen = 0;
-        void    *tmpData = NULL;
+        void    *tmpData = nullptr;
         nsresult rv;
         nsCOMPtr<nsISupports> data;
         rv = item->GetTransferData(actualFlavor,
                                    getter_AddRefs(data),
                                    &tmpDataLen);
         if (NS_SUCCEEDED(rv)) {
             nsPrimitiveHelpers::CreateDataFromPrimitive (actualFlavor, data,
                                                          &tmpData, tmpDataLen);
@@ -1722,17 +1723,17 @@ nsDragService::ScheduleMotionEvent(nsWin
 }
 
 void
 nsDragService::ScheduleLeaveEvent()
 {
     // We don't know at this stage whether a drop signal will immediately
     // follow.  If the drop signal gets sent it will happen before we return
     // to the main loop and the scheduled leave task will be replaced.
-    if (!Schedule(eDragTaskLeave, nullptr, NULL, nsIntPoint(), 0)) {
+    if (!Schedule(eDragTaskLeave, nullptr, nullptr, nsIntPoint(), 0)) {
         NS_WARNING("Drag leave after drop");
     }        
 }
 
 gboolean
 nsDragService::ScheduleDropEvent(nsWindow *aWindow,
                                  GdkDragContext *aDragContext,
                                  nsIntPoint aWindowPoint, guint aTime)
@@ -1775,18 +1776,18 @@ nsDragService::Schedule(DragTask aTask, 
 
     if (!mTaskSource) {
         // High priority is used here because the native events involved have
         // already waited at default priority.  Perhaps a lower than default
         // priority could be used for motion tasks because there is a chance
         // that a leave or drop is waiting, but managing different priorities
         // may not be worth the effort.  Motion tasks shouldn't queue up as
         // they should be throttled based on replies.
-        mTaskSource =
-            g_idle_add_full(G_PRIORITY_HIGH, TaskDispatchCallback, this, NULL);
+        mTaskSource = g_idle_add_full(G_PRIORITY_HIGH, TaskDispatchCallback,
+                                      this, nullptr);
     }
     return TRUE;
 }
 
 gboolean
 nsDragService::TaskDispatchCallback(gpointer data)
 {
     nsRefPtr<nsDragService> dragService = static_cast<nsDragService*>(data);
@@ -1836,17 +1837,17 @@ nsDragService::RunScheduledTask()
         // Returning false removes the task source from the event loop.
         mTaskSource = 0;
         return FALSE;
     }
 
     // This may be the start of a destination drag session.
     StartDragSession();
 
-    // mTargetWidget may be NULL if the window has been destroyed.
+    // mTargetWidget may be nullptr if the window has been destroyed.
     // (The leave event is not scheduled if a drop task is still scheduled.)
     // We still reply appropriately to indicate that the drop will or didn't
     // succeeed. 
     mTargetWidget = mTargetWindow->GetMozContainerWidget();
     mTargetDragContext.steal(mPendingDragContext);
     mTargetTime = mPendingTime;
 
     // http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#drag-and-drop-processing-model
@@ -1895,18 +1896,18 @@ nsDragService::RunScheduledTask()
         // window.
         mTargetWindow = nullptr;
         // Make sure to end the drag session. If this drag started in a
         // different app, we won't get a drag_end signal to end it from.
         EndDragSession(true);
     }
 
     // We're done with the drag context.
-    mTargetWidget = NULL;
-    mTargetDragContext = NULL;
+    mTargetWidget = nullptr;
+    mTargetDragContext = nullptr;
 
     // If we got another drag signal while running the sheduled task, that
     // must have happened while running a nested event loop.  Leave the task
     // source on the event loop.
     if (mScheduledTask != eDragTaskNone)
         return TRUE;
 
     // We have no task scheduled.
--- a/widget/gtk/nsDragService.h
+++ b/widget/gtk/nsDragService.h
@@ -131,17 +131,17 @@ private:
     guint mTaskSource;
 
     // target/destination side vars
     // These variables keep track of the state of the current drag.
 
     // mPendingWindow, mPendingWindowPoint, mPendingDragContext, and
     // mPendingTime, carry information from the GTK signal that will be used
     // when the scheduled task is run.  mPendingWindow and mPendingDragContext
-    // will be NULL if the scheduled task is eDragTaskLeave.
+    // will be nullptr if the scheduled task is eDragTaskLeave.
     nsRefPtr<nsWindow> mPendingWindow;
     nsIntPoint mPendingWindowPoint;
     nsCountedRef<GdkDragContext> mPendingDragContext;
     guint mPendingTime;
 
     // mTargetWindow and mTargetWindowPoint record the position of the last
     // eDragTaskMotion or eDragTaskDrop task that was run or is still running.
     // mTargetWindow is cleared once the drag has completed or left.
--- a/widget/gtk/nsFilePicker.cpp
+++ b/widget/gtk/nsFilePicker.cpp
@@ -87,20 +87,21 @@ UpdateFilePreviewWidget(GtkFileChooser *
     return;
   }
 
   GdkPixbuf *preview_pixbuf;
   // Only scale down images that are too big
   if (preview_width > MAX_PREVIEW_SIZE || preview_height > MAX_PREVIEW_SIZE) {
     preview_pixbuf = gdk_pixbuf_new_from_file_at_size(image_filename,
                                                       MAX_PREVIEW_SIZE,
-                                                      MAX_PREVIEW_SIZE, NULL);
+                                                      MAX_PREVIEW_SIZE,
+                                                      nullptr);
   }
   else {
-    preview_pixbuf = gdk_pixbuf_new_from_file(image_filename, NULL);
+    preview_pixbuf = gdk_pixbuf_new_from_file(image_filename, nullptr);
   }
 
   g_free(image_filename);
 
   if (!preview_pixbuf) {
     gtk_file_chooser_set_preview_widget_active(file_chooser, FALSE);
     return;
   }
@@ -362,17 +363,17 @@ nsFilePicker::Open(nsIFilePickerShownCal
 
   GtkFileChooserAction action = GetGtkFileChooserAction(mMode);
   const gchar *accept_button = (action == GTK_FILE_CHOOSER_ACTION_SAVE)
                                ? GTK_STOCK_SAVE : GTK_STOCK_OPEN;
   GtkWidget *file_chooser =
       gtk_file_chooser_dialog_new(title, parent_widget, action,
                                   GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                                   accept_button, GTK_RESPONSE_ACCEPT,
-                                  NULL);
+                                  nullptr);
   gtk_dialog_set_alternative_button_order(GTK_DIALOG(file_chooser),
                                           GTK_RESPONSE_ACCEPT,
                                           GTK_RESPONSE_CANCEL,
                                           -1);
   if (mAllowURLs) {
     gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(file_chooser), FALSE);
   }
 
@@ -430,17 +431,17 @@ nsFilePicker::Open(nsIFilePickerShownCal
     // so we need to split out each string, and add it manually.
 
     char **patterns = g_strsplit(mFilters[i].get(), ";", -1);
     if (!patterns) {
       return NS_ERROR_OUT_OF_MEMORY;
     }
 
     GtkFileFilter *filter = gtk_file_filter_new();
-    for (int j = 0; patterns[j] != NULL; ++j) {
+    for (int j = 0; patterns[j] != nullptr; ++j) {
       nsAutoCString caseInsensitiveFilter = MakeCaseInsensitiveShellGlob(g_strstrip(patterns[j]));
       gtk_file_filter_add_pattern(filter, caseInsensitiveFilter.get());
     }
 
     g_strfreev(patterns);
 
     if (!mFilterNames[i].IsEmpty()) {
       // If we have a name for our filter, let's use that.
--- a/widget/gtk/nsGtkCursors.h
+++ b/widget/gtk/nsGtkCursors.h
@@ -394,12 +394,12 @@ static const nsGtkCursor GtkCursors[] = 
   { moz_menu_bits,           moz_menu_mask_bits,           2,  2,  "08ffe1e65f80fcfdf9fff11263e74c48" },
   { moz_spinning_bits,       moz_spinning_mask_bits,       2,  2,  "08e8e1c95fe2fc01f976f1e063a24ccd" },
   { moz_zoom_in_bits,        moz_zoom_in_mask_bits,        6,  6,  "f41c0e382c94c0958e07017e42b00462" },
   { moz_zoom_out_bits,       moz_zoom_out_mask_bits,       6,  6,  "f41c0e382c97c0938e07017e42800402" },
   { moz_not_allowed_bits,    moz_not_allowed_mask_bits,    9,  9,  "03b6e0fcb3499374a867d041f52298f0" },
   { moz_vertical_text_bits,  moz_vertical_text_mask_bits,  8,  4,  "048008013003cff3c00c801001200000" },
   { moz_nesw_resize_bits,    moz_nesw_resize_mask_bits,    8,  8,  "50585d75b494802d0151028115016902" },
   { moz_nwse_resize_bits,    moz_nwse_resize_mask_bits,    8,  8,  "38c5dff7c7b8962045400281044508d2" },
-  { moz_none_bits,           moz_none_mask_bits,           0,  0,  NULL }
+  { moz_none_bits,           moz_none_mask_bits,           0,  0,  nullptr }
 };
 
 #endif /* nsGtkCursors_h__ */
--- a/widget/gtk/nsGtkIMModule.cpp
+++ b/widget/gtk/nsGtkIMModule.cpp
@@ -207,26 +207,26 @@ nsGtkIMModule::PrepareToDestroyContext(G
 {
     MozContainer* container = mOwnerWindow->GetMozContainer();
     NS_PRECONDITION(container, "The container of the window is null");
 
     GtkIMMulticontext *multicontext = GTK_IM_MULTICONTEXT(aContext);
 #if (MOZ_WIDGET_GTK == 2)
     GtkIMContext *slave = multicontext->slave;
 #else
-    GtkIMContext *slave = NULL; //TODO GTK3
+    GtkIMContext *slave = nullptr; //TODO GTK3
 #endif
     if (!slave) {
         return;
     }
 
     GType slaveType = G_TYPE_FROM_INSTANCE(slave);
     const gchar *im_type_name = g_type_name(slaveType);
     if (strcmp(im_type_name, "GtkIMContextXIM") == 0) {
-        if (gtk_check_version(2, 12, 1) == NULL) {
+        if (gtk_check_version(2, 12, 1) == nullptr) {
             return; // gtk bug has been fixed
         }
 
         struct GtkIMContextXIM
         {
             GtkIMContext parent;
             gpointer private_data;
             // ... other fields
@@ -235,17 +235,17 @@ nsGtkIMModule::PrepareToDestroyContext(G
         gpointer signal_data =
             reinterpret_cast<GtkIMContextXIM*>(slave)->private_data;
         if (!signal_data) {
             return;
         }
 
         g_signal_handlers_disconnect_matched(
             gtk_widget_get_display(GTK_WIDGET(container)),
-            G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, signal_data);
+            G_SIGNAL_MATCH_DATA, 0, 0, nullptr, nullptr, signal_data);
 
         // Add a reference to prevent the XIM module from being unloaded
         // and reloaded: each time the module is loaded and used, it
         // opens (and doesn't close) new XOpenIM connections.
         static gpointer gtk_xim_context_class =
             g_type_class_ref(slaveType);
         // Mute unused variable warning:
         (void)gtk_xim_context_class;
@@ -1196,27 +1196,27 @@ nsGtkIMModule::SetTextRangeList(nsTArray
         }
 
         gunichar2* uniStr = nullptr;
         if (start == 0) {
             range.mStartOffset = 0;
         } else {
             glong uniStrLen;
             uniStr = g_utf8_to_utf16(preedit_string, start,
-                                     NULL, &uniStrLen, NULL);
+                                     nullptr, &uniStrLen, nullptr);
             if (uniStr) {
                 range.mStartOffset = uniStrLen;
                 g_free(uniStr);
                 uniStr = nullptr;
             }
         }
 
         glong uniStrLen;
         uniStr = g_utf8_to_utf16(preedit_string + start, end - start,
-                                 NULL, &uniStrLen, NULL);
+                                 nullptr, &uniStrLen, nullptr);
         if (!uniStr) {
             range.mEndOffset = range.mStartOffset;
         } else {
             range.mEndOffset = range.mStartOffset + uniStrLen;
             g_free(uniStr);
             uniStr = nullptr;
         }
 
--- a/widget/gtk/nsGtkKeyUtils.cpp
+++ b/widget/gtk/nsGtkKeyUtils.cpp
@@ -458,17 +458,17 @@ KeymapWrapper::OnKeysChanged(GdkKeymap *
     }
 }
 
 /* static */ guint
 KeymapWrapper::GetCurrentModifierState()
 {
     GdkModifierType modifiers;
     gdk_display_get_pointer(gdk_display_get_default(),
-                            NULL, NULL, NULL, &modifiers);
+                            nullptr, nullptr, nullptr, &modifiers);
     return static_cast<guint>(modifiers);
 }
 
 /* static */ bool
 KeymapWrapper::AreModifiersCurrentlyActive(Modifiers aModifiers)
 {
     guint modifierState = GetCurrentModifierState();
     return AreModifiersActive(aModifiers, modifierState);
@@ -930,17 +930,17 @@ uint32_t
 KeymapWrapper::GetCharCodeFor(const GdkEventKey *aGdkKeyEvent,
                               guint aModifierState,
                               gint aGroup)
 {
     guint keyval;
     if (!gdk_keymap_translate_keyboard_state(mGdkKeymap,
              aGdkKeyEvent->hardware_keycode,
              GdkModifierType(aModifierState),
-             aGroup, &keyval, NULL, NULL, NULL)) {
+             aGroup, &keyval, nullptr, nullptr, nullptr)) {
         return 0;
     }
     GdkEventKey tmpEvent = *aGdkKeyEvent;
     tmpEvent.state = aModifierState;
     tmpEvent.keyval = keyval;
     tmpEvent.group = aGroup;
     return GetCharCodeFor(&tmpEvent);
 }
@@ -948,17 +948,17 @@ KeymapWrapper::GetCharCodeFor(const GdkE
 
 gint
 KeymapWrapper::GetKeyLevel(GdkEventKey *aGdkKeyEvent)
 {
     gint level;
     if (!gdk_keymap_translate_keyboard_state(mGdkKeymap,
              aGdkKeyEvent->hardware_keycode,
              GdkModifierType(aGdkKeyEvent->state),
-             aGdkKeyEvent->group, NULL, NULL, &level, NULL)) {
+             aGdkKeyEvent->group, nullptr, nullptr, &level, nullptr)) {
         return -1;
     }
     return level;
 }
 
 gint
 KeymapWrapper::GetFirstLatinGroup()
 {
@@ -1014,17 +1014,17 @@ KeymapWrapper::IsBasicLatinLetterOrNumer
 KeymapWrapper::GetGDKKeyvalWithoutModifier(const GdkEventKey *aGdkKeyEvent)
 {
     KeymapWrapper* keymapWrapper = GetInstance();
     guint state =
         (aGdkKeyEvent->state & keymapWrapper->GetModifierMask(NUM_LOCK));
     guint keyval;
     if (!gdk_keymap_translate_keyboard_state(keymapWrapper->mGdkKeymap,
              aGdkKeyEvent->hardware_keycode, GdkModifierType(state),
-             aGdkKeyEvent->group, &keyval, NULL, NULL, NULL)) {
+             aGdkKeyEvent->group, &keyval, nullptr, nullptr, nullptr)) {
         return 0;
     }
     return keyval;
 }
 
 /* static */ uint32_t
 KeymapWrapper::GetDOMKeyCodeFromKeyPairs(guint aGdkKeyval)
 {
--- a/widget/gtk/nsGtkKeyUtils.h
+++ b/widget/gtk/nsGtkKeyUtils.h
@@ -154,17 +154,17 @@ protected:
           mHardwareKeycode(aHardwareKeycode), mMask(0)
         {
         }
     };
     nsTArray<ModifierKey> mModifierKeys;
 
     /**
      * GetModifierKey() returns modifier key information of the hardware
-     * keycode.  If the key isn't a modifier key, returns NULL.
+     * keycode.  If the key isn't a modifier key, returns nullptr.
      */
     ModifierKey* GetModifierKey(guint aHardwareKeycode);
 
     /**
      * mModifierMasks is bit masks for each modifier.  The index should be one
      * of ModifierIndex values.
      */
     enum ModifierIndex {
@@ -216,32 +216,32 @@ protected:
     static void OnKeysChanged(GdkKeymap* aKeymap, KeymapWrapper* aKeymapWrapper);
     static void OnDestroyKeymap(KeymapWrapper* aKeymapWrapper,
                                 GdkKeymap *aGdkKeymap);
 
     /**
      * GetCharCodeFor() Computes what character is inputted by the key event
      * with aModifierState and aGroup.
      *
-     * @param aGdkKeyEvent      Native key event, must not be NULL.
+     * @param aGdkKeyEvent      Native key event, must not be nullptr.
      * @param aModifierState    Combination of GdkModifierType which you
      *                          want to test with aGdkKeyEvent.
      * @param aGroup            Set group in the mGdkKeymap.
      * @return                  charCode which is inputted by aGdkKeyEvent.
      *                          If failed, this returns 0.
      */
     static uint32_t GetCharCodeFor(const GdkEventKey *aGdkKeyEvent);
     uint32_t GetCharCodeFor(const GdkEventKey *aGdkKeyEvent,
                             guint aModifierState,
                             gint aGroup);
 
     /**
      * GetKeyLevel() returns level of the aGdkKeyEvent in mGdkKeymap.
      *
-     * @param aGdkKeyEvent      Native key event, must not be NULL.
+     * @param aGdkKeyEvent      Native key event, must not be nullptr.
      * @return                  Using level.  Typically, this is 0 or 1.
      *                          If failed, this returns -1.
      */
     gint GetKeyLevel(GdkEventKey *aGdkKeyEvent);
 
     /**
      * GetFirstLatinGroup() returns group of mGdkKeymap which can input an
      * ASCII character by GDK_A.
@@ -282,17 +282,17 @@ protected:
      * it's in KeyPair table.
      */
     static uint32_t GetDOMKeyCodeFromKeyPairs(guint aGdkKeyval);
 
     /**
      * InitKeypressEvent() intializes keyCode, charCode and
      * alternativeCharCodes of keypress event.
      *
-     * @param aKeyEvent         An NS_KEY_PRESS event, must not be NULL.
+     * @param aKeyEvent         An NS_KEY_PRESS event, must not be nullptr.
      *                          The modifier related members and keyCode must
      *                          be initialized already.
      * @param aGdkKeyEvent      A native key event which causes dispatching
      *                          aKeyEvent.
      */
     void InitKeypressEvent(WidgetKeyboardEvent& aKeyEvent,
                            GdkEventKey* aGdkKeyEvent);
 };
--- a/widget/gtk/nsLookAndFeel.cpp
+++ b/widget/gtk/nsLookAndFeel.cpp
@@ -461,17 +461,17 @@ static void darken_gdk_color(GdkColor *s
     dest->red = red * 65535.0;
     dest->green = green * 65535.0;
     dest->blue = blue * 65535.0;
 }
 #endif
 
 static int32_t CheckWidgetStyle(GtkWidget* aWidget, const char* aStyle, int32_t aResult) {
     gboolean value = FALSE;
-    gtk_widget_style_get(aWidget, aStyle, &value, NULL);
+    gtk_widget_style_get(aWidget, aStyle, &value, nullptr);
     return value ? aResult : 0;
 }
 
 static int32_t ConvertGTKStepperStyleToMozillaScrollArrowStyle(GtkWidget* aWidget)
 {
     if (!aWidget)
         return mozilla::LookAndFeel::eScrollArrowStyle_Single;
   
@@ -517,17 +517,17 @@ nsLookAndFeel::GetIntImpl(IntID aID, int
             GtkSettings *settings;
             gint blink_time;
             gboolean blink;
 
             settings = gtk_settings_get_default ();
             g_object_get (settings,
                           "gtk-cursor-blink-time", &blink_time,
                           "gtk-cursor-blink", &blink,
-                          NULL);
+                          nullptr);
  
             if (blink)
                 aResult = (int32_t) blink_time;
             else
                 aResult = 0;
             break;
         }
     case eIntID_CaretWidth:
@@ -543,34 +543,34 @@ nsLookAndFeel::GetIntImpl(IntID aID, int
             gboolean select_on_focus;
 
             entry = gtk_entry_new();
             g_object_ref_sink(entry);
             settings = gtk_widget_get_settings(entry);
             g_object_get(settings, 
                          "gtk-entry-select-on-focus",
                          &select_on_focus,
-                         NULL);
+                         nullptr);
             
             if(select_on_focus)
                 aResult = 1;
             else
                 aResult = 0;
 
             gtk_widget_destroy(entry);
             g_object_unref(entry);
         }
         break;
     case eIntID_SubmenuDelay:
         {
             GtkSettings *settings;
             gint delay;
 
             settings = gtk_settings_get_default ();
-            g_object_get (settings, "gtk-menu-popup-delay", &delay, NULL);
+            g_object_get (settings, "gtk-menu-popup-delay", &delay, nullptr);
             aResult = (int32_t) delay;
             break;
         }
     case eIntID_TooltipDelay:
         {
             aResult = 500;
             break;
         }
@@ -583,17 +583,17 @@ nsLookAndFeel::GetIntImpl(IntID aID, int
         break;
     case eIntID_DragThresholdX:
     case eIntID_DragThresholdY:
         {
             GtkWidget* box = gtk_hbox_new(FALSE, 5);
             gint threshold = 0;
             g_object_get(gtk_widget_get_settings(box),
                          "gtk-dnd-drag-threshold", &threshold,
-                         NULL);
+                         nullptr);
             g_object_ref_sink(box);
             
             aResult = threshold;
         }
         break;
     case eIntID_ScrollArrowStyle:
         moz_gtk_init();
         aResult =
@@ -703,17 +703,17 @@ GetSystemFontInfo(GtkWidget *aWidget,
                   nsString *aFontName,
                   gfxFontStyle *aFontStyle)
 {
     GtkSettings *settings = gtk_widget_get_settings(aWidget);
 
     aFontStyle->style       = NS_FONT_STYLE_NORMAL;
 
     gchar *fontname;
-    g_object_get(settings, "gtk-font-name", &fontname, NULL);
+    g_object_get(settings, "gtk-font-name", &fontname, nullptr);
 
     PangoFontDescription *desc;
     desc = pango_font_description_from_string(fontname);
 
     aFontStyle->systemFont = true;
 
     g_free(fontname);
 
@@ -819,19 +819,19 @@ GetSystemFontInfo(LookAndFeel::FontID /*
 
 #endif // not MOZ_PANGO
 
 bool
 nsLookAndFeel::GetFontImpl(FontID aID, nsString& aFontName,
                            gfxFontStyle& aFontStyle,
                            float aDevPixPerCSSPixel)
 {
-  nsString *cachedFontName = NULL;
-  gfxFontStyle *cachedFontStyle = NULL;
-  bool *isCached = NULL;
+  nsString *cachedFontName = nullptr;
+  gfxFontStyle *cachedFontStyle = nullptr;
+  bool *isCached = nullptr;
 
   switch (aID) {
     case eFont_Menu:         // css2
     case eFont_PullDownMenu: // css3
       cachedFontName = &mMenuFontName;
       cachedFontStyle = &mMenuFontStyle;
       isCached = &mMenuFontCached;
       aID = eFont_Menu;
@@ -933,18 +933,18 @@ nsLookAndFeel::Init()
     GtkWidget *menuitem = gtk_menu_item_new();
     GtkWidget *menu = gtk_menu_new();
 
     g_object_ref_sink(menu);
 
     gtk_container_add(GTK_CONTAINER(menuitem), accel_label);
     gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
 
-    gtk_widget_set_style(accel_label, NULL);
-    gtk_widget_set_style(menu, NULL);
+    gtk_widget_set_style(accel_label, nullptr);
+    gtk_widget_set_style(menu, nullptr);
     gtk_widget_realize(menu);
     gtk_widget_realize(accel_label);
 
     style = gtk_widget_get_style(accel_label);
     if (style) {
         sMenuText = GDK_COLOR_TO_NS_RGB(style->fg[GTK_STATE_NORMAL]);
     }
 
@@ -1059,24 +1059,24 @@ nsLookAndFeel::Init()
     gtk_container_add(GTK_CONTAINER(parent), treeView);
     gtk_container_add(GTK_CONTAINER(parent), linkButton);
     gtk_container_add(GTK_CONTAINER(parent), combobox);
     gtk_container_add(GTK_CONTAINER(parent), menuBar);
     gtk_container_add(GTK_CONTAINER(window), parent);
     gtk_container_add(GTK_CONTAINER(parent), entry);
     
 #if (MOZ_WIDGET_GTK == 2)
-    gtk_widget_set_style(button, NULL);
-    gtk_widget_set_style(label, NULL);
-    gtk_widget_set_style(treeView, NULL);
-    gtk_widget_set_style(linkButton, NULL);
-    gtk_widget_set_style(combobox, NULL);
-    gtk_widget_set_style(comboboxLabel, NULL);
-    gtk_widget_set_style(menuBar, NULL);
-    gtk_widget_set_style(entry, NULL);
+    gtk_widget_set_style(button, nullptr);
+    gtk_widget_set_style(label, nullptr);
+    gtk_widget_set_style(treeView, nullptr);
+    gtk_widget_set_style(linkButton, nullptr);
+    gtk_widget_set_style(combobox, nullptr);
+    gtk_widget_set_style(comboboxLabel, nullptr);
+    gtk_widget_set_style(menuBar, nullptr);
+    gtk_widget_set_style(entry, nullptr);
 
     gtk_widget_realize(button);
     gtk_widget_realize(label);
     gtk_widget_realize(treeView);
     gtk_widget_realize(linkButton);
     gtk_widget_realize(combobox);
     gtk_widget_realize(comboboxLabel);
     gtk_widget_realize(menuBar);
@@ -1103,27 +1103,27 @@ nsLookAndFeel::Init()
     }
 
     // GTK's guide to fancy odd row background colors:
     // 1) Check if a theme explicitly defines an odd row color
     // 2) If not, check if it defines an even row color, and darken it
     //    slightly by a hardcoded value (gtkstyle.c)
     // 3) If neither are defined, take the base background color and
     //    darken that by a hardcoded value
-    colorValuePtr = NULL;
+    colorValuePtr = nullptr;
     gtk_widget_style_get(treeView,
                          "odd-row-color", &colorValuePtr,
-                         NULL);
+                         nullptr);
 
     if (colorValuePtr) {
         colorValue = *colorValuePtr;
     } else {
         gtk_widget_style_get(treeView,
                              "even-row-color", &colorValuePtr,
-                             NULL);
+                             nullptr);
         if (colorValuePtr)
             darken_gdk_color(colorValuePtr, &colorValue);
         else
             darken_gdk_color(&treeView->style->base[GTK_STATE_NORMAL], &colorValue);
     }
 
     sOddCellBackground = GDK_COLOR_TO_NS_RGB(colorValue);
     if (colorValuePtr)
@@ -1187,40 +1187,40 @@ nsLookAndFeel::Init()
     gboolean supports_menubar_drag = FALSE;
     GParamSpec *param_spec =
         gtk_widget_class_find_style_property(GTK_WIDGET_GET_CLASS(menuBar),
                                              "window-dragging");
     if (param_spec) {
         if (g_type_is_a(G_PARAM_SPEC_VALUE_TYPE(param_spec), G_TYPE_BOOLEAN)) {
             gtk_widget_style_get(menuBar,
                                  "window-dragging", &supports_menubar_drag,
-                                 NULL);
+                                 nullptr);
         }
     }
     sMenuSupportsDrag = supports_menubar_drag;
 
-    colorValuePtr = NULL;
-    gtk_widget_style_get(linkButton, "link-color", &colorValuePtr, NULL);
+    colorValuePtr = nullptr;
+    gtk_widget_style_get(linkButton, "link-color", &colorValuePtr, nullptr);
     if (colorValuePtr) {
         colorValue = *colorValuePtr; // we can't pass deref pointers to GDK_COLOR_TO_NS_RGB
         sNativeHyperLinkText = GDK_COLOR_TO_NS_RGB(colorValue);
         gdk_color_free(colorValuePtr);
     } else {
         sNativeHyperLinkText = NS_RGB(0x00,0x00,0xEE);
     }
 
     // invisible character styles
     guint value;
-    g_object_get (entry, "invisible-char", &value, NULL);
+    g_object_get (entry, "invisible-char", &value, nullptr);
     sInvisibleCharacter = PRUnichar(value);
 
     // caret styles
     gtk_widget_style_get(entry,
                          "cursor-aspect-ratio", &sCaretRatio,
-                         NULL);
+                         nullptr);
 
     gtk_widget_destroy(window);
 }
 
 // virtual
 PRUnichar
 nsLookAndFeel::GetPasswordCharacterImpl()
 {
--- a/widget/gtk/nsPSPrinters.cpp
+++ b/widget/gtk/nsPSPrinters.cpp
@@ -60,17 +60,17 @@ nsPSPrinterList::GetPrinterList(nsTArray
     if (gCupsShim.IsInitialized()) {
         cups_dest_t *dests;
 
         int num_dests = (gCupsShim.mCupsGetDests)(&dests);
         if (num_dests) {
             for (int i = 0; i < num_dests; i++) {
                 nsAutoCString fullName(NS_CUPS_PRINTER);
                 fullName.Append(dests[i].name);
-                if (dests[i].instance != NULL) {
+                if (dests[i].instance != nullptr) {
                     fullName.Append("/");
                     fullName.Append(dests[i].instance);
                 }
                 if (dests[i].is_default)
                     aList.InsertElementAt(0, fullName);
                 else
                     aList.AppendElement(fullName);
             }
--- a/widget/gtk/nsPrintDialogGTK.cpp
+++ b/widget/gtk/nsPrintDialogGTK.cpp
@@ -64,17 +64,17 @@ ShowCustomDialog(GtkComboBox *changed_bo
   GtkWidget* prompt_dialog = gtk_dialog_new_with_buttons(NS_ConvertUTF16toUTF8(intlString).get(), printDialog,
 #if (MOZ_WIDGET_GTK == 2)
                                                          (GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR),
 #else
                                                          (GtkDialogFlags)(GTK_DIALOG_MODAL),
 #endif
                                                          GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
                                                          GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
-                                                         NULL);
+                                                         nullptr);
   gtk_dialog_set_default_response(GTK_DIALOG(prompt_dialog), GTK_RESPONSE_ACCEPT);
   gtk_dialog_set_alternative_button_order(GTK_DIALOG(prompt_dialog),
                                           GTK_RESPONSE_ACCEPT,
                                           GTK_RESPONSE_REJECT,
                                           -1);
 
   printBundle->GetStringFromName(NS_LITERAL_STRING("customHeaderFooterPrompt").get(), getter_Copies(intlString));
   GtkWidget* custom_label = gtk_label_new(NS_ConvertUTF16toUTF8(intlString).get());
@@ -181,33 +181,33 @@ nsPrintDialogWidgetGTK::nsPrintDialogWid
   // The vast majority of magic numbers in this widget construction are padding. e.g. for
   // the set_border_width below, 12px matches that of just about every other window.
   GtkWidget* custom_options_tab = gtk_vbox_new(FALSE, 0);
   gtk_container_set_border_width(GTK_CONTAINER(custom_options_tab), 12);
   GtkWidget* tab_label = gtk_label_new(GetUTF8FromBundle("optionsTabLabelGTK").get());
 
   int16_t frameUIFlag;
   aSettings->GetHowToEnableFrameUI(&frameUIFlag);
-  radio_as_laid_out = gtk_radio_button_new_with_mnemonic(NULL, GetUTF8FromBundle("asLaidOut").get());
+  radio_as_laid_out = gtk_radio_button_new_with_mnemonic(nullptr, GetUTF8FromBundle("asLaidOut").get());
   if (frameUIFlag == nsIPrintSettings::kFrameEnableNone)
     gtk_widget_set_sensitive(radio_as_laid_out, FALSE);
 
   radio_selected_frame = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(radio_as_laid_out),
                                                                         GetUTF8FromBundle("selectedFrame").get());
   if (frameUIFlag == nsIPrintSettings::kFrameEnableNone ||
       frameUIFlag == nsIPrintSettings::kFrameEnableAsIsAndEach)
     gtk_widget_set_sensitive(radio_selected_frame, FALSE);
 
   radio_separate_frames = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(radio_as_laid_out),
                                                                          GetUTF8FromBundle("separateFrames").get());
   if (frameUIFlag == nsIPrintSettings::kFrameEnableNone)
     gtk_widget_set_sensitive(radio_separate_frames, FALSE);
 
   // "Print Frames" options label, bold and center-aligned
-  GtkWidget* print_frames_label = gtk_label_new(NULL);
+  GtkWidget* print_frames_label = gtk_label_new(nullptr);
   char* pangoMarkup = g_markup_printf_escaped("<b>%s</b>", GetUTF8FromBundle("printFramesTitleGTK").get());
   gtk_label_set_markup(GTK_LABEL(print_frames_label), pangoMarkup);
   g_free(pangoMarkup);
   gtk_misc_set_alignment(GTK_MISC(print_frames_label), 0, 0);
 
   // Align the radio buttons slightly so they appear to fall under the aforementioned label as per the GNOME HIG
   GtkWidget* frames_radio_container = gtk_alignment_new(0, 0, 0, 0);
   gtk_alignment_set_padding(GTK_ALIGNMENT(frames_radio_container), 8, 0, 12, 0);
@@ -230,48 +230,48 @@ nsPrintDialogWidgetGTK::nsPrintDialogWid
   aSettings->GetPrintOptions(nsIPrintSettings::kEnableSelectionRB, &canSelectText);
   if (gtk_major_version > 2 ||
       (gtk_major_version == 2 && gtk_minor_version >= 18)) {
     useNativeSelection = true;
     g_object_set(dialog,
                  "support-selection", TRUE,
                  "has-selection", canSelectText,
                  "embed-page-setup", TRUE,
-                 NULL);
+                 nullptr);
   } else {
     useNativeSelection = false;
     selection_only_toggle = gtk_check_button_new_with_mnemonic(GetUTF8FromBundle("selectionOnly").get());
     gtk_widget_set_sensitive(selection_only_toggle, canSelectText);
     gtk_box_pack_start(GTK_BOX(check_buttons_container), selection_only_toggle, FALSE, FALSE, 0);
   }
 
   // Check buttons for printing background
   GtkWidget* appearance_buttons_container = gtk_vbox_new(TRUE, 2);
   print_bg_colors_toggle = gtk_check_button_new_with_mnemonic(GetUTF8FromBundle("printBGColors").get());
   print_bg_images_toggle = gtk_check_button_new_with_mnemonic(GetUTF8FromBundle("printBGImages").get());
   gtk_box_pack_start(GTK_BOX(appearance_buttons_container), print_bg_colors_toggle, FALSE, FALSE, 0);
   gtk_box_pack_start(GTK_BOX(appearance_buttons_container), print_bg_images_toggle, FALSE, FALSE, 0);
 
   // "Appearance" options label, bold and center-aligned
-  GtkWidget* appearance_label = gtk_label_new(NULL);
+  GtkWidget* appearance_label = gtk_label_new(nullptr);
   pangoMarkup = g_markup_printf_escaped("<b>%s</b>", GetUTF8FromBundle("printBGOptions").get());
   gtk_label_set_markup(GTK_LABEL(appearance_label), pangoMarkup);
   g_free(pangoMarkup);
   gtk_misc_set_alignment(GTK_MISC(appearance_label), 0, 0);
 
   GtkWidget* appearance_container = gtk_alignment_new(0, 0, 0, 0);
   gtk_alignment_set_padding(GTK_ALIGNMENT(appearance_container), 8, 0, 12, 0);
   gtk_container_add(GTK_CONTAINER(appearance_container), appearance_buttons_container);
 
   GtkWidget* appearance_vertical_squasher = gtk_vbox_new(FALSE, 0);
   gtk_box_pack_start(GTK_BOX(appearance_vertical_squasher), appearance_label, FALSE, FALSE, 0);
   gtk_box_pack_start(GTK_BOX(appearance_vertical_squasher), appearance_container, FALSE, FALSE, 0);
 
   // "Header & Footer" options label, bold and center-aligned
-  GtkWidget* header_footer_label = gtk_label_new(NULL);
+  GtkWidget* header_footer_label = gtk_label_new(nullptr);
   pangoMarkup = g_markup_printf_escaped("<b>%s</b>", GetUTF8FromBundle("headerFooter").get());
   gtk_label_set_markup(GTK_LABEL(header_footer_label), pangoMarkup);
   g_free(pangoMarkup);
   gtk_misc_set_alignment(GTK_MISC(header_footer_label), 0, 0);
 
   GtkWidget* header_footer_container = gtk_alignment_new(0, 0, 0, 0);
   gtk_alignment_set_padding(GTK_ALIGNMENT(header_footer_container), 8, 0, 12, 0);
 
@@ -480,17 +480,17 @@ nsPrintDialogWidgetGTK::ConstructHeaderF
                                  "headerFooterURL", "headerFooterDate",
                                  "headerFooterPage", "headerFooterPageTotal",
                                  "headerFooterCustom"};
 
   for (unsigned int i = 0; i < ArrayLength(hf_options); i++) {
 #if (MOZ_WIDGET_GTK == 2)
     gtk_combo_box_append_text(GTK_COMBO_BOX(dropdown), GetUTF8FromBundle(hf_options[i]).get());
 #else
-    gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(dropdown), NULL, 
+    gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(dropdown), nullptr, 
                               GetUTF8FromBundle(hf_options[i]).get());
 #endif
   }
 
   bool shouldBeCustom = true;
   NS_ConvertUTF16toUTF8 currentStringUTF8(currentString);
 
   for (unsigned int i = 0; i < ArrayLength(header_footer_tags); i++) {
--- a/widget/gtk/nsPrintSettingsGTK.cpp
+++ b/widget/gtk/nsPrintSettingsGTK.cpp
@@ -38,60 +38,60 @@ GtkPaperSize* moz_gtk_paper_size_copy_to
 
 NS_IMPL_ISUPPORTS_INHERITED1(nsPrintSettingsGTK, 
                              nsPrintSettings, 
                              nsPrintSettingsGTK)
 
 /** ---------------------------------------------------
  */
 nsPrintSettingsGTK::nsPrintSettingsGTK() :
-  mPageSetup(NULL),
-  mPrintSettings(NULL),
-  mGTKPrinter(NULL),
+  mPageSetup(nullptr),
+  mPrintSettings(nullptr),
+  mGTKPrinter(nullptr),
   mPrintSelectionOnly(false)
 {
   // The aim here is to set up the objects enough that silent printing works well.
   // These will be replaced anyway if the print dialog is used.
   mPrintSettings = gtk_print_settings_new();
   mPageSetup = gtk_page_setup_new();
   InitUnwriteableMargin();
 
   SetOutputFormat(nsIPrintSettings::kOutputFormatNative);
 
-  GtkPaperSize* defaultPaperSize = gtk_paper_size_new(NULL);
+  GtkPaperSize* defaultPaperSize = gtk_paper_size_new(nullptr);
   mPaperSize = moz_gtk_paper_size_copy_to_new_custom(defaultPaperSize);
   gtk_paper_size_free(defaultPaperSize);
   SaveNewPageSize();
 }
 
 /** ---------------------------------------------------
  */
 nsPrintSettingsGTK::~nsPrintSettingsGTK()
 {
   if (mPageSetup) {
     g_object_unref(mPageSetup);
-    mPageSetup = NULL;
+    mPageSetup = nullptr;
   }
   if (mPrintSettings) {
     g_object_unref(mPrintSettings);
-    mPrintSettings = NULL;
+    mPrintSettings = nullptr;
   }
   if (mGTKPrinter) {
     g_object_unref(mGTKPrinter);
-    mGTKPrinter = NULL;
+    mGTKPrinter = nullptr;
   }
   gtk_paper_size_free(mPaperSize);
 }
 
 /** ---------------------------------------------------
  */
 nsPrintSettingsGTK::nsPrintSettingsGTK(const nsPrintSettingsGTK& aPS) :
-  mPageSetup(NULL),
-  mPrintSettings(NULL),
-  mGTKPrinter(NULL),
+  mPageSetup(nullptr),
+  mPrintSettings(nullptr),
+  mGTKPrinter(nullptr),
   mPrintSelectionOnly(false)
 {
   *this = aPS;
 }
 
 /** ---------------------------------------------------
  */
 nsPrintSettingsGTK& nsPrintSettingsGTK::operator=(const nsPrintSettingsGTK& rhs)
@@ -401,17 +401,18 @@ nsPrintSettingsGTK::GetToFileName(PRUnic
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsPrintSettingsGTK::SetToFileName(const PRUnichar * aToFileName)
 {
   if (aToFileName[0] == 0) {
     mToFileName.SetLength(0);
-    gtk_print_settings_set(mPrintSettings, GTK_PRINT_SETTINGS_OUTPUT_URI, NULL);
+    gtk_print_settings_set(mPrintSettings, GTK_PRINT_SETTINGS_OUTPUT_URI,
+                           nullptr);
     return NS_OK;
   }
 
   if (StringEndsWith(nsDependentString(aToFileName), NS_LITERAL_STRING(".ps"))) {
     gtk_print_settings_set(mPrintSettings, GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT, "ps");
   } else {
     gtk_print_settings_set(mPrintSettings, GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT, "pdf");
   }
@@ -705,21 +706,21 @@ nsPrintSettingsGTK::GetEffectivePageSize
 }
 
 NS_IMETHODIMP
 nsPrintSettingsGTK::SetupSilentPrinting()
 {
   // We have to get a printer here, rather than when the print settings are constructed.
   // This is because when we request sync, GTK makes us wait in the *event loop* while waiting
   // for the enumeration to finish. We must do this when event loop runs are expected.
-  gtk_enumerate_printers(printer_enumerator, this, NULL, TRUE);
+  gtk_enumerate_printers(printer_enumerator, this, nullptr, TRUE);
 
   // XXX If no default printer set, get the first one.
   if (!GTK_IS_PRINTER(mGTKPrinter))
-    gtk_enumerate_printers(ref_printer, this, NULL, TRUE);
+    gtk_enumerate_printers(ref_printer, this, nullptr, TRUE);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsPrintSettingsGTK::GetPageRanges(nsTArray<int32_t> &aPages)
 {
   gint ctRanges;
--- a/widget/gtk/nsPrintSettingsGTK.h
+++ b/widget/gtk/nsPrintSettingsGTK.h
@@ -133,17 +133,17 @@ protected:
    * Re-initialize mUnwriteableMargin with values from mPageSetup.
    * Should be called whenever mPageSetup is initialized or overwritten.
    */
   void InitUnwriteableMargin();
 
   /**
    * On construction:
    * - mPrintSettings, mPageSetup and mPaperSize are just new objects with defaults determined by GTK.
-   * - mGTKPrinter is NULL!!! Remember to be careful when accessing this property.
+   * - mGTKPrinter is nullptr!!! Remember to be careful when accessing this property.
    */
   GtkPageSetup* mPageSetup;
   GtkPrintSettings* mPrintSettings;
   GtkPrinter* mGTKPrinter;
   GtkPaperSize* mPaperSize;
 
   bool mPrintSelectionOnly;
 };
--- a/widget/gtk/nsScreenManagerGtk.cpp
+++ b/widget/gtk/nsScreenManagerGtk.cpp
@@ -106,17 +106,17 @@ nsScreenManagerGtk :: EnsureInit()
 
   return Init();
 }
 
 nsresult
 nsScreenManagerGtk :: Init()
 {
 #ifdef MOZ_X11
-  XineramaScreenInfo *screenInfo = NULL;
+  XineramaScreenInfo *screenInfo = nullptr;
   int numScreens;
 
   if (!mXineramalib) {
     mXineramalib = PR_LoadLibrary("libXinerama.so.1");
     if (!mXineramalib) {
       mXineramalib = SCREEN_MANAGER_LIBRARY_LOAD_FAILED;
     }
   }
@@ -129,17 +129,17 @@ nsScreenManagerGtk :: Init()
         
     // get the number of screens via xinerama
     Display *display = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
     if (_XnrmIsActive && _XnrmQueryScreens && _XnrmIsActive(display)) {
       screenInfo = _XnrmQueryScreens(display, &numScreens);
     }
   }
 
-  // screenInfo == NULL if either Xinerama couldn't be loaded or
+  // screenInfo == nullptr if either Xinerama couldn't be loaded or
   // isn't running on the current display
   if (!screenInfo || numScreens == 1) {
     numScreens = 1;
 #endif
     nsRefPtr<nsScreenGtk> screen;
 
     if (mCachedScreenArray.Count() > 0) {
       screen = static_cast<nsScreenGtk*>(mCachedScreenArray[0]);
--- a/widget/gtk/nsSound.cpp
+++ b/widget/gtk/nsSound.cpp
@@ -105,49 +105,54 @@ ca_context_get_default()
     }
 
     g_static_private_set(&ctx_static_private, ctx, (GDestroyNotify) ca_context_destroy);
 
     GtkSettings* settings = gtk_settings_get_default();
     if (g_object_class_find_property(G_OBJECT_GET_CLASS(settings),
                                      "gtk-sound-theme-name")) {
         gchar* sound_theme_name = nullptr;
-        g_object_get(settings, "gtk-sound-theme-name", &sound_theme_name, NULL);
+        g_object_get(settings, "gtk-sound-theme-name", &sound_theme_name,
+                     nullptr);
 
         if (sound_theme_name) {
-            ca_context_change_props(ctx, "canberra.xdg-theme.name", sound_theme_name, NULL);
+            ca_context_change_props(ctx, "canberra.xdg-theme.name",
+                                    sound_theme_name, nullptr);
             g_free(sound_theme_name);
         }
     }
 
     nsCOMPtr<nsIStringBundleService> bundleService =
         mozilla::services::GetStringBundleService();
     if (bundleService) {
         nsCOMPtr<nsIStringBundle> brandingBundle;
         bundleService->CreateBundle("chrome://branding/locale/brand.properties",
                                     getter_AddRefs(brandingBundle));
         if (brandingBundle) {
             nsAutoString wbrand;
             brandingBundle->GetStringFromName(NS_LITERAL_STRING("brandShortName").get(),
                                               getter_Copies(wbrand));
             NS_ConvertUTF16toUTF8 brand(wbrand);
 
-            ca_context_change_props(ctx, "application.name", brand.get(), NULL);
+            ca_context_change_props(ctx, "application.name", brand.get(),
+                                    nullptr);
         }
     }
 
     nsCOMPtr<nsIXULAppInfo> appInfo = do_GetService("@mozilla.org/xre/app-info;1");
     if (appInfo) {
         nsAutoCString version;
         appInfo->GetVersion(version);
 
-        ca_context_change_props(ctx, "application.version", version.get(), NULL);
+        ca_context_change_props(ctx, "application.version", version.get(),
+                                nullptr);
     }
 
-    ca_context_change_props(ctx, "application.icon_name", MOZ_APP_NAME, NULL);
+    ca_context_change_props(ctx, "application.icon_name", MOZ_APP_NAME,
+                            nullptr);
 
     return ctx;
 }
 
 static void
 ca_finish_cb(ca_context *c,
              uint32_t id,
              int error_code,
@@ -326,22 +331,22 @@ NS_METHOD nsSound::Play(nsIURL *aURL)
             return NS_ERROR_OUT_OF_MEMORY;
         }
 
         nsAutoCString spec;
         rv = aURL->GetSpec(spec);
         if (NS_FAILED(rv)) {
             return rv;
         }
-        gchar *path = g_filename_from_uri(spec.get(), NULL, NULL);
+        gchar *path = g_filename_from_uri(spec.get(), nullptr, nullptr);
         if (!path) {
             return NS_ERROR_FILE_UNRECOGNIZED_PATH;
         }
 
-        ca_context_play(ctx, 0, "media.filename", path, NULL);
+        ca_context_play(ctx, 0, "media.filename", path, nullptr);
         g_free(path);
     } else {
         nsCOMPtr<nsIStreamLoader> loader;
         rv = NS_NewStreamLoader(getter_AddRefs(loader), aURL, this);
     }
 
     return rv;
 }
@@ -355,43 +360,43 @@ NS_IMETHODIMP nsSound::PlayEventSound(ui
         return NS_OK;
 
     // Do we even want alert sounds?
     GtkSettings* settings = gtk_settings_get_default();
 
     if (g_object_class_find_property(G_OBJECT_GET_CLASS(settings),
                                      "gtk-enable-event-sounds")) {
         gboolean enable_sounds = TRUE;
-        g_object_get(settings, "gtk-enable-event-sounds", &enable_sounds, NULL);
+        g_object_get(settings, "gtk-enable-event-sounds", &enable_sounds, nullptr);
 
         if (!enable_sounds) {
             return NS_OK;
         }
     }
 
     ca_context* ctx = ca_context_get_default();
     if (!ctx) {
         return NS_ERROR_OUT_OF_MEMORY;
     }
 
     switch (aEventId) {
         case EVENT_ALERT_DIALOG_OPEN:
-            ca_context_play(ctx, 0, "event.id", "dialog-warning", NULL);
+            ca_context_play(ctx, 0, "event.id", "dialog-warning", nullptr);
             break;
         case EVENT_CONFIRM_DIALOG_OPEN:
-            ca_context_play(ctx, 0, "event.id", "dialog-question", NULL);
+            ca_context_play(ctx, 0, "event.id", "dialog-question", nullptr);
             break;
         case EVENT_NEW_MAIL_RECEIVED:
-            ca_context_play(ctx, 0, "event.id", "message-new-email", NULL);
+            ca_context_play(ctx, 0, "event.id", "message-new-email", nullptr);
             break;
         case EVENT_MENU_EXECUTE:
-            ca_context_play(ctx, 0, "event.id", "menu-click", NULL);
+            ca_context_play(ctx, 0, "event.id", "menu-click", nullptr);
             break;
         case EVENT_MENU_POPUP:
-            ca_context_play(ctx, 0, "event.id", "menu-popup", NULL);
+            ca_context_play(ctx, 0, "event.id", "menu-popup", nullptr);
             break;
     }
     return NS_OK;
 }
 
 NS_IMETHODIMP nsSound::PlaySystemSound(const nsAString &aSoundAlias)
 {
     if (NS_IsMozAliasSound(aSoundAlias)) {
--- a/widget/gtk/nsWidgetFactory.cpp
+++ b/widget/gtk/nsWidgetFactory.cpp
@@ -87,24 +87,24 @@ nsNativeThemeGTKConstructor(nsISupports 
                             void **aResult)
 {
     nsresult rv;
     nsNativeThemeGTK * inst;
 
     if (gDisableNativeTheme)
         return NS_ERROR_NO_INTERFACE;
 
-    *aResult = NULL;
-    if (NULL != aOuter) {
+    *aResult = nullptr;
+    if (nullptr != aOuter) {
         rv = NS_ERROR_NO_AGGREGATION;
         return rv;
     }
 
     inst = new nsNativeThemeGTK();
-    if (NULL == inst) {
+    if (nullptr == inst) {
         rv = NS_ERROR_OUT_OF_MEMORY;
         return rv;
     }
     NS_ADDREF(inst);
     rv = inst->QueryInterface(aIID, aResult);
     NS_RELEASE(inst);
 
     return rv;
@@ -176,24 +176,24 @@ static nsresult
 nsNativeKeyBindingsConstructor(nsISupports *aOuter, REFNSIID aIID,
                                void **aResult,
                                NativeKeyBindingsType aKeyBindingsType)
 {
     nsresult rv;
 
     nsNativeKeyBindings *inst;
 
-    *aResult = NULL;
-    if (NULL != aOuter) {
+    *aResult = nullptr;
+    if (nullptr != aOuter) {
         rv = NS_ERROR_NO_AGGREGATION;
         return rv;
     }
 
     inst = new nsNativeKeyBindings();
-    if (NULL == inst) {
+    if (nullptr == inst) {
         rv = NS_ERROR_OUT_OF_MEMORY;
         return rv;
     }
     NS_ADDREF(inst);
     inst->Init(aKeyBindingsType);
     rv = inst->QueryInterface(aIID, aResult);
     NS_RELEASE(inst);
 
@@ -247,50 +247,50 @@ NS_DEFINE_NAMED_CID(NS_PRINTDIALOGSERVIC
 NS_DEFINE_NAMED_CID(NS_IMAGE_TO_PIXBUF_CID);
 #if defined(MOZ_X11)
 NS_DEFINE_NAMED_CID(NS_IDLE_SERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_GFXINFO_CID);
 #endif
 
 
 static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
-    { &kNS_WINDOW_CID, false, NULL, nsWindowConstructor },
-    { &kNS_CHILD_CID, false, NULL, nsChildWindowConstructor },
-    { &kNS_APPSHELL_CID, false, NULL, nsAppShellConstructor },
-    { &kNS_COLORPICKER_CID, false, NULL, nsColorPickerConstructor },
-    { &kNS_FILEPICKER_CID, false, NULL, nsFilePickerConstructor },
-    { &kNS_SOUND_CID, false, NULL, nsSoundConstructor },
-    { &kNS_TRANSFERABLE_CID, false, NULL, nsTransferableConstructor },
+    { &kNS_WINDOW_CID, false, nullptr, nsWindowConstructor },
+    { &kNS_CHILD_CID, false, nullptr, nsChildWindowConstructor },
+    { &kNS_APPSHELL_CID, false, nullptr, nsAppShellConstructor },
+    { &kNS_COLORPICKER_CID, false, nullptr, nsColorPickerConstructor },
+    { &kNS_FILEPICKER_CID, false, nullptr, nsFilePickerConstructor },
+    { &kNS_SOUND_CID, false, nullptr, nsSoundConstructor },
+    { &kNS_TRANSFERABLE_CID, false, nullptr, nsTransferableConstructor },
 #ifdef MOZ_X11
-    { &kNS_CLIPBOARD_CID, false, NULL, nsClipboardConstructor },
-    { &kNS_CLIPBOARDHELPER_CID, false, NULL, nsClipboardHelperConstructor },
-    { &kNS_DRAGSERVICE_CID, false, NULL, nsDragServiceConstructor },
+    { &kNS_CLIPBOARD_CID, false, nullptr, nsClipboardConstructor },
+    { &kNS_CLIPBOARDHELPER_CID, false, nullptr, nsClipboardHelperConstructor },
+    { &kNS_DRAGSERVICE_CID, false, nullptr, nsDragServiceConstructor },
 #endif
-    { &kNS_HTMLFORMATCONVERTER_CID, false, NULL, nsHTMLFormatConverterConstructor },
-    { &kNS_BIDIKEYBOARD_CID, false, NULL, nsBidiKeyboardConstructor },
-    { &kNS_NATIVEKEYBINDINGSINPUT_CID, false, NULL, nsNativeKeyBindingsInputConstructor },
-    { &kNS_NATIVEKEYBINDINGSTEXTAREA_CID, false, NULL, nsNativeKeyBindingsTextAreaConstructor },
-    { &kNS_NATIVEKEYBINDINGSEDITOR_CID, false, NULL, nsNativeKeyBindingsTextAreaConstructor },
-    { &kNS_SCREENMANAGER_CID, false, NULL, nsScreenManagerGtkConstructor },
+    { &kNS_HTMLFORMATCONVERTER_CID, false, nullptr, nsHTMLFormatConverterConstructor },
+    { &kNS_BIDIKEYBOARD_CID, false, nullptr, nsBidiKeyboardConstructor },
+    { &kNS_NATIVEKEYBINDINGSINPUT_CID, false, nullptr, nsNativeKeyBindingsInputConstructor },
+    { &kNS_NATIVEKEYBINDINGSTEXTAREA_CID, false, nullptr, nsNativeKeyBindingsTextAreaConstructor },
+    { &kNS_NATIVEKEYBINDINGSEDITOR_CID, false, nullptr, nsNativeKeyBindingsTextAreaConstructor },
+    { &kNS_SCREENMANAGER_CID, false, nullptr, nsScreenManagerGtkConstructor },
 #ifdef NATIVE_THEME_SUPPORT
-    { &kNS_THEMERENDERER_CID, false, NULL, nsNativeThemeGTKConstructor },
+    { &kNS_THEMERENDERER_CID, false, nullptr, nsNativeThemeGTKConstructor },
 #endif
 #ifdef NS_PRINTING
-    { &kNS_PRINTSETTINGSSERVICE_CID, false, NULL, nsPrintOptionsGTKConstructor },
-    { &kNS_PRINTER_ENUMERATOR_CID, false, NULL, nsPrinterEnumeratorGTKConstructor },
-    { &kNS_PRINTSESSION_CID, false, NULL, nsPrintSessionConstructor },
-    { &kNS_DEVICE_CONTEXT_SPEC_CID, false, NULL, nsDeviceContextSpecGTKConstructor },
-    { &kNS_PRINTDIALOGSERVICE_CID, false, NULL, nsPrintDialogServiceGTKConstructor },
+    { &kNS_PRINTSETTINGSSERVICE_CID, false, nullptr, nsPrintOptionsGTKConstructor },
+    { &kNS_PRINTER_ENUMERATOR_CID, false, nullptr, nsPrinterEnumeratorGTKConstructor },
+    { &kNS_PRINTSESSION_CID, false, nullptr, nsPrintSessionConstructor },
+    { &kNS_DEVICE_CONTEXT_SPEC_CID, false, nullptr, nsDeviceContextSpecGTKConstructor },
+    { &kNS_PRINTDIALOGSERVICE_CID, false, nullptr, nsPrintDialogServiceGTKConstructor },
 #endif 
-    { &kNS_IMAGE_TO_PIXBUF_CID, false, NULL, nsImageToPixbufConstructor },
+    { &kNS_IMAGE_TO_PIXBUF_CID, false, nullptr, nsImageToPixbufConstructor },
 #if defined(MOZ_X11)
-    { &kNS_IDLE_SERVICE_CID, false, NULL, nsIdleServiceGTKConstructor },
-    { &kNS_GFXINFO_CID, false, NULL, mozilla::widget::GfxInfoConstructor },
+    { &kNS_IDLE_SERVICE_CID, false, nullptr, nsIdleServiceGTKConstructor },
+    { &kNS_GFXINFO_CID, false, nullptr, mozilla::widget::GfxInfoConstructor },
 #endif
-    { NULL }
+    { nullptr }
 };
 
 static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
     { "@mozilla.org/widget/window/gtk;1", &kNS_WINDOW_CID },
     { "@mozilla.org/widgets/child_window/gtk;1", &kNS_CHILD_CID },
     { "@mozilla.org/widget/appshell/gtk;1", &kNS_APPSHELL_CID },
     { "@mozilla.org/colorpicker;1", &kNS_COLORPICKER_CID },
     { "@mozilla.org/filepicker;1", &kNS_FILEPICKER_CID },
@@ -317,17 +317,17 @@ static const mozilla::Module::ContractID
     { "@mozilla.org/gfx/devicecontextspec;1", &kNS_DEVICE_CONTEXT_SPEC_CID },
     { NS_PRINTDIALOGSERVICE_CONTRACTID, &kNS_PRINTDIALOGSERVICE_CID },
 #endif 
     { "@mozilla.org/widget/image-to-gdk-pixbuf;1", &kNS_IMAGE_TO_PIXBUF_CID },
 #if defined(MOZ_X11)
     { "@mozilla.org/widget/idleservice;1", &kNS_IDLE_SERVICE_CID },
     { "@mozilla.org/gfx/info;1", &kNS_GFXINFO_CID },
 #endif
-    { NULL }
+    { nullptr }
 };
 
 static void
 nsWidgetGtk2ModuleDtor()
 {
   nsLookAndFeel::Shutdown();
   nsFilePicker::Shutdown();
   nsSound::Shutdown();
@@ -335,15 +335,15 @@ nsWidgetGtk2ModuleDtor()
   nsGTKToolkit::Shutdown();
   nsAppShellShutdown();
 }
 
 static const mozilla::Module kWidgetModule = {
     mozilla::Module::kVersion,
     kWidgetCIDs,
     kWidgetContracts,
-    NULL,
-    NULL,
+    nullptr,
+    nullptr,
     nsAppShellInit,
     nsWidgetGtk2ModuleDtor
 };
 
 NSMODULE_DEFN(nsWidgetGtk2Module) = &kWidgetModule;
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -252,38 +252,38 @@ static void    drag_data_received_event_
 static nsresult    initialize_prefs        (void);
 
 static guint32 sLastUserInputTime = GDK_CURRENT_TIME;
 static guint32 sRetryGrabTime;
 
 static NS_DEFINE_IID(kCDragServiceCID,  NS_DRAGSERVICE_CID);
 
 // The window from which the focus manager asks us to dispatch key events.
-static nsWindow         *gFocusWindow          = NULL;
+static nsWindow         *gFocusWindow          = nullptr;
 static bool              gBlockActivateEvent   = false;
 static bool              gGlobalsInitialized   = false;
 static bool              gRaiseWindows         = true;
-static nsWindow         *gPluginFocusWindow    = NULL;
+static nsWindow         *gPluginFocusWindow    = nullptr;
 
 
 #define NS_WINDOW_TITLE_MAX_LENGTH 4095
 
 // If after selecting profile window, the startup fail, please refer to
 // http://bugzilla.gnome.org/show_bug.cgi?id=88940
 
 // needed for imgIContainer cursors
 // GdkDisplay* was added in 2.2
 typedef struct _GdkDisplay GdkDisplay;
 
 #define kWindowPositionSlop 20
 
 // cursor cache
 static GdkCursor *gCursorCache[eCursorCount];
 
-static GtkWidget *gInvisibleContainer = NULL;
+static GtkWidget *gInvisibleContainer = nullptr;
 
 // Sometimes this actually also includes the state of the modifier keys, but
 // only the button state bits are used.
 static guint gButtonState;
 
 // nsAutoRef<pixman_region32> uses nsSimpleRef<> to know how to automatically
 // destroy regions.
 template <>
@@ -522,17 +522,17 @@ static void
 CheckDestroyInvisibleContainer()
 {
     NS_PRECONDITION(gInvisibleContainer, "oh, no");
 
     if (!gdk_window_peek_children(gtk_widget_get_window(gInvisibleContainer))) {
         // No children, so not in use.
         // Make sure to destroy the GtkWindow also.
         gtk_widget_destroy(gtk_widget_get_parent(gInvisibleContainer));
-        gInvisibleContainer = NULL;
+        gInvisibleContainer = nullptr;
     }
 }
 
 // Change the containing GtkWidget on a sub-hierarchy of GdkWindows belonging
 // to aOldWidget and rooted at aWindow, and reparent any child GtkWidgets of
 // the GdkWindow hierarchy to aNewWidget.
 static void
 SetWidgetForHierarchy(GdkWindow *aWindow,
@@ -682,18 +682,18 @@ nsWindow::Destroy(void)
     }
     else if (mGdkWindow) {
         // Destroy child windows to ensure that their mThebesSurfaces are
         // released and to remove references from GdkWindows back to their
         // container widget.  (OnContainerUnrealize() does this when the
         // MozContainer widget is destroyed.)
         DestroyChildWindows();
 
-        gdk_window_set_user_data(mGdkWindow, NULL);
-        g_object_set_data(G_OBJECT(mGdkWindow), "nsWindow", NULL);
+        gdk_window_set_user_data(mGdkWindow, nullptr);
+        g_object_set_data(G_OBJECT(mGdkWindow), "nsWindow", nullptr);
         gdk_window_destroy(mGdkWindow);
         mGdkWindow = nullptr;
     }
 
     if (gInvisibleContainer && owningWidget == gInvisibleContainer) {
         CheckDestroyInvisibleContainer();
     }
 
@@ -751,17 +751,17 @@ nsWindow::SetParent(nsIWidget *aNewParen
                           "live GdkWindow with no widget");
         return NS_OK;
     }
 
     if (aNewParent) {
         aNewParent->AddChild(this);
         ReparentNativeWidget(aNewParent);
     } else {
-        // aNewParent is NULL, but reparent to a hidden window to avoid
+        // aNewParent is nullptr, but reparent to a hidden window to avoid
         // destroying the GdkWindow and its descendants.
         // An invisible container widget is needed to hold descendant
         // GtkWidgets.
         GtkWidget* newContainer = EnsureInvisibleContainer();
         GdkWindow* newParentWindow = gtk_widget_get_window(newContainer);
         ReparentNativeWidgetInternal(aNewParent, newContainer, newParentWindow,
                                      oldContainer);
     }
@@ -1527,17 +1527,17 @@ nsWindow::SetCursor(nsCursor aCursor)
         if (!window)
             return NS_ERROR_FAILURE;
 
         return window->SetCursor(aCursor);
     }
 
     // Only change cursor if it's actually been changed
     if (aCursor != mCursor) {
-        GdkCursor *newCursor = NULL;
+        GdkCursor *newCursor = nullptr;
 
         newCursor = get_gtk_cursor(aCursor);
 
         if (nullptr != newCursor) {
             mCursor = aCursor;
 
             if (!mContainer)
                 return NS_OK;
@@ -1728,18 +1728,18 @@ nsWindow::SetIcon(const nsAString& aIcon
                 break;
 
             nsAutoString extension;
             extension.AppendASCII(extensions[i]);
 
             ResolveIconName(aIconSpec, extension, getter_AddRefs(iconFile));
             if (iconFile) {
                 iconFile->GetNativePath(path);
-                GdkPixbuf *icon = gdk_pixbuf_new_from_file(path.get(), NULL);
-                if (icon){
+                GdkPixbuf *icon = gdk_pixbuf_new_from_file(path.get(), nullptr);
+                if (icon) {
                     gtk_icon_theme_add_builtin_icon(iconName.get(),
                                                     gdk_pixbuf_get_height(icon),
                                                     icon);
                     g_object_unref(icon);
                     foundIcon = true;
                 }
             }
         }
@@ -1907,19 +1907,19 @@ gdk_window_flash(GdkWindow *    aGdkWind
   gint         y;
   gint         width;
   gint         height;
   guint        i;
   GdkGC *      gc = 0;
   GdkColor     white;
 
 #if (MOZ_WIDGET_GTK == 2)
-  gdk_window_get_geometry(aGdkWindow,NULL,NULL,&width,&height,NULL);
+  gdk_window_get_geometry(aGdkWindow,nullptr,nullptr,&width,&height,nullptr);
 #else
-  gdk_window_get_geometry(aGdkWindow,NULL,NULL,&width,&height);
+  gdk_window_get_geometry(aGdkWindow,nullptr,nullptr,&width,&height);
 #endif
 
   gdk_window_get_origin (aGdkWindow,
                          &x,
                          &y);
 
   gc = gdk_gc_new(gdk_get_default_root_window());
 
@@ -2328,17 +2328,17 @@ nsWindow::OnConfigureEvent(GtkWidget *aW
     // This event indicates that the window position may have changed.
     // mBounds.Size() is updated in OnSizeAllocate().
 
     // (The gtk_window_get_window_type() function is only available from
     // version 2.20.)
     NS_ASSERTION(GTK_IS_WINDOW(aWidget),
                  "Configure event on widget that is not a GtkWindow");
     gint type;
-    g_object_get(aWidget, "type", &type, NULL);
+    g_object_get(aWidget, "type", &type, nullptr);
     if (type == GTK_WINDOW_POPUP) {
         // Override-redirect window
         //
         // These windows should not be moved by the window manager, and so any
         // change in position is a result of our direction.  mBounds has
         // already been set in Move() or Resize(), and that is more
         // up-to-date than the position in the ConfigureNotify event if the
         // event is from an earlier window move.
@@ -2365,18 +2365,18 @@ nsWindow::OnContainerUnrealize()
 {
     // The GdkWindows are about to be destroyed (but not deleted), so remove
     // their references back to their container widget while the GdkWindow
     // hierarchy is still available.
 
     if (mGdkWindow) {
         DestroyChildWindows();
 
-        g_object_set_data(G_OBJECT(mGdkWindow), "nsWindow", NULL);
-        mGdkWindow = NULL;
+        g_object_set_data(G_OBJECT(mGdkWindow), "nsWindow", nullptr);
+        mGdkWindow = nullptr;
     }
 }
 
 void
 nsWindow::OnSizeAllocate(GtkAllocation *aAllocation)
 {
     LOG(("size_allocate [%p] %d %d %d %d\n",
          (void *)this, aAllocation->x, aAllocation->y,
@@ -2418,17 +2418,17 @@ nsWindow::OnDeleteEvent()
 void
 nsWindow::OnEnterNotifyEvent(GdkEventCrossing *aEvent)
 {
     // This skips NotifyVirtual and NotifyNonlinearVirtual enter notify events
     // when the pointer enters a child window.  If the destination window is a
     // Gecko window then we'll catch the corresponding event on that window,
     // but we won't notice when the pointer directly enters a foreign (plugin)
     // child window without passing over a visible portion of a Gecko window.
-    if (aEvent->subwindow != NULL)
+    if (aEvent->subwindow != nullptr)
         return;
 
     // Check before is_parent_ungrab_enter() as the button state may have
     // changed while a non-Gecko ancestor window had a pointer grab.
     DispatchMissedButtonReleases(aEvent);
 
     if (is_parent_ungrab_enter(aEvent))
         return;
@@ -2467,17 +2467,17 @@ nsWindow::OnLeaveNotifyEvent(GdkEventCro
     // This ignores NotifyVirtual and NotifyNonlinearVirtual leave notify
     // events when the pointer leaves a child window.  If the destination
     // window is a Gecko window then we'll catch the corresponding event on
     // that window.
     //
     // XXXkt However, we will miss toplevel exits when the pointer directly
     // leaves a foreign (plugin) child window without passing over a visible
     // portion of a Gecko window.
-    if (aEvent->subwindow != NULL)
+    if (aEvent->subwindow != nullptr)
         return;
 
     WidgetMouseEvent event(true, NS_MOUSE_EXIT, this, WidgetMouseEvent::eReal);
 
     event.refPoint.x = nscoord(aEvent->x);
     event.refPoint.y = nscoord(aEvent->y);
 
     event.time = aEvent->time;
@@ -2821,17 +2821,17 @@ nsWindow::OnContainerFocusInEvent(GdkEve
     // If keyboard input will be accepted, the focus manager will call
     // SetFocus to set the correct window.
     gFocusWindow = nullptr;
 
     DispatchActivateEvent();
 
     if (!gFocusWindow) {
         // We don't really have a window for dispatching key events, but
-        // setting a non-NULL value here prevents OnButtonPressEvent() from
+        // setting a non-nullptr value here prevents OnButtonPressEvent() from
         // dispatching an activation notification if the widget is already
         // active.
         gFocusWindow = this;
     }
 
     LOGFOCUS(("Events sent from focus in event [%p]\n", (void *)this));
 }
 
@@ -3144,17 +3144,17 @@ nsWindow::OnVisibilityNotifyEvent(GdkEve
         return;
 
     switch (aEvent->state) {
     case GDK_VISIBILITY_UNOBSCURED:
     case GDK_VISIBILITY_PARTIAL:
         if (mIsFullyObscured && mHasMappedToplevel) {
             // GDK_EXPOSE events have been ignored, so make sure GDK
             // doesn't think that the window has already been painted.
-            gdk_window_invalidate_rect(mGdkWindow, NULL, FALSE);
+            gdk_window_invalidate_rect(mGdkWindow, nullptr, FALSE);
         }
 
         mIsFullyObscured = false;
 
         if (!nsGtkIMModule::IsVirtualKeyboardOpened()) {
             // if we have to retry the grab, retry it.
             EnsureGrabs();
         }
@@ -3333,17 +3333,17 @@ CreateGdkWindow(GdkWindow *parent, GtkWi
 
     GdkWindow *window = gdk_window_new(parent, &attributes, attributes_mask);
     gdk_window_set_user_data(window, widget);
 
 // GTK3 TODO?
 #if (MOZ_WIDGET_GTK == 2)
     /* set the default pixmap to None so that you don't end up with the
        gtk default which is BlackPixel. */
-    gdk_window_set_back_pixmap(window, NULL, FALSE);
+    gdk_window_set_back_pixmap(window, nullptr, FALSE);
 #endif
 
     return window;
 }
 
 nsresult
 nsWindow::Create(nsIWidget        *aParent,
                  nsNativeWidget    aNativeParent,
@@ -3495,17 +3495,17 @@ nsWindow::Create(nsIWidget        *aPare
                 // WM_HINTS input field is set to False to tell the window
                 // manager not to set input focus to this window ...
                 gtk_window_set_accept_focus(GTK_WINDOW(mShell), FALSE);
 #ifdef MOZ_X11
                 // ... but when the window manager offers focus through
                 // WM_TAKE_FOCUS, focus is requested on the parent window.
                 gtk_widget_realize(mShell);
                 gdk_window_add_filter(gtk_widget_get_window(mShell),
-                                      popup_take_focus_filter, NULL); 
+                                      popup_take_focus_filter, nullptr); 
 #endif
             }
 
             GdkWindowTypeHint gtkTypeHint;
             if (aInitData->mIsDragPopup) {
                 gtkTypeHint = GDK_WINDOW_TYPE_HINT_DND;
             }
             else {
@@ -3614,81 +3614,81 @@ nsWindow::Create(nsIWidget        *aPare
         g_object_set_data(G_OBJECT(mContainer), "nsWindow", this);
 
     if (mShell)
         g_object_set_data(G_OBJECT(mShell), "nsWindow", this);
 
     // attach listeners for events
     if (mShell) {
         g_signal_connect(mShell, "configure_event",
-                         G_CALLBACK(configure_event_cb), NULL);
+                         G_CALLBACK(configure_event_cb), nullptr);
         g_signal_connect(mShell, "delete_event",
-                         G_CALLBACK(delete_event_cb), NULL);
+                         G_CALLBACK(delete_event_cb), nullptr);
         g_signal_connect(mShell, "window_state_event",
-                         G_CALLBACK(window_state_event_cb), NULL);
+                         G_CALLBACK(window_state_event_cb), nullptr);
 
         GtkSettings* default_settings = gtk_settings_get_default();
         g_signal_connect_after(default_settings,
                                "notify::gtk-theme-name",
                                G_CALLBACK(theme_changed_cb), this);
         g_signal_connect_after(default_settings,
                                "notify::gtk-font-name",
                                G_CALLBACK(theme_changed_cb), this);
     }
 
     if (mContainer) {
         // Widget signals
         g_signal_connect(mContainer, "unrealize",
-                         G_CALLBACK(container_unrealize_cb), NULL);
+                         G_CALLBACK(container_unrealize_cb), nullptr);
         g_signal_connect_after(mContainer, "size_allocate",
-                               G_CALLBACK(size_allocate_cb), NULL);
+                               G_CALLBACK(size_allocate_cb), nullptr);
         g_signal_connect(mContainer, "hierarchy-changed",
-                         G_CALLBACK(hierarchy_changed_cb), NULL);
+                         G_CALLBACK(hierarchy_changed_cb), nullptr);
         // Initialize mHasMappedToplevel.
-        hierarchy_changed_cb(GTK_WIDGET(mContainer), NULL);
+        hierarchy_changed_cb(GTK_WIDGET(mContainer), nullptr);
         // Expose, focus, key, and drag events are sent even to GTK_NO_WINDOW
         // widgets.
 #if (MOZ_WIDGET_GTK == 2)
         g_signal_connect(mContainer, "expose_event",
-                         G_CALLBACK(expose_event_cb), NULL);
+                         G_CALLBACK(expose_event_cb), nullptr);
 #else
         g_signal_connect(G_OBJECT(mContainer), "draw",
-                         G_CALLBACK(expose_event_cb), NULL);
+                         G_CALLBACK(expose_event_cb), nullptr);
 #endif
         g_signal_connect(mContainer, "focus_in_event",
-                         G_CALLBACK(focus_in_event_cb), NULL);
+                         G_CALLBACK(focus_in_event_cb), nullptr);
         g_signal_connect(mContainer, "focus_out_event",
-                         G_CALLBACK(focus_out_event_cb), NULL);
+                         G_CALLBACK(focus_out_event_cb), nullptr);
         g_signal_connect(mContainer, "key_press_event",
-                         G_CALLBACK(key_press_event_cb), NULL);
+                         G_CALLBACK(key_press_event_cb), nullptr);
         g_signal_connect(mContainer, "key_release_event",
-                         G_CALLBACK(key_release_event_cb), NULL);
+                         G_CALLBACK(key_release_event_cb), nullptr);
 
         gtk_drag_dest_set((GtkWidget *)mContainer,
                           (GtkDestDefaults)0,
-                          NULL,
+                          nullptr,
                           0,
                           (GdkDragAction)0);
 
         g_signal_connect(mContainer, "drag_motion",
-                         G_CALLBACK(drag_motion_event_cb), NULL);
+                         G_CALLBACK(drag_motion_event_cb), nullptr);
         g_signal_connect(mContainer, "drag_leave",
-                         G_CALLBACK(drag_leave_event_cb), NULL);
+                         G_CALLBACK(drag_leave_event_cb), nullptr);
         g_signal_connect(mContainer, "drag_drop",
-                         G_CALLBACK(drag_drop_event_cb), NULL);
+                         G_CALLBACK(drag_drop_event_cb), nullptr);
         g_signal_connect(mContainer, "drag_data_received",
-                         G_CALLBACK(drag_data_received_event_cb), NULL);
+                         G_CALLBACK(drag_data_received_event_cb), nullptr);
 
         GtkWidget *widgets[] = { GTK_WIDGET(mContainer), mShell };
         for (size_t i = 0; i < ArrayLength(widgets) && widgets[i]; ++i) {
             // Visibility events are sent to the owning widget of the relevant
             // window but do not propagate to parent widgets so connect on
             // mShell (if it exists) as well as mContainer.
             g_signal_connect(widgets[i], "visibility-notify-event",
-                             G_CALLBACK(visibility_notify_event_cb), NULL);
+                             G_CALLBACK(visibility_notify_event_cb), nullptr);
             // Similarly double buffering is controlled by the window's owning
             // widget.  Disable double buffering for painting directly to the
             // X Window.
             gtk_widget_set_double_buffered(widgets[i], FALSE);
         }
 
         // We create input contexts for all containers, except for
         // toplevel popup windows
@@ -3708,27 +3708,27 @@ nsWindow::Create(nsIWidget        *aPare
         GTK_PRIVATE_SET_FLAG(eventWidget, GTK_HAS_SHAPE_MASK);
 #endif
 
         // These events are sent to the owning widget of the relevant window
         // and propagate up to the first widget that handles the events, so we
         // need only connect on mShell, if it exists, to catch events on its
         // window and windows of mContainer.
         g_signal_connect(eventWidget, "enter-notify-event",
-                         G_CALLBACK(enter_notify_event_cb), NULL);
+                         G_CALLBACK(enter_notify_event_cb), nullptr);
         g_signal_connect(eventWidget, "leave-notify-event",
-                         G_CALLBACK(leave_notify_event_cb), NULL);
+                         G_CALLBACK(leave_notify_event_cb), nullptr);
         g_signal_connect(eventWidget, "motion-notify-event",
-                         G_CALLBACK(motion_notify_event_cb), NULL);
+                         G_CALLBACK(motion_notify_event_cb), nullptr);
         g_signal_connect(eventWidget, "button-press-event",
-                         G_CALLBACK(button_press_event_cb), NULL);
+                         G_CALLBACK(button_press_event_cb), nullptr);
         g_signal_connect(eventWidget, "button-release-event",
-                         G_CALLBACK(button_release_event_cb), NULL);
+                         G_CALLBACK(button_release_event_cb), nullptr);
         g_signal_connect(eventWidget, "scroll-event",
-                         G_CALLBACK(scroll_event_cb), NULL);
+                         G_CALLBACK(scroll_event_cb), nullptr);
     }
 
     LOG(("nsWindow [%p]\n", (void *)this));
     if (mShell) {
         LOG(("\tmShell %p mContainer %p mGdkWindow %p 0x%lx\n",
              mShell, mContainer, mGdkWindow,
              gdk_x11_window_get_xid(mGdkWindow)));
     } else if (mContainer) {
@@ -3755,17 +3755,17 @@ nsWindow::SetWindowClass(const nsAString
   const char *res_class = gdk_get_program_class();
   if (!res_class)
     return NS_ERROR_FAILURE;
   
   char *res_name = ToNewCString(xulWinType);
   if (!res_name)
     return NS_ERROR_OUT_OF_MEMORY;
 
-  const char *role = NULL;
+  const char *role = nullptr;
 
   // Parse res_name into a name and role. Characters other than
   // [A-Za-z0-9_-] are converted to '_'. Anything after the first
   // colon is assigned to role; if there's no colon, assign the
   // whole thing to both role and res_name.
   for (char *c = res_name; *c; c++) {
     if (':' == *c) {
       *c = 0;
@@ -3914,17 +3914,17 @@ nsWindow::SetHasMappedToplevel(bool aSta
     // propagated.
     if (!mIsShown || !mGdkWindow)
         return;
 
     if (aState && !oldState && !mIsFullyObscured) {
         // GDK_EXPOSE events have been ignored but the window is now visible,
         // so make sure GDK doesn't think that the window has already been
         // painted.
-        gdk_window_invalidate_rect(mGdkWindow, NULL, FALSE);
+        gdk_window_invalidate_rect(mGdkWindow, nullptr, FALSE);
 
         // Check that a grab didn't fail due to the window not being
         // viewable.
         EnsureGrabs();
     }
 
     for (GList *children = gdk_window_peek_children(mGdkWindow);
          children;
@@ -4398,17 +4398,17 @@ nsWindow::GrabPointer(guint32 aTime)
 
     gint retval;
     retval = gdk_pointer_grab(mGdkWindow, TRUE,
                               (GdkEventMask)(GDK_BUTTON_PRESS_MASK |
                                              GDK_BUTTON_RELEASE_MASK |
                                              GDK_ENTER_NOTIFY_MASK |
                                              GDK_LEAVE_NOTIFY_MASK |
                                              GDK_POINTER_MOTION_MASK),
-                              (GdkWindow *)NULL, NULL, aTime);
+                              (GdkWindow *)nullptr, nullptr, aTime);
 
     if (retval == GDK_GRAB_NOT_VIEWABLE) {
         LOG(("GrabPointer: window not viewable; will retry\n"));
         mRetryPointerGrab = true;
     } else if (retval != GDK_GRAB_SUCCESS) {
         LOG(("GrabPointer: pointer grab failed: %i\n", retval));
         // A failed grab indicates that another app has grabbed the pointer.
         // Check for rollup now, because, without the grab, we likely won't
@@ -4439,17 +4439,17 @@ nsWindow::GetToplevelWidget()
 
     return gtk_widget_get_toplevel(widget);
 }
 
 GtkWidget *
 nsWindow::GetMozContainerWidget()
 {
     if (!mGdkWindow)
-        return NULL;
+        return nullptr;
 
     if (mContainer)
         return GTK_WIDGET(mContainer);
 
     GtkWidget *owningWidget =
         get_gtk_widget_for_gdk_window(mGdkWindow);
     return owningWidget;
 }
@@ -4564,17 +4564,17 @@ nsWindow::SetNonXEmbedPluginFocus()
     gdk_error_trap_push();
     XSetInputFocus(GDK_WINDOW_XDISPLAY(mGdkWindow),
                    gdk_x11_window_get_xid(mGdkWindow),
                    RevertToNone,
                    CurrentTime);
     gdk_flush();
     gdk_error_trap_pop();
     gPluginFocusWindow = this;
-    gdk_window_add_filter(NULL, plugin_client_message_filter, this);
+    gdk_window_add_filter(nullptr, plugin_client_message_filter, this);
 
     LOGFOCUS(("nsWindow::SetNonXEmbedPluginFocus oldfocus=%p new=%p\n",
               mOldFocusWindow, gdk_x11_window_get_xid(mGdkWindow)));
 }
 
 void
 nsWindow::LoseNonXEmbedPluginFocus()
 {
@@ -4605,19 +4605,19 @@ nsWindow::LoseNonXEmbedPluginFocus()
                      mOldFocusWindow);
         XSetInputFocus(GDK_WINDOW_XDISPLAY(mGdkWindow),
                        mOldFocusWindow,
                        RevertToParent,
                        CurrentTime);
         gdk_flush();
         gdk_error_trap_pop();
     }
-    gPluginFocusWindow = NULL;
+    gPluginFocusWindow = nullptr;
     mOldFocusWindow = 0;
-    gdk_window_remove_filter(NULL, plugin_client_message_filter, this);
+    gdk_window_remove_filter(nullptr, plugin_client_message_filter, this);
 
     LOGFOCUS(("nsWindow::LoseNonXEmbedPluginFocus end\n"));
 }
 #endif /* MOZ_X11 */
 
 gint
 nsWindow::ConvertBorderStyles(nsBorderStyle aStyle)
 {
@@ -4854,17 +4854,17 @@ get_window_for_gdk_window(GdkWindow *win
     gpointer user_data = g_object_get_data(G_OBJECT(window), "nsWindow");
 
     return static_cast<nsWindow *>(user_data);
 }
 
 static GtkWidget *
 get_gtk_widget_for_gdk_window(GdkWindow *window)
 {
-    gpointer user_data = NULL;
+    gpointer user_data = nullptr;
     gdk_window_get_user_data(window, &user_data);
 
     return GTK_WIDGET(user_data);
 }
 
 static GdkCursor *
 get_gtk_cursor(nsCursor aCursor)
 {
@@ -4989,17 +4989,17 @@ get_gtk_cursor(nsCursor aCursor)
         gdkcursor = gdk_cursor_new_from_name(gdk_display_get_default(),
                                              GtkCursors[newType].hash);
     }
 
     // If we still don't have a xcursor, we now really create a bitmap cursor
     if (newType != 0xff && !gdkcursor) {
         GdkPixbuf * cursor_pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 32, 32);
         if (!cursor_pixbuf)
-            return NULL;
+            return nullptr;
       
         guchar *data = gdk_pixbuf_get_pixels(cursor_pixbuf);
         
         // Read data from GtkCursors and compose RGBA surface from 1bit bitmap and mask
         // GtkCursors bits and mask are 32x32 monochrome bitmaps (1 bit for each pixel)
         // so it's 128 byte array (4 bytes for are one bitmap row and there are 32 rows here).
         const unsigned char *bits = GtkCursors[newType].bits;
         const unsigned char *mask_bits = GtkCursors[newType].mask_bits;
@@ -5530,17 +5530,17 @@ hierarchy_changed_cb (GtkWidget *widget,
         }
     }
 
     event.changed_mask = static_cast<GdkWindowState>
         (old_window_state ^ event.new_window_state);
 
     if (event.changed_mask) {
         event.type = GDK_WINDOW_STATE;
-        event.window = NULL;
+        event.window = nullptr;
         event.send_event = TRUE;
         window_state_event_cb(widget, &event);
     }
 }
 
 static gboolean
 window_state_event_cb (GtkWidget *widget, GdkEventWindowState *event)
 {
@@ -5711,17 +5711,17 @@ get_inner_gdk_window (GdkWindow *aWindow
     gint cx, cy, cw, ch;
     GList *children = gdk_window_peek_children(aWindow);
     for (GList *child = g_list_last(children);
          child;
          child = g_list_previous(child)) {
         GdkWindow *childWindow = (GdkWindow *) child->data;
         if (get_window_for_gdk_window(childWindow)) {
 #if (MOZ_WIDGET_GTK == 2)
-            gdk_window_get_geometry(childWindow, &cx, &cy, &cw, &ch, NULL);
+            gdk_window_get_geometry(childWindow, &cx, &cy, &cw, &ch, nullptr);
 #else
             gdk_window_get_geometry(childWindow, &cx, &cy, &cw, &ch);
 #endif
             if ((cx < x) && (x < (cx + cw)) &&
                 (cy < y) && (y < (cy + ch)) &&
                 gdk_window_is_visible(childWindow)) {
                 return get_inner_gdk_window(childWindow,
                                             x - cx, y - cy,
@@ -5931,17 +5931,17 @@ nsWindow::GetSurfaceForGdkDrawable(GdkDr
     if (visual) {
         Visual* xVisual = gdk_x11_visual_get_xvisual(visual);
 
         result = new gfxXlibSurface(xDisplay, xDrawable, xVisual,
                                     gfxIntSize(aSize.width, aSize.height));
     } else {
         // no visual? we must be using an xrender format.  Find a format
         // for this depth.
-        XRenderPictFormat *pf = NULL;
+        XRenderPictFormat *pf = nullptr;
         switch (gdk_drawable_get_depth(aDrawable)) {
             case 32:
                 pf = XRenderFindStandardFormat(xDisplay, PictStandardARGB32);
                 break;
             case 24:
                 pf = XRenderFindStandardFormat(xDisplay, PictStandardRGB24);
                 break;
             default:
@@ -5985,17 +5985,17 @@ nsWindow::GetThebesSurface(cairo_t *cr)
 {
     if (!mGdkWindow)
         return nullptr;
 
 #if (MOZ_WIDGET_GTK != 2)
     cairo_surface_t *surf = cairo_get_target(cr);
     if (cairo_surface_status(surf) != CAIRO_STATUS_SUCCESS) {
       NS_NOTREACHED("Missing cairo target?");
-      return NULL;
+      return nullptr;
     }
 #endif // MOZ_WIDGET_GTK2
 
 #ifdef MOZ_X11
     gint width, height;
 
 #if (MOZ_WIDGET_GTK == 2)
     gdk_drawable_get_size(GDK_DRAWABLE(mGdkWindow), &width, &height);