[gtk+/wip/baedert/drawing] widget: Add baseline and out_clip parameters to size-allocate



commit 3559760562bc1a841fe55936a89da22864421dbc
Author: Timm Bäder <mail baedert org>
Date:   Tue Jul 11 09:58:21 2017 +0200

    widget: Add baseline and out_clip parameters to size-allocate
    
    Since setting a clip is mandatory for almost all widgets, we can as well
    change the size-allocate signature to include a out_clip parameter, just
    like GtkCssGadget did. And since we now always propagate baselines, we
    might as well pass that one on to size-allocate.
    
    This way we can also make sure to transform the clip returned from
    size-allocate to parent-coordinates, i.e. the same coordinate space
    priv->allocation is in.

 demos/gtk-demo/application.c  |    7 +-
 demos/gtk-demo/gtkfishbowl.c  |    6 +-
 gtk/gtkaccellabel.c           |    6 +-
 gtk/gtkactionbar.c            |   11 +--
 gtk/gtkappchooserwidget.c     |    8 +-
 gtk/gtkapplicationwindow.c    |   16 ++--
 gtk/gtkbbox.c                 |   22 +++---
 gtk/gtkbin.c                  |   17 ++---
 gtk/gtkbox.c                  |   22 +++---
 gtk/gtkbutton.c               |   19 ++---
 gtk/gtkcalendar.c             |   11 ++-
 gtk/gtkcellview.c             |   10 ++-
 gtk/gtkcenterbox.c            |   17 ++---
 gtk/gtkcheckbutton.c          |   21 +++---
 gtk/gtkcheckmenuitem.c        |   21 +++---
 gtk/gtkcolorbutton.c          |   10 +--
 gtk/gtkcolorplane.c           |    5 +-
 gtk/gtkcolorswatch.c          |   13 +--
 gtk/gtkcombobox.c             |   11 +--
 gtk/gtkcontainer.c            |    3 +-
 gtk/gtkentry.c                |   25 +++---
 gtk/gtkeventbox.c             |   12 ++-
 gtk/gtkexpander.c             |   15 ++--
 gtk/gtkfilechooserbutton.c    |   10 +--
 gtk/gtkfilechooserdialog.c    |   14 +++-
 gtk/gtkfilechooserwidget.c    |   11 ++-
 gtk/gtkfixed.c                |   10 ++-
 gtk/gtkflowbox.c              |   25 +++----
 gtk/gtkfontbutton.c           |   10 +--
 gtk/gtkfontchooserwidget.c    |    8 +-
 gtk/gtkframe.c                |   23 +++---
 gtk/gtkgizmo.c                |   11 +--
 gtk/gtkglarea.c               |    6 +-
 gtk/gtkgrid.c                 |   21 ++---
 gtk/gtkheaderbar.c            |   29 +++----
 gtk/gtkicon.c                 |    8 --
 gtk/gtkiconview.c             |   13 ++-
 gtk/gtkimage.c                |   17 ++---
 gtk/gtkinvisible.c            |   11 ---
 gtk/gtklabel.c                |   13 ++--
 gtk/gtklayout.c               |   10 ++-
 gtk/gtklevelbar.c             |   22 +++---
 gtk/gtklistbox.c              |   44 +++++-----
 gtk/gtkmenu.c                 |   11 ++-
 gtk/gtkmenubar.c              |   11 ++-
 gtk/gtkmenuitem.c             |   22 +++---
 gtk/gtkmodelbutton.c          |   24 +++---
 gtk/gtknotebook.c             |   54 +++++++------
 gtk/gtkoverlay.c              |    6 +-
 gtk/gtkpaned.c                |   36 ++++-----
 gtk/gtkpathbar.c              |   36 ++++-----
 gtk/gtkpopover.c              |   27 +++----
 gtk/gtkprogressbar.c          |   29 +++----
 gtk/gtkrange.c                |   25 +++----
 gtk/gtkrecentchooserwidget.c  |    8 +-
 gtk/gtkrevealer.c             |   14 ++--
 gtk/gtkscale.c                |   43 ++++------
 gtk/gtkscrollbar.c            |    8 +-
 gtk/gtkscrolledwindow.c       |   19 +++--
 gtk/gtkseparator.c            |    9 --
 gtk/gtkseparatortoolitem.c    |   11 ---
 gtk/gtkshortcutsshortcut.c    |    6 +-
 gtk/gtkspinbutton.c           |   15 ++--
 gtk/gtkspinner.c              |    8 --
 gtk/gtkstack.c                |   26 +++---
 gtk/gtkswitch.c               |   21 ++---
 gtk/gtktextview.c             |   10 ++-
 gtk/gtktoolbar.c              |   10 ++-
 gtk/gtktoolitemgroup.c        |   18 +++--
 gtk/gtktoolpalette.c          |   10 ++-
 gtk/gtktreeview.c             |   10 ++-
 gtk/gtkviewport.c             |   12 ++--
 gtk/gtkwidget.c               |  176 +++++++++++++++++++++++++----------------
 gtk/gtkwidget.h               |   11 ++-
 gtk/gtkwidgetprivate.h        |    3 +-
 gtk/gtkwindow.c               |   10 ++-
 gtk/inspector/gtkstackcombo.c |   11 +--
 tests/testwidgetfocus.c       |    5 +-
 78 files changed, 682 insertions(+), 697 deletions(-)
---
diff --git a/demos/gtk-demo/application.c b/demos/gtk-demo/application.c
index 217947f..af2d8d2 100644
--- a/demos/gtk-demo/application.c
+++ b/demos/gtk-demo/application.c
@@ -456,11 +456,14 @@ demo_application_window_constructed (GObject *object)
 
 static void
 demo_application_window_size_allocate (GtkWidget     *widget,
-                                       GtkAllocation *allocation)
+                                       GtkAllocation *allocation,
+                                       int            baseline,
+                                       GtkAllocation *out_clip)
 {
   DemoApplicationWindow *window = (DemoApplicationWindow *)widget;
 
-  GTK_WIDGET_CLASS (demo_application_window_parent_class)->size_allocate (widget, allocation);
+  GTK_WIDGET_CLASS (demo_application_window_parent_class)->size_allocate (widget, allocation,
+                                                                          baseline, out_clip);
 
   if (!window->maximized && !window->fullscreen)
     gtk_window_get_size (GTK_WINDOW (window), &window->width, &window->height);
diff --git a/demos/gtk-demo/gtkfishbowl.c b/demos/gtk-demo/gtkfishbowl.c
index d3343eb..87ecc22 100644
--- a/demos/gtk-demo/gtkfishbowl.c
+++ b/demos/gtk-demo/gtkfishbowl.c
@@ -115,7 +115,9 @@ gtk_fishbowl_measure (GtkWidget      *widget,
 
 static void
 gtk_fishbowl_size_allocate (GtkWidget     *widget,
-                            GtkAllocation *allocation)
+                            GtkAllocation *allocation,
+                            int            baseline,
+                            GtkAllocation *out_clip)
 {
   GtkFishbowl *fishbowl = GTK_FISHBOWL (widget);
   GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
@@ -139,8 +141,6 @@ gtk_fishbowl_size_allocate (GtkWidget     *widget,
 
       gtk_widget_size_allocate (child->widget, &child_allocation);
     }
-
-  gtk_widget_set_clip (widget, allocation);
 }
 
 static double
diff --git a/gtk/gtkaccellabel.c b/gtk/gtkaccellabel.c
index bb5cac8..8cbf445 100644
--- a/gtk/gtkaccellabel.c
+++ b/gtk/gtkaccellabel.c
@@ -160,12 +160,14 @@ G_DEFINE_TYPE_WITH_PRIVATE (GtkAccelLabel, gtk_accel_label, GTK_TYPE_WIDGET)
 
 static void
 gtk_accel_label_size_allocate (GtkWidget     *widget,
-                               GtkAllocation *allocation)
+                               GtkAllocation *allocation,
+                               int            baseline,
+                               GtkAllocation *out_clip)
 {
   GtkAccelLabel *al = GTK_ACCEL_LABEL (widget);
   GtkAccelLabelPrivate *priv = gtk_accel_label_get_instance_private (al);
 
-  gtk_widget_size_allocate (priv->box, allocation);
+  gtk_widget_size_allocate_with_baseline (priv->box, allocation, baseline, out_clip);
 }
 
 static void
diff --git a/gtk/gtkactionbar.c b/gtk/gtkactionbar.c
index c645769..8d90de1 100644
--- a/gtk/gtkactionbar.c
+++ b/gtk/gtkactionbar.c
@@ -269,15 +269,12 @@ gtk_action_bar_snapshot (GtkWidget   *widget,
 
 static void
 gtk_action_bar_size_allocate (GtkWidget     *widget,
-                              GtkAllocation *allocation)
+                              GtkAllocation *allocation,
+                              int            baseline,
+                              GtkAllocation *out_clip)
 {
   GtkActionBarPrivate *priv = gtk_action_bar_get_instance_private (GTK_ACTION_BAR (widget));
-  GtkAllocation clip = *allocation;
-
-  gtk_widget_size_allocate (priv->revealer, (GtkAllocation *)allocation);
-  gtk_widget_get_clip (priv->revealer, &clip);
-
-  gtk_widget_set_clip (widget, &clip);
+  gtk_widget_size_allocate_with_baseline (priv->revealer, allocation, baseline, out_clip);
 }
 
 static void
diff --git a/gtk/gtkappchooserwidget.c b/gtk/gtkappchooserwidget.c
index 9086bfb..10894b9 100644
--- a/gtk/gtkappchooserwidget.c
+++ b/gtk/gtkappchooserwidget.c
@@ -972,14 +972,16 @@ gtk_app_chooser_widget_snapshot (GtkWidget   *widget,
 
 static void
 gtk_app_chooser_widget_size_allocate (GtkWidget     *widget,
-                                      GtkAllocation *allocation)
+                                      GtkAllocation *allocation,
+                                      int            baseline,
+                                      GtkAllocation *out_clip)
 {
   GtkAppChooserWidget *self = GTK_APP_CHOOSER_WIDGET (widget);
   GtkAppChooserWidgetPrivate *priv = gtk_app_chooser_widget_get_instance_private (self);
 
-  GTK_WIDGET_CLASS (gtk_app_chooser_widget_parent_class)->size_allocate (widget, allocation);
+  GTK_WIDGET_CLASS (gtk_app_chooser_widget_parent_class)->size_allocate (widget, allocation, baseline, 
out_clip);
 
-  gtk_widget_size_allocate (priv->overlay, allocation);
+  gtk_widget_size_allocate_with_baseline (priv->overlay, allocation, baseline, out_clip);
 }
 
 static void
diff --git a/gtk/gtkapplicationwindow.c b/gtk/gtkapplicationwindow.c
index c0094c3..2a24a22 100644
--- a/gtk/gtkapplicationwindow.c
+++ b/gtk/gtkapplicationwindow.c
@@ -595,7 +595,9 @@ gtk_application_window_measure (GtkWidget *widget,
 
 static void
 gtk_application_window_real_size_allocate (GtkWidget     *widget,
-                                           GtkAllocation *allocation)
+                                           GtkAllocation *allocation,
+                                           int            baseline,
+                                           GtkAllocation *out_clip)
 {
   GtkApplicationWindow *window = GTK_APPLICATION_WINDOW (widget);
 
@@ -614,19 +616,19 @@ gtk_application_window_real_size_allocate (GtkWidget     *widget,
                           &menubar_height, NULL, NULL, NULL);
 
       menubar_allocation.height = menubar_height;
-      gtk_widget_size_allocate (window->priv->menubar, &menubar_allocation);
+      gtk_widget_size_allocate_with_baseline (window->priv->menubar, &menubar_allocation, baseline, 
out_clip);
 
       child_allocation.y += menubar_height;
       child_allocation.height -= menubar_height;
       child = gtk_bin_get_child (GTK_BIN (window));
       if (child != NULL && gtk_widget_get_visible (child))
-        gtk_widget_size_allocate (child, &child_allocation);
+        gtk_widget_size_allocate_with_baseline (child, &child_allocation, baseline, out_clip);
     }
   else
-    GTK_WIDGET_CLASS (gtk_application_window_parent_class)
-      ->size_allocate (widget, allocation);
-
-  gtk_widget_set_clip (widget, allocation);
+    GTK_WIDGET_CLASS (gtk_application_window_parent_class)->size_allocate (widget,
+                                                                           allocation,
+                                                                           baseline,
+                                                                           out_clip);
 }
 
 static void
diff --git a/gtk/gtkbbox.c b/gtk/gtkbbox.c
index f35f67e..76faca1 100644
--- a/gtk/gtkbbox.c
+++ b/gtk/gtkbbox.c
@@ -98,7 +98,9 @@ static void gtk_button_box_measure           (GtkWidget         *widget,
                                               int               *minimum_baseline,
                                               int               *natural_baseline);
 static void gtk_button_box_size_allocate      (GtkWidget         *widget,
-                                               GtkAllocation     *allocation);
+                                               GtkAllocation     *allocation,
+                                               int                baseline,
+                                               GtkAllocation     *out_clip);
 static void gtk_button_box_remove             (GtkContainer      *container,
                                                GtkWidget         *widget);
 static void gtk_button_box_set_child_property (GtkContainer      *container,
@@ -743,7 +745,9 @@ gtk_button_box_measure (GtkWidget      *widget,
 
 static void
 gtk_button_box_size_allocate (GtkWidget     *widget,
-                              GtkAllocation *allocation)
+                              GtkAllocation *allocation,
+                              int            baseline,
+                              GtkAllocation *out_clip)
 {
   GtkButtonBox *bbox = GTK_BUTTON_BOX (widget);
   GtkButtonBoxPrivate *priv = bbox->priv;
@@ -769,15 +773,16 @@ gtk_button_box_size_allocate (GtkWidget     *widget,
   gint secondary_size;
   gint total_size;
   gint baseline_height;
-  gint baseline;
   gint child_baseline;
   gint i;
-  GtkAllocation clip = *allocation;
   GdkRectangle child_clip;
 
   if (priv->layout_style == GTK_BUTTONBOX_EXPAND)
     {
-      GTK_WIDGET_CLASS (gtk_button_box_parent_class)->size_allocate (widget, allocation);
+      GTK_WIDGET_CLASS (gtk_button_box_parent_class)->size_allocate (widget,
+                                                                     allocation,
+                                                                     baseline,
+                                                                     out_clip);
       return;
     }
 
@@ -1029,9 +1034,8 @@ gtk_button_box_size_allocate (GtkWidget     *widget,
                 }
             }
 
-          gtk_widget_size_allocate_with_baseline (child, &child_allocation, child_baseline);
-          gtk_widget_get_clip (child, &child_clip);
-          gdk_rectangle_union (&clip, &child_clip, &clip);
+          gtk_widget_size_allocate_with_baseline (child, &child_allocation, child_baseline, &child_clip);
+          gdk_rectangle_union (out_clip, &child_clip, out_clip);
           i++;
         }
     }
