@@ -590,7 +590,7 @@ public void setDraggable(JSFunction f) {
590590 /**
591591 * processed text (local to setIconAndText) is HTML
592592 */
593- private boolean isHTML ;
593+ protected boolean isHTML ;
594594
595595 /**
596596 * set false for tool tip or other non-label object that has text
@@ -1754,7 +1754,8 @@ protected Dimension setHTMLSize1(DOMNode node, boolean addCSS, boolean usePrefer
17541754 dim .height += h ;
17551755 DOMNode .setStyles (node , "position" , null );
17561756 if (w0 != null ) {
1757- DOMNode .setStyles (node , "width" , w0 , "height" , h0 );
1757+ DOMNode .setStyles (node , "width" ,
1758+ (isHTML && isLabel ? "inherit" : w0 ), "height" , h0 );
17581759 }
17591760 if (position != null ) {
17601761 DOMNode .setStyles (node , "position" , position );
@@ -2382,7 +2383,8 @@ protected void setIconAndText(String prop, Icon icon, int gap, String text) {
23822383 if (text == "\0 " ) {
23832384 isPaintedOnly = true ; // this cannot be undone
23842385 }
2385- DOMNode .setStyles (textNode , "white-space" , "nowrap" );
2386+ if (!isHTML || !isLabel )
2387+ DOMNode .setStyles (textNode , "white-space" , "nowrap" );
23862388 if (icon == null ) {
23872389 // tool tip does not allow text alignment
23882390 if (iconNode != null && allowTextAlignment
@@ -2648,11 +2650,10 @@ protected void setAlignments(AbstractButton b, boolean justGetPreferred) {
26482650 Object cssTxt = getJSObject ();
26492651 Object cssIcon = getJSObject ();
26502652
2651- addJSKeyVal (cssCtr , "position" , "absolute" , "top" , null , "left" , null , "transform" , null , "width" , wCtr + "px" ,
2653+ addJSKeyVal (cssCtr , "position" , "absolute" , "top" , null , "left" , null , "transform" , null , "width" , ( isHTML && isLabel ? "inherit" : wCtr + "px" ) ,
26522654 "height" , hCtr + "px" );
26532655 addJSKeyVal (cssIcon , "position" , "absolute" , "top" , null , "left" , null , "transform" , null );
26542656 addJSKeyVal (cssTxt , "position" , "absolute" , "top" , null , "left" , null , "transform" , null );
2655-
26562657 isFullyCentered = (alignHCenter && alignVCenter && wIcon == 0 || wText == 0 && margins .left == margins .right
26572658 && margins .top == margins .bottom && myInsets .left == myInsets .right && myInsets .top == myInsets .bottom );
26582659 if (isFullyCentered ) {
0 commit comments