Circling back to a new layout algorithm
I previously proposed a new iterative layout algorithm [1] that supports baseline alignment and introduces new APIs to give developers control over the way nodes are aligned. This is a solution to the long-standing problem that JavaFX cannot reliably lay out nodes that are aligned on their baseline [2]. The new layout algorithm might also fix some issues where the scene graph layout only settles after interacting with the controls (for example, by clicking). I've created a small application that shows the new APIs and a correctly working baseline-aligned layout [3]. In addition to that, I also built SceneBuilder with both the old and new layout system, and played around with it to find out whether there were any regressions or visual differences. So far, I haven't found any. In order to move this forward, I think it would be a good idea to test the latest version of the new layout system in more real-world JavaFX applications. Any help from JavaFX application developers is greatly appreciated. It's as easy as checking out the JavaFX sources from the PR [1], building a local SDK and linking your application with the binaries. Finally, here's a high-level overview of the new algorithm: When Parent::layout() is called on a layout root (i.e. a scene root or an unmanaged node), it will lay out its children in a loop until the scene graph under the layout root is fully laid out, which means it is clean and doesn't require further layout. The totality of layout activity for a single layout root is called "layout cycle". A layout cycle will often take a few layout passes to finish (but not more than 2 in most cases). There is no limit on how often Parent::layout() will iterate to lay out its children, so in principle, this could lead to an infinite layout loop. One source of infinite layout loops are incorrectly implemented controls: class PathologicalControl extends Region { final Text text = new Text("foo"); PathologicalControl() { getChildren().add(text); } @Override protected void layoutChildren() { text.relocate(0, text.getLayoutY() + 10); } } In this example, each call to layoutChildren() moves down the text node another 10 pixels from where it was, which causes the layout algorithm to schedule yet another layout pass. It's an infinite loop. The layout system detects this by tracking how often a node invalidates the scene graph in a single layout cycle. If a node exceeds a threshold of 100 invalidations, it will be suspended from layout and can no longer invalidate the scene graph in the current layout cycle. A warning will be logged to notify developers of that fact. [1] https://github.com/openjdk/jfx/pull/433 [2] https://bugs.openjdk.java.net/browse/JDK-8090261 [3] https://github.com/mstr2/jfx-layout-sample
Integrated: 8272808: Update constant collections to use the new immutable collections - leftovers
On Tue, 21 Sep 2021 11:13:06 GMT, Nir Lisker wrote: > Replacements of more immutable collections. > > One thing I found was that the field `idMap` in > `com.sun.java.scene.web.WebViewHelper.WebView` seems unused. I can remove it > if that's indeed the case. This pull request has now been integrated. Changeset: 5fc047ba Author:Nir Lisker URL: https://git.openjdk.java.net/jfx/commit/5fc047ba2300b5a285a58cd76451e41fefe6e462 Stats: 168 lines in 8 files changed: 0 ins; 34 del; 134 mod 8272808: Update constant collections to use the new immutable collections - leftovers Reviewed-by: kcr, jvos - PR: https://git.openjdk.java.net/jfx/pull/627
Re: RFR: 8272808: Update constant collections to use the new immutable collections - leftovers [v3]
On Thu, 4 Nov 2021 17:15:45 GMT, Nir Lisker wrote: >> Replacements of more immutable collections. >> >> One thing I found was that the field `idMap` in >> `com.sun.java.scene.web.WebViewHelper.WebView` seems unused. I can remove it >> if that's indeed the case. > > Nir Lisker has updated the pull request incrementally with one additional > commit since the last revision: > > Removed unused field Marked as reviewed by jvos (Reviewer). - PR: https://git.openjdk.java.net/jfx/pull/627
Re: RFR: 8272808: Update constant collections to use the new immutable collections - leftovers [v3]
On Thu, 4 Nov 2021 17:15:45 GMT, Nir Lisker wrote: >> Replacements of more immutable collections. >> >> One thing I found was that the field `idMap` in >> `com.sun.java.scene.web.WebViewHelper.WebView` seems unused. I can remove it >> if that's indeed the case. > > Nir Lisker has updated the pull request incrementally with one additional > commit since the last revision: > > Removed unused field Marked as reviewed by kcr (Lead). - PR: https://git.openjdk.java.net/jfx/pull/627
Re: RFR: 8272808: Update constant collections to use the new immutable collections - leftovers [v2]
On Fri, 15 Oct 2021 14:24:15 GMT, Nir Lisker wrote: >> Replacements of more immutable collections. >> >> One thing I found was that the field `idMap` in >> `com.sun.java.scene.web.WebViewHelper.WebView` seems unused. I can remove it >> if that's indeed the case. > > Nir Lisker has updated the pull request incrementally with one additional > commit since the last revision: > > Removed unused imports I removed the field. Needs a quick re-review. - PR: https://git.openjdk.java.net/jfx/pull/627
Re: RFR: 8272808: Update constant collections to use the new immutable collections - leftovers [v3]
> Replacements of more immutable collections. > > One thing I found was that the field `idMap` in > `com.sun.java.scene.web.WebViewHelper.WebView` seems unused. I can remove it > if that's indeed the case. Nir Lisker has updated the pull request incrementally with one additional commit since the last revision: Removed unused field - Changes: - all: https://git.openjdk.java.net/jfx/pull/627/files - new: https://git.openjdk.java.net/jfx/pull/627/files/79606579..fc72e5dd Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jfx=627=02 - incr: https://webrevs.openjdk.java.net/?repo=jfx=627=01-02 Stats: 2 lines in 1 file changed: 0 ins; 2 del; 0 mod Patch: https://git.openjdk.java.net/jfx/pull/627.diff Fetch: git fetch https://git.openjdk.java.net/jfx pull/627/head:pull/627 PR: https://git.openjdk.java.net/jfx/pull/627
Integrated: 8275911: Keyboard doesn't show when tapping inside an iOS text input control
On Tue, 26 Oct 2021 11:07:50 GMT, Jose Pereda wrote: > After [JDK-8245053](https://bugs.openjdk.java.net/browse/JDK-8245053) for > Android, this PR applies the same approach on iOS: tapping on a text input > control on iOS shows the keyboard, which hides after the control loses the > focus. > > Now, both platforms have the same behaviour. > > Tested on an iOS device. This pull request has now been integrated. Changeset: 7d6493bf Author:Jose Pereda URL: https://git.openjdk.java.net/jfx/commit/7d6493bf8219d8f57b4da07ca2bfe2d3422dd827 Stats: 90 lines in 2 files changed: 60 ins; 2 del; 28 mod 8275911: Keyboard doesn't show when tapping inside an iOS text input control Reviewed-by: jvos - PR: https://git.openjdk.java.net/jfx/pull/653
Re: RFR: 8272808: Update constant collections to use the new immutable collections - leftovers [v2]
On Fri, 15 Oct 2021 14:24:15 GMT, Nir Lisker wrote: >> Replacements of more immutable collections. >> >> One thing I found was that the field `idMap` in >> `com.sun.java.scene.web.WebViewHelper.WebView` seems unused. I can remove it >> if that's indeed the case. > > Nir Lisker has updated the pull request incrementally with one additional > commit since the last revision: > > Removed unused imports If you want to remove the idMap field in the android/.../WebView.java, that's fine. If not, that's fine too. All other changes look reasonable to me. - Marked as reviewed by jvos (Reviewer). PR: https://git.openjdk.java.net/jfx/pull/627
Re: RFR: 8272808: Update constant collections to use the new immutable collections - leftovers [v2]
On Wed, 27 Oct 2021 15:52:38 GMT, Nir Lisker wrote: > @johanvos Can you comment on `idMap` in > `com.sun.java.scene.web.WebViewHelper.WebView`? That is unused and can safely be deleted. - PR: https://git.openjdk.java.net/jfx/pull/627
Re: RFR: 8275911: Keyboard doesn't show when tapping inside an iOS text input control
On Tue, 26 Oct 2021 11:07:50 GMT, Jose Pereda wrote: > After [JDK-8245053](https://bugs.openjdk.java.net/browse/JDK-8245053) for > Android, this PR applies the same approach on iOS: tapping on a text input > control on iOS shows the keyboard, which hides after the control loses the > focus. > > Now, both platforms have the same behaviour. > > Tested on an iOS device. Marked as reviewed by jvos (Reviewer). - PR: https://git.openjdk.java.net/jfx/pull/653
[jfx17u] Integrated: 8275138: WebView: UserAgent string is empty for first request
On Thu, 4 Nov 2021 10:54:12 GMT, Kevin Rushforth wrote: > Clean backport to jfx17u This pull request has now been integrated. Changeset: 75a2f444 Author:Kevin Rushforth URL: https://git.openjdk.java.net/jfx17u/commit/75a2f4443e0c6fe44c583d72bac8f1fd51c347b5 Stats: 51 lines in 4 files changed: 33 ins; 0 del; 18 mod 8275138: WebView: UserAgent string is empty for first request Backport-of: d6f78e27a698925f029126b8d62a3e88d4d6f868 - PR: https://git.openjdk.java.net/jfx17u/pull/17
[jfx17u] Integrated: 8274413: FX: Update copyright year in docs, readme files to 2022
On Thu, 4 Nov 2021 10:53:28 GMT, Kevin Rushforth wrote: > Clean backport to jfx17u This pull request has now been integrated. Changeset: 7b9e7eec Author:Kevin Rushforth URL: https://git.openjdk.java.net/jfx17u/commit/7b9e7eecb88e33716605c481e02d769a01e6e926 Stats: 3 lines in 3 files changed: 0 ins; 0 del; 3 mod 8274413: FX: Update copyright year in docs, readme files to 2022 Backport-of: 7be0abb9aa5e86e953b13d4ad1d88000e652029c - PR: https://git.openjdk.java.net/jfx17u/pull/16
[jfx17u] RFR: 8275138: WebView: UserAgent string is empty for first request
Clean backport to jfx17u - Commit messages: - 8275138: WebView: UserAgent string is empty for first request Changes: https://git.openjdk.java.net/jfx17u/pull/17/files Webrev: https://webrevs.openjdk.java.net/?repo=jfx17u=17=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8275138 Stats: 51 lines in 4 files changed: 33 ins; 0 del; 18 mod Patch: https://git.openjdk.java.net/jfx17u/pull/17.diff Fetch: git fetch https://git.openjdk.java.net/jfx17u pull/17/head:pull/17 PR: https://git.openjdk.java.net/jfx17u/pull/17
[jfx17u] RFR: 8274413: FX: Update copyright year in docs, readme files to 2022
Clean backport to jfx17u - Commit messages: - 8274413: FX: Update copyright year in docs, readme files to 2022 Changes: https://git.openjdk.java.net/jfx17u/pull/16/files Webrev: https://webrevs.openjdk.java.net/?repo=jfx17u=16=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8274413 Stats: 3 lines in 3 files changed: 0 ins; 0 del; 3 mod Patch: https://git.openjdk.java.net/jfx17u/pull/16.diff Fetch: git fetch https://git.openjdk.java.net/jfx17u pull/16/head:pull/16 PR: https://git.openjdk.java.net/jfx17u/pull/16