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

Reply via email to