After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 596984 - [docDisplay] Fix minimum height request, handle 0 allocation better
[docDisplay] Fix minimum height request, handle 0 allocation better
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2009-10-01 13:21 UTC by Colin Walters
Modified: 2009-10-23 02:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[docDisplay] Fix minimum height request, handle 0 allocation better (1.62 KB, patch)
2009-10-01 13:21 UTC, Colin Walters
committed Details | Review

Description Colin Walters 2009-10-01 13:21:39 UTC
First, fix a problem where though we intended to request a minimum
height of 0 for the docs content, we were actually requesting
spacing for all items.

On low resolution screens, we were still attempting to allocate
an item even when we were given 0 height.
Comment 1 Colin Walters 2009-10-01 13:21:41 UTC
Created attachment 144498 [details] [review]
[docDisplay] Fix minimum height request, handle 0 allocation better
Comment 2 Owen Taylor 2009-10-02 19:38:37 UTC
Review of attachment 144498 [details] [review]:

Hmm, patch to getPreferredHeight looks fine, but that function has other issues:

        // Two columns, where we go vertically down first.  So just take
        // the height of half of the children as our preferred height.

        let firstColumnChildren = children.length / 2;

Shouldn't that be:

 Math.ceil(children.length / 2);

        alloc.min_size = 0;

It's bizarre to set min_size = 0 when you are counting on alloc.natural_size being initialized to zero. Either trust or don't trust. Not half-way.

::: js/ui/docDisplay.js
@@ +396,2 @@
                     break;
                 }

So, what if you had two items:

 First item fits vertically
 Second item taller by itself than the total vertical space.

Then this code would put the second item into the second column without checking. The right fix is different from this - it's something like:

                columnIndex += 1;
                x = x + itemWidth + DEFAULT_SPACING;
        	// And y is back to the top.
                y = box.y1;
+               i -= 1; /* retry this item in the second column */
+               continue;                
            }

(or better, make the for into a while loop and move the i++ to the end after you succesfully allocate a child to avoid the i -= 1 hack)

Then that will fix your bug and the other case I mentioned as well.
Comment 3 Colin Walters 2009-10-23 02:09:11 UTC
Bug 596984 - [docDisplay] Fix minimum height request, handle 0 allocation better - UNCONFIRMED