@@ -1040,8 +1044,6 @@ gtk_button_box_size_allocate (GtkWidget     *widget,
   g_free (widths);
   g_free (heights);
   g_free (baselines);
-
-  gtk_widget_set_clip (widget, &clip);
 }
 
 /**
diff --git a/gtk/gtkbin.c b/gtk/gtkbin.c
index 0b65927..18b5bf4 100644
--- a/gtk/gtkbin.c
+++ b/gtk/gtkbin.c
@@ -61,7 +61,9 @@ static void               gtk_bin_measure                         (GtkWidget
                                                                    int            *minimum_baseline,
                                                                    int            *natural_baseline);
 static void               gtk_bin_size_allocate                   (GtkWidget           *widget,
-                                                                   GtkAllocation       *allocation);
+                                                                   GtkAllocation       *allocation,
+                                                                   int                  baseline,
+                                                                   GtkAllocation       *out_clip);
 
 G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GtkBin, gtk_bin, GTK_TYPE_CONTAINER)
 
@@ -183,20 +185,15 @@ gtk_bin_measure (GtkWidget *widget,
 
 static void
 gtk_bin_size_allocate (GtkWidget     *widget,
-                       GtkAllocation *allocation)
+                       GtkAllocation *allocation,
+                       int            baseline,
+                       GtkAllocation *out_clip)
 {
   GtkBin *bin = GTK_BIN (widget);
   GtkBinPrivate *priv = gtk_bin_get_instance_private (bin);
 
   if (priv->child && gtk_widget_get_visible (priv->child))
-    {
-      GtkAllocation clip = *allocation;
-
-      gtk_widget_size_allocate (priv->child, allocation);
-      gtk_widget_get_clip (priv->child, &clip);
-
-      gtk_widget_set_clip (widget, &clip);
-    }
+    gtk_widget_size_allocate_with_baseline (priv->child, allocation, baseline, out_clip);
 }
 
 /**
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c
index 1db4d9b..5d60a53 100644
--- a/gtk/gtkbox.c
+++ b/gtk/gtkbox.c
@@ -142,7 +142,9 @@ struct _GtkBoxChild
 };
 
 static void gtk_box_size_allocate         (GtkWidget              *widget,
-                                           GtkAllocation          *allocation);
+                                           GtkAllocation          *allocation,
+                                           int                     baseline,
+                                           GtkAllocation          *out_clip);
 
 static void gtk_box_direction_changed  (GtkWidget        *widget,
                                         GtkTextDirection  previous_direction);
@@ -369,6 +371,7 @@ get_spacing (GtkBox *box)
 static void
 gtk_box_size_allocate_no_center (GtkWidget           *widget,
                                  const GtkAllocation *allocation,
+                                 int                  baseline,
                                  GdkRectangle        *out_clip)
 {
   GtkBox *box = GTK_BOX (widget);
@@ -385,7 +388,6 @@ gtk_box_size_allocate_no_center (GtkWidget           *widget,
   gint minimum_above, natural_above;
   gint minimum_below, natural_below;
   gboolean have_baseline;
-  int baseline = -1;
 
   GtkPackType packing;
 
@@ -549,8 +551,8 @@ gtk_box_size_allocate_no_center (GtkWidget           *widget,
        }
     }
 
-  if (private->orientation == GTK_ORIENTATION_HORIZONTAL)
-    baseline = gtk_widget_get_allocated_baseline (widget);
+  if (private->orientation == GTK_ORIENTATION_VERTICAL)
+    baseline = -1;
 
   if (baseline == -1 && have_baseline)
     {
@@ -653,7 +655,7 @@ gtk_box_size_allocate_no_center (GtkWidget           *widget,
                  child_allocation.y -= child_size;
                }
            }
-         gtk_widget_size_allocate_with_baseline (child->widget, &child_allocation, baseline);
+         gtk_widget_size_allocate_with_baseline (child->widget, &child_allocation, baseline, out_clip);
           gtk_widget_get_clip (child->widget, &clip);
           gdk_rectangle_union (&clip, out_clip, out_clip);
 
@@ -664,13 +666,11 @@ gtk_box_size_allocate_no_center (GtkWidget           *widget,
 
 static void
 gtk_box_size_allocate (GtkWidget     *widget,
-                       GtkAllocation *allocation)
+                       GtkAllocation *allocation,
+                       int            baseline,
+                       GtkAllocation *out_clip)
 {
-  GtkAllocation clip = *allocation;
-
-  gtk_box_size_allocate_no_center (widget, allocation, &clip);
-
-  gtk_widget_set_clip (widget, &clip);
+  gtk_box_size_allocate_no_center (widget, allocation, baseline, out_clip);
 }
 
 static GType
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index d663d12..44bec2e 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -119,8 +119,10 @@ static void gtk_button_get_property   (GObject            *object,
 static void gtk_button_screen_changed (GtkWidget          *widget,
                                       GdkScreen          *previous_screen);
 static void gtk_button_unrealize (GtkWidget * widget);
-static void gtk_button_size_allocate (GtkWidget * widget,
-                                     GtkAllocation * allocation);
+static void gtk_button_size_allocate (GtkWidget     *widget,
+                                      GtkAllocation *allocation,
+                                      int           baseline,
+                                      GtkAllocation *out_clip);
 static gint gtk_button_grab_broken (GtkWidget * widget,
                                    GdkEventGrabBroken * event);
 static gint gtk_button_key_release (GtkWidget * widget, GdkEventKey * event);
@@ -754,20 +756,15 @@ gtk_button_unrealize (GtkWidget *widget)
 
 static void
 gtk_button_size_allocate (GtkWidget     *widget,
-                         GtkAllocation *allocation)
+                          GtkAllocation *allocation,
+                          int            baseline,
+                          GtkAllocation *out_clip)
 {
-  GtkAllocation clip = *allocation;
   GtkWidget *child;
 
   child = gtk_bin_get_child (GTK_BIN (widget));
   if (child && gtk_widget_get_visible (child))
-    {
-      gtk_widget_size_allocate_with_baseline (child, allocation,
-                                              gtk_widget_get_allocated_baseline (widget));
-      gtk_widget_get_clip (child, &clip);
-    }
-
-  gtk_widget_set_clip (widget, &clip);
+    gtk_widget_size_allocate_with_baseline (child, allocation, baseline, out_clip);
 }
 
 static void
diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c
index 4defe6e..887628e 100644
--- a/gtk/gtkcalendar.c
+++ b/gtk/gtkcalendar.c
@@ -265,7 +265,9 @@ static void     gtk_calendar_measure        (GtkWidget        *widget,
                                              int            *minimum_baseline,
                                              int            *natural_baseline);
 static void     gtk_calendar_size_allocate  (GtkWidget        *widget,
-                                             GtkAllocation    *allocation);
+                                             GtkAllocation    *allocation,
+                                             int               baseline,
+                                             GtkAllocation    *out_clip);
 static void     gtk_calendar_snapshot       (GtkWidget        *widget,
                                              GtkSnapshot      *snapshot);
 static gboolean gtk_calendar_button_press   (GtkWidget        *widget,
@@ -1824,7 +1826,9 @@ gtk_calendar_measure (GtkWidget        *widget,
 
 static void
 gtk_calendar_size_allocate (GtkWidget     *widget,
-                            GtkAllocation *allocation)
+                            GtkAllocation *allocation,
+                            int            baseline,
+                            GtkAllocation *out_clip)
 {
   GtkCalendar *calendar = GTK_CALENDAR (widget);
   GtkCalendarPrivate *priv = calendar->priv;
@@ -1853,9 +1857,6 @@ gtk_calendar_size_allocate (GtkWidget     *widget,
                          - (DAY_XSEP * 6))/7;
       priv->week_width = 0;
     }
-
-
-  gtk_widget_set_clip (widget, allocation);
 }
 
 
diff --git a/gtk/gtkcellview.c b/gtk/gtkcellview.c
index 6c02a23..2a8729a 100644
--- a/gtk/gtkcellview.c
+++ b/gtk/gtkcellview.c
@@ -67,7 +67,9 @@ static void        gtk_cell_view_set_property             (GObject          *obj
 static void        gtk_cell_view_finalize                 (GObject          *object);
 static void        gtk_cell_view_dispose                  (GObject          *object);
 static void        gtk_cell_view_size_allocate            (GtkWidget        *widget,
-                                                           GtkAllocation    *allocation);
+                                                           GtkAllocation    *allocation,
+                                                           int               baseline,
+                                                           GtkAllocation    *out_clip);
 static void        gtk_cell_view_snapshot                 (GtkWidget        *widget,
                                                            GtkSnapshot      *snapshot);
 static void        gtk_cell_view_set_value                (GtkCellView     *cell_view,
@@ -459,7 +461,9 @@ gtk_cell_view_dispose (GObject *object)
 
 static void
 gtk_cell_view_size_allocate (GtkWidget     *widget,
-                             GtkAllocation *allocation)
+                             GtkAllocation *allocation,
+                             int            baseline,
+                             GtkAllocation *out_clip)
 {
   GtkCellView *cellview;
   GtkCellViewPrivate *priv;
@@ -486,8 +490,6 @@ gtk_cell_view_size_allocate (GtkWidget     *widget,
     gtk_cell_area_context_allocate (priv->context, width, -1);
   else if (alloc_height != allocation->height && priv->orientation == GTK_ORIENTATION_VERTICAL)
     gtk_cell_area_context_allocate (priv->context, -1, height);
-
-  gtk_widget_set_clip (widget, allocation);
 }
 
 static void
diff --git a/gtk/gtkcenterbox.c b/gtk/gtkcenterbox.c
index edcd572..e3a058c 100644
--- a/gtk/gtkcenterbox.c
+++ b/gtk/gtkcenterbox.c
@@ -380,11 +380,12 @@ gtk_center_box_measure (GtkWidget      *widget,
 
 static void
 gtk_center_box_size_allocate (GtkWidget     *widget,
-                              GtkAllocation *allocation)
+                              GtkAllocation *allocation,
+                              int            baseline,
+                              GtkAllocation *out_clip)
 {
   GtkCenterBox *self = GTK_CENTER_BOX (widget);
   GtkAllocation child_allocation;
-  GtkAllocation clip = *allocation;
   GtkAllocation child_clip;
   GtkWidget *child[3];
   int child_size[3];
@@ -392,16 +393,12 @@ gtk_center_box_size_allocate (GtkWidget     *widget,
   GtkRequestedSize sizes[3];
   int size;
   int for_size;
-  int baseline;
   int i;
 
-  GTK_WIDGET_CLASS (gtk_center_box_parent_class)->size_allocate (widget, allocation);
-
   if (self->orientation == GTK_ORIENTATION_HORIZONTAL)
     {
       size = allocation->width;
       for_size = allocation->height;
-      baseline = gtk_widget_get_allocated_baseline (widget);
     }
   else
     {
@@ -528,12 +525,10 @@ gtk_center_box_size_allocate (GtkWidget     *widget,
           child_allocation.height = child_size[i];
         }
 
-      gtk_widget_size_allocate_with_baseline (child[i], &child_allocation, allocation->y + baseline);
-      gtk_widget_get_clip (child[i], &child_clip);
-      gdk_rectangle_union (&clip, &clip, &child_clip);
+      gtk_widget_size_allocate_with_baseline (child[i], &child_allocation, allocation->y + baseline,
+                                              &child_clip);
+      gdk_rectangle_union (out_clip, &child_clip, out_clip);
     }
-
-  gtk_widget_set_clip (widget, &clip);
 }
 
 static void
diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c
index 3881db5..9b4983d 100644
--- a/gtk/gtkcheckbutton.c
+++ b/gtk/gtkcheckbutton.c
@@ -78,7 +78,9 @@
 
 
 static void gtk_check_button_size_allocate       (GtkWidget           *widget,
-                                                 GtkAllocation       *allocation);
+                                                  GtkAllocation       *allocation,
+                                                  int                  baseline,
+                                                  GtkAllocation       *out_clip);
 
 typedef struct {
   GtkWidget *indicator_widget;
@@ -433,11 +435,12 @@ gtk_check_button_new_with_mnemonic (const gchar *label)
 
 static void
 gtk_check_button_size_allocate (GtkWidget     *widget,
-                               GtkAllocation *allocation)
+                                GtkAllocation *allocation,
+                                int            baseline,
+                                GtkAllocation *out_clip)
 {
   GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (GTK_CHECK_BUTTON (widget));
   GtkAllocation child_alloc = { 0 };
-  GdkRectangle clip = *allocation;
   GdkRectangle child_clip;
   GtkWidget *child;
   gboolean is_rtl = _gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
@@ -462,9 +465,8 @@ gtk_check_button_size_allocate (GtkWidget     *widget,
           child_alloc.x = allocation->x;
         }
 
-      gtk_widget_size_allocate (priv->indicator_widget, &child_alloc);
-      gtk_widget_get_clip (priv->indicator_widget, &child_clip);
-      gdk_rectangle_union (&clip, &child_clip, &clip);
+      gtk_widget_size_allocate_with_baseline (priv->indicator_widget, &child_alloc, baseline, &child_clip);
+      gdk_rectangle_union (out_clip, &child_clip, out_clip);
     }
 
   child = gtk_bin_get_child (GTK_BIN (widget));
@@ -475,12 +477,9 @@ gtk_check_button_size_allocate (GtkWidget     *widget,
       child_alloc.width = allocation->width - child_alloc.width; /* Indicator width */
       child_alloc.height = allocation->height;
 
-      gtk_widget_size_allocate (child, &child_alloc);
-      gtk_widget_get_clip (child, &child_clip);
-      gdk_rectangle_union (&clip, &child_clip, &clip);
+      gtk_widget_size_allocate_with_baseline (child, &child_alloc, baseline, &child_clip);
+      gdk_rectangle_union (out_clip, &child_clip, out_clip);
     }
-
-  gtk_widget_set_clip (widget, &clip);
 }
 
 GtkCssNode *
diff --git a/gtk/gtkcheckmenuitem.c b/gtk/gtkcheckmenuitem.c
index 24dd548..a74b367 100644
--- a/gtk/gtkcheckmenuitem.c
+++ b/gtk/gtkcheckmenuitem.c
@@ -109,16 +109,20 @@ G_DEFINE_TYPE_WITH_CODE (GtkCheckMenuItem, gtk_check_menu_item, GTK_TYPE_MENU_IT
 
 static void
 gtk_check_menu_item_size_allocate (GtkWidget     *widget,
-                                   GtkAllocation *allocation)
+                                   GtkAllocation *allocation,
+                                   int            baseline,
+                                   GtkAllocation *out_clip)
 {
-  GtkAllocation clip, widget_clip;
+  GtkAllocation child_clip;
   GtkAllocation indicator_alloc;
   GtkCheckMenuItem *check_menu_item = GTK_CHECK_MENU_ITEM (widget);
   GtkCheckMenuItemPrivate *priv = check_menu_item->priv;
   gint toggle_size;
 
-  GTK_WIDGET_CLASS (gtk_check_menu_item_parent_class)->size_allocate
-    (widget, allocation);
+  GTK_WIDGET_CLASS (gtk_check_menu_item_parent_class)->size_allocate (widget,
+                                                                      allocation,
+                                                                      baseline,
+                                                                      out_clip);
 
   gtk_widget_measure (priv->indicator_widget,
                       GTK_ORIENTATION_HORIZONTAL,
@@ -142,12 +146,9 @@ gtk_check_menu_item_size_allocate (GtkWidget     *widget,
 
   gtk_widget_size_allocate_with_baseline (priv->indicator_widget,
                                           &indicator_alloc,
-                                          gtk_widget_get_allocated_baseline (widget));
-  gtk_widget_get_clip (priv->indicator_widget, &clip);
-
-  gtk_widget_get_clip (widget, &widget_clip);
-  gdk_rectangle_union (&widget_clip, &clip, &widget_clip);
-  gtk_widget_set_clip (widget, &widget_clip);
+                                          baseline,
+                                          &child_clip);
+  gdk_rectangle_union (out_clip, &child_clip, out_clip);
 }
 
 static void
diff --git a/gtk/gtkcolorbutton.c b/gtk/gtkcolorbutton.c
index bfe716b..183d75d 100644
--- a/gtk/gtkcolorbutton.c
+++ b/gtk/gtkcolorbutton.c
@@ -169,16 +169,14 @@ gtk_color_button_snapshot (GtkWidget   *widget,
 
 static void
 gtk_color_button_size_allocate (GtkWidget     *widget,
-                                GtkAllocation *allocation)
+                                GtkAllocation *allocation,
+                                int            baseline,
+                                GtkAllocation *out_clip)
 {
   GtkColorButton *button = GTK_COLOR_BUTTON (widget);
   GtkColorButtonPrivate *priv = gtk_color_button_get_instance_private (button);
-  GtkAllocation clip = *allocation;
 
-  gtk_widget_size_allocate (priv->button, allocation);
-  gtk_widget_get_clip (priv->button, &clip);
-
-  gtk_widget_set_clip (widget, &clip);
+  gtk_widget_size_allocate_with_baseline (priv->button, allocation, baseline, out_clip);
 }
 
 static void
diff --git a/gtk/gtkcolorplane.c b/gtk/gtkcolorplane.c
index addc155..1058d76 100644
--- a/gtk/gtkcolorplane.c
+++ b/gtk/gtkcolorplane.c
@@ -180,12 +180,13 @@ create_surface (GtkColorPlane *plane)
 
 static void
 plane_size_allocate (GtkWidget     *widget,
-                     GtkAllocation *allocation)
+                     GtkAllocation *allocation,
+                     int            baseline,
+                     GtkAllocation *out_clip)
 {
   GtkColorPlane *plane = GTK_COLOR_PLANE (widget);
 
   create_surface (plane);
-  gtk_widget_set_clip (widget, allocation);
 }
 
 static void
