[gtk+/gtk-3-20] range: Avoid miscalculating highlight allocation



commit 19a8fbf336451d2ab4e41be1f81958307b74566d
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Mar 26 10:50:00 2016 -0400

    range: Avoid miscalculating highlight allocation
    
    The slider gadget may be turned invisible as side-effect of
    gtk_range_calc_slider(). If that happens,
    gtk_css_gadget_get_content_allocation() returns { 0, 0, 0, 0},
    which leads us to calculate a negative allocation for the highlight
    node. Avoid this, by just reusing our already calculated slider
    allocation in this case (it is not technically the same as the
    content, allocation, but the difference hardly matter here.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=764022

 gtk/gtkrange.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index 1370703..62d8f9d 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -2006,8 +2006,8 @@ gtk_range_allocate_trough (GtkCssGadget        *gadget,
     {
       GtkAllocation highlight_alloc, highlight_clip;
 
-      gtk_css_gadget_get_content_allocation (priv->slider_gadget,
-                                             &slider_alloc, NULL);
+      if (gtk_css_gadget_get_visible (priv->slider_gadget))
+        gtk_css_gadget_get_content_allocation (priv->slider_gadget, &slider_alloc, NULL);
       highlight_alloc = *allocation;
 
       if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)


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