-
Bug
-
Resolution: Not an Issue
-
P3
-
None
-
8u20
-
None
Region.USE_COMPUTED_SIZE is supposed to cause the compute[Min|Pref|Max][Width|Height] to return the region's intrinsic size. Region.USE_PREF_SIZE is supposed to cause the compute[Min|Max][Width|Height] to return the value of computePref[Width|Height]. The compute methods do not follow this.
Example: Region computeMinHeight
@Override protected double computeMinHeight(double width) {
return getInsets().getTop() + getInsets().getBottom();
}
This code should be
@Override protected double computeMinHeight(double width) {
if (getMinHeight() == USE_PREF_SIZE) {
return computePrefHeight(width);
}
else if (getMinHeight() == USE_COMPUTED_SIZE || getMinHeight() < 0) {
return getInsets().getTop() + getInsets().getBottom();
}
else {
return getMinHeight();
}
}
This affects any code that overrides these compute methods.
Example: Region computeMinHeight
@Override protected double computeMinHeight(double width) {
return getInsets().getTop() + getInsets().getBottom();
}
This code should be
@Override protected double computeMinHeight(double width) {
if (getMinHeight() == USE_PREF_SIZE) {
return computePrefHeight(width);
}
else if (getMinHeight() == USE_COMPUTED_SIZE || getMinHeight() < 0) {
return getInsets().getTop() + getInsets().getBottom();
}
else {
return getMinHeight();
}
}
This affects any code that overrides these compute methods.