diff --git a/gtk/gtkcolorswatch.c b/gtk/gtkcolorswatch.c
index 507039c..a6de2ad 100644
--- a/gtk/gtkcolorswatch.c
+++ b/gtk/gtkcolorswatch.c
@@ -381,17 +381,12 @@ tap_action (GtkGestureMultiPress *gesture,
 
 static void
 swatch_size_allocate (GtkWidget     *widget,
-                      GtkAllocation *allocation)
+                      GtkAllocation *allocation,
+                      int            baseline,
+                      GtkAllocation *out_clip)
 {
   GtkColorSwatch *swatch = GTK_COLOR_SWATCH (widget);
-  GtkAllocation clip = *allocation, clip2 = *allocation;
-
-
-  gtk_widget_size_allocate (swatch->priv->overlay_widget, allocation);
-  gtk_widget_get_clip (swatch->priv->overlay_widget, &clip2);
-  gdk_rectangle_union (&clip, &clip2, &clip);
-
-  gtk_widget_set_clip (widget, &clip);
+  gtk_widget_size_allocate_with_baseline (swatch->priv->overlay_widget, allocation, -1, out_clip);
 }
 
 static void
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index f5c7ce4..a7f8ae2 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -368,16 +368,15 @@ gtk_combo_box_measure (GtkWidget      *widget,
 
 static void
 gtk_combo_box_size_allocate (GtkWidget     *widget,
-                             GtkAllocation *allocation)
+                             GtkAllocation *allocation,
+                             int            baseline,
+                             GtkAllocation *out_clip)
 {
   GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
   GtkComboBoxPrivate *priv = combo_box->priv;
-  GtkAllocation clip = *allocation;
 
   gtk_widget_size_allocate_with_baseline (priv->box, allocation,
-                                          gtk_widget_get_allocated_baseline (widget));
-
-  gtk_widget_get_clip (priv->box, &clip);
+                                          baseline, out_clip);
 
   if (gtk_widget_get_visible (priv->popup_widget))
     {
@@ -401,8 +400,6 @@ gtk_combo_box_size_allocate (GtkWidget     *widget,
       /* reposition the menu after giving it a new width */
       gtk_menu_reposition (GTK_MENU (priv->popup_widget));
     }
-
-  gtk_widget_set_clip (widget, &clip);
 }
 
 static void
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index 8180939..3ffed8e 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -1818,6 +1818,7 @@ gtk_container_real_check_resize (GtkContainer *container)
     {
       if (!_gtk_widget_is_toplevel (widget))
         {
+          GtkAllocation clip;
           gtk_widget_get_preferred_size (widget, &requisition, NULL);
           gtk_widget_get_allocated_size (widget, &allocation, &baseline);
 
@@ -1825,7 +1826,7 @@ gtk_container_real_check_resize (GtkContainer *container)
             allocation.width = requisition.width;
           if (allocation.height < requisition.height)
             allocation.height = requisition.height;
-          gtk_widget_size_allocate_with_baseline (widget, &allocation, baseline);
+          gtk_widget_size_allocate_with_baseline (widget, &allocation, baseline, &clip);
         }
       else
         gtk_widget_queue_resize (widget);
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index baaa690..27a9539 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -399,7 +399,9 @@ static void   gtk_entry_unrealize            (GtkWidget        *widget);
 static void   gtk_entry_map                  (GtkWidget        *widget);
 static void   gtk_entry_unmap                (GtkWidget        *widget);
 static void   gtk_entry_size_allocate        (GtkWidget        *widget,
-                                             GtkAllocation    *allocation);
+                                              GtkAllocation    *allocation,
+                                              int               baseline,
+                                              GtkAllocation    *out_clip);
 static void   gtk_entry_snapshot             (GtkWidget        *widget,
                                               GtkSnapshot      *snapshot);
 static gboolean gtk_entry_event              (GtkWidget        *widget,
@@ -3102,16 +3104,16 @@ gtk_entry_measure (GtkWidget      *widget,
 
 static void
 gtk_entry_size_allocate (GtkWidget     *widget,
-                         GtkAllocation *allocation)
+                         GtkAllocation *allocation,
+                         int            baseline,
+                         GtkAllocation *out_clip)
 {
   GtkEntry *entry = GTK_ENTRY (widget);
   GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
-  GdkRectangle clip = *allocation;
   GtkAllocation child_clip;
   gint i;
 
-  priv->text_baseline = gtk_widget_get_allocated_baseline (widget);
-
+  priv->text_baseline = baseline;
   priv->text_x = 0;
   priv->text_width = allocation->width;
 
@@ -3150,9 +3152,8 @@ gtk_entry_size_allocate (GtkWidget     *widget,
       icon_alloc.height = height;
       priv->text_width -= width;
 
-      gtk_widget_size_allocate (icon_info->widget, &icon_alloc);
-      gtk_widget_get_clip (icon_info->widget, &child_clip);
-      gdk_rectangle_union (&child_clip, &clip, &clip);
+      gtk_widget_size_allocate_with_baseline (icon_info->widget, &icon_alloc, baseline, &child_clip);
+      gdk_rectangle_union (out_clip, &child_clip, out_clip);
     }
 
   if (priv->progress_widget && gtk_widget_get_visible (priv->progress_widget))
@@ -3164,10 +3165,8 @@ gtk_entry_size_allocate (GtkWidget     *widget,
       progress_alloc.width = allocation->width;
       progress_alloc.height = allocation->height;
 
-      gtk_widget_size_allocate (priv->progress_widget, &progress_alloc);
-      gtk_widget_get_clip (priv->progress_widget, &child_clip);
-
-      gdk_rectangle_union (&child_clip, &clip, &clip);
+      gtk_widget_size_allocate_with_baseline (priv->progress_widget, &progress_alloc, -1, &child_clip);
+      gdk_rectangle_union (out_clip, &child_clip, out_clip);
     }
 
   /* Do this here instead of gtk_entry_size_allocate() so it works
@@ -3183,8 +3182,6 @@ gtk_entry_size_allocate (GtkWidget     *widget,
       if (completion)
         _gtk_entry_completion_resize_popup (completion);
     }
-
-  gtk_widget_set_clip (widget, &clip);
 }
 
 static void
diff --git a/gtk/gtkeventbox.c b/gtk/gtkeventbox.c
index 42a2cab..09c9232 100644
--- a/gtk/gtkeventbox.c
+++ b/gtk/gtkeventbox.c
@@ -61,7 +61,9 @@ static void     gtk_event_box_unrealize     (GtkWidget        *widget);
 static void     gtk_event_box_map           (GtkWidget        *widget);
 static void     gtk_event_box_unmap         (GtkWidget        *widget);
 static void     gtk_event_box_size_allocate (GtkWidget        *widget,
-                                             GtkAllocation    *allocation);
+                                             GtkAllocation    *allocation,
+                                             int               baseline,
+                                             GtkAllocation    *out_clip);
 static void     gtk_event_box_set_property  (GObject          *object,
                                              guint             prop_id,
                                              const GValue     *value,
@@ -429,11 +431,12 @@ gtk_event_box_unmap (GtkWidget *widget)
 
 static void
 gtk_event_box_size_allocate (GtkWidget     *widget,
-                             GtkAllocation *allocation)
+                             GtkAllocation *allocation,
+                             int            baseline,
+                             GtkAllocation *out_clip)
 {
   GtkBin *bin;
   GtkAllocation child_allocation;
-  gint baseline;
   GtkEventBoxPrivate *priv;
   GtkWidget *child;
 
@@ -464,8 +467,7 @@ gtk_event_box_size_allocate (GtkWidget     *widget,
                                 child_allocation.height);
     }
 
-  baseline = gtk_widget_get_allocated_baseline (widget);
   child = gtk_bin_get_child (bin);
   if (child)
-    gtk_widget_size_allocate_with_baseline (child, &child_allocation, baseline);
+    gtk_widget_size_allocate_with_baseline (child, &child_allocation, baseline, out_clip);
 }
diff --git a/gtk/gtkexpander.c b/gtk/gtkexpander.c
index 12f8191..928bd72 100644
--- a/gtk/gtkexpander.c
+++ b/gtk/gtkexpander.c
@@ -171,7 +171,9 @@ static void gtk_expander_get_property (GObject          *object,
 
 static void     gtk_expander_destroy        (GtkWidget        *widget);
 static void     gtk_expander_size_allocate  (GtkWidget        *widget,
-                                             GtkAllocation    *allocation);
+                                             GtkAllocation    *allocation,
+                                             int               baseline,
+                                             GtkAllocation    *out_clip);
 static gboolean gtk_expander_enter_notify   (GtkWidget        *widget,
                                              GdkEventCrossing *event);
 static gboolean gtk_expander_leave_notify   (GtkWidget        *widget,
@@ -526,15 +528,12 @@ gtk_expander_destroy (GtkWidget *widget)
 
 static void
 gtk_expander_size_allocate (GtkWidget     *widget,
-                            GtkAllocation *allocation)
+                            GtkAllocation *allocation,
+                            int            baseline,
+                            GtkAllocation *out_clip)
 {
   GtkExpanderPrivate *priv = GTK_EXPANDER (widget)->priv;
-  GtkAllocation clip = *allocation;
-
-  gtk_widget_size_allocate_with_baseline (priv->box, allocation,
-                                          gtk_widget_get_allocated_baseline (widget));
-  gtk_widget_get_clip (priv->box, &clip);
-  gtk_widget_set_clip (widget, &clip);
+  gtk_widget_size_allocate_with_baseline (priv->box, allocation, baseline, out_clip);
 }
 
 static void
diff --git a/gtk/gtkfilechooserbutton.c b/gtk/gtkfilechooserbutton.c
index 18fdde9..087d16a 100644
--- a/gtk/gtkfilechooserbutton.c
+++ b/gtk/gtkfilechooserbutton.c
@@ -382,16 +382,14 @@ gtk_file_chooser_button_measure (GtkWidget       *widget,
 
 static void
 gtk_file_chooser_button_size_allocate (GtkWidget     *widget,
-                                       GtkAllocation *allocation)
+                                       GtkAllocation *allocation,
+                                       int            baseline,
+                                       GtkAllocation *out_clip)
 {
   GtkFileChooserButton *button = GTK_FILE_CHOOSER_BUTTON (widget);
   GtkFileChooserButtonPrivate *priv = gtk_file_chooser_button_get_instance_private (button);
-  GtkAllocation clip = *allocation;
 
-  gtk_widget_size_allocate (priv->child, allocation);
-  gtk_widget_get_clip (priv->child, &clip);
-
-  gtk_widget_set_clip (widget, &clip);
+  gtk_widget_size_allocate_with_baseline (priv->child, allocation, baseline, out_clip);
 }
 
 static void
diff --git a/gtk/gtkfilechooserdialog.c b/gtk/gtkfilechooserdialog.c
index 833738e..be58519 100644
--- a/gtk/gtkfilechooserdialog.c
+++ b/gtk/gtkfilechooserdialog.c
@@ -231,7 +231,9 @@ static void     gtk_file_chooser_dialog_notify       (GObject               *obj
 static void     gtk_file_chooser_dialog_map          (GtkWidget             *widget);
 static void     gtk_file_chooser_dialog_unmap        (GtkWidget             *widget);
 static void     gtk_file_chooser_dialog_size_allocate (GtkWidget             *widget,
-                                                       GtkAllocation         *allocation);
+                                                       GtkAllocation         *allocation,
+                                                       int                    baseline,
+                                                       GtkAllocation         *out_clip);
 static void     file_chooser_widget_file_activated   (GtkFileChooser        *chooser,
                                                       GtkFileChooserDialog  *dialog);
 static void     file_chooser_widget_default_size_changed (GtkWidget            *widget,
@@ -617,10 +619,14 @@ gtk_file_chooser_dialog_unmap (GtkWidget *widget)
 
 static void
 gtk_file_chooser_dialog_size_allocate (GtkWidget     *widget,
-                                       GtkAllocation *allocation)
+                                       GtkAllocation *allocation,
+                                       int            baseline,
+                                       GtkAllocation *out_clip)
 {
-  GTK_WIDGET_CLASS (gtk_file_chooser_dialog_parent_class)->size_allocate (widget, allocation);
-
+  GTK_WIDGET_CLASS (gtk_file_chooser_dialog_parent_class)->size_allocate (widget,
+                                                                          allocation,
+                                                                          baseline,
+                                                                          out_clip);
   if (gtk_widget_is_drawable (widget))
     save_dialog_geometry (GTK_FILE_CHOOSER_DIALOG (widget));
 }
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index b2c4c13..aa7d0b7 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -8077,14 +8077,19 @@ gtk_file_chooser_widget_snapshot (GtkWidget   *widget,
 
 static void
 gtk_file_chooser_widget_size_allocate (GtkWidget     *widget,
-                                       GtkAllocation *allocation)
+                                       GtkAllocation *allocation,
+                                       int            baseline,
+                                       GtkAllocation *out_clip)
 {
   GtkFileChooserWidget *self = GTK_FILE_CHOOSER_WIDGET (widget);
   GtkFileChooserWidgetPrivate *priv = gtk_file_chooser_widget_get_instance_private (self);
 
-  GTK_WIDGET_CLASS (gtk_file_chooser_widget_parent_class)->size_allocate (widget, allocation);
+  GTK_WIDGET_CLASS (gtk_file_chooser_widget_parent_class)->size_allocate (widget,
+                                                                          allocation,
+                                                                          baseline,
+                                                                          out_clip);
 
-  gtk_widget_size_allocate (priv->box, allocation);
+  gtk_widget_size_allocate_with_baseline (priv->box, allocation, -1, out_clip);
 }
 
 static void
diff --git a/gtk/gtkfixed.c b/gtk/gtkfixed.c
index 4716dd6..8c14d09 100644
--- a/gtk/gtkfixed.c
+++ b/gtk/gtkfixed.c
@@ -97,7 +97,9 @@ static void gtk_fixed_measure (GtkWidget      *widget,
 
 
 static void gtk_fixed_size_allocate (GtkWidget        *widget,
-                                     GtkAllocation    *allocation);
+                                     GtkAllocation    *allocation,
+                                     int               baseline,
+                                     GtkAllocation    *out_clip);
 static void gtk_fixed_snapshot      (GtkWidget        *widget,
                                      GtkSnapshot      *snapshot);
 static void gtk_fixed_add           (GtkContainer     *container,
@@ -386,7 +388,9 @@ gtk_fixed_measure (GtkWidget      *widget,
 
 static void
 gtk_fixed_size_allocate (GtkWidget     *widget,
-                         GtkAllocation *allocation)
+                         GtkAllocation *allocation,
+                         int            baseline,
+                         GtkAllocation *out_clip)
 {
   GtkFixed *fixed = GTK_FIXED (widget);
   GtkFixedPrivate *priv = fixed->priv;
@@ -408,7 +412,7 @@ gtk_fixed_size_allocate (GtkWidget     *widget,
 
       child_allocation.width = child_requisition.width;
       child_allocation.height = child_requisition.height;
-      gtk_widget_size_allocate (child->widget, &child_allocation);
+      gtk_widget_size_allocate_with_baseline (child->widget, &child_allocation, -1, out_clip);
     }
 }
 
diff --git a/gtk/gtkflowbox.c b/gtk/gtkflowbox.c
index 1fec4ce..525625e 100644
--- a/gtk/gtkflowbox.c
+++ b/gtk/gtkflowbox.c
@@ -418,9 +418,10 @@ gtk_flow_box_child_measure (GtkWidget     *widget,
 
 static void
 gtk_flow_box_child_size_allocate (GtkWidget     *widget,
-                                  GtkAllocation *allocation)
+                                  GtkAllocation *allocation,
+                                  int            baseline,
+                                  GtkAllocation *out_clip)
 {
-  GtkAllocation clip = *allocation;
   GtkWidget *child;
 
   child = gtk_bin_get_child (GTK_BIN (widget));
@@ -428,13 +429,9 @@ gtk_flow_box_child_size_allocate (GtkWidget     *widget,
     {
       GdkRectangle child_clip;
 
-      gtk_widget_size_allocate (child, allocation);
-      gtk_widget_get_clip (child, &child_clip);
-
-      gdk_rectangle_union (&child_clip, &clip, &clip);
+      gtk_widget_size_allocate_with_baseline (child, allocation, -1, &child_clip);
+      gdk_rectangle_union (out_clip, &child_clip, out_clip);
     }
-
-  gtk_widget_set_clip (widget, &clip);
 }
 
 /* GObject implementation {{{2 */
@@ -1403,11 +1400,12 @@ get_offset_pixels (GtkAlign align,
 
 static void
 gtk_flow_box_size_allocate (GtkWidget     *widget,
-                            GtkAllocation *allocation)
+                            GtkAllocation *allocation,
+                            int            baseline,
+                            GtkAllocation *out_clip)
 {
   GtkFlowBox *box = GTK_FLOW_BOX (widget);
   GtkFlowBoxPrivate  *priv = BOX_PRIV (box);
-  GtkAllocation clip = *allocation;
   GdkRectangle child_clip;
   GtkAllocation widget_allocation;
   GtkAllocation child_allocation;
@@ -1748,9 +1746,8 @@ gtk_flow_box_size_allocate (GtkWidget     *widget,
       if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
         child_allocation.x = allocation->width - child_allocation.x - child_allocation.width;
 
-      gtk_widget_size_allocate (child, &child_allocation);
-      gtk_widget_get_clip (child, &child_clip);
-      gdk_rectangle_union (&clip, &child_clip, &clip);
+      gtk_widget_size_allocate_with_baseline (child, &child_allocation, -1, &child_clip);
+      gdk_rectangle_union (out_clip, &child_clip, out_clip);
 
       item_offset += this_item_size;
       item_offset += item_spacing;
@@ -1760,8 +1757,6 @@ gtk_flow_box_size_allocate (GtkWidget     *widget,
 
   g_free (item_sizes);
   g_free (line_sizes);
-
-  gtk_widget_set_clip (widget, &clip);
 }
 
 static GtkSizeRequestMode
diff --git a/gtk/gtkfontbutton.c b/gtk/gtkfontbutton.c
index 4f06b92..23ee842 100644
--- a/gtk/gtkfontbutton.c
+++ b/gtk/gtkfontbutton.c
@@ -464,16 +464,14 @@ gtk_font_button_measure (GtkWidget       *widget,
 
 static void
 gtk_font_button_size_allocate (GtkWidget     *widget,
-                               GtkAllocation *allocation)
+                               GtkAllocation *allocation,
+                               int            baseline,
+                               GtkAllocation *out_clip)
 {
   GtkFontButton *button = GTK_FONT_BUTTON (widget);
   GtkFontButtonPrivate *priv = gtk_font_button_get_instance_private (button);
-  GtkAllocation clip = *allocation;
 
-  gtk_widget_size_allocate (priv->button, allocation);
-  gtk_widget_get_clip (priv->button, &clip);
-
-  gtk_widget_set_clip (widget, &clip);
+  gtk_widget_size_allocate_with_baseline (priv->button, allocation, baseline, out_clip);
 }
 
 static void
diff --git a/gtk/gtkfontchooserwidget.c b/gtk/gtkfontchooserwidget.c
index 3979872..e03f869 100644
--- a/gtk/gtkfontchooserwidget.c
+++ b/gtk/gtkfontchooserwidget.c
@@ -594,14 +594,16 @@ gtk_font_chooser_widget_snapshot (GtkWidget   *widget,
 
 static void
 gtk_font_chooser_widget_size_allocate (GtkWidget     *widget,
-                                       GtkAllocation *allocation)
+                                       GtkAllocation *allocation,
+                                       int            baseline,
+                                       GtkAllocation *out_clip)
 {
   GtkFontChooserWidget *self = GTK_FONT_CHOOSER_WIDGET (widget);
   GtkFontChooserWidgetPrivate *priv = gtk_font_chooser_widget_get_instance_private (self);
 
-  GTK_WIDGET_CLASS (gtk_font_chooser_widget_parent_class)->size_allocate (widget, allocation);
+  GTK_WIDGET_CLASS (gtk_font_chooser_widget_parent_class)->size_allocate (widget, allocation, -1, out_clip);
 
-  gtk_widget_size_allocate (priv->grid, allocation);
+  gtk_widget_size_allocate_with_baseline (priv->grid, allocation, -1, out_clip);
 }
 
 static void
diff --git a/gtk/gtkframe.c b/gtk/gtkframe.c
index ff59bac..80918ab 100644
--- a/gtk/gtkframe.c
+++ b/gtk/gtkframe.c
@@ -118,7 +118,9 @@ static void gtk_frame_get_property (GObject     *object,
                                    GValue      *value,
                                    GParamSpec  *pspec);
 static void gtk_frame_size_allocate (GtkWidget      *widget,
-                                    GtkAllocation  *allocation);
+                                     GtkAllocation  *allocation,
+                                     int             baseline,
+                                     GtkAllocation  *out_clip);
 static void gtk_frame_remove        (GtkContainer   *container,
                                     GtkWidget      *child);
 static void gtk_frame_forall        (GtkContainer   *container,
@@ -612,14 +614,15 @@ gtk_frame_get_shadow_type (GtkFrame *frame)
 
 static void
 gtk_frame_size_allocate (GtkWidget     *widget,
-                         GtkAllocation *allocation)
+                         GtkAllocation *allocation,
+                         int            baseline,
+                         GtkAllocation *out_clip)
 {
   GtkFrame *frame = GTK_FRAME (widget);
   GtkFramePrivate *priv = frame->priv;
   GtkWidget *child;
   GtkAllocation new_allocation;
-  GtkAllocation clip = *allocation;
-  GtkAllocation child_clip = *allocation;
+  GtkAllocation child_clip;
 
   gtk_frame_compute_child_allocation (frame, &new_allocation);
   priv->child_allocation = new_allocation;
@@ -646,20 +649,16 @@ gtk_frame_size_allocate (GtkWidget     *widget,
       priv->label_allocation.height = height;
       priv->label_allocation.width = width;
 
-      gtk_widget_size_allocate (priv->label_widget, &priv->label_allocation);
-      gtk_widget_get_clip (priv->label_widget, &child_clip);
-      gdk_rectangle_union (&child_clip, &clip, &clip);
+      gtk_widget_size_allocate_with_baseline (priv->label_widget, &priv->label_allocation, -1, &child_clip);
+      gdk_rectangle_union (out_clip, &child_clip, out_clip);
     }
 
   child = gtk_bin_get_child (GTK_BIN (widget));
   if (child && gtk_widget_get_visible (child))
     {
-      gtk_widget_size_allocate (child, &priv->child_allocation);
-      gtk_widget_get_clip (child, &child_clip);
-      gdk_rectangle_union (&child_clip, &clip, &clip);
+      gtk_widget_size_allocate_with_baseline (child, &priv->child_allocation, -1, &child_clip);
+      gdk_rectangle_union (out_clip, &child_clip, out_clip);
     }
-
-  gtk_widget_set_clip (widget, &clip);
 }
 
 static void
diff --git a/gtk/gtkgizmo.c b/gtk/gtkgizmo.c
index f80fabe..2d0cfca 100644
--- a/gtk/gtkgizmo.c
+++ b/gtk/gtkgizmo.c
@@ -24,18 +24,17 @@ gtk_gizmo_measure (GtkWidget      *widget,
 
 static void
 gtk_gizmo_size_allocate (GtkWidget     *widget,
-                         GtkAllocation *allocation)
+                         GtkAllocation *allocation,
+                         int           baseline,
+                         GtkAllocation *out_clip)
 {
   GtkGizmo *self = GTK_GIZMO (widget);
-  GtkAllocation clip = *allocation;
 
   if (self->allocate_func)
     self->allocate_func (self,
                          allocation,
-                         gtk_widget_get_allocated_baseline (widget),
-                         &clip);
-
-  gtk_widget_set_clip (widget, &clip);
+                         baseline,
+                         out_clip);
 }
 
 static void
diff --git a/gtk/gtkglarea.c b/gtk/gtkglarea.c
index 9b9c021..eccc27f 100644
--- a/gtk/gtkglarea.c
+++ b/gtk/gtkglarea.c
@@ -577,12 +577,14 @@ gtk_gl_area_unrealize (GtkWidget *widget)
 
 static void
 gtk_gl_area_size_allocate (GtkWidget     *widget,
-                           GtkAllocation *allocation)
+                           GtkAllocation *allocation,
+                           int            baseline,
+                           GtkAllocation *out_clip)
 {
   GtkGLArea *area = GTK_GL_AREA (widget);
   GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area);
 
-  GTK_WIDGET_CLASS (gtk_gl_area_parent_class)->size_allocate (widget, allocation);
+  GTK_WIDGET_CLASS (gtk_gl_area_parent_class)->size_allocate (widget, allocation, baseline, out_clip);
 
   if (gtk_widget_get_realized (widget))
     priv->needs_resize = TRUE;
diff --git a/gtk/gtkgrid.c b/gtk/gtkgrid.c
index 937f3bb..1b3d8cc 100644
--- a/gtk/gtkgrid.c
+++ b/gtk/gtkgrid.c
@@ -1575,9 +1575,8 @@ gtk_grid_request_allocate_children (GtkGridRequest      *request,
         child_allocation.x = allocation->x + allocation->width
                              - (child_allocation.x - allocation->x) - child_allocation.width;
 
-      gtk_widget_size_allocate_with_baseline (child->widget, &child_allocation, baseline);
-      gtk_widget_get_clip (child->widget, &child_clip);
-      gdk_rectangle_union (&child_clip, out_clip, out_clip);
+      gtk_widget_size_allocate_with_baseline (child->widget, &child_allocation, baseline, &child_clip);
+      gdk_rectangle_union (out_clip, &child_clip, out_clip);
     }
 }
 
