[polari] userList: Use visible rows for content height computation



commit 1e17a7b56bddea8e93221a8881028bbe69b74497
Author: Florian Müllner <fmuellner gnome org>
Date:   Thu Nov 27 11:16:14 2014 +0000

    userList: Use visible rows for content height computation
    
    Currently the content height is calculated based on the top eight
    rows, which means that the popover will only adjust its size when
    expanding one of the top rows. Base the computation on the visible
    rows instead, to get consistent behavior for the whole list.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=738518

 src/userList.js |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/src/userList.js b/src/userList.js
index b09ffe8..f46593b 100644
--- a/src/userList.js
+++ b/src/userList.js
@@ -391,11 +391,13 @@ const UserList = new Lang.Class({
             return;
 
         this._updateHeightId = Mainloop.idle_add(Lang.bind(this, function() {
+            let topRow = this._list.get_row_at_y(this.widget.vadjustment.value);
             let membersShown = Math.min(this.numRows, MAX_USERS_SHOWN);
+            let index = Math.min(topRow.get_index(), this.numRows - membersShown);
             let height = 0;
 
             for (let i = 0; i < membersShown; i++)
-                height += this._list.get_row_at_index(i).get_allocated_height();
+                height += this._list.get_row_at_index(index + i).get_allocated_height();
 
             this.widget.min_content_height = height;
             this._updateHeightId = 0;


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