b82271798ad261f8067e0999ed3f8530c387aa2f
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index 71de7d7..93cec35 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -2007,6 +2007,21 @@ gtk_menu_style_set (GtkWidget *widget,
 }
 
 static void
+get_arrows_border (GtkMenu *menu, GtkBorder *border)
+{
+  guint scroll_arrow_height;
+
+  gtk_widget_style_get (GTK_WIDGET (menu),
+			"scroll-arrow-vlength", &scroll_arrow_height,
+			NULL);
+
+  border->top = menu->upper_arrow_visible ? scroll_arrow_height : 0;
+  border->bottom = menu->lower_arrow_visible ? scroll_arrow_height : 0;
+
+  border->left = border->right = 0;
+}
+
+static void
 gtk_menu_realize (GtkWidget *widget)
 {
   GdkWindowAttr attributes;
@@ -2017,7 +2032,7 @@ gtk_menu_realize (GtkWidget *widget)
   GList *children;
   guint vertical_padding;
   guint horizontal_padding;
-  guint scroll_arrow_height;
+  GtkBorder arrow_border;
 
   g_return_if_fail (GTK_IS_MENU (widget));
 
@@ -2048,7 +2063,6 @@ gtk_menu_realize (GtkWidget *widget)
   gtk_widget_style_get (GTK_WIDGET (menu),
 			"vertical-padding", &vertical_padding,
                         "horizontal-padding", &horizontal_padding,
-                        "scroll-arrow-vlength", &scroll_arrow_height,
 			NULL);
 
   attributes.x = border_width + widget->style->xthickness + horizontal_padding;
@@ -2056,14 +2070,10 @@ gtk_menu_realize (GtkWidget *widget)
   attributes.width = MAX (1, widget->allocation.width - attributes.x * 2);
   attributes.height = MAX (1, widget->allocation.height - attributes.y * 2);
 
-  if (menu->upper_arrow_visible)
-    {
-      attributes.y += scroll_arrow_height;
-      attributes.height -= scroll_arrow_height;
-    }
-
-  if (menu->lower_arrow_visible)
-    attributes.height -= scroll_arrow_height;
+  get_arrows_border (menu, &arrow_border);
+  attributes.y += arrow_border.top;
+  attributes.height -= arrow_border.top;
+  attributes.height -= arrow_border.bottom;
 
   menu->view_window = gdk_window_new (widget->window, &attributes, attributes_mask);
   gdk_window_set_user_data (menu->view_window, menu);
@@ -2284,7 +2294,6 @@ gtk_menu_size_allocate (GtkWidget     *widget,
   gint width, height;
   guint vertical_padding;
   guint horizontal_padding;
-  gint scroll_arrow_height;
   
   g_return_if_fail (GTK_IS_MENU (widget));
   g_return_if_fail (allocation != NULL);
@@ -2299,7 +2308,6 @@ gtk_menu_size_allocate (GtkWidget     *widget,
   gtk_widget_style_get (GTK_WIDGET (menu),
 			"vertical-padding", &vertical_padding,
                         "horizontal-padding", &horizontal_padding,
-                        "scroll-arrow-vlength", &scroll_arrow_height,
 			NULL);
 
   x = GTK_CONTAINER (menu)->border_width + widget->style->xthickness + horizontal_padding;
@@ -2314,14 +2322,15 @@ gtk_menu_size_allocate (GtkWidget     *widget,
   if (menu_shell->active)
     gtk_menu_scroll_to (menu, menu->scroll_offset);
 
-  if (menu->upper_arrow_visible && !menu->tearoff_active)
+  if (!menu->tearoff_active)
     {
-      y += scroll_arrow_height;
-      height -= scroll_arrow_height;
-    }
+      GtkBorder arrow_border;
 
-  if (menu->lower_arrow_visible && !menu->tearoff_active)
-    height -= scroll_arrow_height;
+      get_arrows_border (menu, &arrow_border);
+      y += arrow_border.top;
+      height -= arrow_border.top;
+      height -= arrow_border.bottom;
+    }
 
   if (GTK_WIDGET_REALIZED (widget))
     {
@@ -2526,9 +2535,10 @@ gtk_menu_paint (GtkWidget      *widget,
   else if (event->window == menu->bin_window)
     {
       gint y = -border_y + menu->scroll_offset;
+      GtkBorder arrow_border;
 
-      if (menu->upper_arrow_visible && !menu->tearoff_active)
-        y -= scroll_arrow_height;
+      get_arrows_border (menu, &arrow_border);
+      y -= arrow_border.top;
 
       gtk_paint_box (widget->style,
 		     menu->bin_window,
@@ -2998,14 +3008,12 @@ gtk_menu_scroll_by (GtkMenu *menu,
   gint offset;
   gint view_width, view_height;
   gboolean double_arrows;
-  gint scroll_arrow_height;
+  GtkBorder arrow_border;
   
   widget = GTK_WIDGET (menu);
   offset = menu->scroll_offset + step;
 
-  gtk_widget_style_get (GTK_WIDGET (menu),
-                        "scroll-arrow-vlength", &scroll_arrow_height,
-                        NULL);
+  get_arrows_border (menu, &arrow_border);
 
   double_arrows = get_double_arrows (menu);
 
@@ -3015,7 +3023,7 @@ gtk_menu_scroll_by (GtkMenu *menu,
    * screen space than just scrolling to the top.
    */
   if (!double_arrows)
-    if ((step < 0) && (offset < scroll_arrow_height))
+    if ((step < 0) && (offset < arrow_border.top))
       offset = 0;
 
   /* Don't scroll over the top if we weren't before: */
@@ -3030,13 +3038,13 @@ gtk_menu_scroll_by (GtkMenu *menu,
 
   /* Don't scroll past the bottom if we weren't before: */
   if (menu->scroll_offset > 0)
-    view_height -= scroll_arrow_height;
+    view_height -= arrow_border.top;
 
   /* When both arrows are always shown, reduce
    * view height even more.
    */
   if (double_arrows)
-    view_height -= scroll_arrow_height;
+    view_height -= arrow_border.bottom;
 
   if ((menu->scroll_offset + view_height <= widget->requisition.height) &&
       (offset + view_height > widget->requisition.height))
@@ -3778,7 +3786,6 @@ gtk_menu_position (GtkMenu *menu)
   GdkScreen *screen;
   GdkScreen *pointer_screen;
   GdkRectangle monitor;
-  gint scroll_arrow_height;
   
   g_return_if_fail (GTK_IS_MENU (menu));
 
@@ -3787,10 +3794,6 @@ gtk_menu_position (GtkMenu *menu)
   screen = gtk_widget_get_screen (widget);
   gdk_display_get_pointer (gdk_screen_get_display (screen),
 			   &pointer_screen, &x, &y, NULL);
-
-  gtk_widget_style_get (GTK_WIDGET (menu),
-                        "scroll-arrow-vlength", &scroll_arrow_height,
-                        NULL);
   
   /* We need the requisition to figure out the right place to
    * popup the menu. In fact, we always need to ask here, since
@@ -3986,7 +3989,12 @@ gtk_menu_position (GtkMenu *menu)
     }
 
   if (scroll_offset > 0)
-    scroll_offset += scroll_arrow_height;
+    {
+      GtkBorder arrow_border;
+
+      get_arrows_border (menu, &arrow_border);
+      scroll_offset += arrow_border.top;
+    }
   
   gtk_window_move (GTK_WINDOW (GTK_MENU_SHELL (menu)->active ? menu->toplevel : menu->tearoff_window), 
 		   x, y);
@@ -4040,7 +4048,7 @@ gtk_menu_scroll_to (GtkMenu *menu,
   guint vertical_padding;
   guint horizontal_padding;
   gboolean double_arrows;
-  gint scroll_arrow_height;
+  GtkBorder arrow_border;
   
   widget = GTK_WIDGET (menu);
 
@@ -4061,7 +4069,6 @@ gtk_menu_scroll_to (GtkMenu *menu,
   gtk_widget_style_get (GTK_WIDGET (menu),
                         "vertical-padding", &vertical_padding,
                         "horizontal-padding", &horizontal_padding,
-                        "scroll-arrow-vlength", &scroll_arrow_height,
                         NULL);
 
   double_arrows = get_double_arrows (menu);
@@ -4088,11 +4095,13 @@ gtk_menu_scroll_to (GtkMenu *menu,
           if (!menu->upper_arrow_visible || !menu->lower_arrow_visible)
             gtk_widget_queue_draw (GTK_WIDGET (menu));
 
-          view_height -= 2 * scroll_arrow_height;
-          y += scroll_arrow_height;
-
           menu->upper_arrow_visible = menu->lower_arrow_visible = TRUE;
 
+	  get_arrows_border (menu, &arrow_border);
+	  y += arrow_border.top;
+	  view_height -= arrow_border.top;
+	  view_height -= arrow_border.bottom;
+
           if (offset <= 0)
             priv->upper_arrow_state = GTK_STATE_INSENSITIVE;
           else if (priv->upper_arrow_state == GTK_STATE_INSENSITIVE)
@@ -4149,8 +4158,8 @@ gtk_menu_scroll_to (GtkMenu *menu,
       last_visible = menu->upper_arrow_visible;
       menu->upper_arrow_visible = offset > 0;
       
-      if (menu->upper_arrow_visible)
-	view_height -= scroll_arrow_height;
+      get_arrows_border (menu, &arrow_border);
+      view_height -= arrow_border.top;
       
       if ((last_visible != menu->upper_arrow_visible) &&
           !menu->upper_arrow_visible)
@@ -4168,8 +4177,9 @@ gtk_menu_scroll_to (GtkMenu *menu,
       last_visible = menu->lower_arrow_visible;
       menu->lower_arrow_visible = offset < menu_height - view_height;
       
-      if (menu->lower_arrow_visible)
-	view_height -= scroll_arrow_height;
+      /* recheck the bottom border */
+      get_arrows_border (menu, &arrow_border);
+      view_height -= arrow_border.bottom;
       
       if ((last_visible != menu->lower_arrow_visible) &&
 	   !menu->lower_arrow_visible)
@@ -4184,8 +4194,7 @@ gtk_menu_scroll_to (GtkMenu *menu,
 	    }
 	}
       
-      if (menu->upper_arrow_visible)
-	y += scroll_arrow_height;
+      y += arrow_border.top;
     }
 
   /* Scroll the menu: */
@@ -4263,14 +4272,12 @@ gtk_menu_scroll_item_visible (GtkMenuShell    *menu_shell,
     {
       guint vertical_padding;
       gboolean double_arrows;
-      gint scroll_arrow_height;
       
       y = menu->scroll_offset;
       gdk_drawable_get_size (GTK_WIDGET (menu)->window, &width, &height);
 
       gtk_widget_style_get (GTK_WIDGET (menu),
 			    "vertical-padding", &vertical_padding,
-                            "scroll-arrow-vlength", &scroll_arrow_height,
                             NULL);
 
       double_arrows = get_double_arrows (menu);
@@ -4286,23 +4293,22 @@ gtk_menu_scroll_item_visible (GtkMenuShell    *menu_shell,
 	}
       else
 	{
-	  arrow_height = 0;
-	  if (menu->upper_arrow_visible && !menu->tearoff_active)
-	    arrow_height += scroll_arrow_height;
-	  if (menu->lower_arrow_visible && !menu->tearoff_active)
-	    arrow_height += scroll_arrow_height;
+          GtkBorder arrow_border;
+
+          get_arrows_border (menu, &arrow_border);
+          arrow_height = arrow_border.top + arrow_border.bottom;
 	  
 	  if (child_offset + child_height > y + height - arrow_height)
 	    {
 	      arrow_height = 0;
 	      if ((!last_child && !menu->tearoff_active) || double_arrows)
-		arrow_height += scroll_arrow_height;
+		arrow_height += arrow_border.bottom;
 
 	      y = child_offset + child_height - height + arrow_height;
 	      if (((y > 0) && !menu->tearoff_active) || double_arrows)
 		{
 		  /* Need upper arrow */
-		  arrow_height += scroll_arrow_height;
+		  arrow_height += arrow_border.top;
 		  y = child_offset + child_height - height + arrow_height;
 		}
 	      /* Ignore the enter event we might get if the pointer is on the menu
@@ -4654,21 +4660,20 @@ get_visible_size (GtkMenu *menu)
 {
   GtkWidget *widget = GTK_WIDGET (menu);
   GtkContainer *container = GTK_CONTAINER (menu);
-  gint scroll_arrow_height;
   
   gint menu_height = (widget->allocation.height
 		      - 2 * (container->border_width
 			     + widget->style->ythickness));
-  
-  gtk_widget_style_get (GTK_WIDGET (menu),
-                        "scroll-arrow-vlength", &scroll_arrow_height,
-                        NULL);
 
-  if (menu->upper_arrow_visible && !menu->tearoff_active)
-    menu_height -= scroll_arrow_height;
-  if (menu->lower_arrow_visible && !menu->tearoff_active)
-    menu_height -= scroll_arrow_height;
+  if (!menu->tearoff_active)
+    {
+      GtkBorder arrow_border;
 
+      get_arrows_border (menu, &arrow_border);
+      menu_height -= arrow_border.top;
+      menu_height -= arrow_border.bottom;
+    }
+  
   return menu_height;
 }
 
@@ -4721,20 +4726,18 @@ get_menu_height (GtkMenu *menu)
 {
   gint height;
   GtkWidget *widget = GTK_WIDGET (menu);
-  gint scroll_arrow_height;
 
-  gtk_widget_style_get (GTK_WIDGET (menu),
-                        "scroll-arrow-vlength", &scroll_arrow_height,
-                        NULL);
-  
   height = widget->requisition.height;
   height -= (GTK_CONTAINER (widget)->border_width + widget->style->ythickness) * 2;
 
-  if (menu->upper_arrow_visible && !menu->tearoff_active)
-    height -= scroll_arrow_height;
+  if (!menu->tearoff_active)
+    {
+      GtkBorder arrow_border;
 
-  if (menu->lower_arrow_visible && !menu->tearoff_active)
-    height -= scroll_arrow_height;
+      get_arrows_border (menu, &arrow_border);
+      height -= arrow_border.top;
+      height -= arrow_border.bottom;
+    }
 
   return height;
 }
@@ -4746,11 +4749,6 @@ gtk_menu_real_move_scroll (GtkMenu       *menu,
   gint page_size = get_visible_size (menu);
   gint end_position = get_menu_height (menu);
   GtkMenuShell *menu_shell = GTK_MENU_SHELL (menu);
-  gint scroll_arrow_height;
-
-  gtk_widget_style_get (GTK_WIDGET (menu),
-                        "scroll-arrow-vlength", &scroll_arrow_height,
-                        NULL);
   
   switch (type)
     {
@@ -4790,11 +4788,14 @@ gtk_menu_real_move_scroll (GtkMenu       *menu,
 	  {
 	    GtkWidget *new_child;
 	    gboolean new_upper_arrow_visible = menu->upper_arrow_visible && !menu->tearoff_active;
+            GtkBorder arrow_border;
+
+	    get_arrows_border (menu, &arrow_border);
 
 	    if (menu->scroll_offset != old_offset)
 	      step = menu->scroll_offset - old_offset;
 
-	    step -= (new_upper_arrow_visible - old_upper_arrow_visible) * scroll_arrow_height;
+	    step -= (new_upper_arrow_visible - old_upper_arrow_visible) * arrow_border.top;
 
 	    new_child = child_at (menu, child_offset + step);
 	    if (new_child)
