Skip to content

8337656 iOS WebView Position #1526

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

FlorianKirmaier
Copy link
Member

@FlorianKirmaier FlorianKirmaier commented Aug 1, 2024

Fixing WebView on iOS
(I couldn't compile it because I don't know how to build it for iOS, but the code should be correct.)

@johanvos
If this looks reasonable to you, can you provide a test build for @dlemmermann ?
Then he can test it with his JFX-Central iOS version.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Integration blocker

 ⚠️ Title mismatch between PR and JBS for issue JDK-8337656

Issue

  • JDK-8337656: JavaFX iOS WebView positioned sometimes wrong. (Bug - P4) ⚠️ Title mismatch between PR and JBS.

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/1526/head:pull/1526
$ git checkout pull/1526

Update a local copy of the PR:
$ git checkout pull/1526
$ git pull https://git.openjdk.org/jfx.git pull/1526/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1526

View PR using the GUI difftool:
$ git pr show -t 1526

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/1526.diff

Webrev

Link to Webrev Comment

Fixing position of WebView on ios
Added missing import
@bridgekeeper
Copy link

bridgekeeper bot commented Aug 1, 2024

👋 Welcome back fkirmaier! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Aug 1, 2024

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot added the rfr Ready for review label Aug 1, 2024
@mlbridge
Copy link

mlbridge bot commented Aug 1, 2024

Webrevs

@FlorianKirmaier
Copy link
Member Author

Some Background:
Dirk made a new jfx-central mobile version, in the hope of getting it through the app review.
But in this version the WebView is buggy.
So I looked into the code, and I assume, my change would fix it.

@dlemmermann
Copy link

The proper positioning of the WebView is the last thing missing for us to go for a release. Would be great to know whether we can use the WebView for displaying YouTube videos or not. Any support in this area would be much appreciated.

@FlorianKirmaier
Copy link
Member Author

Just some more Feedback.
The position of the WebView on iOS is sometimes wrong.
I assume it's because its position is only updated when its layout bounds change.
But it should be updated whenever its position - relative to the scene, is changed.
Therefore, I only change what we put the listener. It's a one-line change.
(The rest is refactoring to avoid duplicated code)

@dlemmermann
Copy link

The bug can be tested by running the jfxcentral app on ios. The project is completely configured and can be quickly installed on your phone via the standard GluonFX plugin. The bug becomes visible when opening Frank's tutorial for an "LED strip with a JavaFX UI".

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 12, 2024

@FlorianKirmaier This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 10, 2024

@FlorianKirmaier This pull request has been inactive for more than 8 weeks and will now be automatically closed. If you would like to continue working on this pull request in the future, feel free to reopen it! This can be done using the /open pull request command.

@bridgekeeper bridgekeeper bot closed this Oct 10, 2024
@FlorianKirmaier
Copy link
Member Author

@dlemmermann
Can you maybe provide the workaround, we've developed together for this bug?
Just as a comment in the ticket. So it doesn't get lost.

@dlemmermann
Copy link

For the fix I am adding a listener to the localToSceneTransform property. Every time this changes I invoke code to "fix" the location:

     webView.localToSceneTransformProperty().addListener((obs, oldV, newV) -> fixIt(view)));

The actual fix is done like this:

    boolean fixing = false;

    private void fixIt(WebView view) {
        if (!fixing) {
            fixing = true;
            view.setLayoutY(view.getLayoutY() + 1);
            double width = view.getWidth();
            double height = view.getHeight();
            view.resize(width + 1, height + 1);
            view.resize(width, height);
            Platform.runLater(() -> fixing = false);
        }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rfr Ready for review
Development

Successfully merging this pull request may close these issues.

2 participants