Skip to content

Commit e6f28d6

Browse files
author
jossonsmith
committed
Fix style bugs for IE on ProgressBar
1 parent 27989e0 commit e6f28d6

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/swt-default.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1572,13 +1572,15 @@ input.text-border {
15721572
.progress-bar-horizontal {
15731573
background-color:highlight;
15741574
width:0;
1575+
font-size:0;
15751576
position:absolute;
15761577
top:1px;
15771578
left:1px;
15781579
}
15791580
.progress-bar-vertical {
15801581
background-color:highlight;
15811582
height:0;
1583+
font-size:0;
15821584
position:absolute;
15831585
bottom:1px;
15841586
left:1px;

sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets/ProgressBar.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -404,12 +404,15 @@ protected void updateSelection(int selection) {
404404
int blockSize = 9;
405405
int w = ((style & SWT.HORIZONTAL) != 0) ? width : height;
406406
w = Math.round((w - 2) * selection / maximum);
407+
if (w < 0) {
408+
w = 0;
409+
}
407410
if ((style & SWT.SMOOTH) != 0) {
408411
if ((style & SWT.HORIZONTAL) != 0) {
409412
innerHandles[0].style.width = w + "px";
410-
innerHandles[0].style.height = (height - 2) + "px";
413+
innerHandles[0].style.height = ((height - 2) < 0 ? 0 : height - 2) + "px";
411414
} else {
412-
innerHandles[0].style.width = (width - 2) + "px";
415+
innerHandles[0].style.width = ((width - 2) < 0 ? 0 : (width - 2)) + "px";
413416
innerHandles[0].style.height = w + "px";
414417
}
415418
} else {
@@ -439,14 +442,14 @@ protected void updateSelection(int selection) {
439442
el.style.display = "block";
440443
}
441444
if ((style & SWT.HORIZONTAL) != 0) {
442-
el.style.height = (height - 2) + "px";
445+
el.style.height = ((height - 2) < 0 ? 0 : height - 2) + "px";
443446
if ((i + 1) * (blockSize + 2) <= width - 2) {
444447
el.style.width = blockSize + "px";
445448
} else {
446449
el.style.width = (w - i * (blockSize + 2)) + "px";
447450
}
448451
} else {
449-
el.style.width = (width - 2) + "px";
452+
el.style.width = ((width - 2) < 0 ? 0 : (width - 2)) + "px";
450453
if ((i + 1) * (blockSize + 2) <= height - 2) {
451454
el.style.height = blockSize + "px";
452455
} else {

0 commit comments

Comments
 (0)