ScrolledWindow: Don’t check if child is Scrollable

If the child added is not a Scrollable, it gets wrapped in a ViewPort –
which is. So it is impossible to end up with a non-Scrollable child.

Just check we have /any/ child where needed, which is semantically nicer

https://bugzilla.gnome.org/show_bug.cgi?id=778853
This commit is contained in:
Daniel Boles 2017-03-10 20:37:27 +00:00
parent 16b9e8261d
commit 93d68270c4

View File

@ -1545,12 +1545,13 @@ gtk_scrolled_window_allocate (GtkCssGadget *gadget,
gboolean previous_hvis;
gboolean previous_vvis;
guint count = 0;
GtkScrollable *scrollable_child = GTK_SCROLLABLE (child);
hscroll_policy = GTK_IS_SCROLLABLE (child)
? gtk_scrollable_get_hscroll_policy (GTK_SCROLLABLE (child))
hscroll_policy = scrollable_child != NULL
? gtk_scrollable_get_hscroll_policy (scrollable_child)
: GTK_SCROLL_MINIMUM;
vscroll_policy = GTK_IS_SCROLLABLE (child)
? gtk_scrollable_get_vscroll_policy (GTK_SCROLLABLE (child))
vscroll_policy = scrollable_child != NULL
? gtk_scrollable_get_vscroll_policy (scrollable_child)
: GTK_SCROLL_MINIMUM;
/* Determine scrollbar visibility first via hfw apis */
@ -1812,7 +1813,7 @@ gtk_scrolled_window_measure (GtkCssGadget *gadget,
child = gtk_bin_get_child (bin);
if (GTK_IS_SCROLLABLE (child))
if (child)
gtk_scrollable_get_border (GTK_SCROLLABLE (child), &sborder);
/*
@ -2284,7 +2285,7 @@ gtk_scrolled_window_set_hadjustment (GtkScrolledWindow *scrolled_window,
gtk_scrolled_window_adjustment_value_changed (hadjustment, scrolled_window);
child = gtk_bin_get_child (bin);
if (GTK_IS_SCROLLABLE (child))
if (child)
gtk_scrollable_set_hadjustment (GTK_SCROLLABLE (child), hadjustment);
if (gtk_widget_should_animate (GTK_WIDGET (scrolled_window)))
@ -2352,7 +2353,7 @@ gtk_scrolled_window_set_vadjustment (GtkScrolledWindow *scrolled_window,
gtk_scrolled_window_adjustment_value_changed (vadjustment, scrolled_window);
child = gtk_bin_get_child (bin);
if (GTK_IS_SCROLLABLE (child))
if (child)
gtk_scrollable_set_vadjustment (GTK_SCROLLABLE (child), vadjustment);
if (gtk_widget_should_animate (GTK_WIDGET (scrolled_window)))
@ -2969,8 +2970,7 @@ gtk_scrolled_window_inner_allocation (GtkWidget *widget,
gtk_scrolled_window_relative_allocation (widget, rect);
child = gtk_bin_get_child (GTK_BIN (widget));
if (GTK_IS_SCROLLABLE (child) &&
gtk_scrollable_get_border (GTK_SCROLLABLE (child), &border))
if (child && gtk_scrollable_get_border (GTK_SCROLLABLE (child), &border))
{
rect->x += border.left;
rect->y += border.top;