| Summary: | [Layout] If a composite with a FillLayout (with marginWidth != 0) contains a widget which could expand depending on a fixed width or height, than computeSize() doesn't calculate the expanding size correctly. | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | andreas <au> | ||||||
| Component: | SWT | Assignee: | Platform-SWT-Inbox <platform-swt-inbox> | ||||||
| Status: | CLOSED WONTFIX | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | eheck, ericwill, pinnamur, vasko | ||||||
| Version: | 4.8 | Keywords: | helpwanted, triaged | ||||||
| Target Milestone: | --- | ||||||||
| Hardware: | PC | ||||||||
| OS: | Linux | ||||||||
| See Also: |
https://git.eclipse.org/r/101950 https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=2b5b61a8a721d5c2a84df9cac18fb280a04de0fc |
||||||||
| Whiteboard: | stalebug | ||||||||
| Attachments: |
|
||||||||
Created attachment 148201 [details]
test class
sorry my first solution was not correct, FillLayout.computeSize() should be changed to:
...
int w = wHint - 2 * this.marginWidth, h = hHint - 2 * this.marginHeight;
if (count > 0) {
if (type == SWT.HORIZONTAL && wHint != SWT.DEFAULT) {
w = Math.max (0, (w - (count - 1) * spacing) / count);
}
if (type == SWT.VERTICAL && hHint != SWT.DEFAULT) {
h = Math.max (0, (h - (count - 1) * spacing) / count);
}
}
...
I had created a test case too, before I found this existing entry. I'll just attach it now. I might add that the problem is the same on Windows. Created attachment 170627 [details]
Another test case
New Gerrit change created: https://git.eclipse.org/r/101950 Gerrit change https://git.eclipse.org/r/101950 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=2b5b61a8a721d5c2a84df9cac18fb280a04de0fc (In reply to Eclipse Genie from comment #6) > Gerrit change https://git.eclipse.org/r/101950 was merged to [master]. > Commit: > http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/ > ?id=2b5b61a8a721d5c2a84df9cac18fb280a04de0fc This issue is still reproducible. Bug snippet is in master now. This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.6) Gecko/2009011912 Firefox/3.0.6 Build Identifier: swt-3.5-gtk-linux-x86.zip (R-3.5-200906111540) e.g.: A Composite with FillLayout (which has a marginWidth), contains a text-widget which should expand vertically depending on the fixed width given to computeSize() with wHint, than the height-result of composite.computeSize(wHint, SWT.DEFAULT) is not big enough to contain the full text-widget. The problem is, that FillLayout.computeSize() passes wHint of the composite to computeChildSize(text-widget, wHint, SWT.DEFAULT, true). the text-widget calculates his heigth for wHint of the composite which leads to the wrong result. the text-widget should calculate his heigth with (wHint - 2*marginWidth) I think FillLayout.computeSize() should be changed to: ... if (type == SWT.HORIZONTAL && wHint != SWT.DEFAULT) { w = Math.max (0, (wHint - 2 * this.marginWidth - (count - 1) * spacing) / count); } if (type == SWT.VERTICAL && hHint != SWT.DEFAULT) { h = Math.max (0, (hHint - 2 * this.marginHeight - (count - 1) * spacing) / count); } ... Reproducible: Always Steps to Reproduce: 1. Start the test-class 2. the first composite calculates the wrong height, the second one with no margin is working as expected.