Skip to content

Commit 628d354

Browse files
author
zhourenjian
committed
Safari 4.0 beta + supports native window button. So there is no need to keep CSS hacks for buttons
1 parent 6e245bf commit 628d354

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,18 @@
4444
font-size:1em;
4545
}
4646

47-
@media all and (-webkit-min-device-pixel-ratio:0){/* safari only */
48-
.button-push, .button-toggle {
47+
.button-push-safari, .button-toggle-safari {
4948
height:auto !important;
5049
top:-0.9em;
5150
margin-top:50%;
5251
padding:0.25em 0 0.35em 0;
5352
}
54-
.button-arrow {
53+
.button-arrow-safari {
5554
height:auto !important;
5655
top:-0.7em;
5756
margin-top:50%;
5857
padding:0.25em 0 0.35em 0;
5958
}
60-
}
6159

6260
body:nth-of-type(1) .button-push-chrome,
6361
body:nth-of-type(1) .button-toggle-chrome,

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,21 @@ void createHandle() {
492492
}
493493
if (OS.isChrome) {
494494
btnHandle.className += " " + btnHandle.className + "-chrome";
495+
} else if (OS.isSafari) {
496+
boolean isSafari4Plus = false;
497+
/**
498+
* @j2sNative
499+
* var ua = navigator.userAgent;
500+
* var verIdx = ua.indexOf ("Version/");
501+
* if (verIdx != -1) {
502+
* var verStr = ua.substring (verIdx + 8);
503+
* var verNumber = parseFloat (verStr);
504+
* isSafari4Plus = verNumber >= 4.0
505+
* }
506+
*/ {}
507+
if (!isSafari4Plus) { // There is no need of CSS hack for Safari 4.0+
508+
btnHandle.className += " " + btnHandle.className + "-safari";
509+
}
495510
}
496511
}
497512
btnHandle.onmouseover = new RunnableCompatibility() {

0 commit comments

Comments
 (0)