On Wed, 27 Mar 2024 23:20:49 GMT, Marius Hanl <mh...@openjdk.org> wrote:

>> This PR fixes the issue that the initial column autosizing is wrong under 
>> some circumstances.
>> The following things will break the initial autosizing:
>> - Bold Column text (that is where I initially found this problem)
>> - Another font / font size
>> - Graphic
>> - Graphic Content Display (which can be styled via CSS)
>> 
>> The reason is actually quite simple: The CSS is not (yet) applied initially, 
>> we therefore ALWAYS take the default font into account + the graphic is not 
>> yet layouted as well.
>> 
>> ~It was not so easy to write tests for this, also for me the 
>> `test_resizeColumnToFitContentHeader` is always failing locally. I don't 
>> know what happens here, but he seems to not find a (Stub?) `Font` for me.~
>> **EDIT: Found out the cause and fixed it. I will check if I can write more 
>> tests since it works now. :)**
>> 
>> The test I wrote now is checking if the css is applied after we triggered 
>> the autosize, which is what we would expect here since we measure text.
>> 
>> I also copied the `TableColumnHeaderTest` and rewrote the tests for 
>> `TreeTableView` as well, so we can catch any errors here as well since they 
>> both use different code (although it is technically the same - C&P errors 
>> can happen very easy).
>
> Marius Hanl has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   use snapped insets

As per request I tested the changes of this PR with the Benchmark found at 
https://gist.github.com/effad/9eebee0c1e86a8e605cb55ced9485dd4

Baseline: JFX 23-internal+0-2024-04-02-130613 average run time: 975
After `gh pr checkout 1405`: JFX 23-internal+0-2024-04-02-130613 average run 
time: 1026

So we have a measurable (~5%) but (IMO) neglectable slowdown. Compared to JFX 
21.0.2+5 (2460) we are still more than twice as fast.

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

Marked as reviewed by rlichten (Author).

PR Review: https://git.openjdk.org/jfx/pull/1405#pullrequestreview-1973799359

Reply via email to