JDK-8120722 : Baseline offset depends on layout bounds which are calculated during layout
  • Type: Bug
  • Component: javafx
  • Sub-Component: scenegraph
  • Affected Version: 8
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2013-06-07
  • Updated: 2020-12-18
  • Resolved: 2013-09-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description
Baseline offset calculation in Node depends on layout bounds which are calculated during layout for resizable nodes. This creates cyclic dependency - because the  value of baseline offset is used during layout. This may lead to some strange situations e.g. in the first layout pass, the baseline offset of child is 0 (the child hasn't been laid out yet). During the layout pass, the height of the child is calculated which changes baseline offset. In the next pass, the baseline offset is not 0 anymore and this can lead to different layout - now the calculated height of the child may be different -> baseline offset is different again and the layout will again be different in subsequent layout pass etc.

Current proposal is to use new symbolic constant (-1 or -Infinity, or NaN) for baseline offset of resizable nodes which currently use layout bounds. The constant would have similar meaning as USE_COMPUTED_SIZE in Region. The actual baseline offset would be calculated during layout pass.

Of course, the baseline offset of nodes which can calculate it from their properties (Label etc.) should do so (and they already do), this only applies to resizable nodes which don't have a proper way to calculate it and fall back to implementation in Node.

Comments
== works with infinity or neg. infinity. It's just NaN that is different.
03-09-2013

-1 is probably a bad choice, just because a baseline of -1 might make sense. NaN and Infinity are a pain because you then can't do a directly comparison " if (baselineOffset == USE_COMPUTED_BASELINE_OFFSET)" will always fail. Go with Double.MIN_VALUE or something instead? Check with the SB team before pushing the fix if possible.
03-09-2013