RFR: 8267554: Support loading stylesheets from data-URIs

2021-06-17 Thread Michael Strauß
This PR extends data URI support to allow stylesheets to be loaded from data 
URIs.

-

Commit messages:
 - Stylesheets can be loaded from data URIs

Changes: https://git.openjdk.java.net/jfx/pull/536/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jfx=536=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8267554
  Stats: 237 lines in 4 files changed: 218 ins; 7 del; 12 mod
  Patch: https://git.openjdk.java.net/jfx/pull/536.diff
  Fetch: git fetch https://git.openjdk.java.net/jfx pull/536/head:pull/536

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


Integrated: 8267551: Support loading images from inline data-URIs

2021-06-17 Thread Michael Strauß
On Wed, 19 May 2021 20:24:31 GMT, Michael Strauß  wrote:

> This PR adds support for loading images from [inline data 
> URIs](https://en.wikipedia.org/wiki/Data_URI_scheme), which is also widely 
> supported by web browsers. This enables developers to package small images in 
> CSS files, rather than separately deploying the images alongside the CSS file.

This pull request has now been integrated.

Changeset: 171e484c
Author:Michael Strauß 
Committer: Kevin Rushforth 
URL:   
https://git.openjdk.java.net/jfx/commit/171e484ca63bdfd50599417482eb704f71f10107
Stats: 552 lines in 8 files changed: 477 ins; 30 del; 45 mod

8267551: Support loading images from inline data-URIs

Reviewed-by: kcr, arapte

-

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


Re: RFR: 8234920: Add SpotLight to the selection of 3D light types [v26]

2021-06-17 Thread Kevin Rushforth
On Thu, 17 Jun 2021 00:38:56 GMT, Nir Lisker  wrote:

>> Added a SpotLight only to the D3D pipeline currently.
>> 
>> ### API discussion points
>> 
>> - [X]  Added `SpotLight` as a subclass of `LightBase`. However, it could 
>> also be a subclass of `PointLight` as it's a point light with direction and 
>> extra factors. I saw that `scenario.effect.light.SpotLight` extends its 
>> respective `PointLight`, but it's not a perfect analogy. In the end, I think 
>> it's a questions of whether `PointLight` will be expanded in a way which 
>> doesn't not suit `SpotLight`, and I tend to think that the answer is no.
>> 
>> - [X] The inner and outer angles are the "diameter angles" as shown 
>> [here](https://docs.microsoft.com/en-us/windows/win32/direct3d9/light-typeshttps://docs.microsoft.com/en-us/windows/win32/direct3d9/light-types).
>>   I, personally, find it more intuitive that these are the "radius angles", 
>> so half these angles, as used in the spotlight factor formula. Do you think 
>> I can change this or do you prefer the current definition of the angles?
>> 
>> - [x] The current implementation uses an ad-hoc direction property (using a 
>> `Point3D`). It crossed my mind that we could use the rotation transforms of 
>> the node to control the direction instead, just like we use the 
>> translation/layout of the node to get the position (there is an internal 
>> Affine3D transform for lights, not sure why `AmbientLight` needs it). 
>> Wouldn't that make more sense? When I rotate the light I would expect to see 
>> a change in direction.
>> 
>> ### Implementation discussion points
>> 
>> - [ ] I've gotten advice from a graphics engineer to treat point lights as 
>> spot lights with a 360 degrees coverage, which simplifies a few places. We 
>> can still try to optimize for a point light by looking at the light 
>> parameters: `falloff = 0` and `outerAngle = 180`. These possible 
>> optimization exist in `ES2PhongShader.java` and `D3DMeshView.cc`, and in the 
>> pixel/fragment shaders in the form of 3 different ways to compute the 
>> spotlight factor (the `computeLightN` methods). We need to check which of 
>> these give the best results.
>> 
>> ## Performance
>> 
>> Testing 3 point lights and comparing this branch with `master` using a 1000 
>> division sphere, 200 meshes, and 5000 meshes.
>> Using an AMD RX 470 4GB GPU.
>> 
>> In this branch, there is a possible CPU optimization for checking the light 
>> type and using precalculated values (in `D3DMeshView.cc` for d3d and 
>> `ES2PhongShader.java` for opengl). On the GPU, I tried 3 ways of computing 
>> the spotlight factor contributions (`computeSpotlightFactor`, 
>> `computeSpotlightFactor2` and `computeSpotlightFactor3`) trying out 
>> different branching and shortcuts.
>> 
>> ### Results
>> The CPU "optimizations" made no difference, which is understandable 
>> considering it will not be the bottleneck. We can remove these if we want to 
>> simplify, though maybe if we allow a large number of lights it could make a 
>> difference (I doubt it). I don't have a strong preference either way.
>> 
>> The sphere 1000 tests always gave max fps (120 on Win and 60 on Ubuntu).
>> 
>> **Win 10**
>> Compared with the `master` branch, this patch shows 5-10 fps drop in the 
>> mesh 200 test and ~5 in the mesh 5000 test. I repeated the tests on several 
>> occasions and got different results in terms of absolute numbers, but the 
>> relative performance difference remained more or less the same. Out of the 3 
>> `computeSpotlightFactor` methods, `computeSpotlightFactor3`, which has no 
>> "optimizations", gives slightly better performance.
>> 
>> **Ubuntu 18**
>> The mesh 200 test always gave 60 fps because it is locked to this fps, so we 
>> can't measure the real GPU performance change.
>> The mesh 5000 test shows 2-6 fps drop from master, with 
>> `computeSpotlightFactor` > `computeSpotlightFactor2`  > 
>> `computeSpotlightFactor3` at in terms of performance (~2 fps difference 
>> each).
>> 
>> **Conclusion**: we can expect a 5 fps drop more or less with 3 point lights. 
>> `computeSpotlightFactor3` on d3d and `computeSpotlightFactor` on opengl gave 
>> the best performances.
>
> Nir Lisker has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Fixed method call in glsl shaders

I did a full test run on 5 different system, including manual tests on 4 of 
them:

Windows 10 w/ Intel graphics
Linux w/ NVIDIA graphics (no manual testing)
Linux VM guest running on Windows 10 host
Mac w/ discrete graphics
Mac w/ integrated graphics

No problems detected. All looks good.

I think there could be some additional tuning done for point lights, but that 
could be looked at in a follow-on fix.

I reviewed the CSR and it is ready to be Finalized.

I finished reviewing the shader code, and left a couple comments on the HLSL 
shaders.

modules/javafx.graphics/src/main/native-prism-d3d/hlsl/psConstants.h line 28:

> 26: // see 

RFR: 8268915: WebKit build fails with Xcode 12.5

2021-06-17 Thread Kevin Rushforth
The JavaFX WebKit build fails with Xcode 12.5 + MacOS 11.3 SDK. This is related 
to the added C++20 support where some of the system include files now do 
`#include `. Because the macOS file system is case insensitive, it 
matches a file named `VERSION` in the sqlite source directory. That file is 
just a plain text file (not used by our build at all) so the fix is to rename 
it to `VERSION.txt`. I've done a CI build on all three platforms. @jgneff has 
verified that renaming this file fixes the build for XCode 12.5.

-

Commit messages:
 - 8268915: WebKit build fails with Xcode 12.5

Changes: https://git.openjdk.java.net/jfx/pull/535/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jfx=535=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8268915
  Stats: 0 lines in 1 file changed: 0 ins; 0 del; 0 mod
  Patch: https://git.openjdk.java.net/jfx/pull/535.diff
  Fetch: git fetch https://git.openjdk.java.net/jfx pull/535/head:pull/535

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


RFR: 8240506: TextFieldSkin/Behavior: misbehavior on switching skin

2021-06-17 Thread Jeanette Winzenburg
The issue is about memory leaks and side-effects (like NPEs) when switching 
skins. 

Details (copied from issue for convenience):

memory leak in TextInputControlBehavior:
- listener accidentally added twice (removed once)
- keyPad mappings not properly installed/disposed

memory leak TextFieldBehavior:
- listeners to scene/focusOwner property not removed,

memory leak in TextInputControlSkin:
- event handlers related to inputMethods not removed

issues in TextFieldSkin:
- memory leak due to behavior leaking
- memory leaks due to manually added change/invalidation listeners that are not 
removed
- memory leaks due to not removing children with strong references to skin
- side-effects (f.i. NPEs) due to listeners/bindings that are still active 
after dispose

Fix was to properly install/remove those listeners/handlers. Added tests that 
failed/passed before/after the fix, respectively, also added tests passing 
before that must pass after the fix.

-

Commit messages:
 - 8240506: TextFieldSkin/Behavior: misbehavior on switching skin

Changes: https://git.openjdk.java.net/jfx/pull/534/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jfx=534=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8240506
  Stats: 753 lines in 10 files changed: 687 ins; 38 del; 28 mod
  Patch: https://git.openjdk.java.net/jfx/pull/534.diff
  Fetch: git fetch https://git.openjdk.java.net/jfx pull/534/head:pull/534

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