@@ -1585,10 +1584,10 @@ gtk_grid_request_allocate_children (GtkGridRequest      *request,
 
 static void
 gtk_grid_size_allocate (GtkWidget     *widget,
-                        GtkAllocation *allocation)
+                        GtkAllocation *allocation,
+                        int            baseline,
+                        GtkAllocation *out_clip)
 {
-  GtkAllocation clip = *allocation;
-  GtkAllocation children_clip = *allocation;
   GtkGrid *grid = GTK_GRID (widget);
   GtkGridPrivate *priv = grid->priv;
   GtkGridRequest request;
@@ -1596,10 +1595,7 @@ gtk_grid_size_allocate (GtkWidget     *widget,
   GtkOrientation orientation;
 
   if (priv->children == NULL)
-    {
-      gtk_widget_set_clip (widget, &clip);
-      return;
-    }
+    return;
 
   request.grid = grid;
 
@@ -1625,10 +1621,7 @@ gtk_grid_size_allocate (GtkWidget     *widget,
   gtk_grid_request_position (&request, 0);
   gtk_grid_request_position (&request, 1);
 
-  gtk_grid_request_allocate_children (&request, allocation, &children_clip);
-  gdk_rectangle_union (&children_clip, &clip, &clip);
-
-  gtk_widget_set_clip (widget, &clip);
+  gtk_grid_request_allocate_children (&request, allocation, out_clip);
 }
 
 static void
diff --git a/gtk/gtkheaderbar.c b/gtk/gtkheaderbar.c
index e415a4c..9098a0d 100644
--- a/gtk/gtkheaderbar.c
+++ b/gtk/gtkheaderbar.c
@@ -894,10 +894,11 @@ gtk_header_bar_measure (GtkWidget      *widget,
 
 static void
 gtk_header_bar_size_allocate (GtkWidget     *widget,
-                              GtkAllocation *allocation)
+                              GtkAllocation *allocation,
+                              int            baseline,
+                              GtkAllocation *out_clip)
 {
   GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (GTK_HEADER_BAR (widget));
-  GtkAllocation clip = *allocation;
   GtkWidget *title_widget;
   GtkHeaderBar *bar = GTK_HEADER_BAR (widget);
   GtkRequestedSize *sizes;
@@ -919,7 +920,7 @@ gtk_header_bar_size_allocate (GtkWidget     *widget,
   gint x;
   gint child_size;
   GtkTextDirection direction;
-  GtkAllocation child_clip;
+  GtkAllocation child_clip = {0, };
 
   direction = gtk_widget_get_direction (widget);
   nvis_children = count_visible_children (bar);
@@ -1096,9 +1097,8 @@ gtk_header_bar_size_allocate (GtkWidget     *widget,
           if (direction == GTK_TEXT_DIR_RTL)
             child_allocation.x = allocation->x + allocation->width - (child_allocation.x - allocation->x) - 
child_allocation.width;
 
-          gtk_widget_size_allocate (child->widget, &child_allocation);
-          gtk_widget_get_clip (child->widget, &child_clip);
-          gdk_rectangle_union (&child_clip, &clip, &clip);
+          gtk_widget_size_allocate_with_baseline (child->widget, &child_allocation, baseline, &child_clip);
+          gdk_rectangle_union (out_clip, &child_clip, out_clip);
 
         next:
           i++;
@@ -1135,9 +1135,8 @@ gtk_header_bar_size_allocate (GtkWidget     *widget,
 
   if (title_widget != NULL)
     {
-      gtk_widget_size_allocate (title_widget, &child_allocation);
-      gtk_widget_get_clip (title_widget, &child_clip);
-      gdk_rectangle_union (&child_clip, &clip, &clip);
+      gtk_widget_size_allocate_with_baseline (title_widget, &child_allocation, baseline, &child_clip);
+      gdk_rectangle_union (out_clip, &child_clip, out_clip);
     }
 
   child_allocation.y = allocation->y;
@@ -1151,9 +1150,8 @@ gtk_header_bar_size_allocate (GtkWidget     *widget,
       else
         child_allocation.x = allocation->x + allocation->width - start_width + priv->spacing;
       child_allocation.width = start_width - priv->spacing;
-      gtk_widget_size_allocate (priv->titlebar_start_box, &child_allocation);
-      gtk_widget_get_clip (priv->titlebar_start_box, &child_clip);
-      gdk_rectangle_union (&child_clip, &clip, &clip);
+      gtk_widget_size_allocate_with_baseline (priv->titlebar_start_box, &child_allocation, baseline, 
&child_clip);
+      gdk_rectangle_union (out_clip, &child_clip, out_clip);
     }
 
   if (priv->titlebar_end_box)
@@ -1164,12 +1162,9 @@ gtk_header_bar_size_allocate (GtkWidget     *widget,
       else
         child_allocation.x = allocation->x + allocation->width - end_width + priv->spacing;
       child_allocation.width = end_width - priv->spacing;
-      gtk_widget_size_allocate (priv->titlebar_end_box, &child_allocation);
-      gtk_widget_get_clip (priv->titlebar_end_box, &child_clip);
-      gdk_rectangle_union (&child_clip, &clip, &clip);
+      gtk_widget_size_allocate_with_baseline (priv->titlebar_end_box, &child_allocation, baseline, 
&child_clip);
+      gdk_rectangle_union (out_clip, &child_clip, out_clip);
     }
-
-  gtk_widget_set_clip (widget, &clip);
 }
 
 /**
diff --git a/gtk/gtkicon.c b/gtk/gtkicon.c
index 56b4fdd..aefd1c7 100644
--- a/gtk/gtkicon.c
+++ b/gtk/gtkicon.c
@@ -34,13 +34,6 @@
 G_DEFINE_TYPE (GtkIcon, gtk_icon, GTK_TYPE_WIDGET)
 
 static void
-gtk_icon_size_allocate (GtkWidget     *widget,
-                        GtkAllocation *allocation)
-{
-  gtk_widget_set_clip (widget, allocation);
-}
-
-static void
 gtk_icon_snapshot (GtkWidget   *widget,
                    GtkSnapshot *snapshot)
 {
@@ -61,7 +54,6 @@ gtk_icon_class_init (GtkIconClass *klass)
 {
   GtkWidgetClass *wclass = GTK_WIDGET_CLASS (klass);
 
-  wclass->size_allocate = gtk_icon_size_allocate;
   wclass->snapshot = gtk_icon_snapshot;
 }
 
diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c
index cf06fb1..2862f64 100644
--- a/gtk/gtkiconview.c
+++ b/gtk/gtkiconview.c
@@ -151,7 +151,9 @@ static void gtk_icon_view_measure (GtkWidget *widget,
                                    int            *minimum_baseline,
                                    int            *natural_baseline);
 static void             gtk_icon_view_size_allocate             (GtkWidget          *widget,
-                                                                GtkAllocation      *allocation);
+                                                                 GtkAllocation      *allocation,
+                                                                 int                 baseline,
+                                                                 GtkAllocation      *out_clip);
 static void             gtk_icon_view_snapshot                  (GtkWidget          *widget,
                                                                  GtkSnapshot        *snapshot);
 static gboolean         gtk_icon_view_motion                    (GtkWidget          *widget,
@@ -1604,15 +1606,18 @@ gtk_icon_view_allocate_children (GtkIconView *icon_view)
   for (list = icon_view->priv->children; list; list = list->next)
     {
       GtkIconViewChild *child = list->data;
+      GtkAllocation clip;
 
       /* totally ignore our child's requisition */
-      gtk_widget_size_allocate (child->widget, &child->area);
+      gtk_widget_size_allocate_with_baseline (child->widget, &child->area, -1, &clip);
     }
 }
 
 static void
 gtk_icon_view_size_allocate (GtkWidget      *widget,
-                            GtkAllocation  *allocation)
+                             GtkAllocation  *allocation,
+                             int             baseline,
+                             GtkAllocation  *out_clip)
 {
   GtkIconView *icon_view = GTK_ICON_VIEW (widget);
 
@@ -1645,8 +1650,6 @@ gtk_icon_view_size_allocate (GtkWidget      *widget,
   /* Emit any pending signals now */
   g_object_thaw_notify (G_OBJECT (icon_view->priv->hadjustment));
   g_object_thaw_notify (G_OBJECT (icon_view->priv->vadjustment));
-
-  gtk_widget_set_clip (widget, allocation);
 }
 
 static void
diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c
index 11fb9ea..f9e053c 100644
--- a/gtk/gtkimage.c
+++ b/gtk/gtkimage.c
@@ -142,7 +142,9 @@ struct _GtkImagePrivate
 static void gtk_image_snapshot             (GtkWidget    *widget,
                                             GtkSnapshot  *snapshot);
 static void gtk_image_size_allocate        (GtkWidget    *widget,
-                                            GtkAllocation*allocation);
+                                            GtkAllocation*allocation,
+                                            int           baseline,
+                                            GtkAllocation*out_clip);
 static void gtk_image_unmap                (GtkWidget    *widget);
 static void gtk_image_unrealize            (GtkWidget    *widget);
 static void gtk_image_measure (GtkWidget      *widget,
@@ -1234,21 +1236,16 @@ gtk_image_reset_anim_iter (GtkImage *image)
 
 static void
 gtk_image_size_allocate (GtkWidget     *widget,
-                         GtkAllocation *allocation)
+                         GtkAllocation *allocation,
+                         int            baseline,
+                         GtkAllocation *out_clip)
 {
-  GtkAllocation clip = *allocation;
-  GdkRectangle extents;
-
   _gtk_style_context_get_icon_extents (gtk_widget_get_style_context (widget),
-                                       &extents,
+                                       out_clip,
                                        allocation->x,
                                        allocation->y,
                                        allocation->width,
                                        allocation->height);
-
-  gdk_rectangle_union (&clip, &extents, &clip);
-
-  gtk_widget_set_clip (widget, &clip);
 }
 
 static void
diff --git a/gtk/gtkinvisible.c b/gtk/gtkinvisible.c
index 9478977..2ead489 100644
--- a/gtk/gtkinvisible.c
+++ b/gtk/gtkinvisible.c
@@ -59,8 +59,6 @@ static void gtk_invisible_destroy       (GtkWidget         *widget);
 static void gtk_invisible_realize       (GtkWidget         *widget);
 static void gtk_invisible_style_updated (GtkWidget         *widget);
 static void gtk_invisible_show          (GtkWidget         *widget);
-static void gtk_invisible_size_allocate (GtkWidget         *widget,
-                                        GtkAllocation     *allocation);
 static void gtk_invisible_set_property  (GObject           *object,
                                         guint              prop_id,
                                         const GValue      *value,
@@ -85,7 +83,6 @@ gtk_invisible_class_init (GtkInvisibleClass *class)
   widget_class->realize = gtk_invisible_realize;
   widget_class->style_updated = gtk_invisible_style_updated;
   widget_class->show = gtk_invisible_show;
-  widget_class->size_allocate = gtk_invisible_size_allocate;
   widget_class->destroy = gtk_invisible_destroy;
 
   gobject_class->set_property = gtk_invisible_set_property;
@@ -251,14 +248,6 @@ gtk_invisible_show (GtkWidget *widget)
   gtk_widget_map (widget);
 }
 
-static void
-gtk_invisible_size_allocate (GtkWidget     *widget,
-                             GtkAllocation *allocation)
-{
-  gtk_widget_set_clip (widget, allocation);
-}
-
-
 static void 
 gtk_invisible_set_property  (GObject      *object,
                             guint         prop_id,
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 5b5525f..ed31abc 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -399,7 +399,9 @@ static void gtk_label_get_property      (GObject          *object,
 static void gtk_label_finalize          (GObject          *object);
 static void gtk_label_destroy           (GtkWidget        *widget);
 static void gtk_label_size_allocate     (GtkWidget        *widget,
-                                         GtkAllocation    *allocation);
+                                         GtkAllocation    *allocation,
+                                         int               baseline,
+                                         GtkAllocation    *out_clip);
 static void gtk_label_state_flags_changed   (GtkWidget        *widget,
                                              GtkStateFlags     prev_state);
 static void gtk_label_style_updated     (GtkWidget        *widget);
@@ -3723,18 +3725,17 @@ gtk_label_get_ink_rect (GtkLabel     *label,
 
 static void
 gtk_label_size_allocate (GtkWidget     *widget,
-                         GtkAllocation *allocation)
+                         GtkAllocation *allocation,
+                         int            baseline,
+                         GtkAllocation *out_clip)
 {
   GtkLabel *label = GTK_LABEL (widget);
   GtkLabelPrivate *priv = label->priv;
-  GdkRectangle clip_rect;
 
   if (priv->layout)
     gtk_label_update_layout_width (label);
 
-  gtk_label_get_ink_rect (label, &clip_rect);
-  gdk_rectangle_union (&clip_rect, allocation, &clip_rect);
-  gtk_widget_set_clip (widget, &clip_rect);
+  gtk_label_get_ink_rect (label, out_clip);
 }
 
 static void
diff --git a/gtk/gtklayout.c b/gtk/gtklayout.c
index c510934..de1808e 100644
--- a/gtk/gtklayout.c
+++ b/gtk/gtklayout.c
@@ -123,7 +123,9 @@ static void gtk_layout_measure (GtkWidget *widget,
                                 int            *minimum_baseline,
                                 int            *natural_baseline);
 static void gtk_layout_size_allocate      (GtkWidget      *widget,
-                                           GtkAllocation  *allocation);
+                                           GtkAllocation  *allocation,
+                                           int             baseline,
+                                           GtkAllocation  *out_clip);
 static void gtk_layout_add                (GtkContainer   *container,
                                           GtkWidget      *widget);
 static void gtk_layout_remove             (GtkContainer   *container,
@@ -758,7 +760,9 @@ gtk_layout_measure (GtkWidget *widget,
 
 static void
 gtk_layout_size_allocate (GtkWidget     *widget,
-                         GtkAllocation *allocation)
+                          GtkAllocation *allocation,
+                          int            baseline,
+                          GtkAllocation *out_clip)
 {
   GtkLayout *layout = GTK_LAYOUT (widget);
   GtkLayoutPrivate *priv = layout->priv;
@@ -776,8 +780,6 @@ gtk_layout_size_allocate (GtkWidget     *widget,
 
   gtk_layout_set_hadjustment_values (layout);
   gtk_layout_set_vadjustment_values (layout);
-
-  gtk_widget_set_clip (widget, allocation);
 }
 
 /* Container methods
diff --git a/gtk/gtklevelbar.c b/gtk/gtklevelbar.c
index 969fe47..fd334ec 100644
--- a/gtk/gtklevelbar.c
+++ b/gtk/gtklevelbar.c
@@ -438,8 +438,8 @@ gtk_level_bar_allocate_trough_continuous (GtkLevelBar *self,
   block_area = *allocation;
   gtk_widget_size_allocate_with_baseline (self->priv->block_widget[inverted ? 0 : 1],
                                           &block_area,
-                                          baseline);
-  gtk_widget_get_clip (self->priv->block_widget[inverted ? 0 : 1], out_clip);
+                                          baseline,
+                                          out_clip);
 
   /* now allocate the filled part */
   block_area = *allocation;
@@ -468,8 +468,8 @@ gtk_level_bar_allocate_trough_continuous (GtkLevelBar *self,
 
   gtk_widget_size_allocate_with_baseline (self->priv->block_widget[inverted ? 1 : 0],
                                           &block_area,
-                                          baseline);
-  gtk_widget_get_clip (self->priv->block_widget[inverted ? 1 : 0], &clip);
+                                          baseline,
+                                          &clip);
   gdk_rectangle_intersect (out_clip, &clip, out_clip);
 }
 
@@ -509,8 +509,8 @@ gtk_level_bar_allocate_trough_discrete (GtkLevelBar *self,
     {
       gtk_widget_size_allocate_with_baseline (self->priv->block_widget[i],
                                               &block_area,
-                                              baseline);
-      gtk_widget_get_clip (self->priv->block_widget[i], &clip);
+                                              baseline,
+                                              &clip);
       gdk_rectangle_intersect (out_clip, &clip, out_clip);
 
       if (self->priv->orientation == GTK_ORIENTATION_HORIZONTAL)
@@ -537,15 +537,13 @@ gtk_level_bar_allocate_trough (GtkGizmo            *gizmo,
 
 static void
 gtk_level_bar_size_allocate (GtkWidget     *widget,
-                             GtkAllocation *allocation)
+                             GtkAllocation *allocation,
+                             int            baseline,
+                             GtkAllocation *out_clip)
 {
   GtkLevelBarPrivate *priv = gtk_level_bar_get_instance_private (GTK_LEVEL_BAR (widget));
-  GtkAllocation clip = *allocation;
 
-  gtk_widget_size_allocate (priv->trough_widget, allocation);
-  gtk_widget_get_clip (priv->trough_widget, &clip);
-
-  gtk_widget_set_clip (widget, &clip);
+  gtk_widget_size_allocate_with_baseline (priv->trough_widget, allocation, baseline, out_clip);
 }
 
 static void
diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c
index 12d76fe..4503582 100644
--- a/gtk/gtklistbox.c
+++ b/gtk/gtklistbox.c
@@ -214,7 +214,9 @@ static void                 gtk_list_box_compute_expand               (GtkWidget
 static GType                gtk_list_box_child_type                   (GtkContainer        *container);
 static GtkSizeRequestMode   gtk_list_box_get_request_mode             (GtkWidget           *widget);
 static void                 gtk_list_box_size_allocate                (GtkWidget           *widget,
-                                                                       GtkAllocation       *allocation);
+                                                                       GtkAllocation       *allocation,
+                                                                       int                  baseline,
+                                                                       GtkAllocation       *out_clip);
 static void                 gtk_list_box_drag_leave                   (GtkWidget           *widget,
                                                                        GdkDragContext      *context,
                                                                        guint                time_);
@@ -2510,10 +2512,11 @@ gtk_list_box_measure (GtkWidget     *widget,
 
 static void
 gtk_list_box_size_allocate (GtkWidget     *widget,
-                            GtkAllocation *allocation)
+                            GtkAllocation *allocation,
+                            int            baseline,
+                            GtkAllocation *out_clip)
 {
   GtkListBoxPrivate *priv = BOX_PRIV (widget);
-  GtkAllocation clip = *allocation;
   GtkAllocation child_clip;
   GtkAllocation child_allocation;
   GtkAllocation header_allocation;
@@ -2539,9 +2542,8 @@ gtk_list_box_size_allocate (GtkWidget     *widget,
                           &child_min, NULL, NULL, NULL);
       header_allocation.height = allocation->height;
       header_allocation.y = child_allocation.y;
-      gtk_widget_size_allocate (priv->placeholder, &header_allocation);
-      gtk_widget_get_clip (priv->placeholder, &child_clip);
-      gdk_rectangle_union (&child_clip, &clip, &clip);
+      gtk_widget_size_allocate_with_baseline (priv->placeholder, &header_allocation, -1, &child_clip);
+      gdk_rectangle_union (out_clip, &child_clip, out_clip);
       child_allocation.y += child_min;
     }
 
@@ -2564,9 +2566,11 @@ gtk_list_box_size_allocate (GtkWidget     *widget,
                               &child_min, NULL, NULL, NULL);
           header_allocation.height = child_min;
           header_allocation.y = child_allocation.y;
-          gtk_widget_size_allocate (ROW_PRIV (row)->header, &header_allocation);
-          gtk_widget_get_clip (ROW_PRIV (row)->header, &child_clip);
-          gdk_rectangle_union (&child_clip, &clip, &clip);
+          gtk_widget_size_allocate_with_baseline (ROW_PRIV (row)->header,
+                                                  &header_allocation,
+                                                  -1,
+                                                  &child_clip);
+          gdk_rectangle_union (out_clip, &child_clip, out_clip);
           child_allocation.y += child_min;
         }
 
@@ -2578,13 +2582,13 @@ gtk_list_box_size_allocate (GtkWidget     *widget,
       child_allocation.height = child_min;
 
       ROW_PRIV (row)->height = child_allocation.height;
-      gtk_widget_size_allocate (GTK_WIDGET (row), &child_allocation);
-      gtk_widget_get_clip (GTK_WIDGET (row), &child_clip);
-      gdk_rectangle_union (&child_clip, &clip, &clip);
+      gtk_widget_size_allocate_with_baseline (GTK_WIDGET (row),
+                                              &child_allocation,
+                                              -1,
+                                              &child_clip);
+      gdk_rectangle_union (out_clip, &child_clip, out_clip);
       child_allocation.y += child_min;
     }
-
-  gtk_widget_set_clip (widget, &clip);
 }
 
 /**
@@ -3062,19 +3066,15 @@ gtk_list_box_row_measure (GtkWidget     *widget,
 
 static void
 gtk_list_box_row_size_allocate (GtkWidget     *widget,
-                                GtkAllocation *allocation)
+                                GtkAllocation *allocation,
+                                int            baseline,
+                                GtkAllocation *out_clip)
 {
   GtkWidget *child;
-  GtkAllocation clip = *allocation;
 
   child = gtk_bin_get_child (GTK_BIN (widget));
   if (child && gtk_widget_get_visible (child))
-    {
-      gtk_widget_size_allocate (child, allocation);
-      gtk_widget_get_clip (child, &clip);
-    }
-
-  gtk_widget_set_clip (widget, &clip);
+    gtk_widget_size_allocate (child, allocation);
 }
 
 /**
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index 5a66f30..c766f2f 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -232,7 +232,9 @@ static void     gtk_menu_destroy           (GtkWidget        *widget);
 static void     gtk_menu_realize           (GtkWidget        *widget);
 static void     gtk_menu_unrealize         (GtkWidget        *widget);
 static void     gtk_menu_size_allocate     (GtkWidget        *widget,
-                                            GtkAllocation    *allocation);
+                                            GtkAllocation    *allocation,
+                                            int               baseline,
+                                            GtkAllocation    *out_clip);
 static void     gtk_menu_show              (GtkWidget        *widget);
 static void     gtk_menu_snapshot          (GtkWidget        *widget,
                                             GtkSnapshot      *snapshot);
@@ -2692,14 +2694,15 @@ calculate_line_heights (GtkMenu *menu,
 
 static void
 gtk_menu_size_allocate (GtkWidget     *widget,
-                        GtkAllocation *allocation)
+                        GtkAllocation *allocation,
+                        int            baseline,
+                        GtkAllocation *out_clip)
 {
   GtkMenu *menu;
   GtkMenuPrivate *priv;
   GtkMenuShell *menu_shell;
   GtkWidget *child;
   GtkAllocation arrow_allocation, child_allocation;
-  GtkAllocation clip = *allocation;
   GList *children;
   gint x, y, i;
   gint width, height;
@@ -2794,8 +2797,6 @@ gtk_menu_size_allocate (GtkWidget     *widget,
             }
         }
     }
-
-  gtk_widget_set_clip (widget, &clip);
 }
 
 static void
diff --git a/gtk/gtkmenubar.c b/gtk/gtkmenubar.c
index 955d39a..c29f18f 100644
--- a/gtk/gtkmenubar.c
+++ b/gtk/gtkmenubar.c
@@ -89,7 +89,9 @@ static void gtk_menu_bar_measure (GtkWidget     *widget,
                                   int            *minimum_baseline,
                                   int            *natural_baseline);
 static void gtk_menu_bar_size_allocate     (GtkWidget       *widget,
-                                           GtkAllocation   *allocation);
+                                            GtkAllocation   *allocation,
+                                            int              baseline,
+                                            GtkAllocation   *out_clip);
 static void gtk_menu_bar_hierarchy_changed (GtkWidget       *widget,
                                            GtkWidget       *old_toplevel);
 static gint gtk_menu_bar_get_popup_delay   (GtkMenuShell    *menu_shell);
@@ -343,11 +345,12 @@ gtk_menu_bar_measure (GtkWidget      *widget,
 
 static void
 gtk_menu_bar_size_allocate (GtkWidget     *widget,
-                            GtkAllocation *allocation)
+                            GtkAllocation *allocation,
+                            int            baseline,
+                            GtkAllocation *out_clip)
 {
   GtkMenuBar *menu_bar = GTK_MENU_BAR (widget);
   GtkMenuBarPrivate *priv = menu_bar->priv;
-  GtkAllocation clip = *allocation;
   GtkMenuShell *menu_shell;
   GtkWidget *child;
   GList *children;
@@ -475,8 +478,6 @@ gtk_menu_bar_size_allocate (GtkWidget     *widget,
     }
 
   g_array_free (requested_sizes, TRUE);
-
-  gtk_widget_set_clip (widget, &clip);
 }
 
 static GList *
diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c
index ab130da..9a7e7ba 100644
--- a/gtk/gtkmenuitem.c
+++ b/gtk/gtkmenuitem.c
@@ -247,11 +247,12 @@ gtk_menu_item_actionable_interface_init (GtkActionableInterface *iface)
 
 static void
 gtk_menu_item_size_allocate (GtkWidget     *widget,
-                             GtkAllocation *allocation)
+                             GtkAllocation *allocation,
+                             int            baseline,
+                             GtkAllocation *out_clip)
 {
   GtkMenuItem *menu_item = GTK_MENU_ITEM (widget);
   GtkMenuItemPrivate *priv = menu_item->priv;
-  GtkAllocation clip = *allocation;
   GtkAllocation child_allocation;
   GtkAllocation arrow_clip = { 0 };
   GtkAllocation child_clip = *allocation;
@@ -324,22 +325,21 @@ gtk_menu_item_size_allocate (GtkWidget     *widget,
           arrow_alloc.y = child_allocation.y +
             (child_allocation.height - arrow_alloc.height) / 2;
 
-          gtk_widget_size_allocate (priv->arrow_widget, &arrow_alloc);
-          gtk_widget_get_clip (priv->arrow_widget, &arrow_clip);
-          gdk_rectangle_union (&arrow_clip, &clip, &clip);
-       }
+          gtk_widget_size_allocate_with_baseline (priv->arrow_widget,
+                                                  &arrow_alloc,
+                                                  baseline,
+                                                  &arrow_clip);
+          gdk_rectangle_union (out_clip, &arrow_clip, out_clip);
+        }
 
       child_allocation.width = MAX (1, child_allocation.width);
 
-      gtk_widget_size_allocate (child, &child_allocation);
-      gtk_widget_get_clip (child, &child_clip);
-      gdk_rectangle_union (&child_clip, &clip, &clip);
+      gtk_widget_size_allocate_with_baseline (child, &child_allocation, baseline, &child_clip);
+      gdk_rectangle_union (out_clip, &child_clip, out_clip);
     }
 
   if (priv->submenu)
     gtk_menu_reposition (GTK_MENU (priv->submenu));
-
-  gtk_widget_set_clip (widget, &clip);
 }
 
 static void
diff --git a/gtk/gtkmodelbutton.c b/gtk/gtkmodelbutton.c
index d87f838..c0b9ddc 100644
--- a/gtk/gtkmodelbutton.c
+++ b/gtk/gtkmodelbutton.c
@@ -756,22 +756,25 @@ gtk_model_button_measure (GtkWidget      *widget,
 
 static void
 gtk_model_button_size_allocate (GtkWidget     *widget,
-                                GtkAllocation *allocation)
+                                GtkAllocation *allocation,
+                                int            baseline,
+                                GtkAllocation *out_clip)
 {
   if (GTK_MODEL_BUTTON (widget)->iconic)
     {
-      GTK_WIDGET_CLASS (gtk_model_button_parent_class)->size_allocate (widget, allocation);
+      GTK_WIDGET_CLASS (gtk_model_button_parent_class)->size_allocate (widget,
+                                                                       allocation,
+                                                                       baseline,
+                                                                       out_clip);
     }
   else
     {
-      GtkAllocation clip = *allocation;
       GtkAllocation child_clip = *allocation;
       GtkModelButton *button;
       GtkAllocation child_allocation;
       GtkWidget *child;
       gint check_min_width, check_nat_width;
       gint check_min_height, check_nat_height;
-      int baseline;
 
       button = GTK_MODEL_BUTTON (widget);
       child = gtk_bin_get_child (GTK_BIN (widget));
@@ -798,9 +801,8 @@ gtk_model_button_size_allocate (GtkWidget     *widget,
       child_allocation.height = check_nat_height;
 
       gtk_widget_size_allocate_with_baseline (button->indicator_widget, &child_allocation,
-                                              gtk_widget_get_allocated_baseline (widget));
-      gtk_widget_get_clip (button->indicator_widget, &child_clip);
-      gdk_rectangle_union (&clip, &child_clip, &clip);
+                                              baseline, &child_clip);
+      gdk_rectangle_union (out_clip, &child_clip, out_clip);
 
       if (child && gtk_widget_get_visible (child))
         {
@@ -824,16 +826,12 @@ gtk_model_button_size_allocate (GtkWidget     *widget,
           child_allocation.width = allocation->width - border.left - border.right;
           child_allocation.height = allocation->height - border.top - border.bottom;
 
-          baseline = gtk_widget_get_allocated_baseline (widget);
           if (baseline != -1)
             baseline -= border.top;
 
-          gtk_widget_size_allocate_with_baseline (child, &child_allocation, baseline);
-          gtk_widget_get_clip (child, &child_clip);
-          gdk_rectangle_union (&clip, &child_clip, &clip);
+          gtk_widget_size_allocate_with_baseline (child, &child_allocation, baseline, &child_clip);
+          gdk_rectangle_union (out_clip, &child_clip, out_clip);
         }
-
-      gtk_widget_set_clip (widget, &clip);
     }
 }
 
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 64576a5..e4f8377 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -363,7 +363,9 @@ static void gtk_notebook_measure (GtkWidget      *widget,
                                   int            *minimum_baseline,
                                   int            *natural_baseline);
 static void gtk_notebook_size_allocate       (GtkWidget        *widget,
-                                              GtkAllocation    *allocation);
+                                              GtkAllocation    *allocation,
+                                              int               baseline,
+                                              GtkAllocation    *out_clip);
 static void gtk_notebook_snapshot            (GtkWidget        *widget,
                                               GtkSnapshot      *snapshot);
 static gboolean gtk_notebook_popup_menu      (GtkWidget        *widget);
@@ -2072,16 +2074,14 @@ gtk_notebook_allocate_tabs (GtkGizmo            *gizmo,
 
 static void
 gtk_notebook_size_allocate (GtkWidget     *widget,
-                            GtkAllocation *allocation)
+                            GtkAllocation *allocation,
+                            int            baseline,
+                            GtkAllocation *out_clip)
 {
   GtkNotebook *notebook = GTK_NOTEBOOK (widget);
   GtkNotebookPrivate *priv = notebook->priv;
-  GtkAllocation clip = *allocation;
 
-  gtk_widget_size_allocate (priv->box, allocation);
-  gtk_widget_get_clip (priv->box, &clip);
-
-  gtk_widget_set_clip (widget, &clip);
+  gtk_widget_size_allocate_with_baseline (priv->box, allocation, -1, out_clip);
 }
 
 static void
@@ -3961,9 +3961,8 @@ allocate_tab (GtkGizmo            *gizmo,
 
   gtk_widget_size_allocate_with_baseline (page->tab_label,
                                           &child_allocation,
-                                          baseline);
-
-  gtk_widget_get_clip (page->tab_label, out_clip);
+                                          baseline,
+                                          out_clip);
 }
 
 static gint
@@ -4534,8 +4533,10 @@ gtk_notebook_allocate_arrows (GtkNotebook   *notebook,
             {
               arrow_allocation.x = allocation->x;
               arrow_allocation.width = min;
-              gtk_widget_size_allocate (priv->arrow_widget[ii], &arrow_allocation);
-              gtk_widget_get_clip (priv->arrow_widget[ii], &arrow_clip);
+              gtk_widget_size_allocate_with_baseline (priv->arrow_widget[ii],
+                                                      &arrow_allocation,
+                                                      -1,
+                                                      &arrow_clip);
               allocation->x += min;
               allocation->width -= min;
             }
@@ -4543,8 +4544,10 @@ gtk_notebook_allocate_arrows (GtkNotebook   *notebook,
             {
               arrow_allocation.x = allocation->x + allocation->width - min;
               arrow_allocation.width = min;
-              gtk_widget_size_allocate (priv->arrow_widget[ii], &arrow_allocation);
-              gtk_widget_get_clip (priv->arrow_widget[ii], &arrow_clip);
+              gtk_widget_size_allocate_with_baseline (priv->arrow_widget[ii],
+                                                      &arrow_allocation,
+                                                      -1,
+                                                      &arrow_clip);
               allocation->width -= min;
             }
         }
@@ -4566,11 +4569,13 @@ gtk_notebook_allocate_arrows (GtkNotebook   *notebook,
           arrow_allocation.width = size1;
           arrow_allocation.height = min;
           if (priv->arrow_widget[0])
-            gtk_widget_size_allocate (priv->arrow_widget[0], &arrow_allocation);
+            gtk_widget_size_allocate_with_baseline (priv->arrow_widget[0], &arrow_allocation, -1,
+                                                    &arrow_clip);
           arrow_allocation.x += size1;
           arrow_allocation.width = size2;
           if (priv->arrow_widget[1])
-            gtk_widget_size_allocate (priv->arrow_widget[1], &arrow_allocation);
+            gtk_widget_size_allocate_with_baseline (priv->arrow_widget[1], &arrow_allocation, -1,
+                                                    &arrow_clip);
           allocation->y += min;
           allocation->height -= min;
         }
@@ -4588,11 +4593,13 @@ gtk_notebook_allocate_arrows (GtkNotebook   *notebook,
           arrow_allocation.width = size1;
           arrow_allocation.height = min;
           if (priv->arrow_widget[2])
-            gtk_widget_size_allocate (priv->arrow_widget[2], &arrow_allocation);
+            gtk_widget_size_allocate_with_baseline (priv->arrow_widget[2], &arrow_allocation, -1,
+                                                    &arrow_clip);
           arrow_allocation.x += size1;
           arrow_allocation.width = size2;
           if (priv->arrow_widget[3])
-            gtk_widget_size_allocate (priv->arrow_widget[3], &arrow_allocation);
+            gtk_widget_size_allocate_with_baseline (priv->arrow_widget[3], &arrow_allocation, -1,
+                                                    &arrow_clip);
           allocation->height -= min;
         }
       break;
@@ -5098,21 +5105,20 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook          *notebook,
         {
           GtkAllocation fixed_allocation = { priv->drag_window_x, priv->drag_window_y,
                                              child_allocation.width, child_allocation.height };
-          gtk_widget_size_allocate (page->tab_widget, &fixed_allocation);
-          gtk_widget_get_clip (page->tab_widget, &page_clip);
+          gtk_widget_size_allocate_with_baseline (page->tab_widget, &fixed_allocation, -1,
+                                                  &page_clip);
         }
       else if (page == priv->detached_tab && priv->operation == DRAG_OPERATION_DETACH)
         {
           /* needs to be allocated at 0,0
            * to be shown in the drag window */
           GtkAllocation fixed_allocation = { 0, 0, child_allocation.width, child_allocation.height };
-          gtk_widget_size_allocate (page->tab_widget, &fixed_allocation);
-          gtk_widget_get_clip (page->tab_widget, &page_clip);
+          gtk_widget_size_allocate_with_baseline (page->tab_widget, &fixed_allocation, -1,
+                                                  &page_clip);
         }
       else if (gtk_notebook_page_tab_label_is_visible (page))
         {
-          gtk_widget_size_allocate (page->tab_widget, &child_allocation);
-          gtk_widget_get_clip (page->tab_widget, &page_clip);
+          gtk_widget_size_allocate_with_baseline (page->tab_widget, &child_allocation, -1, &page_clip);
         }
 
       /* calculate whether to leave a gap based on reorder operation or not */
diff --git a/gtk/gtkoverlay.c b/gtk/gtkoverlay.c
index baea9d3..e499597 100644
--- a/gtk/gtkoverlay.c
+++ b/gtk/gtkoverlay.c
@@ -250,14 +250,16 @@ gtk_overlay_child_allocate (GtkOverlay      *overlay,
 
 static void
 gtk_overlay_size_allocate (GtkWidget     *widget,
-                           GtkAllocation *allocation)
+                           GtkAllocation *allocation,
+                           int            baseline,
+                           GtkAllocation *out_clip)
 {
   GtkOverlay *overlay = GTK_OVERLAY (widget);
   GtkOverlayPrivate *priv = overlay->priv;
   GSList *children;
   GtkWidget *main_widget;
 
-  GTK_WIDGET_CLASS (gtk_overlay_parent_class)->size_allocate (widget, allocation);
+  GTK_WIDGET_CLASS (gtk_overlay_parent_class)->size_allocate (widget, allocation, baseline, out_clip);
 
   main_widget = gtk_bin_get_child (GTK_BIN (overlay));
   if (main_widget && gtk_widget_get_visible (main_widget))
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c
index 7ce9e5d..149124c 100644
--- a/gtk/gtkpaned.c
+++ b/gtk/gtkpaned.c
@@ -210,7 +210,9 @@ static void     gtk_paned_measure (GtkWidget *widget,
                                    int            *minimum_baseline,
                                    int            *natural_baseline);
 static void     gtk_paned_size_allocate         (GtkWidget        *widget,
-                                                 GtkAllocation    *allocation);
+                                                 GtkAllocation    *allocation,
+                                                 int               baseline,
+                                                 GtkAllocation    *out_clip);
 static void     gtk_paned_unrealize             (GtkWidget        *widget);
 static void     gtk_paned_direction_changed     (GtkWidget        *widget,
                                                  GtkTextDirection  previous_direction);
@@ -1225,11 +1227,12 @@ gtk_paned_set_child_visible (GtkPaned  *paned,
 
 static void
 gtk_paned_size_allocate (GtkWidget     *widget,
-                         GtkAllocation *allocation)
+                         GtkAllocation *allocation,
+                         int            baseline,
+                         GtkAllocation *out_clip)
 {
   GtkPaned *paned = GTK_PANED (widget);
   GtkPanedPrivate *priv = paned->priv;
-  GtkAllocation clip = *allocation;
   GtkAllocation child_clip;
 
   if (priv->child1 && gtk_widget_get_visible (priv->child1) &&
@@ -1337,9 +1340,8 @@ gtk_paned_size_allocate (GtkWidget     *widget,
             child2_allocation.height = child2_height;
         }
 
-      gtk_widget_size_allocate (priv->handle_widget, &priv->handle_pos);
-      gtk_widget_get_clip (priv->handle_widget, &child_clip);
-      gdk_rectangle_union (&clip, &child_clip, &clip);
+      gtk_widget_size_allocate_with_baseline (priv->handle_widget, &priv->handle_pos, -1, &child_clip);
+      gdk_rectangle_union (out_clip, &child_clip, out_clip);
 
       if (gtk_widget_get_mapped (widget) &&
           (old_handle_pos.x != priv->handle_pos.x ||
@@ -1356,13 +1358,11 @@ gtk_paned_size_allocate (GtkWidget     *widget,
         }
 
 
-      gtk_widget_size_allocate (priv->child1, &child1_allocation);
-      gtk_widget_get_clip (priv->child1, &child_clip);
-      gdk_rectangle_union (&clip, &child_clip, &clip);
+      gtk_widget_size_allocate_with_baseline (priv->child1, &child1_allocation, -1, &child_clip);
+      gdk_rectangle_union (out_clip, &child_clip, out_clip);
 
-      gtk_widget_size_allocate (priv->child2, &child2_allocation);
-      gtk_widget_get_clip (priv->child2, &child_clip);
-      gdk_rectangle_union (&clip, &child_clip, &clip);
+      gtk_widget_size_allocate_with_baseline (priv->child2, &child2_allocation, -1, &child_clip);
+      gdk_rectangle_union (out_clip, &child_clip, out_clip);
     }
   else
     {
@@ -1378,18 +1378,16 @@ gtk_paned_size_allocate (GtkWidget     *widget,
           gtk_paned_set_child_visible (paned, CHILD1, TRUE);
           gtk_paned_set_child_visible (paned, CHILD2, FALSE);
 
-          gtk_widget_size_allocate (priv->child1, &child_allocation);
-          gtk_widget_get_clip (priv->child1, &child_clip);
-          gdk_rectangle_union (&clip, &child_clip, &clip);
+          gtk_widget_size_allocate_with_baseline (priv->child1, &child_allocation, -1, &child_clip);
+          gdk_rectangle_union (out_clip, &child_clip, out_clip);
         }
       else if (priv->child2 && gtk_widget_get_visible (priv->child2))
         {
           gtk_paned_set_child_visible (paned, CHILD1, FALSE);
           gtk_paned_set_child_visible (paned, CHILD2, TRUE);
 
-          gtk_widget_size_allocate (priv->child2, &child_allocation);
-          gtk_widget_get_clip (priv->child2, &child_clip);
-          gdk_rectangle_union (&clip, &child_clip, &clip);
+          gtk_widget_size_allocate_with_baseline (priv->child2, &child_allocation, -1, &child_clip);
+          gdk_rectangle_union (out_clip, &child_clip, out_clip);
         }
       else
         {
@@ -1397,8 +1395,6 @@ gtk_paned_size_allocate (GtkWidget     *widget,
           gtk_paned_set_child_visible (paned, CHILD2, FALSE);
         }
     }
-
-  gtk_widget_set_clip (widget, &clip);
 }
 
 
diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c
index 399bb94..395a603 100644
--- a/gtk/gtkpathbar.c
+++ b/gtk/gtkpathbar.c
@@ -122,7 +122,9 @@ static void gtk_path_bar_measure (GtkWidget *widget,
                                   int            *natural_baseline);
 static void gtk_path_bar_unmap                    (GtkWidget        *widget);
 static void gtk_path_bar_size_allocate            (GtkWidget        *widget,
-                                                  GtkAllocation    *allocation);
+                                                   GtkAllocation    *allocation,
+                                                   int               baseline,
+                                                   GtkAllocation    *out_clip);
 static void gtk_path_bar_add                      (GtkContainer     *container,
                                                   GtkWidget        *widget);
 static void gtk_path_bar_remove                   (GtkContainer     *container,
@@ -450,7 +452,9 @@ gtk_path_bar_unmap (GtkWidget *widget)
  */
 static void
 gtk_path_bar_size_allocate (GtkWidget     *widget,
-                           GtkAllocation *allocation)
+                            GtkAllocation *allocation,
+                            int            baseline,
+                            GtkAllocation *out_clip)
 {
   GtkWidget *child;
   GtkPathBar *path_bar = GTK_PATH_BAR (widget);
@@ -463,16 +467,11 @@ gtk_path_bar_size_allocate (GtkWidget     *widget,
   gint up_slider_offset = 0;
   gint down_slider_offset = 0;
   GtkRequisition child_requisition;
-  GtkAllocation clip = *allocation;
   GtkAllocation child_clip;
 
   /* No path is set; we don't have to allocate anything. */
   if (path_bar->priv->button_list == NULL)
-    {
-      gtk_widget_set_clip (widget, allocation);
-
-      return;
-    }
+    return;
 
   direction = gtk_widget_get_direction (widget);
   allocation_width = allocation->width;
@@ -623,9 +622,8 @@ gtk_path_bar_size_allocate (GtkWidget     *widget,
        gtk_widget_set_tooltip_text (child, NULL);
       
       gtk_widget_set_child_visible (child, TRUE);
-      gtk_widget_size_allocate (child, &child_allocation);
-      gtk_widget_get_clip (child, &child_clip);
-      gdk_rectangle_union (&clip, &child_clip, &clip);
+      gtk_widget_size_allocate_with_baseline (child, &child_allocation, baseline, &child_clip);
+      gdk_rectangle_union (out_clip, &child_clip, out_clip);
 
       if (direction == GTK_TEXT_DIR_RTL)
         {
@@ -654,9 +652,10 @@ gtk_path_bar_size_allocate (GtkWidget     *widget,
     {
       child_allocation.width = path_bar->priv->slider_width;
       child_allocation.x = up_slider_offset + allocation->x;
-      gtk_widget_size_allocate (path_bar->priv->up_slider_button, &child_allocation);
-      gtk_widget_get_clip (path_bar->priv->up_slider_button, &child_clip);
-      gdk_rectangle_union (&clip, &child_clip, &clip);
+      gtk_widget_size_allocate_with_baseline (path_bar->priv->up_slider_button,
+                                              &child_allocation,
+                                              -1, &child_clip);
+      gdk_rectangle_union (out_clip, &child_clip, out_clip);
 
       gtk_widget_set_child_visible (path_bar->priv->up_slider_button, TRUE);
       gtk_widget_show (path_bar->priv->up_slider_button);
@@ -674,9 +673,10 @@ gtk_path_bar_size_allocate (GtkWidget     *widget,
       child_allocation.width = path_bar->priv->slider_width;
       child_allocation.x = down_slider_offset + allocation->x;
       
-      gtk_widget_size_allocate (path_bar->priv->down_slider_button, &child_allocation);
-      gtk_widget_get_clip (path_bar->priv->down_slider_button, &child_clip);
-      gdk_rectangle_union (&clip, &child_clip, &clip);
+      gtk_widget_size_allocate_with_baseline (path_bar->priv->down_slider_button,
+                                              &child_allocation,
+                                              -1, &child_clip);
+      gdk_rectangle_union (out_clip, &child_clip, out_clip);
 
       gtk_widget_set_child_visible (path_bar->priv->down_slider_button, TRUE);
       gtk_widget_show (path_bar->priv->down_slider_button);
@@ -686,8 +686,6 @@ gtk_path_bar_size_allocate (GtkWidget     *widget,
     {
       gtk_widget_set_child_visible (path_bar->priv->down_slider_button, FALSE);
     }
-
-  gtk_widget_set_clip (widget, &clip);
 }
 
 static void
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index b1ca46a..51c4be4 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -252,7 +252,7 @@ allocate_contents (GtkGizmo            *gizmo,
   GtkWidget *child = gtk_bin_get_child (GTK_BIN (popover));
 
   if (child)
-    gtk_widget_size_allocate (child, (GtkAllocation*)allocation);
+    gtk_widget_size_allocate_with_baseline (child, (GtkAllocation*)allocation, -1, out_clip);
 }
 
 static void
@@ -368,6 +368,7 @@ gtk_popover_get_property (GObject    *object,
 static gboolean
 transitions_enabled (GtkPopover *popover)
 {
+  /*return FALSE;*/
   return gtk_settings_get_enable_animations (gtk_widget_get_settings (GTK_WIDGET (popover)));
 }
 
@@ -1367,14 +1368,17 @@ gtk_popover_measure (GtkWidget      *widget,
 
 static void
 gtk_popover_size_allocate (GtkWidget     *widget,
-                           GtkAllocation *allocation)
+                           GtkAllocation *allocation,
+                           int            baseline,
+                           GtkAllocation *out_clip)
 {
   GtkPopover *popover = GTK_POPOVER (widget);
   GtkPopoverPrivate *priv = gtk_popover_get_instance_private (popover);
   GtkAllocation child_clip;
-  GtkAllocation clip = *allocation;
   GtkAllocation child_alloc = *allocation;
 
+  GTK_WIDGET_CLASS (gtk_popover_parent_class)->size_allocate (widget, allocation, baseline, out_clip);
+
   /* Note that we in measure() we add TAIL_HEIGHT in both directions, regardless
    * of the popovers position. This is to ensure that we get enough space
    * even priv->current_position changes between measure and size-allocate.
@@ -1401,20 +1405,11 @@ gtk_popover_size_allocate (GtkWidget     *widget,
       break;
     }
 
-  gtk_widget_size_allocate (priv->contents_widget, &child_alloc);
-  gtk_widget_get_clip (priv->contents_widget, &child_clip);
-  gdk_rectangle_union (&clip, &child_clip, &clip);
+  gtk_widget_size_allocate_with_baseline (priv->contents_widget, &child_alloc, -1, &child_clip);
+  gdk_rectangle_union (out_clip, &child_clip, out_clip);
 
   if (gtk_widget_get_realized (widget))
-    {
-      GtkAllocation a;
-      gtk_widget_get_window_allocation (widget, &a);
-      gdk_window_move_resize (gtk_widget_get_window (widget),
-                              a.x, a.y, a.width, a.height);
-      gtk_popover_update_shape (popover);
-    }
-
-  gtk_widget_set_clip (widget, &clip);
+    gtk_popover_update_shape (popover);
 }
 
 static gboolean
@@ -1837,6 +1832,8 @@ _gtk_popover_parent_unmap (GtkWidget *widget,
 static void
 _gtk_popover_parent_size_allocate (GtkWidget     *widget,
                                    GtkAllocation *allocation,
+                                   int            baseline,
+                                   GtkAllocation *out_clip,
                                    GtkPopover    *popover)
 {
   gtk_popover_update_position (popover);
diff --git a/gtk/gtkprogressbar.c b/gtk/gtkprogressbar.c
index 3998f29..4c5e06c 100644
--- a/gtk/gtkprogressbar.c
+++ b/gtk/gtkprogressbar.c
@@ -141,7 +141,9 @@ static void gtk_progress_bar_get_property         (GObject        *object,
                                                    GValue         *value,
                                                    GParamSpec     *pspec);
 static void gtk_progress_bar_size_allocate        (GtkWidget      *widget,
-                                                   GtkAllocation  *allocation);
+                                                   GtkAllocation  *allocation,
+                                                   int             baseline,
+                                                   GtkAllocation  *out_clip);
 
 static void     gtk_progress_bar_snapshot         (GtkWidget      *widget,
                                                    GtkSnapshot    *snapshot);
@@ -445,8 +447,7 @@ allocate_trough (GtkGizmo            *gizmo,
         }
     }
 
-  gtk_widget_size_allocate (priv->progress_widget, &alloc);
-  gtk_widget_get_clip (priv->progress_widget, out_clip);
+  gtk_widget_size_allocate_with_baseline (priv->progress_widget, &alloc,-1, out_clip);
 
 }
 
@@ -625,9 +626,10 @@ get_current_text (GtkProgressBar *pbar)
 
 static void
 gtk_progress_bar_size_allocate (GtkWidget     *widget,
-                                GtkAllocation *allocation)
+                                GtkAllocation *allocation,
+                                int            baseline,
+                                GtkAllocation *out_clip)
 {
-  GtkAllocation clip = *allocation;
   GtkAllocation child_clip = *allocation;
   GtkProgressBarPrivate *priv;
   gint bar_width, bar_height;
@@ -657,15 +659,11 @@ gtk_progress_bar_size_allocate (GtkWidget     *widget,
   alloc.width = bar_width;
   alloc.height = bar_height;
 
-  gtk_widget_size_allocate (priv->trough_widget, &alloc);
-  gtk_widget_get_clip (priv->trough_widget, &child_clip);
-  gdk_rectangle_union (&clip, &child_clip, &clip);
+  gtk_widget_size_allocate_with_baseline (priv->trough_widget, &alloc, -1, &child_clip);
+  gdk_rectangle_union (out_clip, &child_clip, out_clip);
 
   if (!priv->show_text)
-    {
-      gtk_widget_set_clip (widget, &clip);
-      return;
-    }
+    return;
 
   gtk_widget_measure (priv->label, GTK_ORIENTATION_HORIZONTAL, -1,
                       &text_min, &text_nat,
@@ -691,11 +689,8 @@ gtk_progress_bar_size_allocate (GtkWidget     *widget,
       alloc.height = text_height;
     }
 
-  gtk_widget_size_allocate (priv->label, &alloc);
-  gtk_widget_get_clip (priv->label, &text_clip);
-  gdk_rectangle_union (&clip, &text_clip, &clip);
-
-  gtk_widget_set_clip (widget, &clip);
+  gtk_widget_size_allocate_with_baseline (priv->label, &alloc, -1, &text_clip);
+  gdk_rectangle_union (out_clip, &text_clip, out_clip);
 }
 
 static void
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index 839d22c..bda5c1a 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -163,7 +163,9 @@ static void gtk_range_measure        (GtkWidget      *widget,
                                       int            *minimum_baseline,
                                       int            *natural_baseline);
 static void gtk_range_size_allocate  (GtkWidget        *widget,
-                                      GtkAllocation    *allocation);
+                                      GtkAllocation    *allocation,
+                                      int               baseline,
+                                      GtkAllocation    *out_clip);
 static void gtk_range_unmap          (GtkWidget        *widget);
 
 static void gtk_range_multipress_gesture_pressed  (GtkGestureMultiPress *gesture,
@@ -1422,8 +1424,7 @@ gtk_range_allocate_trough (GtkGizmo            *gizmo,
                                      gtk_adjustment_get_value (priv->adjustment),
                                      &slider_alloc);
 
-  gtk_widget_size_allocate (priv->slider_widget, &slider_alloc);
-  gtk_widget_get_clip (priv->slider_widget, out_clip);
+  gtk_widget_size_allocate_with_baseline (priv->slider_widget, &slider_alloc, -1, out_clip);
 
   if (gtk_adjustment_get_lower (priv->adjustment) == gtk_adjustment_get_upper (priv->adjustment))
     value = 0;
@@ -1465,8 +1466,7 @@ gtk_range_allocate_trough (GtkGizmo            *gizmo,
             fill_alloc.y += allocation->height - fill_alloc.height;
         }
 
-      gtk_widget_size_allocate (priv->fill_widget, &fill_alloc);
-      gtk_widget_get_clip (priv->fill_widget, &fill_clip);
+      gtk_widget_size_allocate_with_baseline (priv->fill_widget, &fill_alloc, -1, &fill_clip);
       gdk_rectangle_union (out_clip, &fill_clip, out_clip);
     }
 
@@ -1505,9 +1505,7 @@ gtk_range_allocate_trough (GtkGizmo            *gizmo,
           highlight_alloc.height = MAX (min, allocation->height* value);
         }
 
-      gtk_widget_size_allocate (priv->highlight_widget, &highlight_alloc);
-      gtk_widget_get_clip (priv->highlight_widget, &highlight_clip);
-      gdk_rectangle_union (out_clip, &highlight_clip, out_clip);
+      gtk_widget_size_allocate_with_baseline (priv->highlight_widget, &highlight_alloc, -1, &highlight_clip);
     }
 }
 
@@ -1600,12 +1598,12 @@ clamp_dimensions (const GtkAllocation *allocation,
 
 static void
 gtk_range_size_allocate (GtkWidget     *widget,
-                         GtkAllocation *allocation)
+                         GtkAllocation *allocation,
+                         int            baseline,
+                         GtkAllocation *out_clip)
 {
   GtkRange *range = GTK_RANGE (widget);
   GtkRangePrivate *priv = range->priv;
-  GtkAllocation clip = *allocation;
-  GtkAllocation child_clip;
   GtkBorder border = { 0 };
   GtkAllocation box_alloc;
   int box_min_width, box_min_height;
@@ -1632,14 +1630,11 @@ gtk_range_size_allocate (GtkWidget     *widget,
   box_alloc.width = box_min_width;
   box_alloc.height = box_min_height;
 
-  gtk_widget_size_allocate (priv->trough_widget, &box_alloc);
-  gtk_widget_get_clip (priv->trough_widget, &child_clip);
+  gtk_widget_size_allocate_with_baseline (priv->trough_widget, &box_alloc, -1, out_clip);
 
   /* TODO: we should compute a proper clip from get_range_border(),
    * but this will at least give us outset shadows.
    */
-  gdk_rectangle_union (&child_clip, &clip, &clip);
-  gtk_widget_set_clip (widget, &clip);
 }
 
 static void
diff --git a/gtk/gtkrecentchooserwidget.c b/gtk/gtkrecentchooserwidget.c
index 0d50098..66ed294 100644
--- a/gtk/gtkrecentchooserwidget.c
+++ b/gtk/gtkrecentchooserwidget.c
@@ -155,14 +155,16 @@ gtk_recent_chooser_widget_snapshot (GtkWidget   *widget,
 
 static void
 gtk_recent_chooser_widget_size_allocate (GtkWidget     *widget,
-                                       GtkAllocation *allocation)
+                                         GtkAllocation *allocation,
+                                         int            baseline,
+                                         GtkAllocation *out_clip)
 {
   GtkRecentChooserWidget *self = GTK_RECENT_CHOOSER_WIDGET (widget);
   GtkRecentChooserWidgetPrivate *priv = gtk_recent_chooser_widget_get_instance_private (self);
 
-  GTK_WIDGET_CLASS (gtk_recent_chooser_widget_parent_class)->size_allocate (widget, allocation);
+  GTK_WIDGET_CLASS (gtk_recent_chooser_widget_parent_class)->size_allocate (widget, allocation, -1, 
out_clip);
 
-  gtk_widget_size_allocate (priv->chooser, allocation);
+  gtk_widget_size_allocate_with_baseline (priv->chooser, allocation, -1, out_clip);
 }
 
 static void
diff --git a/gtk/gtkrevealer.c b/gtk/gtkrevealer.c
index 1d2baf5..910c691 100644
--- a/gtk/gtkrevealer.c
+++ b/gtk/gtkrevealer.c
@@ -95,7 +95,9 @@ static GParamSpec *props[LAST_PROP] = { NULL, };
 static void     gtk_revealer_real_add                            (GtkContainer  *widget,
                                                                   GtkWidget     *child);
 static void     gtk_revealer_real_size_allocate                  (GtkWidget     *widget,
-                                                                  GtkAllocation *allocation);
+                                                                  GtkAllocation *allocation,
+                                                                  int            baseline,
+                                                                  GtkAllocation *out_clip);
 static void gtk_revealer_measure (GtkWidget      *widget,
                                   GtkOrientation  orientation,
                                   int             for_size,
@@ -358,11 +360,12 @@ gtk_revealer_real_add (GtkContainer *container,
 
 static void
 gtk_revealer_real_size_allocate (GtkWidget     *widget,
-                                 GtkAllocation *allocation)
+                                 GtkAllocation *allocation,
+                                 int            baseline,
+                                 GtkAllocation *out_clip)
 {
   GtkRevealer *revealer = GTK_REVEALER (widget);
   GtkWidget *child;
-  GtkAllocation clip = *allocation;
 
   child = gtk_bin_get_child (GTK_BIN (revealer));
   if (child != NULL && gtk_widget_get_visible (child))
@@ -370,11 +373,8 @@ gtk_revealer_real_size_allocate (GtkWidget     *widget,
       GtkAllocation child_allocation;
 
       gtk_revealer_get_child_allocation (revealer, allocation, &child_allocation);
-      gtk_widget_size_allocate (child, &child_allocation);
-      gtk_widget_get_clip (child, &clip);
+      gtk_widget_size_allocate_with_baseline (child, &child_allocation, -1, out_clip);
     }
-
-  gtk_widget_set_clip (widget, &clip);
 }
 
 static void
diff --git a/gtk/gtkscale.c b/gtk/gtkscale.c
index 75b89ad..8080568 100644
--- a/gtk/gtkscale.c
+++ b/gtk/gtkscale.c
@@ -403,8 +403,7 @@ gtk_scale_allocate_value (GtkScale      *scale,
         }
     }
 
-  gtk_widget_size_allocate (priv->value_widget, &value_alloc);
-  gtk_widget_get_clip (priv->value_widget, out_clip);
+  gtk_widget_size_allocate_with_baseline (priv->value_widget, &value_alloc, -1, out_clip);
 }
 
 static void
@@ -451,8 +450,7 @@ gtk_scale_allocate_mark (GtkGizmo            *gizmo,
       indicator_alloc.height = indicator_height;
     }
 
-  gtk_widget_size_allocate_with_baseline (mark->indicator_widget, &indicator_alloc, baseline);
-  gtk_widget_get_clip (mark->indicator_widget, out_clip);
+  gtk_widget_size_allocate_with_baseline (mark->indicator_widget, &indicator_alloc, baseline, out_clip);
 
   if (mark->label_widget)
     {
@@ -473,8 +471,7 @@ gtk_scale_allocate_mark (GtkGizmo            *gizmo,
             label_alloc.x = indicator_alloc.x + indicator_alloc.width;
         }
 
-      gtk_widget_size_allocate_with_baseline (mark->label_widget, &label_alloc, baseline);
-      gtk_widget_get_clip (mark->label_widget, &label_clip);
+      gtk_widget_size_allocate_with_baseline (mark->label_widget, &label_alloc, baseline, &label_clip);
       gdk_rectangle_union (out_clip, &label_clip, out_clip);
     }
 }
@@ -531,8 +528,7 @@ gtk_scale_allocate_marks (GtkGizmo            *gizmo,
           mark_alloc.y -= mark_size / 2;
         }
 
-      gtk_widget_size_allocate_with_baseline (mark->widget, &mark_alloc, baseline);
-      gtk_widget_get_clip (mark->widget, &mark_clip);
+      gtk_widget_size_allocate_with_baseline (mark->widget, &mark_alloc, baseline, &mark_clip);
       gdk_rectangle_union (out_clip, &mark_clip, out_clip);
     }
 
@@ -541,15 +537,16 @@ gtk_scale_allocate_marks (GtkGizmo            *gizmo,
 
 static void
 gtk_scale_size_allocate (GtkWidget     *widget,
-                         GtkAllocation *allocation)
+                         GtkAllocation *allocation,
+                         int            baseline,
+                         GtkAllocation *out_clip)
 {
   GtkScale *scale = GTK_SCALE (widget);
   GtkScalePrivate *priv = scale->priv;
-  GtkAllocation clip = *allocation;
   GtkAllocation marks_clip, range_rect, marks_rect;
   GtkOrientation orientation;
 
-  GTK_WIDGET_CLASS (gtk_scale_parent_class)->size_allocate (widget, allocation);
+  GTK_WIDGET_CLASS (gtk_scale_parent_class)->size_allocate (widget, allocation, baseline, out_clip);
 
   orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (widget));
   gtk_range_get_range_rect (GTK_RANGE (scale), &range_rect);
@@ -567,9 +564,8 @@ gtk_scale_size_allocate (GtkWidget     *widget,
           marks_rect = range_rect;
           marks_rect.y = 0;
           marks_rect.height = marks_height;
-          gtk_widget_size_allocate (priv->top_marks_widget, &marks_rect);
-          gtk_widget_get_clip (priv->top_marks_widget, &marks_clip);
-          gdk_rectangle_union (&clip, &marks_clip, &clip);
+          gtk_widget_size_allocate_with_baseline (priv->top_marks_widget, &marks_rect, -1, &marks_clip);
+          gdk_rectangle_union (out_clip, &marks_clip, out_clip);
         }
 
       if (priv->bottom_marks_widget)
@@ -581,9 +577,8 @@ gtk_scale_size_allocate (GtkWidget     *widget,
           marks_rect = range_rect;
           marks_rect.y += range_rect.height;
           marks_rect.height = marks_height;
-          gtk_widget_size_allocate (priv->bottom_marks_widget, &marks_rect);
-          gtk_widget_get_clip (priv->bottom_marks_widget, &marks_clip);
-          gdk_rectangle_union (&clip, &marks_clip, &clip);
+          gtk_widget_size_allocate_with_baseline (priv->bottom_marks_widget, &marks_rect, -1, &marks_clip);
+          gdk_rectangle_union (out_clip, &marks_clip, out_clip);
         }
     }
   else
@@ -599,9 +594,8 @@ gtk_scale_size_allocate (GtkWidget     *widget,
           marks_rect = range_rect;
           marks_rect.x -= marks_width;
           marks_rect.width = marks_width;
-          gtk_widget_size_allocate (priv->top_marks_widget, &marks_rect);
-          gtk_widget_get_clip (priv->top_marks_widget, &marks_clip);
-          gdk_rectangle_union (&clip, &marks_clip, &clip);
+          gtk_widget_size_allocate_with_baseline (priv->top_marks_widget, &marks_rect, -1, &marks_clip);
+          gdk_rectangle_union (out_clip, &marks_clip, out_clip);
         }
 
       if (priv->bottom_marks_widget)
@@ -613,9 +607,8 @@ gtk_scale_size_allocate (GtkWidget     *widget,
           marks_rect = range_rect;
           marks_rect.x += range_rect.width;
           marks_rect.width = marks_width;
-          gtk_widget_size_allocate (priv->bottom_marks_widget, &marks_rect);
-          gtk_widget_get_clip (priv->bottom_marks_widget, &marks_clip);
-          gdk_rectangle_union (&clip, &marks_clip, &clip);
+          gtk_widget_size_allocate_with_baseline (priv->bottom_marks_widget, &marks_rect, -1, &marks_clip);
+          gdk_rectangle_union (out_clip, &marks_clip, out_clip);
         }
     }
 
@@ -624,10 +617,8 @@ gtk_scale_size_allocate (GtkWidget     *widget,
       GtkAllocation value_clip;
 
       gtk_scale_allocate_value (scale, &value_clip);
-      gdk_rectangle_union (&clip, &value_clip, &clip);
+      gdk_rectangle_union (out_clip, &value_clip, out_clip);
     }
-
-  gtk_widget_set_clip (widget, &clip);
 }
 
 #define add_slider_binding(binding_set, keyval, mask, scroll)              \
diff --git a/gtk/gtkscrollbar.c b/gtk/gtkscrollbar.c
index 7d77f68..eaf5266 100644
--- a/gtk/gtkscrollbar.c
+++ b/gtk/gtkscrollbar.c
@@ -121,14 +121,14 @@ gtk_scrollbar_measure (GtkWidget      *widget,
 
 static void
 gtk_scrollbar_size_allocate (GtkWidget     *widget,
-                             GtkAllocation *allocation)
+                             GtkAllocation *allocation,
+                             int            baseline,
+                             GtkAllocation *out_clip)
 {
   GtkScrollbar *self = GTK_SCROLLBAR (widget);
   GtkScrollbarPrivate *priv = gtk_scrollbar_get_instance_private (self);
 
-  gtk_widget_size_allocate (priv->box, allocation);
-
-  gtk_widget_set_clip (widget, allocation);
+  gtk_widget_size_allocate_with_baseline (priv->box, allocation, -1, out_clip);
 }
 
 static void
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 14efd37..214afab 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -312,7 +312,9 @@ static void     gtk_scrolled_window_destroy            (GtkWidget         *widge
 static void     gtk_scrolled_window_snapshot           (GtkWidget         *widget,
                                                         GtkSnapshot       *snapshot);
 static void     gtk_scrolled_window_size_allocate      (GtkWidget         *widget,
-                                                        GtkAllocation     *allocation);
+                                                        GtkAllocation     *allocation,
+                                                        int               baseline,
+                                                        GtkAllocation     *out_clip);
 static gboolean gtk_scrolled_window_scroll_event       (GtkWidget         *widget,
                                                         GdkEventScroll    *event);
 static gboolean gtk_scrolled_window_focus              (GtkWidget         *widget,
@@ -1348,7 +1350,9 @@ captured_event_cb (GtkWidget *widget,
 
 static void
 gtk_scrolled_window_size_allocate (GtkWidget     *widget,
-                                   GtkAllocation *allocation)
+                                   GtkAllocation *allocation,
+                                   int            baseline,
+                                   GtkAllocation *out_clip)
 {
   GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
   GtkScrolledWindowPrivate *priv = scrolled_window->priv;
@@ -1583,24 +1587,24 @@ gtk_scrolled_window_size_allocate (GtkWidget     *widget,
   gtk_widget_set_child_visible (priv->hscrollbar, priv->hscrollbar_visible);
   if (priv->hscrollbar_visible)
     {
+      GtkAllocation clip;
       gtk_scrolled_window_allocate_scrollbar (scrolled_window,
                                               priv->hscrollbar,
                                               &child_allocation);
-      gtk_widget_size_allocate (priv->hscrollbar, &child_allocation);
+      gtk_widget_size_allocate_with_baseline (priv->hscrollbar, &child_allocation, -1, &clip);
     }
 
   gtk_widget_set_child_visible (priv->vscrollbar, priv->vscrollbar_visible);
   if (priv->vscrollbar_visible)
     {
+      GtkAllocation clip;
       gtk_scrolled_window_allocate_scrollbar (scrolled_window,
                                               priv->vscrollbar,
                                               &child_allocation);
-      gtk_widget_size_allocate (priv->vscrollbar, &child_allocation);
+      gtk_widget_size_allocate_with_baseline (priv->vscrollbar, &child_allocation, -1, &clip);
     }
 
   gtk_scrolled_window_check_attach_pan_gesture (scrolled_window);
-
-  gtk_widget_set_clip (widget, allocation);
 }
 
 static void
@@ -2975,6 +2979,7 @@ gtk_scrolled_window_allocate_child (GtkScrolledWindow   *swindow,
   GtkScrolledWindowPrivate *priv = gtk_scrolled_window_get_instance_private (swindow);
   GtkWidget     *widget = GTK_WIDGET (swindow), *child;
   GtkAllocation  child_allocation;
+  GtkAllocation child_clip;
   int sb_width;
   int sb_height;
 
@@ -3016,7 +3021,7 @@ gtk_scrolled_window_allocate_child (GtkScrolledWindow   *swindow,
       child_allocation.height = MAX (1, child_allocation.height - sb_height);
     }
 
-  gtk_widget_size_allocate (child, &child_allocation);
+  gtk_widget_size_allocate_with_baseline (child, &child_allocation, -1, &child_clip);
 }
 
 static void
diff --git a/gtk/gtkseparator.c b/gtk/gtkseparator.c
index 5306b8e..ebb2f50 100644
--- a/gtk/gtkseparator.c
+++ b/gtk/gtkseparator.c
@@ -124,20 +124,11 @@ gtk_separator_init (GtkSeparator *separator)
 }
 
 static void
-gtk_separator_size_allocate (GtkWidget     *widget,
-                             GtkAllocation *allocation)
-{
-  gtk_widget_set_clip (widget, allocation);
-}
-
-static void
 gtk_separator_class_init (GtkSeparatorClass *class)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (class);
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
 
-  widget_class->size_allocate = gtk_separator_size_allocate;
-
   object_class->set_property = gtk_separator_set_property;
   object_class->get_property = gtk_separator_get_property;
 
diff --git a/gtk/gtkseparatortoolitem.c b/gtk/gtkseparatortoolitem.c
index 4893ab8..3cd9f2c 100644
--- a/gtk/gtkseparatortoolitem.c
+++ b/gtk/gtkseparatortoolitem.c
@@ -68,8 +68,6 @@ static void     gtk_separator_tool_item_get_property      (GObject
                                                            guint                      prop_id,
                                                            GValue                    *value,
                                                            GParamSpec                *pspec);
-static void     gtk_separator_tool_item_size_allocate     (GtkWidget                 *widget,
-                                                           GtkAllocation             *allocation);
 static void     gtk_separator_tool_item_add               (GtkContainer              *container,
                                                            GtkWidget                 *child);
 
@@ -91,8 +89,6 @@ gtk_separator_tool_item_class_init (GtkSeparatorToolItemClass *class)
   object_class->set_property = gtk_separator_tool_item_set_property;
   object_class->get_property = gtk_separator_tool_item_get_property;
 
-  widget_class->size_allocate = gtk_separator_tool_item_size_allocate;
-
   toolitem_class->create_menu_proxy = gtk_separator_tool_item_create_menu_proxy;
   
   container_class->add = gtk_separator_tool_item_add;
@@ -178,13 +174,6 @@ gtk_separator_tool_item_get_property (GObject      *object,
     }
 }
 
-static void
-gtk_separator_tool_item_size_allocate (GtkWidget     *widget,
-                                       GtkAllocation *allocation)
-{
-  gtk_widget_set_clip (widget, allocation);
-}
-
 /**
  * gtk_separator_tool_item_new:
  * 
diff --git a/gtk/gtkshortcutsshortcut.c b/gtk/gtkshortcutsshortcut.c
index 6815c0d..ca1eb65 100644
--- a/gtk/gtkshortcutsshortcut.c
+++ b/gtk/gtkshortcutsshortcut.c
@@ -517,9 +517,11 @@ gtk_shortcuts_shortcut_snapshot (GtkWidget   *widget,
 
 static void
 gtk_shortcuts_shortcut_size_allocate (GtkWidget     *widget,
-                                      GtkAllocation *allocation)
+                                      GtkAllocation *allocation,
+                                      int            baseline,
+                                      GtkAllocation *out_clip)
 {
-  GTK_WIDGET_CLASS (gtk_shortcuts_shortcut_parent_class)->size_allocate (widget, allocation);
+  GTK_WIDGET_CLASS (gtk_shortcuts_shortcut_parent_class)->size_allocate (widget, allocation, baseline, 
out_clip);
 
   gtk_widget_size_allocate (GTK_WIDGET (GTK_SHORTCUTS_SHORTCUT (widget)->box), allocation);
 }
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index d1eaef2..36a600e 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -254,7 +254,9 @@ static void gtk_spin_button_measure (GtkWidget      *widget,
                                      int            *minimum_baseline,
                                      int            *natural_baseline);
 static void gtk_spin_button_size_allocate  (GtkWidget          *widget,
-                                            GtkAllocation      *allocation);
+                                            GtkAllocation      *allocation,
+                                            int                 baseline,
+                                            GtkAllocation      *out_clip);
 static gint gtk_spin_button_focus_out      (GtkWidget          *widget,
                                             GdkEventFocus      *event);
 static void gtk_spin_button_grab_notify    (GtkWidget          *widget,
@@ -1056,16 +1058,13 @@ gtk_spin_button_measure (GtkWidget      *widget,
 
 static void
 gtk_spin_button_size_allocate (GtkWidget     *widget,
-                               GtkAllocation *allocation)
+                               GtkAllocation *allocation,
+                               int            baseline,
+                               GtkAllocation *out_clip)
 {
   GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (GTK_SPIN_BUTTON (widget));
-  GtkAllocation clip = *allocation;
 
-  gtk_widget_size_allocate_with_baseline (priv->box, allocation,
-                                          gtk_widget_get_allocated_baseline (widget));
-  gtk_widget_get_clip (priv->box, &clip);
-
-  gtk_widget_set_clip (widget, &clip);
+  gtk_widget_size_allocate_with_baseline (priv->box, allocation, baseline, out_clip);
 }
 
 static gint
diff --git a/gtk/gtkspinner.c b/gtk/gtkspinner.c
index 12c98aa..3b4fc7d 100644
--- a/gtk/gtkspinner.c
+++ b/gtk/gtkspinner.c
@@ -104,13 +104,6 @@ gtk_spinner_measure (GtkWidget      *widget,
 }
 
 static void
-gtk_spinner_size_allocate (GtkWidget     *widget,
-                           GtkAllocation *allocation)
-{
-  gtk_widget_set_clip (widget, allocation);
-}
-
-static void
 gtk_spinner_snapshot (GtkWidget   *widget,
                       GtkSnapshot *snapshot)
 {
@@ -195,7 +188,6 @@ gtk_spinner_class_init (GtkSpinnerClass *klass)
   gobject_class->set_property = gtk_spinner_set_property;
 
   widget_class = GTK_WIDGET_CLASS(klass);
-  widget_class->size_allocate = gtk_spinner_size_allocate;
   widget_class->snapshot = gtk_spinner_snapshot;
   widget_class->measure = gtk_spinner_measure;
 
diff --git a/gtk/gtkstack.c b/gtk/gtkstack.c
index b1d515a..73b1d84 100644
--- a/gtk/gtkstack.c
+++ b/gtk/gtkstack.c
@@ -169,7 +169,9 @@ static void     gtk_stack_compute_expand                 (GtkWidget     *widget,
                                                           gboolean      *hexpand,
                                                           gboolean      *vexpand);
 static void     gtk_stack_size_allocate                  (GtkWidget     *widget,
-                                                          GtkAllocation *allocation);
+                                                          GtkAllocation *allocation,
+                                                          int            baseline,
+                                                          GtkAllocation *out_clip);
 static void     gtk_stack_snapshot                       (GtkWidget     *widget,
                                                           GtkSnapshot   *snapshot);
 static void     gtk_stack_measure                        (GtkWidget      *widget,
@@ -2028,11 +2030,12 @@ gtk_stack_snapshot (GtkWidget   *widget,
 
 static void
 gtk_stack_size_allocate (GtkWidget     *widget,
-                         GtkAllocation *allocation)
+                         GtkAllocation *allocation,
+                         int            baseline,
+                         GtkAllocation *out_clip)
 {
   GtkStack *stack = GTK_STACK (widget);
   GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
-  GtkAllocation clip = *allocation;
   GdkRectangle child_clip;
   GtkAllocation child_allocation;
 
@@ -2052,10 +2055,10 @@ gtk_stack_size_allocate (GtkWidget     *widget,
                           &min, &nat, NULL, NULL);
       child_allocation.height = MAX (min, allocation->height);
 
-      gtk_widget_size_allocate (priv->last_visible_child->widget, &child_allocation);
-      gtk_widget_get_clip (priv->last_visible_child->widget, &child_clip);
-      gdk_rectangle_union (&clip, &child_clip, &clip);
-
+      gtk_widget_size_allocate_with_baseline (priv->last_visible_child->widget,
+                                              &child_allocation,
+                                              -1, &child_clip);
+      gdk_rectangle_union (out_clip, &child_clip, out_clip);
 
       if (!gdk_rectangle_equal (&priv->last_visible_surface_allocation,
                                 &child_allocation))
@@ -2100,12 +2103,11 @@ gtk_stack_size_allocate (GtkWidget     *widget,
             child_allocation.x = (allocation->height - child_allocation.height);
         }
 
-      gtk_widget_size_allocate (priv->visible_child->widget, &child_allocation);
-      gtk_widget_get_clip (priv->visible_child->widget, &child_clip);
-      gdk_rectangle_union (&clip, &child_clip, &clip);
+      gtk_widget_size_allocate_with_baseline (priv->visible_child->widget,
+                                              &child_allocation,
+                                              -1, &child_clip);
+      gdk_rectangle_union (out_clip, &child_clip, out_clip);
     }
-
-  gtk_widget_set_clip (widget, &clip);
 }
 
 #define LERP(a, b, t) ((a) + (((b) - (a)) * (1.0 - (t))))
diff --git a/gtk/gtkswitch.c b/gtk/gtkswitch.c
index bddd46f..2a0a174 100644
--- a/gtk/gtkswitch.c
+++ b/gtk/gtkswitch.c
@@ -324,11 +324,12 @@ gtk_switch_measure (GtkWidget      *widget,
 
 static void
 gtk_switch_size_allocate (GtkWidget     *widget,
-                          GtkAllocation *allocation)
+                          GtkAllocation *allocation,
+                          int            baseline,
+                          GtkAllocation *out_clip)
 {
   GtkSwitch *self = GTK_SWITCH (widget);
   GtkSwitchPrivate *priv = gtk_switch_get_instance_private (self);
-  GtkAllocation clip = *allocation;
   GtkAllocation child_clip;
   GtkAllocation child_alloc;
   GtkAllocation slider_alloc;
@@ -339,9 +340,9 @@ gtk_switch_size_allocate (GtkWidget     *widget,
   slider_alloc.width = allocation->width / 2;
   slider_alloc.height = allocation->height;
 
-  gtk_widget_size_allocate (priv->slider, &slider_alloc);
+  gtk_widget_size_allocate_with_baseline (priv->slider, &slider_alloc, -1, &child_clip);
   gtk_widget_get_clip (priv->slider, &child_clip);
-  gdk_rectangle_union (&child_clip, &clip, &clip);
+  gdk_rectangle_union (out_clip, &child_clip, out_clip);
 
 
   /* Center ON label in left half */
@@ -351,9 +352,8 @@ gtk_switch_size_allocate (GtkWidget     *widget,
   gtk_widget_measure (priv->on_label, GTK_ORIENTATION_VERTICAL, min, &min, NULL, NULL, NULL);
   child_alloc.y = (allocation->height - min) / 2;
   child_alloc.height = min;
-  gtk_widget_size_allocate (priv->on_label, &child_alloc);
-  gtk_widget_get_clip (priv->on_label, &child_clip);
-  gdk_rectangle_union (&child_clip, &clip, &clip);
+  gtk_widget_size_allocate_with_baseline (priv->on_label, &child_alloc, -1, &child_clip);
+  gdk_rectangle_union (out_clip, &child_clip, out_clip);
 
   /* Center OFF label in right half */
   gtk_widget_measure (priv->off_label, GTK_ORIENTATION_HORIZONTAL, -1, &min, NULL, NULL, NULL);
@@ -362,11 +362,8 @@ gtk_switch_size_allocate (GtkWidget     *widget,
   gtk_widget_measure (priv->off_label, GTK_ORIENTATION_VERTICAL, min, &min, NULL, NULL, NULL);
   child_alloc.y = (allocation->height - min) / 2;
   child_alloc.height = min;
-  gtk_widget_size_allocate (priv->off_label, &child_alloc);
-  gtk_widget_get_clip (priv->off_label, &child_clip);
-  gdk_rectangle_union (&child_clip, &clip, &clip);
-
-  gtk_widget_set_clip (widget, &clip);
+  gtk_widget_size_allocate_with_baseline (priv->off_label, &child_alloc, -1, &child_clip);
+  gdk_rectangle_union (out_clip, &child_clip, out_clip);
 }
 
 static void
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index edd39ac..b41d4ea 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -387,7 +387,9 @@ static void gtk_text_view_measure (GtkWidget      *widget,
                                    int            *minimum_baseline,
                                    int            *natural_baseline);
 static void gtk_text_view_size_allocate        (GtkWidget        *widget,
-                                                GtkAllocation    *allocation);
+                                                GtkAllocation    *allocation,
+                                                int               baseline,
+                                                GtkAllocation    *out_clip);
 static void gtk_text_view_realize              (GtkWidget        *widget);
 static void gtk_text_view_unrealize            (GtkWidget        *widget);
 static void gtk_text_view_map                  (GtkWidget        *widget);
@@ -4179,7 +4181,9 @@ gtk_text_view_allocate_children (GtkTextView *text_view)
 
 static void
 gtk_text_view_size_allocate (GtkWidget *widget,
-                             GtkAllocation *allocation)
+                             GtkAllocation *allocation,
+                             int            baseline,
+                             GtkAllocation *out_clip)
 {
   GtkTextView *text_view;
   GtkTextViewPrivate *priv;
@@ -4294,8 +4298,6 @@ gtk_text_view_size_allocate (GtkWidget *widget,
    * chance to run. So we do the work here. 
    */
   gtk_text_view_flush_first_validate (text_view);
-
-  gtk_widget_set_clip (widget, allocation);
 }
 
 static void
diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c
index f8fa09d..ecff35e 100644
--- a/gtk/gtktoolbar.c
+++ b/gtk/gtktoolbar.c
@@ -194,7 +194,9 @@ static void       gtk_toolbar_get_property         (GObject             *object,
 static void       gtk_toolbar_snapshot             (GtkWidget           *widget,
                                                     GtkSnapshot         *snapshot);
 static void       gtk_toolbar_size_allocate        (GtkWidget           *widget,
-                                                   GtkAllocation       *allocation);
+                                                    GtkAllocation       *allocation,
+                                                    int                  baseline,
+                                                    GtkAllocation       *out_clip);
 static void       gtk_toolbar_style_updated        (GtkWidget           *widget);
 static gboolean   gtk_toolbar_focus                (GtkWidget           *widget,
                                                    GtkDirectionType     dir);
@@ -1264,7 +1266,9 @@ rebuild_menu (GtkToolbar *toolbar)
 
 static void
 gtk_toolbar_size_allocate (GtkWidget     *widget,
-                           GtkAllocation *allocation)
+                           GtkAllocation *allocation,
+                           int            baseline,
+                           GtkAllocation *out_clip)
 {
   GtkToolbar *toolbar = GTK_TOOLBAR (widget);
   GtkToolbarPrivate *priv = toolbar->priv;
@@ -1585,8 +1589,6 @@ gtk_toolbar_size_allocate (GtkWidget     *widget,
 
   g_free (allocations);
   g_free (new_states);
-
-  gtk_widget_set_clip (widget, allocation);
 }
 
 static void
diff --git a/gtk/gtktoolitemgroup.c b/gtk/gtktoolitemgroup.c
index e9375f2..2e0f992 100644
--- a/gtk/gtktoolitemgroup.c
+++ b/gtk/gtktoolitemgroup.c
@@ -880,7 +880,9 @@ gtk_tool_item_group_real_size_query (GtkWidget      *widget,
 
 static void
 gtk_tool_item_group_real_size_allocate (GtkWidget     *widget,
-                                        GtkAllocation *allocation)
+                                        GtkAllocation *allocation,
+                                        int            baseline,
+                                        GtkAllocation *out_clip)
 {
   GtkToolItemGroup *group = GTK_TOOL_ITEM_GROUP (widget);
   GtkToolItemGroupPrivate* priv = group->priv;
@@ -903,7 +905,8 @@ gtk_tool_item_group_real_size_allocate (GtkWidget     *widget,
   orientation = gtk_tool_shell_get_orientation (GTK_TOOL_SHELL (group));
 
   /* chain up */
-  GTK_WIDGET_CLASS (gtk_tool_item_group_parent_class)->size_allocate (widget, allocation);
+  GTK_WIDGET_CLASS (gtk_tool_item_group_parent_class)->size_allocate (widget, allocation,
+                                                                      baseline, out_clip);
 
   child_allocation.x = 0;
   child_allocation.y = 0;
@@ -1055,7 +1058,8 @@ gtk_tool_item_group_real_size_allocate (GtkWidget     *widget,
 
           child_allocation.height = item_size.height;
 
-          gtk_widget_size_allocate (GTK_WIDGET (child->item), &child_allocation);
+          gtk_widget_size_allocate_with_baseline (GTK_WIDGET (child->item),
+                                                  &child_allocation, -1, out_clip);
           gtk_widget_set_child_visible (GTK_WIDGET (child->item), TRUE);
         }
 
@@ -1077,11 +1081,11 @@ gtk_tool_item_group_real_size_allocate (GtkWidget     *widget,
 
 static void
 gtk_tool_item_group_size_allocate (GtkWidget     *widget,
-                                   GtkAllocation *allocation)
+                                   GtkAllocation *allocation,
+                                   int            baseline,
+                                   GtkAllocation *out_clip)
 {
-  gtk_tool_item_group_real_size_allocate (widget, allocation);
-
-  gtk_widget_queue_draw (widget);
+  gtk_tool_item_group_real_size_allocate (widget, allocation, baseline, out_clip);
 }
 
 static void
diff --git a/gtk/gtktoolpalette.c b/gtk/gtktoolpalette.c
index 90e0699..e20ec2b 100644
--- a/gtk/gtktoolpalette.c
+++ b/gtk/gtktoolpalette.c
@@ -473,7 +473,9 @@ gtk_tool_palette_measure (GtkWidget      *widget,
 
 static void
 gtk_tool_palette_size_allocate (GtkWidget     *widget,
-                                GtkAllocation *allocation)
+                                GtkAllocation *allocation,
+                                int            baseline,
+                                GtkAllocation *out_clip)
 {
   GtkToolPalette *palette = GTK_TOOL_PALETTE (widget);
   GtkAdjustment *adjustment = NULL;
@@ -496,7 +498,8 @@ gtk_tool_palette_size_allocate (GtkWidget     *widget,
 
   direction = gtk_widget_get_direction (widget);
 
-  GTK_WIDGET_CLASS (gtk_tool_palette_parent_class)->size_allocate (widget, allocation);
+  GTK_WIDGET_CLASS (gtk_tool_palette_parent_class)->size_allocate (widget, allocation,
+                                                                   baseline, out_clip);
 
   if (GTK_ORIENTATION_VERTICAL == palette->priv->orientation)
     {
@@ -702,10 +705,11 @@ gtk_tool_palette_adjustment_value_changed (GtkAdjustment *adjustment,
                                            gpointer       data)
 {
   GtkAllocation allocation;
+  GtkAllocation clip;
   GtkWidget *widget = GTK_WIDGET (data);
 
   gtk_widget_get_allocation (widget, &allocation);
-  gtk_tool_palette_size_allocate (widget, &allocation);
+  gtk_tool_palette_size_allocate (widget, &allocation, -1, &clip);
 }
 
 static void
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index b48d706..d6bf0bf 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -593,7 +593,9 @@ static void     gtk_tree_view_measure              (GtkWidget        *widget,
                                                     int            *minimum_baseline,
                                                     int            *natural_baseline);
 static void     gtk_tree_view_size_allocate        (GtkWidget        *widget,
-                                                   GtkAllocation    *allocation);
+                                                    GtkAllocation    *allocation,
+                                                    int               baseline,
+                                                    GtkAllocation    *out_clip);
 static void     gtk_tree_view_snapshot             (GtkWidget        *widget,
                                                     GtkSnapshot      *snapshot);
 static gboolean gtk_tree_view_key_press            (GtkWidget        *widget,
@@ -2569,7 +2571,9 @@ gtk_tree_view_size_allocate_drag_column (GtkWidget *widget)
 
 static void
 gtk_tree_view_size_allocate (GtkWidget     *widget,
-                            GtkAllocation *allocation)
+                             GtkAllocation *allocation,
+                             int            baseline,
+                             GtkAllocation *out_clip)
 {
   GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
   GList *tmp_list;
@@ -2745,8 +2749,6 @@ gtk_tree_view_size_allocate (GtkWidget     *widget,
       gtk_tree_path_free (path);
       gtk_widget_size_allocate (child->widget, &child_rect);
     }
-
-  gtk_widget_set_clip (widget, allocation);
 }
 
 /* Grabs the focus and unsets the GTK_TREE_VIEW_DRAW_KEYFOCUS flag */
diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c
index e633844..b456c68 100644
--- a/gtk/gtkviewport.c
+++ b/gtk/gtkviewport.c
@@ -99,7 +99,9 @@ static void gtk_viewport_destroy                  (GtkWidget        *widget);
 static void gtk_viewport_snapshot                 (GtkWidget        *widget,
                                                   GtkSnapshot      *snapshot);
 static void gtk_viewport_size_allocate            (GtkWidget        *widget,
-                                                  GtkAllocation    *allocation);
+                                                   GtkAllocation    *allocation,
+                                                   int               baseline,
+                                                   GtkAllocation    *out_clip);
 static void gtk_viewport_adjustment_value_changed (GtkAdjustment    *adjustment,
                                                   gpointer          data);
 static void viewport_set_adjustment               (GtkViewport      *viewport,
@@ -504,11 +506,12 @@ gtk_viewport_snapshot (GtkWidget   *widget,
 
 static void
 gtk_viewport_size_allocate (GtkWidget     *widget,
-                            GtkAllocation *allocation)
+                            GtkAllocation *allocation,
+                            int            baseline,
+                            GtkAllocation *out_clip)
 {
   GtkViewport *viewport = GTK_VIEWPORT (widget);
   GtkViewportPrivate *priv = viewport->priv;
-  GtkAllocation clip = *allocation;
   GtkAdjustment *hadjustment = priv->hadjustment;
   GtkAdjustment *vadjustment = priv->vadjustment;
   GtkWidget *child;
@@ -530,13 +533,10 @@ gtk_viewport_size_allocate (GtkWidget     *widget,
       child_allocation.height = gtk_adjustment_get_upper (vadjustment);
 
       gtk_widget_size_allocate (child, &child_allocation);
-      gtk_widget_get_clip (child, &clip);
     }
 
   g_object_thaw_notify (G_OBJECT (hadjustment));
   g_object_thaw_notify (G_OBJECT (vadjustment));
-
-  gtk_widget_set_clip (widget, &clip);
 }
 
 static void
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index dcf3871..10e9ba6 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -619,8 +619,10 @@ static void        gtk_widget_real_map              (GtkWidget         *widget);
 static void    gtk_widget_real_unmap            (GtkWidget         *widget);
 static void    gtk_widget_real_realize          (GtkWidget         *widget);
 static void    gtk_widget_real_unrealize        (GtkWidget         *widget);
-static void    gtk_widget_real_size_allocate    (GtkWidget         *widget,
-                                                  GtkAllocation            *allocation);
+static void    gtk_widget_real_size_allocate    (GtkWidget         *widget,
+                                                  GtkAllocation     *allocation,
+                                                  int                baseline,
+                                                  GtkAllocation     *out_clip);
 static void    gtk_widget_real_direction_changed(GtkWidget         *widget,
                                                   GtkTextDirection   previous_direction);
 
@@ -1646,6 +1648,8 @@ gtk_widget_class_init (GtkWidgetClass *klass)
    * @widget: the object which received the signal.
    * @allocation: (type Gtk.Allocation): the region which has been
    *   allocated to the widget.
+   * @baseline: the baseline
+   * @out_clip: (type Gtk.Allocation): Return address for the widget's clip
    */
   widget_signals[SIZE_ALLOCATE] =
     g_signal_new (I_("size-allocate"),
@@ -1654,8 +1658,10 @@ gtk_widget_class_init (GtkWidgetClass *klass)
                  G_STRUCT_OFFSET (GtkWidgetClass, size_allocate),
                  NULL, NULL,
                  NULL,
-                 G_TYPE_NONE, 1,
-                 GDK_TYPE_RECTANGLE | G_SIGNAL_TYPE_STATIC_SCOPE);
+                 G_TYPE_NONE, 3,
+                 GDK_TYPE_RECTANGLE | G_SIGNAL_TYPE_STATIC_SCOPE,
+                  G_TYPE_INT,
+                  GDK_TYPE_RECTANGLE | G_SIGNAL_TYPE_STATIC_SCOPE);
 
   /**
    * GtkWidget::state-flags-changed:
@@ -5293,7 +5299,6 @@ gtk_widget_queue_draw_region (GtkWidget            *widget,
 {
   GtkWidget *parent;
   cairo_region_t *region2;
-  GtkAllocation alloc;
   int x, y;
   GtkCssStyle *parent_style;
   GtkBorder border, padding;
@@ -5324,7 +5329,6 @@ gtk_widget_queue_draw_region (GtkWidget            *widget,
   g_assert (parent != NULL);
 
   /* @region's coordinates are originally relative to @widget's origin */
-  gtk_widget_get_allocation (widget, &alloc);
   if (widget != parent)
     gtk_widget_translate_coordinates (_gtk_widget_get_parent (widget),
                                       parent,
@@ -5378,8 +5382,9 @@ invalidate:
  **/
 void
 gtk_widget_size_allocate_with_baseline (GtkWidget     *widget,
-                                       GtkAllocation *allocation,
-                                       gint           baseline)
+                                        GtkAllocation *allocation,
+                                        int            baseline,
+                                        GtkAllocation *out_clip)
 {
   GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
   GdkRectangle real_allocation;
@@ -5393,14 +5398,19 @@ gtk_widget_size_allocate_with_baseline (GtkWidget     *widget,
   gint min_width, min_height;
   GtkCssStyle *style;
   GtkBorder margin, border, padding;
+  GtkAllocation new_clip;
 
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
-  if (!priv->visible && !_gtk_widget_is_toplevel (widget))
-    return;
 
   gtk_widget_push_verify_invariants (widget);
 
+  if (!priv->visible && !_gtk_widget_is_toplevel (widget))
+    {
+      memset (out_clip, 0, sizeof (GdkRectangle));
+      goto out;
+    }
+
 #ifdef G_ENABLE_DEBUG
   if (GTK_DISPLAY_DEBUG_CHECK (gtk_widget_get_display (widget), RESIZE))
     {
@@ -5424,10 +5434,10 @@ gtk_widget_size_allocate_with_baseline (GtkWidget     *widget,
       depth = 0;
       parent = widget;
       while (parent)
-       {
-         depth++;
-         parent = _gtk_widget_get_parent (parent);
-       }
+        {
+          depth++;
+          parent = _gtk_widget_get_parent (parent);
+        }
 
       name = g_type_name (G_OBJECT_TYPE (G_OBJECT (widget)));
       g_message ("gtk_widget_size_allocate: %*s%s %d %d %d %d, baseline %d",
@@ -5542,11 +5552,27 @@ gtk_widget_size_allocate_with_baseline (GtkWidget     *widget,
 
   /* Set the widget allocation to real_allocation now, pass the smaller allocation to the vfunc */
   priv->allocation = real_allocation;
-  priv->clip = real_allocation;
   priv->allocated_baseline = baseline;
 
   if (!alloc_needed && !size_changed && !baseline_changed)
-    goto out;
+    {
+      gtk_widget_set_clip (widget, &priv->reported_clip);
+      *out_clip = priv->clip;
+
+      /* Still have to move the window... */
+      if (_gtk_widget_get_realized (widget) &&
+          _gtk_widget_get_has_window (widget))
+         {
+           GtkAllocation window_alloc;
+
+           gtk_widget_get_window_allocation (widget, &window_alloc);
+           gdk_window_move_resize (priv->window,
+                                   window_alloc.x, window_alloc.y,
+                                   window_alloc.width, window_alloc.height);
+         }
+
+      goto check_clip;
+    }
 
   /* Since gtk_widget_measure does it for us, we can be sure here that
    * the given alloaction is large enough for the css margin/bordder/padding */
@@ -5556,11 +5582,18 @@ gtk_widget_size_allocate_with_baseline (GtkWidget     *widget,
                            margin.right + border.right + padding.right;
   real_allocation.height -= margin.top + border.top + padding.top +
                             margin.bottom + border.bottom + padding.bottom;
+  new_clip = real_allocation;
 
   if (g_signal_has_handler_pending (widget, widget_signals[SIZE_ALLOCATE], 0, FALSE))
-    g_signal_emit (widget, widget_signals[SIZE_ALLOCATE], 0, &real_allocation);
+    g_signal_emit (widget, widget_signals[SIZE_ALLOCATE], 0,
+                   &real_allocation,
+                   baseline,
+                   &new_clip);
   else
-    GTK_WIDGET_GET_CLASS (widget)->size_allocate (widget, &real_allocation);
+    GTK_WIDGET_GET_CLASS (widget)->size_allocate (widget,
+                                                  &real_allocation,
+                                                  baseline,
+                                                  &new_clip);
 
   /* Size allocation is god... after consulting god, no further requests or allocations are needed */
 #ifdef G_ENABLE_DEBUG
@@ -5570,10 +5603,16 @@ gtk_widget_size_allocate_with_baseline (GtkWidget     *widget,
                  gtk_widget_get_name (widget), widget);
     }
 #endif
+
+  priv->reported_clip = new_clip;
+  gtk_widget_set_clip (widget, &priv->reported_clip);
+  *out_clip = priv->clip;
+
   gtk_widget_ensure_resize (widget);
   priv->alloc_needed = FALSE;
   priv->alloc_needed_on_child = FALSE;
 
+check_clip:
   size_changed |= (old_clip.width != priv->clip.width ||
                    old_clip.height != priv->clip.height);
   position_changed |= (old_clip.x != priv->clip.x ||
@@ -5633,7 +5672,9 @@ void
 gtk_widget_size_allocate (GtkWidget    *widget,
                          GtkAllocation *allocation)
 {
-  gtk_widget_size_allocate_with_baseline (widget, allocation, -1);
+  GdkRectangle content_clip = {0};
+
+  gtk_widget_size_allocate_with_baseline (widget, allocation, -1, &content_clip);
 }
 
 /**
@@ -5769,16 +5810,21 @@ gtk_widget_translate_coordinates (GtkWidget  *src_widget,
 
 static void
 gtk_widget_real_size_allocate (GtkWidget     *widget,
-                              GtkAllocation *allocation)
+                               GtkAllocation *allocation,
+                               int            baseline,
+                               GtkAllocation *out_clip)
 {
-  GtkWidgetPrivate *priv = widget->priv;
+  GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
 
   if (_gtk_widget_get_realized (widget) &&
       _gtk_widget_get_has_window (widget))
      {
-       gdk_window_move_resize (priv->window,
-                               allocation->x, allocation->y,
-                               allocation->width, allocation->height);
+       GtkAllocation window_alloc;
+
+       gtk_widget_get_window_allocation (widget, &window_alloc);
+       gdk_window_move_resize (priv->window,
+                               window_alloc.x, window_alloc.y,
+                               window_alloc.width, window_alloc.height);
      }
 }
 
@@ -13127,70 +13173,63 @@ gtk_widget_set_clip (GtkWidget           *widget,
 {
   GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
   GtkBorder shadow;
-  GtkAllocation allocation;
-  GtkBorder margin, border, padding;
+  GtkBorder margin;
   GtkCssStyle *style;
   GdkRectangle new_clip;
+  GtkAllocation allocation;
 
   g_return_if_fail (GTK_IS_WIDGET (widget));
   g_return_if_fail (_gtk_widget_get_visible (widget) || _gtk_widget_is_toplevel (widget));
   g_return_if_fail (clip != NULL);
 
+  style = gtk_css_node_get_style (priv->cssnode);
+  get_box_margin (style, &margin);
+  _gtk_css_shadows_value_get_extents (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BOX_SHADOW), &shadow);
+
+  /* The given clip is in @widget's coordinates, but we need it to be in the parent's coordinates,
+   * just like priv->allocation is. So first we transform the clip, then union it with
+   * the allocation (minus css margins) and then we add the box shadow size. */
+  new_clip = *clip;
+  new_clip.x += priv->allocation.x + margin.left;
+  new_clip.y += priv->allocation.y + margin.top;
+
+  allocation = priv->allocation;
+  allocation.x += margin.left;
+  allocation.y += margin.top;
+  allocation.width -= margin.left + margin.right;
+  allocation.height -= margin.top + margin.bottom;
+
+  gdk_rectangle_union (&allocation, &new_clip, &priv->clip);
+  priv->clip.x -= shadow.left;
+  priv->clip.y -= shadow.top;
+  priv->clip.width += shadow.left + shadow.right;
+  priv->clip.height += shadow.top + shadow.bottom;
+
 #ifdef G_ENABLE_DEBUG
   if (GTK_DEBUG_CHECK (GEOMETRY))
     {
       gint depth;
       GtkWidget *parent;
       const gchar *name;
+      const char *cssname;
 
       depth = 0;
       parent = widget;
       while (parent)
-       {
-         depth++;
-         parent = _gtk_widget_get_parent (parent);
-       }
+        {
+          depth++;
+          parent = _gtk_widget_get_parent (parent);
+        }
 
       name = g_type_name (G_OBJECT_TYPE (G_OBJECT (widget)));
-      g_message ("gtk_widget_set_clip:      %*s%s %d %d %d %d",
-                2 * depth, " ", name,
-                clip->x, clip->y,
-                clip->width, clip->height);
+      cssname = gtk_css_node_get_name (priv->cssnode);
+      g_message ("gtk_widget_set_clip:      %s %s %d %d %d %d",
+                 name,
+                 cssname,
+                 priv->clip.x, priv->clip.y,
+                 priv->clip.width, priv->clip.height);
     }
 #endif /* G_ENABLE_DEBUG */
-
-
-  /* The given clip is relative to the widget's origin, but we union
-   * it with priv->allocation, which is the orgin minus CSS padding, border and margin.
-   * Additionally, the box shadow is drawn around the widget's border box */
-
-  style = gtk_css_node_get_style (priv->cssnode);
-  allocation = priv->allocation;
-  get_box_margin (style, &margin);
-  get_box_margin (style, &border);
-  get_box_margin (style, &padding);
-  _gtk_css_shadows_value_get_extents (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BOX_SHADOW), &shadow);
-
-  /* Get border box from allocation */
-  allocation.x += margin.left;
-  allocation.y += margin.top;
-  allocation.width -= margin.left + margin.right;
-  allocation.height -= margin.top + margin.bottom;
-
-  /* Add box shadow size to border box */
-  allocation.x -= shadow.left;
-  allocation.y -= shadow.top;
-  allocation.width += shadow.left + shadow.right;
-  allocation.height += shadow.top + shadow.bottom;
-
-  /* Transform clip into coordinate space of priv->allocation */
-  new_clip = *clip;
-  new_clip.x += priv->allocation.x + border.left + padding.left;
-  new_clip.y += priv->allocation.y + border.top  + padding.top;
-  new_clip.width -= margin.left + margin.right;
-  new_clip.height -= margin.top + margin.bottom;
-
-  gdk_rectangle_union (&allocation, &new_clip, &priv->clip);
 }
 
 /**
@@ -13887,10 +13926,11 @@ gtk_widget_ensure_allocate (GtkWidget *widget)
   if (priv->alloc_needed)
     {
       GtkAllocation allocation;
+      GtkAllocation clip;
       int baseline;
 
       gtk_widget_get_allocated_size (widget, &allocation, &baseline);
-      gtk_widget_size_allocate_with_baseline (widget, &allocation, baseline);
+      gtk_widget_size_allocate_with_baseline (widget, &allocation, baseline, &clip);
     }
   else if (priv->alloc_needed_on_child)
     {
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index 536a19c..e2c1092 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -303,7 +303,9 @@ struct _GtkWidgetClass
   void (* realize)            (GtkWidget        *widget);
   void (* unrealize)          (GtkWidget        *widget);
   void (* size_allocate)       (GtkWidget        *widget,
-                               GtkAllocation    *allocation);
+                                GtkAllocation    *allocation,
+                                int               baseline,
+                                GtkAllocation    *out_clip);
   void (* state_flags_changed) (GtkWidget        *widget,
                                GtkStateFlags     previous_state_flags);
   void (* parent_set)         (GtkWidget        *widget,
@@ -545,9 +547,10 @@ GDK_AVAILABLE_IN_ALL
 void      gtk_widget_size_allocate       (GtkWidget           *widget,
                                           GtkAllocation       *allocation);
 GDK_AVAILABLE_IN_3_10
-void      gtk_widget_size_allocate_with_baseline         (GtkWidget           *widget,
-                                                          GtkAllocation       *allocation,
-                                                          gint                 baseline);
+void       gtk_widget_size_allocate_with_baseline         (GtkWidget           *widget,
+                                                           GtkAllocation       *allocation,
+                                                           int                  baseline,
+                                                           GtkAllocation       *out_clip);
 
 GDK_AVAILABLE_IN_ALL
 GtkSizeRequestMode  gtk_widget_get_request_mode               (GtkWidget      *widget);
diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h
index 30b045a..86b020f 100644
--- a/gtk/gtkwidgetprivate.h
+++ b/gtk/gtkwidgetprivate.h
@@ -94,8 +94,6 @@ struct _GtkWidgetPrivate
   guint   halign              : 4;
   guint   valign              : 4;
 
-  guint clip_set : 1;
-
   guint8 alpha;
   guint8 user_alpha;
 
@@ -139,6 +137,7 @@ struct _GtkWidgetPrivate
   gint allocated_size_baseline;
   GtkAllocation allocation;
   GtkAllocation clip;
+  GtkAllocation reported_clip;
   gint allocated_baseline;
 
   /* The widget's requested sizes */
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index e804609..539b6a7 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -407,7 +407,9 @@ static void gtk_window_unmap              (GtkWidget         *widget);
 static void gtk_window_realize            (GtkWidget         *widget);
 static void gtk_window_unrealize          (GtkWidget         *widget);
 static void gtk_window_size_allocate      (GtkWidget         *widget,
-                                          GtkAllocation     *allocation);
+                                           GtkAllocation     *allocation,
+                                           int                baseline,
+                                           GtkAllocation     *out_clip);
 static gboolean gtk_window_map_event      (GtkWidget         *widget,
                                            GdkEventAny       *event);
 static gint gtk_window_configure_event    (GtkWidget         *widget,
@@ -7046,7 +7048,9 @@ _gtk_window_set_allocation (GtkWindow           *window,
 
 static void
 gtk_window_size_allocate (GtkWidget     *widget,
-                          GtkAllocation *allocation)
+                          GtkAllocation *allocation,
+                          int            baseline,
+                          GtkAllocation *out_clip)
 {
   GtkWindow *window = GTK_WINDOW (widget);
   GtkWidget *child;
@@ -7057,8 +7061,6 @@ gtk_window_size_allocate (GtkWidget     *widget,
   child = gtk_bin_get_child (GTK_BIN (window));
   if (child && gtk_widget_get_visible (child))
     gtk_widget_size_allocate (child, &child_allocation);
-
-  gtk_widget_set_clip (widget, allocation);
 }
 
 static gint
diff --git a/gtk/inspector/gtkstackcombo.c b/gtk/inspector/gtkstackcombo.c
index c0d5798..5502e96 100644
--- a/gtk/inspector/gtkstackcombo.c
+++ b/gtk/inspector/gtkstackcombo.c
@@ -250,15 +250,12 @@ gtk_stack_combo_snapshot (GtkWidget   *widget,
 
 static void
 gtk_stack_combo_size_allocate (GtkWidget     *widget,
-                               GtkAllocation *allocation)
+                               GtkAllocation *allocation,
+                               int            baseline,
+                               GtkAllocation *out_clip)
 {
   GtkStackCombo *self = GTK_STACK_COMBO (widget);
-  GtkAllocation clip = *allocation;
-
-  gtk_widget_size_allocate (GTK_WIDGET (self->combo), allocation);
-  gtk_widget_get_clip (GTK_WIDGET (self->combo), &clip);
-
-  gtk_widget_set_clip (widget, &clip);
+  gtk_widget_size_allocate_with_baseline (GTK_WIDGET (self->combo), allocation, baseline, out_clip);
 }
 
 static void
diff --git a/tests/testwidgetfocus.c b/tests/testwidgetfocus.c
index 780f652..da9df68 100644
--- a/tests/testwidgetfocus.c
+++ b/tests/testwidgetfocus.c
@@ -84,7 +84,10 @@ GType gtk_focus_widget_get_type (void) G_GNUC_CONST;
 G_DEFINE_TYPE(GtkFocusWidget, gtk_focus_widget, GTK_TYPE_WIDGET)
 
 static void
-gtk_focus_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
+gtk_focus_widget_size_allocate (GtkWidget     *widget,
+                                GtkAllocation *allocation,
+                                int            baseline,
+                                GtkAllocation *out_clip)
 {
   GtkFocusWidget *self = GTK_FOCUS_WIDGET (widget);
   int child_width  = (allocation->width)  / 2;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]