+ if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
+ {
+ cell_alloc.x = cell_area->x + cell->position;
+ cell_alloc.width = cell->size;
+ }
+ else
+ {
+ cell_alloc.y = cell_area->y + cell->position;
+ cell_alloc.height = cell->size;
+ }
+
+ /* Stop iterating over cells if they flow out of the render
+ * area, this can happen because the render area can actually
+ * be smaller than the requested area (treeview columns can
+ * be user resizable and can be resized to be smaller than
+ * the actual requested area).
+ */
+ if (cell_alloc.x > cell_area->x + cell_area->width ||
+ cell_alloc.x + cell_alloc.width < cell_area->x ||
+ cell_alloc.y > cell_area->y + cell_area->height)
+ break;
+
+ /* Special case for the last cell (or first cell in rtl)...
+ * let the last cell consume the remaining space in the area
+ * (the last cell is allowed to consume the remaining space if
+ * the space given for rendering is actually larger than allocation,
+ * this can happen in the expander GtkTreeViewColumn where only the
+ * deepest depth column receives the allocation... shallow columns
+ * receive more width). */
+ if (!l->next)
+ {
+ if (rtl)
+ {
+ /* Fill the leading space for the first cell in the area
+ * (still last in the list)
+ */
+ cell_alloc.width = (cell_alloc.x - cell_area->x) + cell_alloc.width;
+ cell_alloc.x = cell_area->x;
+ }
+ else
+ {
+ cell_alloc.width = cell_area->x + cell_area->width - cell_alloc.x;
+ cell_alloc.height = cell_area->y + cell_area->height - cell_alloc.y;
+ }
+ }
+ else
+ {
+ /* If the cell we are rendering doesnt fit into the remaining space,
+ * clip it so that the underlying renderer has a chance to deal with
+ * it (for instance text renderers get a chance to ellipsize).
+ */
+ if (cell_alloc.x + cell_alloc.width > cell_area->x + cell_area->width)
+ cell_alloc.width = cell_area->x + cell_area->width - cell_alloc.x;
+
+ if (cell_alloc.y + cell_alloc.height > cell_area->y + cell_area->height)
+ cell_alloc.height = cell_area->y + cell_area->height - cell_alloc.y;
+ }
+
+ /* Add portions of the background_area to the cell_alloc
+ * to create the cell_background
+ */
+ cell_background = cell_alloc;