[GTK] Use the default screen in PlatformScreenGtk methods when they are called with a NULL widget
https://bugs.webkit.org/show_bug.cgi?id=75620

Reviewed by Philippe Normand.

We are currently retuning an empty rectangle for
screenRect/screenAvailableRect and 0 for getVisual.

* platform/gtk/PlatformScreenGtk.cpp:
(WebCore::getVisual):
(WebCore::screenRect):
(WebCore::screenAvailableRect):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@104151 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp b/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp
index 93228c3..0a3b486 100644
--- a/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp
+++ b/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp
@@ -49,10 +49,7 @@
 
 static GdkVisual* getVisual(Widget* widget)
 {
-    if (!widget)
-        return 0;
-
-    GtkWidget* container = GTK_WIDGET(widget->root()->hostWindow()->platformPageClient());
+    GtkWidget* container = widget ? GTK_WIDGET(widget->root()->hostWindow()->platformPageClient()) : 0;
     if (!container) {
         GdkScreen* screen = gdk_screen_get_default();
         return screen ? gdk_screen_get_system_visual(screen) : 0;
@@ -105,10 +102,7 @@
 
 FloatRect screenRect(Widget* widget)
 {
-    if (!widget)
-        return FloatRect();
-
-    GtkWidget* container = GTK_WIDGET(widget->root()->hostWindow()->platformPageClient());
+    GtkWidget* container = widget ? GTK_WIDGET(widget->root()->hostWindow()->platformPageClient()) : 0;
     if (container)
         container = getToplevel(container);
 
@@ -126,10 +120,7 @@
 
 FloatRect screenAvailableRect(Widget* widget)
 {
-    if (!widget)
-        return FloatRect();
-
-    GtkWidget* container = GTK_WIDGET(widget->root()->hostWindow()->platformPageClient());
+    GtkWidget* container = widget ? GTK_WIDGET(widget->root()->hostWindow()->platformPageClient()) : 0;
     if (container && !gtk_widget_get_realized(container))
         return screenRect(widget);