Bug 430600 - ExpandItem.getHeaderHeight incorrect
fixed the issue as allocation.height was returning the correct header
height instead of the assumed height of header + body height. Can be
tested with the snippet in comment 3.
Tested with AllNoneBrowserTests GTK2 to 3.22 with no additional errors.
Change-Id: Ieba507d956d39f71f9a7eed1aacd5225ac7df6fa
Signed-off-by: Ian Pun <ipun@redhat.com>
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java
index c1082d4..38f371d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java
@@ -290,7 +290,14 @@
checkWidget ();
GtkAllocation allocation = new GtkAllocation ();
OS.gtk_widget_get_allocation (handle, allocation);
- return allocation.height - (expanded ? height : 0);
+ // allocation.height normally returns the header height instead of the whole
+ // widget itself. This is to prevent situations where allocation.height actually
+ // returns the correct header height.
+ int headerHeight = allocation.height - (expanded ? height : 0);
+ if (expanded && headerHeight < 0) {
+ return allocation.height;
+ }
+ return headerHeight;
}
/**
* Gets the height of the receiver.