The regression caused by change in this method was because the rootView
layout was changed in those fix(es), but this code is only changing the
preferredSize height but I can understand the scepticism.
I think since this fix is more about margin, it should be placed in more
appropriate class related to borders/margin so I have placed my fix in
BasicBorders and not in BasicTextUI.
http://cr.openjdk.java.net/~psadhukhan/8242410/webrev.1/
Regards
Prasanta
On 16-Apr-20 4:58 PM, Sergey Bylokhov wrote:
Hi, Prasanta.
Remembering the number of regressions caused by the changes in this
method, I suggest to improve it by some additional code only when we
investigate the root cause of all previous issues. The general
approach of using zeros as non-initialized flags seems broken.
On 4/13/20 3:06 am, Prasanta Sadhukhan wrote:
Hi All,
Please review a fix for an issue where it is seen that when
JEditorPane is created with empty text and zero top and bottom
insets, the text is not shown after updating it by the method
setText(String)
This is because the the JEditorPane height is not updated and remains
0 if the margin top/botton insets are 0.
Proposed fix is to check if the margin being set is less than default
margin, then update the margin to the default.
Bug: https://bugs.openjdk.java.net/browse/JDK-8242410
webrev: http://cr.openjdk.java.net/~psadhukhan/8242410/webrev.0/
I also considered changing getPreferredSize() to update the rootView
size if height is 0, but it seems it has caused some regression in
the past, so abstained from that
/-else if (d.width == 0 && d.height == 0) {/
/+//else if (d.width == 0 || d.height == 0) {/
/ // Probably haven't been layed out yet, force some
sort of//
// // initial sizing.//
// rootView.setSize(Integer.MAX_VALUE,
Integer.MAX_VALUE);//
// }/
Regards
Prasanta