RFR: 8160597: IllegalArgumentException when we initiate drag on Image [v2]

Kevin Rushforth kcr at openjdk.java.net
Wed Nov 24 19:38:12 UTC 2021


On Wed, 24 Nov 2021 19:26:42 GMT, Jose Pereda <jpereda at openjdk.org> wrote:

>> This PR fixes an exception that can happen when dragging an image from a WebView on macOS.
>> 
>> Dragging an image that is directly included like `<img src="some image"/>` works fine, without exception. However, there are (at least) two other cases when the IAE is thrown: 
>> 
>> - Dragging an image that is part of an hyperlink, like `<a href="some url"><img src="some image"/></a>`.
>> - Dragging an image encoded as base64.
>> 
>> The IAE happens only on macOS, where a native image is created in `GlassPasteboard.m` from an URL, and in those two cases the generated image has 0x0 dimensions:
>>  
>> `<NSImage 0x... Size={0, 0} ...>`
>> 
>> which leads to `ByteArrayFromPixels` being called with a null byte array. 
>> 
>> The included test reproduces the case by directly pushing the `MacPasteboard` content (instead of adding a more complex test with a webView and a drag and drop gesture).
>
> Jose Pereda has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Address feedback

Marked as reviewed by kcr (Lead).

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

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


More information about the openjfx-dev mailing list