[6fc8f95bc6465849249d974d53eecc56c00ffda0fc3c7024bfa5b8e4d794b072/gnome-3-36] st/viewport: Only extend child allocation when scrolled



commit 0790503f168ec5145d079880cd5e7ab6d8ecd2de
Author: Florian Müllner <fmuellner gnome org>
Date:   Mon Jun 29 00:16:58 2020 +0200

    st/viewport: Only extend child allocation when scrolled
    
    When scrolled, the container's allocation is smaller than the allocation
    of the content. To account for that, commit 2717ca9d080eb added the
    additional size reported by the layout manager to the content allocation.
    
    However as it did so unconditionally, we now allow children to extend
    outside the parent even when *not* scrolled, which breaks any constraints
    set on the container (like "width" or "max-height").
    
    Fix this by only extending the child allocation in scrollable dimensions.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2491

 src/st/st-viewport.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/st/st-viewport.c b/src/st/st-viewport.c
index 2ce8ef5f75..473c451788 100644
--- a/src/st/st-viewport.c
+++ b/src/st/st-viewport.c
@@ -262,8 +262,10 @@ st_viewport_allocate (ClutterActor           *actor,
   clutter_actor_set_allocation (actor, box, flags);
 
   content_box = viewport_box;
-  content_box.x2 += MAX (0, min_width - avail_width);
-  content_box.y2 += MAX (0, min_height - avail_height);
+  if (priv->hadjustment)
+    content_box.x2 += MAX (0, min_width - avail_width);
+  if (priv->vadjustment)
+    content_box.y2 += MAX (0, min_height - avail_height);
 
   clutter_layout_manager_allocate (layout, CLUTTER_CONTAINER (actor),
                                    &content_box, flags);


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