@@ -207,19 +207,30 @@ protected void checkSubclass () {
207207public Point computeSize (int wHint , int hHint , boolean changed ) {
208208 checkWidget ();
209209 Point size = super .computeSize (wHint , hHint , changed );
210- int width = -124 ; // this number is an experimental number from WinXP in classical style
210+ int width = 12 ;
211+ int height = 0 ;
211212 if (items != null && items .length != 0 ) {
212213// int height = OS.getContainerHeight(items[0].handle);
213214// size.y += height;
214215 for (int i = 0 ; i < items .length ; i ++) {
215216 if (items [i ] != null && !items [i ].isDisposed ()) {
216- width += OS .getContainerWidth (items [i ].handle );
217+ int containerWidth = OS .getContainerWidth (items [i ].handle );
218+ if (containerWidth == document .body .clientWidth ) {
219+ if (items [i ].image != null ) {
220+ containerWidth = 18 ;
221+ } else {
222+ containerWidth = 0 ;
223+ }
224+ containerWidth += 6 + OS .getStringStyledWidth (items [i ].text , "tab-folder-default" , null );
225+ }
226+ width += containerWidth ;
227+ if (items [i ].control != null ) {
228+ Point s = items [i ].control .computeSize (wHint , hHint );
229+ height = Math .max (height , s .y );
230+ }
217231 }
218232 }
219233 }
220- if (width < 0 ) {
221- width += 124 + 12 ;
222- }
223234 /*
224235 RECT insetRect = new RECT (), itemRect = new RECT ();
225236 OS.SendMessage (handle, OS.TCM_ADJUSTRECT, 0, insetRect);
@@ -238,9 +249,10 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
238249// width = rect.right - rect.left;
239250 width += border * 2 ;
240251 size .x = Math .max (width , size .x );
252+ size .y = Math .max (height , size .y );
241253
242254// size.x += items.length * 32;
243- // size.y += 24;
255+ // size.y += 24;
244256 return size ;
245257}
246258
@@ -259,7 +271,7 @@ public Rectangle computeTrim (int x, int y, int width, int height) {
259271 */
260272 int lineHeight = 0 ;
261273 if (items != null && items .length > 0 ) {
262- lineHeight = OS .getContainerHeight (items [offset ].handle );
274+ lineHeight = Math . max ( OS .getContainerHeight (items [offset ].handle ), 20 );
263275 if (getSelectionIndex () == offset ) {
264276 lineHeight -= 2 ; // padding-top:2px
265277 }
@@ -406,9 +418,17 @@ protected void createHandle () {
406418 btnNextTab = document .createElement ("BUTTON" );
407419 el .appendChild (btnNextTab );
408420 Element arrowRight = (Element ) createCSSElement (btnNextTab , "button-arrow-right" );
409- if (OS .isMozilla && !OS .isFirefox ) {
421+ if ((( OS .isSafari && OS . isChrome ) || OS . isMozilla ) && !OS .isFirefox ) {
410422 arrowRight .style .left = "-5px" ;
411423 arrowRight .style .top = "0" ;
424+ } else if (OS .isIE ) {
425+ arrowRight .style .top = "0" ;
426+ } else if (OS .isSafari ) {
427+ arrowRight .style .left = "-1px" ;
428+ arrowRight .style .top = "1px" ;
429+ } else if (OS .isOpera ) {
430+ arrowRight .style .left = "-4px" ;
431+ arrowRight .style .top = "0" ;
412432 }
413433
414434 el .onclick = btnNextTab .onclick = new RunnableCompatibility () {
@@ -441,9 +461,17 @@ public void run() {
441461 el .appendChild (btnPrevTab );
442462 //createCSSElement(btnPrevTab, "button-arrow-left");
443463 Element arrowLeft = (Element ) createCSSElement (btnPrevTab , "button-arrow-left" );
444- if (OS .isMozilla && !OS .isFirefox ) {
464+ if ((( OS .isSafari && OS . isChrome ) || OS . isMozilla ) && !OS .isFirefox ) {
445465 arrowLeft .style .left = "-6px" ;
446466 arrowLeft .style .top = "0" ;
467+ } else if (OS .isIE ) {
468+ arrowLeft .style .top = "0" ;
469+ } else if (OS .isSafari ) {
470+ arrowLeft .style .left = "-3px" ;
471+ arrowLeft .style .top = "1px" ;
472+ } else if (OS .isOpera ) {
473+ arrowLeft .style .left = "-4px" ;
474+ arrowLeft .style .top = "0" ;
447475 }
448476 el .onclick = btnPrevTab .onclick = new RunnableCompatibility () {
449477 public void run () {
@@ -1058,6 +1086,9 @@ void updateSelectionWithWidth(int index, int prefWidth) {
10581086 int x = 2 ;
10591087 for (int i = offset ; i < items .length ; i ++) {
10601088 //items[i].handle.style.display = "block";
1089+ if ("" + items [i ].handle .style .zIndex == "-1" ) {
1090+ items [i ].handle .style .display = "" ;
1091+ }
10611092 items [i ].handle .style .zIndex = (i + 1 ) + "" ;
10621093 OS .removeCSSClass (items [i ].handle , key );
10631094 int w = OS .getContainerWidth (items [i ].handle );
@@ -1083,6 +1114,11 @@ void updateSelectionWithWidth(int index, int prefWidth) {
10831114 }
10841115 OS .addCSSClass (items [index ].handle , key );
10851116 items [index ].handle .style .zIndex = ((index >= offset ) ? items .length + 1 : -1 ) + "" ;
1117+ if (index < offset ) {
1118+ items [index ].handle .style .display = "none" ;
1119+ } else {
1120+ items [index ].handle .style .display = "" ;
1121+ }
10861122 if (this .width != 0 ) {
10871123 int w = OS .getContainerWidth (items [index ].handle );
10881124 left += 4 ;
0 commit comments