RFR: 8278759 : PointerEvent: buttons property set to 0 when mouse down [v3]

Ambarish Rapte arapte at openjdk.java.net
Mon Feb 28 09:38:52 UTC 2022


On Fri, 25 Feb 2022 17:54:48 GMT, Hima Bindu Meda <duke at openjdk.java.net> wrote:

>> Basically, buttons property is a mask which represents the button/buttons clicked on the mouse.
>>     It is observed that event.buttons property is set to 0 when there is mouse press or drag event.This behaviour is observed only with javafx webView.Other browsers set the buttons property to 1, when there is mouse press or drag.
>>      The issue happens because the buttons property is not updated in the framework.
>>      Added implementation to update and propagate the buttons property from javafx platform to native webkit.Added a robot test case for the same.
>>    Performed sanity testing with the added implementation and the buttons property is compliant with the specification mentioned in https://w3c.github.io/pointerevents/#the-buttons-property.
>
> Hima Bindu Meda has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Use ESC key so that the popup, if any, disappears

Fix itself looks good. 
Suggesting some changes in the test.

tests/system/src/test/java/test/robot/javafx/web/PointerEventTest.java line 112:

> 110:             webEngine = webView.getEngine();
> 111:             String URL =  this.getClass().getResource("pointerEvent.html").toString();
> 112:             webEngine.load( URL);

Minor: `webEngine.load(URL);` 
While you are at it, please remove the double spaces on line 111, 144

tests/system/src/test/java/test/robot/javafx/web/PointerEventTest.java line 113:

> 111:             String URL =  this.getClass().getResource("pointerEvent.html").toString();
> 112:             webEngine.load( URL);
> 113:             webView.getEngine().getLoadWorker().stateProperty().addListener((ov, o, n) -> {

The listener ideally should be added before calling `load()`. (before line 111)

tests/system/src/test/java/test/robot/javafx/web/PointerEventTest.java line 123:

> 121:             stage.setScene(scene);
> 122:             stage.setAlwaysOnTop(true);
> 123:             Platform.runLater(startupLatch::countDown);

This latch countDown should be done when the stage is shown on the screen. 
It should be: `stage.setOnShown(e -> { Platform.runLater(() -> startupLatch.countDown()); });`

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

Changes requested by arapte (Reviewer).

PR: https://git.openjdk.java.net/jfx/pull/742


More information about the openjfx-dev mailing list