8301283: Util methods for computing text/width height giving up some performance#2145
Conversation
|
👋 Welcome back mhanl! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
Webrevs
|
|
Reviewer: @andy-goryachev-oracle @prrace Would you also be able to review this? Or comment on the points raised in the PR description? /reviewers 2 |
|
@kevinrushforth |
There was a problem hiding this comment.
No ill effects as far as i can see with the Monkey Tester on macOS 26.3.1
I do see build errors in Eclipse:
Description Resource Type Path Location
GlyphLayout cannot be resolved to a type TextLayoutUtilsContractTest.java Java Problem /controls/src/test/java/test/javafx/scene/control/skin line 245
GlyphLayout cannot be resolved to a type TextLayoutUtilsContractTest.java Java Problem /controls/src/test/java/test/javafx/scene/control/skin line 277
GlyphLayout cannot be resolved to a type TextLayoutUtilsContractTest.java Java Problem /controls/src/test/java/test/javafx/scene/control/skin line 310
GlyphLayout cannot be resolved to a type TextLayoutUtilsContractTest.java Java Problem /controls/src/test/java/test/javafx/scene/control/skin line 342
The type com.sun.javafx.text.GlyphLayout is not accessible TextLayoutUtilsContractTest.java Java Problem /controls/src/test/java/test/javafx/scene/control/skin line 30
(I've merged the latest master branch before testing)
|
Can you add this change to fix the Eclipse warnings: https://github.com/andy-goryachev-oracle/jfx/blob/ag.2145/modules/javafx.controls/.classpath |
I don't feel to confident doing something like that, since I can not test it. Will just copy your code for now, but can not do any reasoning about it or fixes if someone git blame me in the future |
|
Thanks! |
andy-goryachev-oracle
left a comment
There was a problem hiding this comment.
The changes look good!
The only product change is adding missing TextLayout configuration items in Utils.
This one took me actually some hours to fully understand.
I recommend reading the ticket description made by Phil as it already explains most of it.
What is the problem (in
Utils):Utils.computeTextWidth(..)does not initialize theboundsType. As a consequence, we do not cache the layout resultNote that the
boundsTypedoes not matter for the width calculation itself, but we really want it set so the result will be cached if possibleUtils.computeTextHeight(..)method call, theboundsTypeis initialized. Now calls toUtils.computeTextWidth(..)do cache the resultUtils.computeTextWidth(..)does now set the the property as wellOk, but why only cache this specific usecase (Phil was also wondering about that) (in
PrismTextLayout):What it actually does:
PrismTextLayoutdoes is to cache the layout result for simple cases with the default setting.-fx-bounds-type: logical_vertical_center;for everTextnodewrapWidthor theboundsTypeis different, we can reuse the runs but not the whole cached layout resultboundsType = 0, as those will have another height than withboundsType = BOUNDS_CENTERAs
StubTextLayoutextendsPrismTextLayout, we can actually write meaningful tests:GlyphLayoutis created (due to a complete cache miss)PrismTextLayout.setContent(..)will request the font strike (forhashCodecalculation for the layout result cache), I needed to implementhashCodeandequalsfor some of the stub test classes (the JavaFX font classes do that as well)StubFontContractTestto a better name since we do test a bit more nowCan we improve more?
LabeledSkinBase. There are also some TODOs in this class. This could be a potential follow-up.Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/2145/head:pull/2145$ git checkout pull/2145Update a local copy of the PR:
$ git checkout pull/2145$ git pull https://git.openjdk.org/jfx.git pull/2145/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 2145View PR using the GUI difftool:
$ git pr show -t 2145Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/2145.diff
Using Webrev
Link to Webrev Comment