RFR: 8218826: TableRowSkinBase: horizontal layout broken if row has padding [v2]

Marius Hanl mhanl at openjdk.org
Tue Jun 28 15:19:50 UTC 2022


> This PR fixes a problem, where the layout is broken when a `(Tree)TableRow` has padding.
> As also mentioned in the ticket, the `layoutChildren` method in `TableRowSkinBase` is implemented wrong.
> 
> The `layoutChildren` method is responsible for layouting all the `(Tree)TableCells`. 
> When the row has padding, it is subtracted on every `(Tree)TableCell` - which is wrong.
> 
> Instead the `x` and `y` from `layoutChildren` should be used. (E.g. if `x` is 10 (=padding left+right = 10), then only the first cell should start at 10 and the other cells follow as usual)
> Also the `compute...` methods needs to add the padding as well.
> 
> **Example:**
> _Row padding left right 0:_ 
> [Cell1][Cell2][Cell3]
> _Row padding left right 10:_ 
> [    10    ][Cell1][Cell2][Cell3][    10    ] (`compute...` method also needs to account the padding)
> _Same for top bottom._
> 
> When a `fixedCellSize` is set, the padding is currently ignored (also after this PR).
> Therefore, `y` in the `layoutChildren` method is set to 0 for `fixedCellSize`.
> 
> This may can be discussed in the mailing list (Could be a follow up). To support padding also when a `fixedCellSize` is set, the `compute...` methods needs to also add the padding when a `fixedCellSize` is set (in the `if` clauses) and the `VirtualFlow` needs to add the padding to every row instead of using the `fixedCellSize` directly (probably at the cost of performance).

Marius Hanl has updated the pull request incrementally with one additional commit since the last revision:

  8218826: changed test file to use junit5 api

-------------

Changes:
  - all: https://git.openjdk.org/jfx/pull/800/files
  - new: https://git.openjdk.org/jfx/pull/800/files/cb931627..30082b8b

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jfx&pr=800&range=01
 - incr: https://webrevs.openjdk.org/?repo=jfx&pr=800&range=00-01

  Stats: 6 lines in 1 file changed: 0 ins; 0 del; 6 mod
  Patch: https://git.openjdk.org/jfx/pull/800.diff
  Fetch: git fetch https://git.openjdk.org/jfx pull/800/head:pull/800

PR: https://git.openjdk.org/jfx/pull/800


More information about the openjfx-dev mailing list