File tree Expand file tree Collapse file tree 4 files changed +29
-9
lines changed
sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt Expand file tree Collapse file tree 4 files changed +29
-9
lines changed Original file line number Diff line number Diff line change @@ -1392,15 +1392,19 @@ public boolean setText(String html) {
13921392 handle.src = "about:blank";
13931393}
13941394try {
1395- handle.contentWindow.document.write (html);
1396- handle.contentWindow.document.close ();
1395+ var doc = handle.contentWindow.document;
1396+ doc.open ();
1397+ doc.write (html);
1398+ doc.close ();
13971399} catch (e) {
1398- window.setTimeout ((function () {
1400+ window.setTimeout ((function (handle, html ) {
13991401 return function () {
1400- handle.contentWindow.document.write (html);
1401- handle.contentWindow.document.close ();
1402+ var doc = handle.contentWindow.document;
1403+ doc.open ();
1404+ doc.write (html);
1405+ doc.close ();
14021406 };
1403- }) (), 25);
1407+ }) (handle, html ), 25);
14041408}
14051409 */
14061410private native void iframeDocumentWrite (Object handle , String html );
Original file line number Diff line number Diff line change @@ -519,6 +519,7 @@ public void setImage (Image image) {
519519// imgBackground.style.height = "100%";
520520// imgBackground.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\"" + this.image.url + "\", sizingMethod=\"image\")";
521521// handle.appendChild(imgBackground);
522+ handleStyle .backgroundImage = "" ;
522523 handleStyle .filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\" " + this .image .url + "\" , sizingMethod=\" image\" )" ;
523524 } else {
524525 handleStyle .backgroundRepeat = "no-repeat" ;
Original file line number Diff line number Diff line change @@ -225,8 +225,23 @@ void _setVisible (boolean visible) {
225225 style .zIndex = "1" + window .currentTopZIndex ;
226226 style .display = "block" ;
227227 int height = OS .getContainerHeight (handle );
228- if (OS .isIE ) {
229- handle .style .width = "200px" ;
228+ if (OS .isIE || OS .isOpera ) {
229+ int maxWidth = 0 ;
230+ boolean hasImage = false ;
231+ boolean hasSelection = false ;
232+ MenuItem [] children = getItems ();
233+ for (int i = 0 ; i < children .length ; i ++) {
234+ MenuItem item = children [i ];
235+ int width = OS .getStringStyledWidth (item .getText (), "menu-item-text" , null );
236+ if (item .getImage () != null ) {
237+ hasImage = true ;
238+ }
239+ if ((item .getStyle () & (SWT .CHECK | SWT .RADIO )) != 0 ) {
240+ hasImage = true ;
241+ }
242+ maxWidth = Math .max (maxWidth , width );
243+ }
244+ handle .style .width = (maxWidth + (hasImage ? 18 : 0 ) + (hasSelection ? 18 : 0 ) + 32 ) + "px" ;
230245 }
231246 int width = OS .getContainerWidth (handle );
232247 int left = x , top = y ;
Original file line number Diff line number Diff line change 1111 background-color : buttonface;
1212 border-style : solid solid solid none;
1313 border-width : 1px ;
14- border-height : buttonshadow;
14+ border-color : buttonshadow;
1515 /*opacity:0.25;
1616 filter:Alpha(Opacity=25);*/
1717}
You can’t perform that action at this time.
0 commit comments