<Swing Dev> RFR: [12] JDK-8208638: Instead of circle rendered in appl window, but ellipse is produced JEditor Pane
Krishna Addepalli
krishna.addepalli at oracle.com
Wed Sep 5 04:10:52 UTC 2018
Hi All,
I found an issue with the test, and am working on it to make it pass reliably. I was setting the size of the frame and then querying the preferred size, which makes it a non-test.
I'm working to address it, meanwhile you could still review the fix itself.
Thanks,
Krishna
From: Krishna Addepalli
Sent: Wednesday, September 5, 2018 12:10 AM
To: swing-dev at openjdk.java.net
Subject: RFR: [12] JDK-8208638: Instead of circle rendered in appl window, but ellipse is produced JEditor Pane
Hi All,
Please review a fix for JDK-8208638: https://bugs.openjdk.java.net/browse/JDK-8208638
Webrev: http://cr.openjdk.java.net/~kaddepalli/8208638/webrev00/
JEditorPane supports loading HTML content, including images, and this bug is about image scaling when either of the width/height attributes are not specified in the HTML text.
The problem is that scaling of the images in all cases was not handled properly. Here is the behavior that is observed in other browsers:
1. If both width and height are specified in html, then use them instead.
2. If both are not specified, then use the image dimensions.
3. If either one is specified, then proportionately adjust the other dimension to preserve the aspect ratio of the image.
ImageView.java implementation was not handling the last case, which is added in the fix.
The test is also fixed now, which was earlier relying on Robot.getPixelColor, which does not work reliably. A happy alternative was found, where in the "RootView" that is rendering the html content is retrieved from the JEditorPane, and its preferred span is queried, which should match the case specific width/height.
Tested it on all platforms (Windows, Linux(Ubuntu) and Mac) and now it reliably passes.
Thanks,
Krishna
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20180904/d3ff3d5e/attachment.html>
More information about the swing-dev
mailing list